Commit 5443b9db authored by Alexander Barkov's avatar Alexander Barkov

Moving "bool abort_on_null" from Item_bool_func2 to Item_func_eq,

as it's not used by the other Item_bool_func2 descendands.
parent 979c5049
...@@ -1281,9 +1281,13 @@ int Arg_comparator::compare_row() ...@@ -1281,9 +1281,13 @@ int Arg_comparator::compare_row()
case Item_func::GT_FUNC: case Item_func::GT_FUNC:
case Item_func::GE_FUNC: case Item_func::GE_FUNC:
return -1; // <, <=, > and >= always fail on NULL return -1; // <, <=, > and >= always fail on NULL
default: // EQ_FUNC case Item_func::EQ_FUNC:
if (((Item_bool_func2*)owner)->abort_on_null) if (((Item_func_eq*)owner)->abort_on_null)
return -1; // We do not need correct NULL returning return -1; // We do not need correct NULL returning
break;
default:
DBUG_ASSERT(0);
break;
} }
was_null= 1; was_null= 1;
owner->null_value= 0; owner->null_value= 0;
......
...@@ -293,12 +293,10 @@ class Item_bool_func2 :public Item_bool_func ...@@ -293,12 +293,10 @@ class Item_bool_func2 :public Item_bool_func
{ /* Bool with 2 string args */ { /* Bool with 2 string args */
protected: protected:
Arg_comparator cmp; Arg_comparator cmp;
bool abort_on_null;
public: public:
Item_bool_func2(Item *a,Item *b) Item_bool_func2(Item *a,Item *b)
:Item_bool_func(a,b), cmp(tmp_arg, tmp_arg+1), :Item_bool_func(a,b), cmp(tmp_arg, tmp_arg+1) { sargable= TRUE; }
abort_on_null(FALSE) { sargable= TRUE; }
void fix_length_and_dec(); void fix_length_and_dec();
int set_cmp_func() int set_cmp_func()
{ {
...@@ -316,7 +314,6 @@ public: ...@@ -316,7 +314,6 @@ public:
bool is_null() { return MY_TEST(args[0]->is_null() || args[1]->is_null()); } bool is_null() { return MY_TEST(args[0]->is_null() || args[1]->is_null()); }
CHARSET_INFO *compare_collation() const CHARSET_INFO *compare_collation() const
{ return cmp.cmp_collation.collation; } { return cmp.cmp_collation.collation; }
void top_level_item() { abort_on_null= TRUE; }
Arg_comparator *get_comparator() { return &cmp; } Arg_comparator *get_comparator() { return &cmp; }
void cleanup() void cleanup()
{ {
...@@ -326,7 +323,6 @@ public: ...@@ -326,7 +323,6 @@ public:
COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value,
bool top_level); bool top_level);
friend class Arg_comparator;
}; };
class Item_bool_rowready_func2 :public Item_bool_func2 class Item_bool_rowready_func2 :public Item_bool_func2
...@@ -369,7 +365,6 @@ public: ...@@ -369,7 +365,6 @@ public:
enum Functype functype() const { return XOR_FUNC; } enum Functype functype() const { return XOR_FUNC; }
const char *func_name() const { return "xor"; } const char *func_name() const { return "xor"; }
longlong val_int(); longlong val_int();
void top_level_item() {}
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
bool subst_argument_checker(uchar **arg) bool subst_argument_checker(uchar **arg)
{ {
...@@ -478,15 +473,18 @@ public: ...@@ -478,15 +473,18 @@ public:
class Item_func_eq :public Item_bool_rowready_func2 class Item_func_eq :public Item_bool_rowready_func2
{ {
bool abort_on_null;
public: public:
Item_func_eq(Item *a,Item *b) : Item_func_eq(Item *a,Item *b) :
Item_bool_rowready_func2(a,b), in_equality_no(UINT_MAX) Item_bool_rowready_func2(a,b),
abort_on_null(false), in_equality_no(UINT_MAX)
{} {}
longlong val_int(); longlong val_int();
enum Functype functype() const { return EQ_FUNC; } enum Functype functype() const { return EQ_FUNC; }
enum Functype rev_functype() const { return EQ_FUNC; } enum Functype rev_functype() const { return EQ_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; } cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "="; } const char *func_name() const { return "="; }
void top_level_item() { abort_on_null= true; }
Item *negated_item(); Item *negated_item();
COND *build_equal_items(THD *thd, COND_EQUAL *inherited, COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
bool link_item_fields, bool link_item_fields,
...@@ -508,6 +506,7 @@ public: ...@@ -508,6 +506,7 @@ public:
*/ */
uint in_equality_no; uint in_equality_no;
virtual uint exists2in_reserved_items() { return 1; }; virtual uint exists2in_reserved_items() { return 1; };
friend class Arg_comparator;
}; };
class Item_func_equal :public Item_bool_rowready_func2 class Item_func_equal :public Item_bool_rowready_func2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment