diff options
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index b139eb83d07..7d2513bd419 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -810,7 +810,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, error=write_record(thd, table ,&info); if (error) break; - thd->row_count++; + thd->warning_info->inc_current_row_for_warning(); } free_underlaid_joins(thd, &thd->lex->select_lex); @@ -949,10 +949,12 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, 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); + (ulong) (info.records - info.copied), + (ulong) thd->warning_info->statement_warn_count()); else sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records, - (ulong) (info.deleted + updated), (ulong) thd->cuted_fields); + (ulong) (info.deleted + updated), + (ulong) thd->warning_info->statement_warn_count()); thd->row_count_func= info.copied + info.deleted + updated; ::my_ok(thd, (ulong) thd->row_count_func, id, buff); } @@ -1955,7 +1957,7 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list) main thread. Use of my_message will enable stored procedures continue handlers. */ - my_message(di->thd.main_da.sql_errno(), di->thd.main_da.message(), + my_message(di->thd.stmt_da->sql_errno(), di->thd.stmt_da->message(), MYF(0)); } di->unlock(); @@ -2032,7 +2034,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) goto error; if (dead) { - my_message(thd.main_da.sql_errno(), thd.main_da.message(), MYF(0)); + my_message(thd.stmt_da->sql_errno(), thd.stmt_da->message(), MYF(0)); goto error; } } @@ -2281,8 +2283,8 @@ static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di) if (init_thr_lock() || thd->store_globals()) { /* Can't use my_error since store_globals has perhaps failed */ - thd->main_da.set_error_status(thd, ER_OUT_OF_RESOURCES, - ER(ER_OUT_OF_RESOURCES)); + thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES, + ER(ER_OUT_OF_RESOURCES), NULL); thd->fatal_error(); goto err; } @@ -2500,8 +2502,8 @@ pthread_handler_t handle_delayed_insert(void *arg) if (my_thread_init()) { /* Can't use my_error since store_globals has not yet been called */ - thd->main_da.set_error_status(thd, ER_OUT_OF_RESOURCES, - ER(ER_OUT_OF_RESOURCES)); + thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES, + ER(ER_OUT_OF_RESOURCES), NULL); goto end; } #endif @@ -2753,7 +2755,7 @@ bool Delayed_insert::handle_inserts(void) { /* This should never happen */ table->file->print_error(error,MYF(0)); - sql_print_error("%s", thd.main_da.message()); + sql_print_error("%s", thd.stmt_da->message()); DBUG_PRINT("error", ("HA_EXTRA_NO_CACHE failed in loop")); goto err; } @@ -2795,7 +2797,7 @@ bool Delayed_insert::handle_inserts(void) if ((error=table->file->extra(HA_EXTRA_NO_CACHE))) { // This shouldn't happen table->file->print_error(error,MYF(0)); - sql_print_error("%s", thd.main_da.message()); + sql_print_error("%s", thd.stmt_da->message()); DBUG_PRINT("error", ("HA_EXTRA_NO_CACHE failed after loop")); goto err; } @@ -3263,10 +3265,12 @@ bool select_insert::send_eof() char buff[160]; if (info.ignore) sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records, - (ulong) (info.records - info.copied), (ulong) thd->cuted_fields); + (ulong) (info.records - info.copied), + (ulong) thd->warning_info->statement_warn_count()); else sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records, - (ulong) (info.deleted+info.updated), (ulong) thd->cuted_fields); + (ulong) (info.deleted+info.updated), + (ulong) thd->warning_info->statement_warn_count()); thd->row_count_func= info.copied + info.deleted + ((thd->client_capabilities & CLIENT_FOUND_ROWS) ? info.touched : info.updated); |