Skip to content

Commit cbc318f

Browse files
author
Alexander Barkov
committed
Removing some duplicate code: deriving Item_func_opt_neg from Item_bool_func.
1 parent 52b3d95 commit cbc318f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

sql/item_cmpfunc.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ class Item_bool_func :public Item_int_func
122122
Item_bool_func() :Item_int_func() {}
123123
Item_bool_func(Item *a) :Item_int_func(a) {}
124124
Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {}
125+
Item_bool_func(Item *a, Item *b, Item *c) :Item_int_func(a, b, c) {}
126+
Item_bool_func(List<Item> &list) :Item_int_func(list) { }
125127
Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {}
126128
bool is_bool_func() { return 1; }
127129
void fix_length_and_dec() { decimals=0; max_length=1; }
@@ -644,16 +646,16 @@ class Item_func_ne :public Item_bool_rowready_func2
644646
645647
*/
646648

647-
class Item_func_opt_neg :public Item_int_func
649+
class Item_func_opt_neg :public Item_bool_func
648650
{
649651
public:
650652
bool negated; /* <=> the item represents NOT <func> */
651653
bool pred_level; /* <=> [NOT] <func> is used on a predicate level */
652654
public:
653655
Item_func_opt_neg(Item *a, Item *b, Item *c)
654-
:Item_int_func(a, b, c), negated(0), pred_level(0) {}
656+
:Item_bool_func(a, b, c), negated(0), pred_level(0) {}
655657
Item_func_opt_neg(List<Item> &list)
656-
:Item_int_func(list), negated(0), pred_level(0) {}
658+
:Item_bool_func(list), negated(0), pred_level(0) {}
657659
public:
658660
inline void negate() { negated= !negated; }
659661
inline void top_level_item() { pred_level= 1; }
@@ -684,9 +686,7 @@ class Item_func_between :public Item_func_opt_neg
684686
bool fix_fields(THD *, Item **);
685687
void fix_length_and_dec();
686688
virtual void print(String *str, enum_query_type query_type);
687-
bool is_bool_func() { return 1; }
688689
CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
689-
uint decimal_precision() const { return 1; }
690690
bool eval_not_null_tables(uchar *opt_arg);
691691
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
692692
bool count_sargable_conds(uchar *arg);
@@ -1352,7 +1352,6 @@ class Item_func_in :public Item_func_opt_neg
13521352
longlong val_int();
13531353
bool fix_fields(THD *, Item **);
13541354
void fix_length_and_dec();
1355-
uint decimal_precision() const { return 1; }
13561355
void cleanup()
13571356
{
13581357
uint i;
@@ -1373,7 +1372,6 @@ class Item_func_in :public Item_func_opt_neg
13731372
enum Functype functype() const { return IN_FUNC; }
13741373
const char *func_name() const { return " IN "; }
13751374
bool nulls_in_row();
1376-
bool is_bool_func() { return 1; }
13771375
CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
13781376
bool eval_not_null_tables(uchar *opt_arg);
13791377
void fix_after_pullout(st_select_lex *new_parent, Item **ref);

0 commit comments

Comments
 (0)