diff options
author | unknown <msvensson@pilot.(none)> | 2007-06-19 11:31:34 +0200 |
---|---|---|
committer | unknown <msvensson@pilot.(none)> | 2007-06-19 11:31:34 +0200 |
commit | 75689af808d935de69a39138e35cde575c982251 (patch) | |
tree | c2668ecbca1fc441f2a39eb25cbb54f16181414a /sql/sql_insert.cc | |
parent | 3955e94c34d638df24c5d640558a5aee14342603 (diff) | |
parent | 54c531607df9b14f206fa8a44f39f2764f55ac82 (diff) | |
download | mariadb-git-75689af808d935de69a39138e35cde575c982251.tar.gz |
Merge bk-internal:/home/bk/mysql-5.1-maint
into pilot.(none):/data/msvensson/mysql/mysql-5.1-new-maint
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/t/mysqltest.test:
Auto merged
BitKeeper/deleted/.del-wait_for_slave_io_to_stop.inc:
Auto merged
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 9067df2f014..0ce52779ce1 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -932,20 +932,24 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (values_list.elements == 1 && (!(thd->options & OPTION_WARNINGS) || !thd->cuted_fields)) { - thd->row_count_func= info.copied+info.deleted+info.updated; + thd->row_count_func= info.copied + info.deleted + + ((thd->client_capabilities & CLIENT_FOUND_ROWS) ? + info.touched : info.updated); send_ok(thd, (ulong) thd->row_count_func, id); } else { char buff[160]; + ha_rows updated=((thd->client_capabilities & CLIENT_FOUND_ROWS) ? + info.touched : info.updated); if (ignore) sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records, (lock_type == TL_WRITE_DELAYED) ? (ulong) 0 : (ulong) (info.records - info.copied), (ulong) thd->cuted_fields); else sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records, - (ulong) (info.deleted+info.updated), (ulong) thd->cuted_fields); - thd->row_count_func= info.copied+info.deleted+info.updated; + (ulong) (info.deleted + updated), (ulong) thd->cuted_fields); + thd->row_count_func= info.copied + info.deleted + updated; ::send_ok(thd, (ulong) thd->row_count_func, id, buff); } thd->abort_on_warning= 0; @@ -1415,19 +1419,20 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) goto before_trg_err; table->file->restore_auto_increment(prev_insert_id); - if ((error=table->file->ha_update_row(table->record[1], - table->record[0]))) - { - if (info->ignore && - !table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) - { - goto ok_or_after_trg_err; - } - goto err; - } if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) || - compare_record(table)) + compare_record(table)) { + if ((error=table->file->ha_update_row(table->record[1], + table->record[0]))) + { + if (info->ignore && + !table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) + { + goto ok_or_after_trg_err; + } + goto err; + } + info->updated++; /* If ON DUP KEY UPDATE updates a row instead of inserting one, it's @@ -1446,6 +1451,11 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) info->copied++; } + if (table->next_number_field) + table->file->adjust_next_insert_id_after_explicit_value( + table->next_number_field->val_int()); + info->touched++; + goto ok_or_after_trg_err; } else /* DUP_REPLACE */ @@ -3136,7 +3146,9 @@ bool select_insert::send_eof() else sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records, (ulong) (info.deleted+info.updated), (ulong) thd->cuted_fields); - thd->row_count_func= info.copied+info.deleted+info.updated; + thd->row_count_func= info.copied + info.deleted + + ((thd->client_capabilities & CLIENT_FOUND_ROWS) ? + info.touched : info.updated); id= (thd->first_successful_insert_id_in_cur_stmt > 0) ? thd->first_successful_insert_id_in_cur_stmt : |