From: Alexander Barkov Date: April 17 2012 2:39pm Subject: bzr push into mysql-trunk branch (alexander.barkov:3885 to 3886) Bug#12537203 List-Archive: http://lists.mysql.com/commits/143565 X-Bug: 12537203 Message-Id: <201204171444.q3HEilL9021994@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3886 Alexander Barkov 2012-04-17 BUG#12537203 post-fix Now Item_int, Item_uint, Item_float,Item_decimal, Item_null constructors use NameString and a data type for the "name" argument. modified: sql/handler.cc sql/item.cc sql/item.h sql/item_create.cc sql/item_strfunc.cc sql/item_strfunc.h sql/item_subselect.cc sql/item_xmlfunc.cc sql/sp_head.cc sql/sql_base.cc sql/sql_class.cc sql/sql_optimizer.cc sql/sql_parse.cc sql/sql_show.cc sql/sql_string.h sql/sql_table.cc sql/sql_yacc.yy 3885 Hemant Kumar 2012-04-17 In order to reduce test execution time on daily valgrind, I have just disabled the test execution of some selected tests on daily valgrind only. modified: mysql-test/suite/engines/funcs/t/crash_manytables_number.test mysql-test/suite/engines/funcs/t/ld_all_number_string_calendar_types.test mysql-test/suite/engines/funcs/t/se_join_cross.test mysql-test/suite/engines/funcs/t/se_join_default.test mysql-test/suite/engines/funcs/t/se_join_inner.test mysql-test/suite/engines/funcs/t/se_join_left.test mysql-test/suite/engines/funcs/t/se_join_natural_left.test mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test mysql-test/suite/engines/funcs/t/se_join_natural_right.test mysql-test/suite/engines/funcs/t/se_join_natural_right_outer.test mysql-test/suite/engines/funcs/t/se_join_right.test mysql-test/suite/engines/funcs/t/se_join_right_outer.test mysql-test/suite/engines/funcs/t/se_join_straight.test mysql-test/suite/engines/funcs/t/se_string_limit.test mysql-test/suite/engines/iuds/t/update_delete_number.test mysql-test/suite/innodb/t/innodb_bug30423.test mysql-test/suite/innodb/t/innodb_bug53290.test mysql-test/suite/parts/t/partition_float_myisam.test mysql-test/suite/rpl/t/rpl_innodb_bug28430.test mysql-test/suite/rpl/t/rpl_parallel_innodb.test mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test mysql-test/suite/rpl/t/rpl_row_img_blobs.test mysql-test/suite/rpl/t/rpl_row_img_eng_full.test mysql-test/suite/rpl/t/rpl_row_img_idx_full.test mysql-test/suite/rpl/t/rpl_stop_slave.test mysql-test/suite/rpl/t/rpl_typeconv.test mysql-test/t/index_merge_innodb.test mysql-test/t/innodb_explain_json_non_select_all.test mysql-test/t/innodb_explain_non_select_all.test mysql-test/t/innodb_explain_non_select_none.test mysql-test/t/mysql_client_test_embedded.test === modified file 'sql/handler.cc' --- a/sql/handler.cc 2012-04-11 13:50:46 +0000 +++ b/sql/handler.cc 2012-04-17 14:37:50 +0000 @@ -1826,9 +1826,9 @@ bool mysql_xa_recover(THD *thd) XID_STATE *xs; DBUG_ENTER("mysql_xa_recover"); - field_list.push_back(new Item_int("formatID", 0, MY_INT32_NUM_DECIMAL_DIGITS)); - field_list.push_back(new Item_int("gtrid_length", 0, MY_INT32_NUM_DECIMAL_DIGITS)); - field_list.push_back(new Item_int("bqual_length", 0, MY_INT32_NUM_DECIMAL_DIGITS)); + field_list.push_back(new Item_int(NAME_STRING("formatID"), 0, MY_INT32_NUM_DECIMAL_DIGITS)); + field_list.push_back(new Item_int(NAME_STRING("gtrid_length"), 0, MY_INT32_NUM_DECIMAL_DIGITS)); + field_list.push_back(new Item_int(NAME_STRING("bqual_length"), 0, MY_INT32_NUM_DECIMAL_DIGITS)); field_list.push_back(new Item_empty_string("data",XIDDATASIZE)); if (protocol->send_result_set_metadata(&field_list, === modified file 'sql/item.cc' --- a/sql/item.cc 2012-04-12 15:31:01 +0000 +++ b/sql/item.cc 2012-04-17 14:37:50 +0000 @@ -958,7 +958,7 @@ bool Item::check_cols(uint c) } -NameString null_name_string(NULL, 0); +const NameString null_name_string(NULL, 0); void NameString::copy(const char *str, uint length, const CHARSET_INFO *cs) @@ -2997,20 +2997,6 @@ void Item_int::print(String *str, enum_q } -Item_uint::Item_uint(const char *str_arg, uint length): - Item_int(str_arg, length) -{ - unsigned_flag= 1; -} - - -Item_uint::Item_uint(const char *str_arg, longlong i, uint length): - Item_int(str_arg, i, length) -{ - unsigned_flag= 1; -} - - String *Item_uint::val_str(String *str) { // following assert is redundant, because fixed=1 assigned in constructor @@ -3065,11 +3051,12 @@ Item_decimal::Item_decimal(double val, i } -Item_decimal::Item_decimal(const char *str, const my_decimal *val_arg, +Item_decimal::Item_decimal(const NameString &name_arg, + const my_decimal *val_arg, uint decimal_par, uint length) { my_decimal2decimal(val_arg, &decimal_value); - item_name.set(str); + item_name= name_arg; decimals= (uint8) decimal_par; max_length= length; fixed= 1; @@ -3996,13 +3983,13 @@ Item_param::clone_item() /* see comments in the header file */ switch (state) { case NULL_VALUE: - return new Item_null(item_name.ptr()); + return new Item_null(item_name); case INT_VALUE: return (unsigned_flag ? - new Item_uint(item_name.ptr(), value.integer, max_length) : - new Item_int(item_name.ptr(), value.integer, max_length)); + new Item_uint(item_name, value.integer, max_length) : + new Item_int(item_name, value.integer, max_length)); case REAL_VALUE: - return new Item_float(item_name.ptr(), value.real, decimals, max_length); + return new Item_float(item_name, value.real, decimals, max_length); case STRING_VALUE: case LONG_DATA_VALUE: return new Item_string(item_name, str_value.c_ptr_quick(), str_value.length(), @@ -6253,8 +6240,8 @@ Item *Item_int_with_ref::clone_item() parameter markers. */ return (ref->unsigned_flag ? - new Item_uint(ref->item_name.ptr(), ref->val_int(), ref->max_length) : - new Item_int(ref->item_name.ptr(), ref->val_int(), ref->max_length)); + new Item_uint(ref->item_name, ref->val_int(), ref->max_length) : + new Item_int(ref->item_name, ref->val_int(), ref->max_length)); } @@ -6265,7 +6252,7 @@ Item *Item_time_with_ref::clone_item() We need to evaluate the constant to make sure it works with parameter markers. */ - return new Item_temporal(MYSQL_TYPE_TIME, ref->item_name.ptr(), + return new Item_temporal(MYSQL_TYPE_TIME, ref->item_name, ref->val_time_temporal(), ref->max_length); } @@ -6277,7 +6264,7 @@ Item *Item_datetime_with_ref::clone_item We need to evaluate the constant to make sure it works with parameter markers. */ - return new Item_temporal(MYSQL_TYPE_DATETIME, ref->item_name.ptr(), + return new Item_temporal(MYSQL_TYPE_DATETIME, ref->item_name, ref->val_date_temporal(), ref->max_length); } @@ -8163,8 +8150,6 @@ void resolve_const_item(THD *thd, Item * return; // Can't be better Item_result res_type=item_cmp_type(comp_item->result_type(), item->result_type()); - const char *name= item->item_name.ptr(); // Alloced by sql_alloc - switch (res_type) { case STRING_RESULT: { @@ -8172,7 +8157,7 @@ void resolve_const_item(THD *thd, Item * String tmp(buff,sizeof(buff),&my_charset_bin),*result; result=item->val_str(&tmp); if (item->null_value) - new_item= new Item_null(name); + new_item= new Item_null(item->item_name); else if (item->is_temporal()) { enum_field_types type= item->field_type() == MYSQL_TYPE_TIMESTAMP ? @@ -8193,8 +8178,8 @@ void resolve_const_item(THD *thd, Item * longlong result=item->val_int(); uint length=item->max_length; bool null_value=item->null_value; - new_item= (null_value ? (Item*) new Item_null(name) : - (Item*) new Item_int(name, result, length)); + new_item= (null_value ? (Item*) new Item_null(item->item_name) : + (Item*) new Item_int(item->item_name, result, length)); break; } case ROW_RESULT: @@ -8232,19 +8217,19 @@ void resolve_const_item(THD *thd, Item * double result= item->val_real(); uint length=item->max_length,decimals=item->decimals; bool null_value=item->null_value; - new_item= (null_value ? (Item*) new Item_null(name) : (Item*) - new Item_float(name, result, decimals, length)); + new_item= (null_value ? (Item*) new Item_null(item->item_name) : (Item*) + new Item_float(item->item_name, result, decimals, length)); break; } case DECIMAL_RESULT: { my_decimal decimal_value; my_decimal *result= item->val_decimal(&decimal_value); - uint length= item->max_length, decimals= item->decimals; bool null_value= item->null_value; new_item= (null_value ? - (Item*) new Item_null(name) : - (Item*) new Item_decimal(name, result, length, decimals)); + (Item*) new Item_null(item->item_name) : + (Item*) new Item_decimal(item->item_name, result, + item->max_length, item->decimals)); break; } default: === modified file 'sql/item.h' --- a/sql/item.h 2012-04-12 15:31:01 +0000 +++ b/sql/item.h 2012-04-17 14:37:50 +0000 @@ -147,6 +147,11 @@ public: /** Storage for name strings. Enpowers SimpleCString with allocation routines from the sql_strmake family. + + This class must stay as small as possible as we often + pass it into functions using call-by-value evaluation. + + Don't add new members or virual methods into this class! */ class NameString: public SimpleCString { @@ -160,6 +165,11 @@ private: } public: NameString(): SimpleCString() {} + /* + Please do NOT add constructor NameString(const char *str) ! + It will involve hidden strlen() call, which can affect + performance negatively. Use NameString(str, len) instead. + */ NameString(const char *str, uint length): SimpleCString(str, length) {} NameString(const LEX_STRING str): SimpleCString(str) {} @@ -226,7 +236,10 @@ public: }; -extern NameString null_name_string; +#define NAME_STRING(x) NameString(C_STRING_WITH_LEN(x)) + + +extern const NameString null_name_string; /** @@ -2211,15 +2224,24 @@ public: class Item_null :public Item_basic_constant { -public: - Item_null(const char *name_par=0) + void init() { maybe_null= null_value= TRUE; max_length= 0; - item_name.copy(name_par ? name_par : (char*) "NULL"); fixed= 1; collation.set(&my_charset_bin, DERIVATION_IGNORABLE); } +public: + Item_null() + { + init(); + item_name= NAME_STRING("NULL"); + } + Item_null(const NameString &name_par) + { + init(); + item_name= name_par; + } enum Type type() const { return NULL_ITEM; } bool eq(const Item *item, bool binary_cmp) const; double val_real(); @@ -2242,7 +2264,7 @@ public: enum Item_result result_type () const { return STRING_RESULT; } enum_field_types field_type() const { return MYSQL_TYPE_NULL; } bool basic_const_item() const { return 1; } - Item *clone_item() { return new Item_null(item_name.ptr()); } + Item *clone_item() { return new Item_null(item_name); } bool is_null() { return 1; } virtual inline void print(String *str, enum_query_type query_type) @@ -2450,10 +2472,10 @@ public: max_length= item_arg->max_length; fixed= 1; } - Item_int(const char *str_arg,longlong i,uint length) :value(i) + Item_int(const NameString &name_arg, longlong i, uint length) :value(i) { max_length= length; - item_name.set(str_arg); + item_name= name_arg; fixed= 1; } Item_int(const char *str_arg, uint length); @@ -2484,6 +2506,16 @@ public: }; +/** + Item_int with value==0 and length==1 +*/ +class Item_int_0 :public Item_int +{ +public: + Item_int_0() :Item_int(NAME_STRING("0"), 0, 1) {} +}; + + /* Item_temporal is used to store numeric representation of time/date/datetime values for queries like: @@ -2503,13 +2535,13 @@ public: { DBUG_ASSERT(is_temporal_type(field_type_arg)); } - Item_temporal(enum_field_types field_type_arg, - const char *str_arg, longlong i, uint length): Item_int(i), + Item_temporal(enum_field_types field_type_arg, const NameString &name_arg, + longlong i, uint length): Item_int(i), cached_field_type(field_type_arg) { DBUG_ASSERT(is_temporal_type(field_type_arg)); max_length= length; - item_name.set(str_arg); + item_name= name_arg; fixed= 1; } Item *clone_item() { return new Item_temporal(field_type(), value); } @@ -2536,13 +2568,15 @@ public: class Item_uint :public Item_int { public: - Item_uint(const char *str_arg, uint length); + Item_uint(const char *str_arg, uint length) + :Item_int(str_arg, length) { unsigned_flag= 1; } Item_uint(ulonglong i) :Item_int((ulonglong) i, 10) {} - Item_uint(const char *str_arg, longlong i, uint length); + Item_uint(const NameString &name_arg, longlong i, uint length) + :Item_int(name_arg, i, length) { unsigned_flag= 1; } double val_real() { DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); } String *val_str(String*); - Item *clone_item() { return new Item_uint(item_name.ptr(), value, max_length); } + Item *clone_item() { return new Item_uint(item_name, value, max_length); } int save_in_field(Field *field, bool no_conversions); virtual void print(String *str, enum_query_type query_type); Item_num *neg (); @@ -2558,8 +2592,8 @@ protected: my_decimal decimal_value; public: Item_decimal(const char *str_arg, uint length, const CHARSET_INFO *charset); - Item_decimal(const char *str, const my_decimal *val_arg, - uint decimal_par, uint length); + Item_decimal(const NameString &name_arg, + const my_decimal *val_arg, uint decimal_par, uint length); Item_decimal(my_decimal *value_par); Item_decimal(longlong val, bool unsig); Item_decimal(double val, int precision, int scale); @@ -2584,7 +2618,7 @@ public: bool basic_const_item() const { return 1; } Item *clone_item() { - return new Item_decimal(item_name.ptr(), &decimal_value, decimals, max_length); + return new Item_decimal(item_name, &decimal_value, decimals, max_length); } virtual void print(String *str, enum_query_type query_type); Item_num *neg() @@ -2607,13 +2641,14 @@ public: double value; // Item_real() :value(0) {} Item_float(const char *str_arg, uint length); - Item_float(const char *str,double val_arg,uint decimal_par,uint length) + Item_float(const NameString name_arg, + double val_arg, uint decimal_par, uint length) :value(val_arg) { - presentation.set(str); - item_name.set(str); - decimals=(uint8) decimal_par; - max_length=length; + presentation= name_arg; + item_name= name_arg; + decimals= (uint8) decimal_par; + max_length= length; fixed= 1; } Item_float(double value_par, uint decimal_par) :value(value_par) @@ -2650,7 +2685,7 @@ public: } bool basic_const_item() const { return 1; } Item *clone_item() - { return new Item_float(item_name.ptr(), value, decimals, max_length); } + { return new Item_float(item_name, value, decimals, max_length); } Item_num *neg() { value= -value; return this; } virtual void print(String *str, enum_query_type query_type); bool eq(const Item *, bool binary_cmp) const; @@ -2659,11 +2694,12 @@ public: class Item_static_float_func :public Item_float { - const char *func_name; + const NameString func_name; public: - Item_static_float_func(const char *str, double val_arg, uint decimal_par, - uint length) - :Item_float(NullS, val_arg, decimal_par, length), func_name(str) + Item_static_float_func(const NameString &name_arg, + double val_arg, uint decimal_par, uint length) + :Item_float(null_name_string, + val_arg, decimal_par, length), func_name(name_arg) {} virtual inline void print(String *str, enum_query_type query_type) @@ -2827,10 +2863,10 @@ double_from_string_with_check (const CHA class Item_static_string_func :public Item_string { - const char *func_name; + const NameString func_name; public: - Item_static_string_func(const char *name_par, const char *str, uint length, - const CHARSET_INFO *cs, + Item_static_string_func(const NameString &name_par, + const char *str, uint length, const CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) :Item_string(null_name_string, str, length, cs, dv), func_name(name_par) {} @@ -2909,7 +2945,8 @@ class Item_return_int :public Item_int public: Item_return_int(const char *name_arg, uint length, enum_field_types field_type_arg, longlong value= 0) - :Item_int(name_arg, value, length), int_field_type(field_type_arg) + :Item_int(NameString(name_arg, name_arg ? strlen(name_arg) : 0), + value, length), int_field_type(field_type_arg) { unsigned_flag=1; } === modified file 'sql/item_create.cc' --- a/sql/item_create.cc 2012-03-30 15:38:01 +0000 +++ b/sql/item_create.cc 2012-04-17 14:37:50 +0000 @@ -4700,7 +4700,8 @@ Create_func_pi Create_func_pi::s_singlet Item* Create_func_pi::create(THD *thd) { - return new (thd->mem_root) Item_static_float_func("pi()", M_PI, 6, 8); + return new (thd->mem_root) Item_static_float_func(NAME_STRING("pi()"), + M_PI, 6, 8); } @@ -4827,7 +4828,7 @@ Create_func_round::create_native(THD *th case 1: { Item *param_1= item_list->pop(); - Item *i0 = new (thd->mem_root) Item_int((char*)"0", 0, 1); + Item *i0 = new (thd->mem_root) Item_int_0(); func= new (thd->mem_root) Item_func_round(param_1, i0, 0); break; } @@ -5186,7 +5187,7 @@ Item* Create_func_version::create(THD *thd) { thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); - return new (thd->mem_root) Item_static_string_func("version()", + return new (thd->mem_root) Item_static_string_func(NAME_STRING("version()"), server_version, (uint) strlen(server_version), system_charset_info, @@ -5208,7 +5209,7 @@ Create_func_weekofyear Create_func_weeko Item* Create_func_weekofyear::create(THD *thd, Item *arg1) { - Item *i1= new (thd->mem_root) Item_int((char*) "0", 3, 1); + Item *i1= new (thd->mem_root) Item_int(NAME_STRING("0"), 3, 1); return new (thd->mem_root) Item_func_week(arg1, i1); } @@ -5291,7 +5292,7 @@ Create_func_year_week::create_native(THD case 1: { Item *param_1= item_list->pop(); - Item *i0= new (thd->mem_root) Item_int((char*) "0", 0, 1); + Item *i0= new (thd->mem_root) Item_int_0(); func= new (thd->mem_root) Item_func_yearweek(param_1, i0); break; } === modified file 'sql/item_strfunc.cc' --- a/sql/item_strfunc.cc 2012-03-19 17:59:14 +0000 +++ b/sql/item_strfunc.cc 2012-04-17 14:37:50 +0000 @@ -2081,7 +2081,7 @@ Item *Item_func_sysconst::safe_charset_c String tmp, cstr, *ostr= val_str(&tmp); if (null_value) { - Item *null_item= new Item_null((char *) fully_qualified_func_name()); + Item *null_item= new Item_null(fully_qualified_func_name()); null_item->collation.set (tocs); return null_item; } === modified file 'sql/item_strfunc.h' --- a/sql/item_strfunc.h 2012-03-06 14:29:42 +0000 +++ b/sql/item_strfunc.h 2012-04-17 14:37:50 +0000 @@ -464,7 +464,7 @@ public: safe_charset_converter, return string representation of this function call */ - virtual const char *fully_qualified_func_name() const = 0; + virtual const NameString fully_qualified_func_name() const = 0; }; @@ -479,7 +479,8 @@ public: maybe_null=1; } const char *func_name() const { return "database"; } - const char *fully_qualified_func_name() const { return "database()"; } + const NameString fully_qualified_func_name() const + { return NAME_STRING("database()"); } }; @@ -505,7 +506,8 @@ public: (HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN); } const char *func_name() const { return "user"; } - const char *fully_qualified_func_name() const { return "user()"; } + const NameString fully_qualified_func_name() const + { return NAME_STRING("user()"); } int save_in_field(Field *field, bool no_conversions) { return save_str_value_in_field(field, &str_value); @@ -522,7 +524,8 @@ public: : context(context_arg) {} bool fix_fields(THD *thd, Item **ref); const char *func_name() const { return "current_user"; } - const char *fully_qualified_func_name() const { return "current_user()"; } + const NameString fully_qualified_func_name() const + { return NAME_STRING("current_user()"); } }; === modified file 'sql/item_subselect.cc' --- a/sql/item_subselect.cc 2012-03-30 15:38:01 +0000 +++ b/sql/item_subselect.cc 2012-04-17 14:37:50 +0000 @@ -1495,7 +1495,7 @@ Item_in_subselect::single_value_in_to_ex bool tmp; Item *having= item, *orig_item= item; select_lex->item_list.empty(); - select_lex->item_list.push_back(new Item_int("Not_used", + select_lex->item_list.push_back(new Item_int(NAME_STRING("Not_used"), (longlong) 1, MY_INT64_NUM_DECIMAL_DIGITS)); join->ref_ptrs[0]= select_lex->item_list.head(); === modified file 'sql/item_xmlfunc.cc' --- a/sql/item_xmlfunc.cc 2012-04-12 15:31:01 +0000 +++ b/sql/item_xmlfunc.cc 2012-04-17 14:37:50 +0000 @@ -1167,7 +1167,7 @@ static Item *create_func_string_length(M static Item *create_func_round(MY_XPATH *xpath, Item **args, uint nargs) { - return new Item_func_round(args[0], new Item_int((char*)"0",0,1),0); + return new Item_func_round(args[0], new Item_int_0(), 0); } === modified file 'sql/sp_head.cc' --- a/sql/sp_head.cc 2012-04-13 12:00:39 +0000 +++ b/sql/sp_head.cc 2012-04-17 14:37:50 +0000 @@ -2815,7 +2815,7 @@ sp_head::show_routine_code(THD *thd) if (check_show_routine_access(thd, this, &full_access) || !full_access) DBUG_RETURN(1); - field_list.push_back(new Item_uint("Pos", 0, 9)); + field_list.push_back(new Item_uint(NAME_STRING("Pos"), 0, 9)); // 1024 is for not to confuse old clients field_list.push_back(new Item_empty_string("Instruction", max(buffer.length(), 1024U))); === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2012-04-12 15:31:01 +0000 +++ b/sql/sql_base.cc 2012-04-17 14:37:50 +0000 @@ -8162,7 +8162,7 @@ int setup_wild(THD *thd, TABLE_LIST *tab Item_int do not need fix_fields() because it is basic constant. */ - it.replace(new Item_int("Not_used", (longlong) 1, + it.replace(new Item_int(NAME_STRING("Not_used"), (longlong) 1, MY_INT64_NUM_DECIMAL_DIGITS)); } else if (insert_fields(thd, ((Item_field*) item)->context, === modified file 'sql/sql_class.cc' --- a/sql/sql_class.cc 2012-04-13 12:00:39 +0000 +++ b/sql/sql_class.cc 2012-04-17 14:37:50 +0000 @@ -2084,7 +2084,8 @@ int THD::send_explain_fields(select_resu item->maybe_null= 1; if (lex->describe & DESCRIBE_EXTENDED) { - field_list.push_back(item= new Item_float("filtered", 0.1234, 2, 4)); + field_list.push_back(item= new Item_float(NAME_STRING("filtered"), + 0.1234, 2, 4)); item->maybe_null=1; } field_list.push_back(new Item_empty_string("Extra", 255, cs)); === modified file 'sql/sql_optimizer.cc' --- a/sql/sql_optimizer.cc 2012-03-30 15:38:01 +0000 +++ b/sql/sql_optimizer.cc 2012-04-17 14:37:50 +0000 @@ -8299,7 +8299,7 @@ remove_eq_conds(THD *thd, Item *cond, It #endif Item *new_cond; if ((new_cond= new Item_func_eq(args[0], - new Item_int("last_insert_id()", + new Item_int(NAME_STRING("last_insert_id()"), thd->read_first_successful_insert_id_in_prev_stmt(), MY_INT64_NUM_DECIMAL_DIGITS)))) { === modified file 'sql/sql_parse.cc' --- a/sql/sql_parse.cc 2012-04-13 12:00:39 +0000 +++ b/sql/sql_parse.cc 2012-04-17 14:37:50 +0000 @@ -7621,7 +7621,7 @@ Item *negate_expression(THD *thd, Item * if it is not boolean function then we have to emulate value of not(not(a)), it will be a != 0 */ - return new Item_func_ne(arg, new Item_int((char*) "0", 0, 1)); + return new Item_func_ne(arg, new Item_int_0()); } if ((negated= expr->neg_transformer(thd)) != 0) === modified file 'sql/sql_show.cc' --- a/sql/sql_show.cc 2012-04-13 12:00:39 +0000 +++ b/sql/sql_show.cc 2012-04-17 14:37:50 +0000 @@ -2050,7 +2050,7 @@ void mysqld_list_processes(THD *thd,cons Protocol *protocol= thd->protocol; DBUG_ENTER("mysqld_list_processes"); - field_list.push_back(new Item_int("Id", 0, MY_INT32_NUM_DECIMAL_DIGITS)); + field_list.push_back(new Item_int(NAME_STRING("Id"), 0, MY_INT32_NUM_DECIMAL_DIGITS)); field_list.push_back(new Item_empty_string("User",16)); field_list.push_back(new Item_empty_string("Host",LIST_PROCESS_HOST_LEN)); field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN)); @@ -6695,10 +6695,14 @@ TABLE *create_schema_table(THD *thd, TAB break; case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_DOUBLE: - if ((item= new Item_float(fields_info->field_name, 0.0, NOT_FIXED_DEC, - fields_info->field_length)) == NULL) + { + const NameString field_name(fields_info->field_name, + strlen(fields_info->field_name)); + if ((item= new Item_float(field_name, 0.0, NOT_FIXED_DEC, + fields_info->field_length)) == NULL) DBUG_RETURN(NULL); break; + } case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_NEWDECIMAL: if (!(item= new Item_decimal((longlong) fields_info->value, false))) === modified file 'sql/sql_string.h' --- a/sql/sql_string.h 2012-04-12 15:31:01 +0000 +++ b/sql/sql_string.h 2012-04-17 14:37:50 +0000 @@ -27,6 +27,12 @@ A wrapper class for null-terminated constant strings. Constructors make sure that the position of the '\0' terminating byte in m_str is always in sync with m_length. + + This class must stay as small as possible as we often + pass it and its descendants (such as NameString) into functions + using call-by-value evaluation. + + Don't add new members or virual methods into this class! */ class SimpleCString { === modified file 'sql/sql_table.cc' --- a/sql/sql_table.cc 2012-04-13 08:56:09 +0000 +++ b/sql/sql_table.cc 2012-04-17 14:37:50 +0000 @@ -7947,7 +7947,8 @@ bool mysql_checksum_table(THD *thd, TABL field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2)); item->maybe_null= 1; - field_list.push_back(item= new Item_int("Checksum", (longlong) 1, + field_list.push_back(item= new Item_int(NAME_STRING("Checksum"), + (longlong) 1, MY_INT64_NUM_DECIMAL_DIGITS)); item->maybe_null= 1; if (protocol->send_result_set_metadata(&field_list, === modified file 'sql/sql_yacc.yy' --- a/sql/sql_yacc.yy 2012-04-12 15:31:01 +0000 +++ b/sql/sql_yacc.yy 2012-04-17 14:37:50 +0000 @@ -9392,7 +9392,7 @@ function_call_conflict: | WEEK_SYM '(' expr ')' { THD *thd= YYTHD; - Item *i1= new (thd->mem_root) Item_int((char*) "0", + Item *i1= new (thd->mem_root) Item_int(NAME_STRING("0"), thd->variables.default_week_format, 1); if (i1 == NULL) @@ -12745,13 +12745,13 @@ literal: } | FALSE_SYM { - $$= new (YYTHD->mem_root) Item_int((char*) "FALSE",0,1); + $$= new (YYTHD->mem_root) Item_int(NAME_STRING("FALSE"), 0, 1); if ($$ == NULL) MYSQL_YYABORT; } | TRUE_SYM { - $$= new (YYTHD->mem_root) Item_int((char*) "TRUE",1,1); + $$= new (YYTHD->mem_root) Item_int(NAME_STRING("TRUE"), 1, 1); if ($$ == NULL) MYSQL_YYABORT; } @@ -12831,7 +12831,7 @@ NUM_literal: { int error; $$= new (YYTHD->mem_root) - Item_int($1.str, + Item_int($1, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); if ($$ == NULL) @@ -12841,7 +12841,7 @@ NUM_literal: { int error; $$= new (YYTHD->mem_root) - Item_int($1.str, + Item_int($1, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); if ($$ == NULL) No bundle (reason: useless for push emails).