From: Alexander Barkov Date: August 10 2012 1:29pm Subject: bzr push into mysql-5.6 branch (alexander.barkov:4131 to 4132) List-Archive: http://lists.mysql.com/commits/144545 Message-Id: <201208101337.q7ADbURX025669@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4132 Alexander Barkov 2012-08-10 Removing duplicate code. modified: sql/item_cmpfunc.cc sql/item_cmpfunc.h 4131 Georgi Kodinov 2012-08-10 Bug #14482472: CLIENT_CONNECT_ATTRS AND CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA USE THE SAME ID Fixed CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA to take the next available bit (21) modified: include/mysql_com.h === modified file 'sql/item_cmpfunc.cc' --- a/sql/item_cmpfunc.cc 2012-07-10 11:59:40 +0000 +++ b/sql/item_cmpfunc.cc 2012-08-10 13:28:30 +0000 @@ -519,6 +519,27 @@ static bool convert_constant_item(THD *t } +bool Item_bool_func2::convert_constant_arg(THD *thd, Item *field, Item **item) +{ + if (field->real_item()->type() != FIELD_ITEM) + return false; + + Item_field *field_item= (Item_field*) (field->real_item()); + if (field_item->field->can_be_compared_as_longlong() && + !(field_item->is_temporal_with_date() && + (*item)->result_type() == STRING_RESULT)) + { + if (convert_constant_item(thd, field_item, item)) + { + cmp.set_cmp_func(this, tmp_arg, tmp_arg + 1, INT_RESULT); + field->cmp_context= (*item)->cmp_context= INT_RESULT; + return true; + } + } + return false; +} + + void Item_bool_func2::fix_length_and_dec() { max_length= 1; // Function returns 0 or 1 @@ -555,38 +576,9 @@ void Item_bool_func2::fix_length_and_dec thd= current_thd; if (!thd->lex->is_ps_or_view_context_analysis()) { - if (args[0]->real_item()->type() == FIELD_ITEM) - { - Item_field *field_item= (Item_field*) (args[0]->real_item()); - if (field_item->field->can_be_compared_as_longlong() && - !(field_item->is_temporal_with_date() && - args[1]->result_type() == STRING_RESULT)) - { - if (convert_constant_item(thd, field_item, &args[1])) - { - cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, - INT_RESULT); // Works for all types. - args[0]->cmp_context= args[1]->cmp_context= INT_RESULT; - DBUG_VOID_RETURN; - } - } - } - if (args[1]->real_item()->type() == FIELD_ITEM) - { - Item_field *field_item= (Item_field*) (args[1]->real_item()); - if (field_item->field->can_be_compared_as_longlong() && - !(field_item->is_temporal_with_date() && - args[0]->result_type() == STRING_RESULT)) - { - if (convert_constant_item(thd, field_item, &args[0])) - { - cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, - INT_RESULT); // Works for all types. - args[0]->cmp_context= args[1]->cmp_context= INT_RESULT; - DBUG_VOID_RETURN; - } - } - } + if (convert_constant_arg(thd, args[0], &args[1]) || + convert_constant_arg(thd, args[1], &args[0])) + DBUG_VOID_RETURN; } set_cmp_func(); DBUG_VOID_RETURN; === modified file 'sql/item_cmpfunc.h' --- a/sql/item_cmpfunc.h 2012-07-10 11:59:40 +0000 +++ b/sql/item_cmpfunc.h 2012-08-10 13:28:30 +0000 @@ -373,6 +373,8 @@ public: class Item_bool_func2 :public Item_bool_func { /* Bool with 2 string args */ +private: + bool convert_constant_arg(THD *thd, Item *field, Item **item); protected: Arg_comparator cmp; bool abort_on_null; No bundle (reason: useless for push emails).