From: Dmitry Shulga Date: September 13 2012 10:20am Subject: bzr push into mysql-trunk branch (Dmitry.Shulga:4204 to 4205) List-Archive: http://lists.mysql.com/commits/144763 Message-Id: <201209131020.q8DAKYae005642@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4205 Dmitry Shulga 2012-09-13 Fixed bug introduced by changeset 4203. modified: sql/sql_insert.cc sql/sql_insert.h 4204 Alexander Nozdrin 2012-09-13 Adding commented-out functions (for the record). modified: sql/sql_insert.h === modified file 'sql/sql_insert.cc' --- a/sql/sql_insert.cc 2012-09-13 09:24:15 +0000 +++ b/sql/sql_insert.cc 2012-09-13 10:19:46 +0000 @@ -747,6 +747,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t List_item *values= its++; const uint value_count= values->elements; TABLE *table= NULL; + Missed_fields_handler miss_flds_handler(thd, ignore); if (mysql_prepare_insert(thd, table_list, table, fields, values, update_fields, update_values, duplic, &unused_conds, @@ -754,13 +755,10 @@ bool mysql_insert(THD *thd,TABLE_LIST *t (fields.elements || !value_count || table_list->view != 0), !ignore && thd->is_strict_mode())) - DBUG_RETURN(true); + goto exit_without_my_ok; /* mysql_prepare_insert set table_list->table if it was not set */ table= table_list->table; - Missed_fields_handler miss_flds_handler(thd, ignore, - table->s->column_bitmap_size, - table->s->fields); /* Must be done before can_prune_insert, due to internal initialization. */ if (info.add_function_default_columns(table, table->write_set)) @@ -769,6 +767,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *t update.add_function_default_columns(table, table->write_set)) goto exit_without_my_ok; + miss_flds_handler.init(table->s->column_bitmap_size, + table->s->fields); + context= &thd->lex->select_lex.context; /* These three asserts test the hypothesis that the resetting of the name === modified file 'sql/sql_insert.h' --- a/sql/sql_insert.h 2012-09-13 09:24:48 +0000 +++ b/sql/sql_insert.h 2012-09-13 10:19:46 +0000 @@ -47,22 +47,30 @@ void upgrade_lock_type_for_insert(THD *t class Missed_fields_handler { public: + Missed_fields_handler(THD* thd_val, bool ignore_errs) + : thd(thd_val), number_of_missed_fields(0), + is_view(false), ignore_errors(ignore_errs) + {} + Missed_fields_handler(THD* thd_val, bool ignore_errs, uint column_bitmap_size, uint number_of_fields) : thd(thd_val), number_of_missed_fields(0), is_view(false), ignore_errors(ignore_errs) { if (column_bitmap_size) + init(column_bitmap_size, number_of_fields); + } + + void init(uint column_bitmap_size, uint number_of_fields) + { + uchar* bitmaps= (uchar*) alloc_root(thd->mem_root, + column_bitmap_size); // TDOD: replace THD::mem_root by statement level mem root + if (bitmaps) { - uchar* bitmaps= (uchar*) alloc_root(thd->mem_root, - column_bitmap_size); // TDOD: replace THD::mem_root by statement level mem root - if (bitmaps) - { - bitmap_init(&fields_not_set_during_insert, - (my_bitmap_map*) (bitmaps), - number_of_fields, - false); - } + bitmap_init(&fields_not_set_during_insert, + (my_bitmap_map*) (bitmaps), + number_of_fields, + false); } } No bundle (reason: useless for push emails).