37
37
Arg_comparator *comparators; // used only for compare_row()
39
39
/* Fields used in DATE/DATETIME comparison. */
41
41
enum_field_types a_type, b_type; // Types of a and b items
42
42
Item *a_cache, *b_cache; // Cached values of a and b items
43
43
bool is_nulls_eq; // TRUE <=> compare for the EQUAL_FUNC
44
44
enum enum_date_cmp_type { CMP_DATE_DFLT= 0, CMP_DATE_WITH_DATE,
45
45
CMP_DATE_WITH_STR, CMP_STR_WITH_DATE };
46
uint64_t (*get_value_func)(Session *thd, Item ***item_arg, Item **cache_arg,
46
uint64_t (*get_value_func)(Session *session, Item ***item_arg, Item **cache_arg,
47
47
Item *warn_item, bool *is_null);
49
49
DTCollation cmp_collation;
51
Arg_comparator(): thd(0), a_cache(0), b_cache(0) {};
52
Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), thd(0),
51
Arg_comparator(): session(0), a_cache(0), b_cache(0) {};
52
Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), session(0),
53
53
a_cache(0), b_cache(0) {};
55
55
int set_compare_func(Item_bool_func2 *owner, Item_result type);
106
106
Item_bool_func() :Item_int_func() {}
107
107
Item_bool_func(Item *a) :Item_int_func(a) {}
108
108
Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {}
109
Item_bool_func(Session *thd, Item_bool_func *item) :Item_int_func(thd, item) {}
109
Item_bool_func(Session *session, Item_bool_func *item) :Item_int_func(session, item) {}
110
110
bool is_bool_func() { return 1; }
111
111
void fix_length_and_dec() { decimals=0; max_length=1; }
112
112
uint32_t decimal_precision() const { return 1; }
235
235
save_cache(0), result_for_null_param(UNKNOWN)
236
236
{ with_subselect= true; }
237
237
bool fix_fields(Session *, Item **);
238
bool fix_left(Session *thd, Item **ref);
238
bool fix_left(Session *session, Item **ref);
240
240
int64_t val_int();
363
363
allowed_arg_cols= 0; // Fetch this value from first argument
365
Item *neg_transformer(Session *thd);
365
Item *neg_transformer(Session *session);
366
366
virtual Item *negated_item();
367
367
bool subst_argument_checker(unsigned char **arg __attribute__((unused)))
375
375
int64_t val_int();
376
376
enum Functype functype() const { return NOT_FUNC; }
377
377
const char *func_name() const { return "not"; }
378
Item *neg_transformer(Session *thd);
378
Item *neg_transformer(Session *session);
379
379
virtual void print(String *str, enum_query_type query_type);
447
447
void set_sum_test(Item_sum_hybrid *item) { test_sum_item= item; };
448
448
void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; };
449
449
bool empty_underlying_subquery();
450
Item *neg_transformer(Session *thd);
450
Item *neg_transformer(Session *session);
485
485
enum Functype rev_functype() const { return EQUAL_FUNC; }
486
486
cond_result eq_cmp_result() const { return COND_TRUE; }
487
487
const char *func_name() const { return "<=>"; }
488
Item *neg_transformer(Session *thd __attribute__((unused))) { return 0; }
488
Item *neg_transformer(Session *session __attribute__((unused))) { return 0; }
577
577
inline void negate() { negated= !negated; }
578
578
inline void top_level_item() { pred_level= 1; }
579
Item *neg_transformer(Session *thd __attribute__((unused)))
579
Item *neg_transformer(Session *session __attribute__((unused)))
581
581
negated= !negated;
864
864
class in_datetime :public in_int64_t
868
868
/* An item used to issue warnings. */
870
870
/* Cache for the left item. */
871
871
Item *lval_cache;
873
873
in_datetime(Item *warn_item_arg, uint32_t elements)
874
:in_int64_t(elements), thd(current_thd), warn_item(warn_item_arg),
874
:in_int64_t(elements), session(current_session), warn_item(warn_item_arg),
875
875
lval_cache(0) {};
876
876
void set(uint32_t pos,Item *item);
877
877
unsigned char *get_value(Item *item);
1023
1023
uint64_t value;
1026
1026
/* Item used for issuing warnings. */
1027
1027
Item *warn_item;
1028
1028
/* Cache for the left item. */
1029
1029
Item *lval_cache;
1031
1031
cmp_item_datetime(Item *warn_item_arg)
1032
:thd(current_thd), warn_item(warn_item_arg), lval_cache(0) {}
1032
:session(current_session), warn_item(warn_item_arg), lval_cache(0) {}
1033
1033
void store_value(Item *item);
1034
1034
int cmp(Item *arg);
1035
1035
int compare(cmp_item *ci);
1156
1156
int64_t val_int();
1157
1157
String *val_str(String *);
1158
1158
my_decimal *val_decimal(my_decimal *);
1159
bool fix_fields(Session *thd, Item **ref);
1159
bool fix_fields(Session *session, Item **ref);
1160
1160
void fix_length_and_dec();
1161
1161
uint32_t decimal_precision() const;
1162
1162
table_map not_null_tables() const { return 0; }
1305
1305
table_map not_null_tables() const { return 0; }
1306
1306
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
1307
Item *neg_transformer(Session *thd);
1307
Item *neg_transformer(Session *session);
1308
1308
const CHARSET_INFO *compare_collation() { return args[0]->collation.collation; }
1350
1350
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
1351
1351
table_map not_null_tables() const
1352
1352
{ return abort_on_null ? not_null_tables_cache : 0; }
1353
Item *neg_transformer(Session *thd);
1353
Item *neg_transformer(Session *session);
1354
1354
virtual void print(String *str, enum_query_type query_type);
1355
1355
const CHARSET_INFO *compare_collation() { return args[0]->collation.collation; }
1356
1356
void top_level_item() { abort_on_null=1; }
1390
1390
optimize_type select_optimize() const;
1391
1391
cond_result eq_cmp_result() const { return COND_TRUE; }
1392
1392
const char *func_name() const { return "like"; }
1393
bool fix_fields(Session *thd, Item **ref);
1393
bool fix_fields(Session *session, Item **ref);
1394
1394
void cleanup();
1414
1414
list.push_back(i1);
1415
1415
list.push_back(i2);
1417
Item_cond(Session *thd, Item_cond *item);
1417
Item_cond(Session *session, Item_cond *item);
1418
1418
Item_cond(List<Item> &nlist)
1419
1419
:Item_bool_func(), list(nlist), abort_on_null(0) {}
1420
1420
bool add(Item *item) { return list.push_back(item); }
1428
1428
table_map used_tables() const;
1429
1429
void update_used_tables();
1430
1430
virtual void print(String *str, enum_query_type query_type);
1431
void split_sum_func(Session *thd, Item **ref_pointer_array, List<Item> &fields);
1432
friend int setup_conds(Session *thd, TableList *tables, TableList *leaves,
1431
void split_sum_func(Session *session, Item **ref_pointer_array, List<Item> &fields);
1432
friend int setup_conds(Session *session, TableList *tables, TableList *leaves,
1434
1434
void top_level_item() { abort_on_null=1; }
1435
void copy_andor_arguments(Session *thd, Item_cond *item);
1435
void copy_andor_arguments(Session *session, Item_cond *item);
1436
1436
bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg);
1437
1437
Item *transform(Item_transformer transformer, unsigned char *arg);
1438
1438
void traverse_cond(Cond_traverser, void *arg, traverse_order order);
1439
void neg_arguments(Session *thd);
1439
void neg_arguments(Session *session);
1440
1440
enum_field_types field_type() const { return DRIZZLE_TYPE_LONGLONG; }
1441
1441
bool subst_argument_checker(unsigned char **arg __attribute__((unused)))
1442
1442
{ return true; }
1548
1548
void sort(Item_field_cmpfunc cmp, void *arg);
1549
1549
friend class Item_equal_iterator;
1550
1550
void fix_length_and_dec();
1551
bool fix_fields(Session *thd, Item **ref);
1551
bool fix_fields(Session *session, Item **ref);
1552
1552
void update_used_tables();
1553
1553
bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg);
1554
1554
Item *transform(Item_transformer transformer, unsigned char *arg);
1597
1597
to multiple equalities of upper and levels */
1598
1598
Item_cond_and() :Item_cond() {}
1599
1599
Item_cond_and(Item *i1,Item *i2) :Item_cond(i1,i2) {}
1600
Item_cond_and(Session *thd, Item_cond_and *item) :Item_cond(thd, item) {}
1600
Item_cond_and(Session *session, Item_cond_and *item) :Item_cond(session, item) {}
1601
1601
Item_cond_and(List<Item> &list_arg): Item_cond(list_arg) {}
1602
1602
enum Functype functype() const { return COND_AND_FUNC; }
1603
1603
int64_t val_int();
1604
1604
const char *func_name() const { return "and"; }
1605
1605
table_map not_null_tables() const
1606
1606
{ return abort_on_null ? not_null_tables_cache: and_tables_cache; }
1607
Item* copy_andor_structure(Session *thd)
1607
Item* copy_andor_structure(Session *session)
1609
1609
Item_cond_and *item;
1610
if ((item= new Item_cond_and(thd, this)))
1611
item->copy_andor_arguments(thd, this);
1610
if ((item= new Item_cond_and(session, this)))
1611
item->copy_andor_arguments(session, this);
1614
Item *neg_transformer(Session *thd);
1614
Item *neg_transformer(Session *session);
1617
1617
inline bool is_cond_and(Item *item)
1629
1629
Item_cond_or() :Item_cond() {}
1630
1630
Item_cond_or(Item *i1,Item *i2) :Item_cond(i1,i2) {}
1631
Item_cond_or(Session *thd, Item_cond_or *item) :Item_cond(thd, item) {}
1631
Item_cond_or(Session *session, Item_cond_or *item) :Item_cond(session, item) {}
1632
1632
Item_cond_or(List<Item> &list_arg): Item_cond(list_arg) {}
1633
1633
enum Functype functype() const { return COND_OR_FUNC; }
1634
1634
int64_t val_int();
1635
1635
const char *func_name() const { return "or"; }
1636
1636
table_map not_null_tables() const { return and_tables_cache; }
1637
Item* copy_andor_structure(Session *thd)
1637
Item* copy_andor_structure(Session *session)
1639
1639
Item_cond_or *item;
1640
if ((item= new Item_cond_or(thd, this)))
1641
item->copy_andor_arguments(thd, this);
1640
if ((item= new Item_cond_or(session, this)))
1641
item->copy_andor_arguments(session, this);
1644
Item *neg_transformer(Session *thd);
1644
Item *neg_transformer(Session *session);
1647
1647
inline bool is_cond_or(Item *item)