diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-05-28 16:00:05 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-05-28 16:00:05 +0400 |
commit | 5443b9db21e0d38672928d58d631dbd6decbb319 (patch) | |
tree | 3bc2a64d52a50b03b903fe1c108c2c7d940082f9 | |
parent | 979c5049ef6fdd55c29fa5170a96c62d2a8a6823 (diff) | |
download | mariadb-git-5443b9db21e0d38672928d58d631dbd6decbb319.tar.gz |
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.
-rw-r--r-- | sql/item_cmpfunc.cc | 8 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 13 |
2 files changed, 12 insertions, 9 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 93e478892e0..5bea5dac711 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1281,9 +1281,13 @@ int Arg_comparator::compare_row() case Item_func::GT_FUNC: case Item_func::GE_FUNC: return -1; // <, <=, > and >= always fail on NULL - default: // EQ_FUNC - if (((Item_bool_func2*)owner)->abort_on_null) + case Item_func::EQ_FUNC: + if (((Item_func_eq*)owner)->abort_on_null) return -1; // We do not need correct NULL returning + break; + default: + DBUG_ASSERT(0); + break; } was_null= 1; owner->null_value= 0; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 2f26e4807b8..06a0c39dc7f 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -293,12 +293,10 @@ class Item_bool_func2 :public Item_bool_func { /* Bool with 2 string args */ protected: Arg_comparator cmp; - bool abort_on_null; public: Item_bool_func2(Item *a,Item *b) - :Item_bool_func(a,b), cmp(tmp_arg, tmp_arg+1), - abort_on_null(FALSE) { sargable= TRUE; } + :Item_bool_func(a,b), cmp(tmp_arg, tmp_arg+1) { sargable= TRUE; } void fix_length_and_dec(); int set_cmp_func() { @@ -316,7 +314,6 @@ public: bool is_null() { return MY_TEST(args[0]->is_null() || args[1]->is_null()); } CHARSET_INFO *compare_collation() const { return cmp.cmp_collation.collation; } - void top_level_item() { abort_on_null= TRUE; } Arg_comparator *get_comparator() { return &cmp; } void cleanup() { @@ -326,7 +323,6 @@ public: COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, bool top_level); - friend class Arg_comparator; }; class Item_bool_rowready_func2 :public Item_bool_func2 @@ -369,7 +365,6 @@ public: enum Functype functype() const { return XOR_FUNC; } const char *func_name() const { return "xor"; } longlong val_int(); - void top_level_item() {} Item *neg_transformer(THD *thd); bool subst_argument_checker(uchar **arg) { @@ -478,15 +473,18 @@ public: class Item_func_eq :public Item_bool_rowready_func2 { + bool abort_on_null; public: 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(); enum Functype functype() const { return EQ_FUNC; } enum Functype rev_functype() const { return EQ_FUNC; } cond_result eq_cmp_result() const { return COND_TRUE; } const char *func_name() const { return "="; } + void top_level_item() { abort_on_null= true; } Item *negated_item(); COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, @@ -508,6 +506,7 @@ public: */ uint in_equality_no; virtual uint exists2in_reserved_items() { return 1; }; + friend class Arg_comparator; }; class Item_func_equal :public Item_bool_rowready_func2 |