diff options
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 3ad3cf9151f..af8c29c309e 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -904,6 +904,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, using_bulk_insert= 1; table->file->ha_start_bulk_insert(values_list.elements); } + else + table->file->ha_reset_copy_info(); } thd->abort_on_warning= !ignore && thd->is_strict_mode(); @@ -1107,11 +1109,23 @@ values_loop_end: auto_inc values from the delayed_insert thread as they share TABLE. */ table->file->ha_release_auto_increment(); - if (using_bulk_insert && unlikely(table->file->ha_end_bulk_insert()) && - !error) + if (using_bulk_insert) + { + if (unlikely(table->file->ha_end_bulk_insert()) && + !error) + { + table->file->print_error(my_errno,MYF(0)); + error=1; + } + } + /* Get better status from handler if handler supports it */ + if (table->file->copy_info.records) { - table->file->print_error(my_errno,MYF(0)); - error=1; + DBUG_ASSERT(info.copied >= table->file->copy_info.copied); + info.touched= table->file->copy_info.touched; + info.copied= table->file->copy_info.copied; + info.deleted= table->file->copy_info.deleted; + info.updated= table->file->copy_info.updated; } if (duplic != DUP_ERROR || ignore) { @@ -1234,8 +1248,12 @@ values_loop_end: retval= thd->lex->explain->send_explain(thd); goto abort; } - if ((iteration * values_list.elements) == 1 && (!(thd->variables.option_bits & OPTION_WARNINGS) || - !thd->cuted_fields)) + DBUG_PRINT("info", ("touched: %llu copied: %llu updated: %llu deleted: %llu", + (ulonglong) info.touched, (ulonglong) info.copied, + (ulonglong) info.updated, (ulonglong) info.deleted)); + + if ((iteration * values_list.elements) == 1 && + (!(thd->variables.option_bits & OPTION_WARNINGS) || !thd->cuted_fields)) { my_ok(thd, info.copied + info.deleted + ((thd->client_capabilities & CLIENT_FOUND_ROWS) ? |