summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r--sql/item_cmpfunc.h311
1 files changed, 146 insertions, 165 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index b4f5d2dd963..83f3afaa009 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -155,11 +155,11 @@ protected:
KEY_PART *key_part,
Item_func::Functype type, Item *value);
public:
- Item_bool_func() :Item_int_func() {}
- Item_bool_func(Item *a) :Item_int_func(a) {}
- Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {}
- Item_bool_func(Item *a, Item *b, Item *c) :Item_int_func(a, b, c) {}
- Item_bool_func(List<Item> &list) :Item_int_func(list) { }
+ Item_bool_func(THD *thd): Item_int_func(thd) {}
+ Item_bool_func(THD *thd, Item *a): Item_int_func(thd, a) {}
+ Item_bool_func(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
+ Item_bool_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
+ Item_bool_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {}
bool is_bool_type() { return true; }
void fix_length_and_dec() { decimals=0; max_length=1; }
@@ -181,8 +181,8 @@ public:
virtual void print(String *str, enum_query_type query_type);
protected:
- Item_func_truth(Item *a, bool a_value, bool a_affirmative)
- : Item_bool_func(a), value(a_value), affirmative(a_affirmative)
+ Item_func_truth(THD *thd, Item *a, bool a_value, bool a_affirmative):
+ Item_bool_func(thd, a), value(a_value), affirmative(a_affirmative)
{}
~Item_func_truth()
@@ -207,7 +207,7 @@ private:
class Item_func_istrue : public Item_func_truth
{
public:
- Item_func_istrue(Item *a) : Item_func_truth(a, true, true) {}
+ Item_func_istrue(THD *thd, Item *a): Item_func_truth(thd, a, true, true) {}
~Item_func_istrue() {}
virtual const char* func_name() const { return "istrue"; }
};
@@ -220,7 +220,8 @@ public:
class Item_func_isnottrue : public Item_func_truth
{
public:
- Item_func_isnottrue(Item *a) : Item_func_truth(a, true, false) {}
+ Item_func_isnottrue(THD *thd, Item *a):
+ Item_func_truth(thd, a, true, false) {}
~Item_func_isnottrue() {}
virtual const char* func_name() const { return "isnottrue"; }
};
@@ -233,7 +234,7 @@ public:
class Item_func_isfalse : public Item_func_truth
{
public:
- Item_func_isfalse(Item *a) : Item_func_truth(a, false, true) {}
+ Item_func_isfalse(THD *thd, Item *a): Item_func_truth(thd, a, false, true) {}
~Item_func_isfalse() {}
virtual const char* func_name() const { return "isfalse"; }
};
@@ -246,7 +247,8 @@ public:
class Item_func_isnotfalse : public Item_func_truth
{
public:
- Item_func_isnotfalse(Item *a) : Item_func_truth(a, false, false) {}
+ Item_func_isnotfalse(THD *thd, Item *a):
+ Item_func_truth(thd, a, false, false) {}
~Item_func_isnotfalse() {}
virtual const char* func_name() const { return "isnotfalse"; }
};
@@ -285,8 +287,8 @@ protected:
*/
int result_for_null_param;
public:
- Item_in_optimizer(Item *a, Item *b):
- Item_bool_func(a, b), cache(0), expr_cache(0),
+ Item_in_optimizer(THD *thd, Item *a, Item *b):
+ Item_bool_func(thd, a, b), cache(0), expr_cache(0),
save_cache(0), result_for_null_param(UNKNOWN)
{ with_subselect= true; }
bool fix_fields(THD *, Item **);
@@ -298,8 +300,8 @@ public:
const char *func_name() const { return "<in_optimizer>"; }
Item_cache **get_cache() { return &cache; }
void keep_top_level_cache();
- Item *transform(Item_transformer transformer, uchar *arg);
- virtual Item *expr_cache_insert_transformer(uchar *thd_arg);
+ Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
+ virtual Item *expr_cache_insert_transformer(THD *thd, uchar *unused);
bool is_expensive_processor(uchar *arg);
bool is_expensive();
void set_join_tab_idx(uint join_tab_idx_arg)
@@ -339,8 +341,8 @@ protected:
DBUG_RETURN(get_mm_parts(param, field, func_type, value, cmp_type));
}
public:
- Item_bool_func2(Item *a,Item *b)
- :Item_bool_func(a,b) { }
+ Item_bool_func2(THD *thd, Item *a, Item *b):
+ Item_bool_func(thd, a, b) { }
virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }
bool is_null() { return MY_TEST(args[0]->is_null() || args[1]->is_null()); }
@@ -355,8 +357,8 @@ class Item_bool_rowready_func2 :public Item_bool_func2
protected:
Arg_comparator cmp;
public:
- Item_bool_rowready_func2(Item *a, Item *b)
- :Item_bool_func2(a, b), cmp(tmp_arg, tmp_arg+1)
+ Item_bool_rowready_func2(THD *thd, Item *a, Item *b):
+ Item_bool_func2(thd, a, b), cmp(tmp_arg, tmp_arg + 1)
{
allowed_arg_cols= 0; // Fetch this value from first argument
}
@@ -365,7 +367,7 @@ public:
Item_func::print_op(str, query_type);
}
Item *neg_transformer(THD *thd);
- virtual Item *negated_item();
+ virtual Item *negated_item(THD *thd);
bool subst_argument_checker(uchar **arg)
{
return (*arg != NULL);
@@ -408,7 +410,7 @@ public:
class Item_func_xor :public Item_bool_func
{
public:
- Item_func_xor(Item *i1, Item *i2) :Item_bool_func(i1, i2) {}
+ Item_func_xor(THD *thd, Item *i1, Item *i2): Item_bool_func(thd, i1, i2) {}
enum Functype functype() const { return XOR_FUNC; }
const char *func_name() const { return "xor"; }
void print(String *str, enum_query_type query_type)
@@ -425,7 +427,8 @@ class Item_func_not :public Item_bool_func
{
bool abort_on_null;
public:
- Item_func_not(Item *a) :Item_bool_func(a), abort_on_null(FALSE) {}
+ Item_func_not(THD *thd, Item *a):
+ Item_bool_func(thd, a), abort_on_null(FALSE) {}
virtual void top_level_item() { abort_on_null= 1; }
bool is_top_level_item() { return abort_on_null; }
longlong val_int();
@@ -471,7 +474,8 @@ class Item_func_trig_cond: public Item_bool_func
{
bool *trig_var;
public:
- Item_func_trig_cond(Item *a, bool *f) : Item_bool_func(a) { trig_var= f; }
+ Item_func_trig_cond(THD *thd, Item *a, bool *f): Item_bool_func(thd, a)
+ { trig_var= f; }
longlong val_int() { return *trig_var ? args[0]->val_int() : 1; }
enum Functype functype() const { return TRIG_COND_FUNC; };
const char *func_name() const { return "trigcond"; };
@@ -491,9 +495,8 @@ class Item_func_not_all :public Item_func_not
public:
bool show;
- Item_func_not_all(Item *a)
- :Item_func_not(a), test_sum_item(0), test_sub_item(0),
- show(0)
+ Item_func_not_all(THD *thd, Item *a):
+ Item_func_not(thd, a), test_sum_item(0), test_sub_item(0), show(0)
{}
table_map not_null_tables() const { return 0; }
longlong val_int();
@@ -513,7 +516,7 @@ class Item_func_nop_all :public Item_func_not_all
{
public:
- Item_func_nop_all(Item *a) :Item_func_not_all(a) {}
+ Item_func_nop_all(THD *thd, Item *a): Item_func_not_all(thd, a) {}
longlong val_int();
const char *func_name() const { return "<nop>"; }
Item *neg_transformer(THD *thd);
@@ -524,8 +527,8 @@ 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),
+ Item_func_eq(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b),
abort_on_null(false), in_equality_no(UINT_MAX)
{}
longlong val_int();
@@ -534,7 +537,7 @@ public:
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();
+ Item *negated_item(THD *thd);
COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
bool link_item_fields,
COND_EQUAL **cond_equal_ref);
@@ -561,7 +564,8 @@ public:
class Item_func_equal :public Item_bool_rowready_func2
{
public:
- Item_func_equal(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
+ Item_func_equal(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {}
longlong val_int();
void fix_length_and_dec();
table_map not_null_tables() const { return 0; }
@@ -583,52 +587,56 @@ public:
class Item_func_ge :public Item_bool_rowready_func2
{
public:
- Item_func_ge(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
+ Item_func_ge(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {};
longlong val_int();
enum Functype functype() const { return GE_FUNC; }
enum Functype rev_functype() const { return LE_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return ">="; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
};
class Item_func_gt :public Item_bool_rowready_func2
{
public:
- Item_func_gt(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
+ Item_func_gt(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {};
longlong val_int();
enum Functype functype() const { return GT_FUNC; }
enum Functype rev_functype() const { return LT_FUNC; }
cond_result eq_cmp_result() const { return COND_FALSE; }
const char *func_name() const { return ">"; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
};
class Item_func_le :public Item_bool_rowready_func2
{
public:
- Item_func_le(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
+ Item_func_le(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {};
longlong val_int();
enum Functype functype() const { return LE_FUNC; }
enum Functype rev_functype() const { return GE_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "<="; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
};
class Item_func_lt :public Item_bool_rowready_func2
{
public:
- Item_func_lt(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {}
+ Item_func_lt(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {}
longlong val_int();
enum Functype functype() const { return LT_FUNC; }
enum Functype rev_functype() const { return GT_FUNC; }
cond_result eq_cmp_result() const { return COND_FALSE; }
const char *func_name() const { return "<"; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
};
@@ -642,13 +650,14 @@ protected:
DBUG_RETURN(get_ne_mm_tree(param, field, value, value, cmp_type));
}
public:
- Item_func_ne(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {}
+ Item_func_ne(THD *thd, Item *a, Item *b):
+ Item_bool_rowready_func2(thd, a, b) {}
longlong val_int();
enum Functype functype() const { return NE_FUNC; }
enum Functype rev_functype() const { return NE_FUNC; }
cond_result eq_cmp_result() const { return COND_FALSE; }
const char *func_name() const { return "<>"; }
- Item *negated_item();
+ Item *negated_item(THD *thd);
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
table_map usable_tables, SARGABLE_PARAM **sargables);
};
@@ -669,10 +678,10 @@ public:
bool negated; /* <=> the item represents NOT <func> */
bool pred_level; /* <=> [NOT] <func> is used on a predicate level */
public:
- Item_func_opt_neg(Item *a, Item *b, Item *c)
- :Item_bool_func(a, b, c), negated(0), pred_level(0) {}
- Item_func_opt_neg(List<Item> &list)
- :Item_bool_func(list), negated(0), pred_level(0) {}
+ Item_func_opt_neg(THD *thd, Item *a, Item *b, Item *c):
+ Item_bool_func(thd, a, b, c), negated(0), pred_level(0) {}
+ Item_func_opt_neg(THD *thd, List<Item> &list):
+ Item_bool_func(thd, list), negated(0), pred_level(0) {}
public:
inline void negate() { negated= !negated; }
inline void top_level_item() { pred_level= 1; }
@@ -697,8 +706,8 @@ public:
String value0,value1,value2;
/* TRUE <=> arguments will be compared as dates. */
Item *compare_as_dates;
- Item_func_between(Item *a, Item *b, Item *c)
- :Item_func_opt_neg(a, b, c), compare_as_dates(FALSE) { }
+ Item_func_between(THD *thd, Item *a, Item *b, Item *c):
+ Item_func_opt_neg(thd, a, b, c), compare_as_dates(FALSE) { }
longlong val_int();
enum Functype functype() const { return BETWEEN; }
const char *func_name() const { return "between"; }
@@ -720,7 +729,8 @@ class Item_func_strcmp :public Item_int_func
String value1, value2;
DTCollation cmp_collation;
public:
- Item_func_strcmp(Item *a,Item *b) :Item_int_func(a,b) {}
+ Item_func_strcmp(THD *thd, Item *a, Item *b):
+ Item_int_func(thd, a, b) {}
longlong val_int();
uint decimal_precision() const { return 1; }
const char *func_name() const { return "strcmp"; }
@@ -745,8 +755,8 @@ class Item_func_interval :public Item_int_func
bool use_decimal_comparison;
interval_range *intervals;
public:
- Item_func_interval(Item_row *a)
- :Item_int_func(a),row(a),intervals(0)
+ Item_func_interval(THD *thd, Item_row *a):
+ Item_int_func(thd, a), row(a), intervals(0)
{
allowed_arg_cols= 0; // Fetch this value from first argument
}
@@ -765,8 +775,10 @@ public:
class Item_func_coalesce :public Item_func_hybrid_field_type
{
public:
- Item_func_coalesce(Item *a, Item *b) :Item_func_hybrid_field_type(a, b) {}
- Item_func_coalesce(List<Item> &list) :Item_func_hybrid_field_type(list) {}
+ Item_func_coalesce(THD *thd, Item *a, Item *b):
+ Item_func_hybrid_field_type(thd, a, b) {}
+ Item_func_coalesce(THD *thd, List<Item> &list):
+ Item_func_hybrid_field_type(thd, list) {}
double real_op();
longlong int_op();
String *str_op(String *);
@@ -786,10 +798,10 @@ public:
class Item_func_case_abbreviation2 :public Item_func_hybrid_field_type
{
public:
- Item_func_case_abbreviation2(Item *a, Item *b)
- :Item_func_hybrid_field_type(a, b) { }
- Item_func_case_abbreviation2(Item *a, Item *b, Item *c)
- :Item_func_hybrid_field_type(a, b, c) { }
+ Item_func_case_abbreviation2(THD *thd, Item *a, Item *b):
+ Item_func_hybrid_field_type(thd, a, b) { }
+ Item_func_case_abbreviation2(THD *thd, Item *a, Item *b, Item *c):
+ Item_func_hybrid_field_type(thd, a, b, c) { }
void fix_length_and_dec2(Item **args);
uint decimal_precision2(Item **args) const;
};
@@ -798,7 +810,8 @@ public:
class Item_func_ifnull :public Item_func_case_abbreviation2
{
public:
- Item_func_ifnull(Item *a, Item *b) :Item_func_case_abbreviation2(a,b) {}
+ Item_func_ifnull(THD *thd, Item *a, Item *b):
+ Item_func_case_abbreviation2(thd, a, b) {}
double real_op();
longlong int_op();
String *str_op(String *str);
@@ -822,8 +835,8 @@ public:
class Item_func_if :public Item_func_case_abbreviation2
{
public:
- Item_func_if(Item *a,Item *b,Item *c)
- :Item_func_case_abbreviation2(a, b, c)
+ Item_func_if(THD *thd, Item *a, Item *b, Item *c):
+ Item_func_case_abbreviation2(thd, a, b, c)
{}
bool date_op(MYSQL_TIME *ltime, uint fuzzydate);
longlong int_op();
@@ -857,8 +870,8 @@ class Item_func_nullif :public Item_func_hybrid_field_type
*/
Item *m_args0_copy;
public:
- Item_func_nullif(Item *a,Item *b)
- :Item_func_hybrid_field_type(a, b),
+ Item_func_nullif(THD *thd, Item *a, Item *b):
+ Item_func_hybrid_field_type(thd, a, b),
m_args0_copy(a)
{}
bool date_op(MYSQL_TIME *ltime, uint fuzzydate);
@@ -917,7 +930,7 @@ public:
vector in form of Item_xxx constants without creating Item_xxx object
for every array element you get (i.e. this implements "FlyWeight" pattern)
*/
- virtual Item* create_item() { return NULL; }
+ virtual Item* create_item(THD *thd) { return NULL; }
/*
Store the value at position #pos into provided item object
@@ -944,8 +957,8 @@ class in_string :public in_vector
class Item_string_for_in_vector: public Item_string
{
public:
- Item_string_for_in_vector(CHARSET_INFO *cs):
- Item_string(cs)
+ Item_string_for_in_vector(THD *thd, CHARSET_INFO *cs):
+ Item_string(thd, cs)
{ }
void set_value(const String *str)
{
@@ -958,9 +971,9 @@ public:
~in_string();
void set(uint pos,Item *item);
uchar *get_value(Item *item);
- Item* create_item()
- {
- return new Item_string_for_in_vector(collation);
+ Item* create_item(THD *thd)
+ {
+ return new Item_string_for_in_vector(thd, collation);
}
void value_to_item(uint pos, Item *item)
{
@@ -989,13 +1002,13 @@ public:
void set(uint pos,Item *item);
uchar *get_value(Item *item);
- Item* create_item()
+ Item* create_item(THD *thd)
{
/*
We're created a signed INT, this may not be correct in
general case (see BUG#19342).
*/
- return new Item_int((longlong)0);
+ return new Item_int(thd, (longlong)0);
}
void value_to_item(uint pos, Item *item)
{
@@ -1029,9 +1042,9 @@ public:
lval_cache(0) {};
void set(uint pos,Item *item);
uchar *get_value(Item *item);
- Item* create_item()
+ Item* create_item(THD *thd)
{
- return new Item_datetime();
+ return new Item_datetime(thd);
}
void value_to_item(uint pos, Item *item)
{
@@ -1050,9 +1063,9 @@ public:
in_double(uint elements);
void set(uint pos,Item *item);
uchar *get_value(Item *item);
- Item *create_item()
+ Item *create_item(THD *thd)
{
- return new Item_float(0.0, 0);
+ return new Item_float(thd, 0.0, 0);
}
void value_to_item(uint pos, Item *item)
{
@@ -1069,9 +1082,9 @@ public:
in_decimal(uint elements);
void set(uint pos, Item *item);
uchar *get_value(Item *item);
- Item *create_item()
+ Item *create_item(THD *thd)
{
- return new Item_decimal(0, FALSE);
+ return new Item_decimal(thd, 0, FALSE);
}
void value_to_item(uint pos, Item *item)
{
@@ -1297,8 +1310,9 @@ class Item_func_case :public Item_func_hybrid_field_type
cmp_item *cmp_items[6]; /* For all result types */
cmp_item *case_item;
public:
- Item_func_case(List<Item> &list, Item *first_expr_arg, Item *else_expr_arg)
- :Item_func_hybrid_field_type(), first_expr_num(-1), else_expr_num(-1),
+ Item_func_case(THD *thd, List<Item> &list, Item *first_expr_arg,
+ Item *else_expr_arg):
+ Item_func_hybrid_field_type(thd), first_expr_num(-1), else_expr_num(-1),
left_result_type(INT_RESULT), case_item(0)
{
ncases= list.elements;
@@ -1368,9 +1382,9 @@ public:
cmp_item *cmp_items[6]; /* One cmp_item for each result type */
DTCollation cmp_collation;
- Item_func_in(List<Item> &list)
- :Item_func_opt_neg(list), array(0), have_null(0),
- arg_types_compatible(FALSE)
+ Item_func_in(THD *thd, List<Item> &list):
+ Item_func_opt_neg(thd, list), array(0), have_null(0),
+ arg_types_compatible(FALSE)
{
bzero(&cmp_items, sizeof(cmp_items));
allowed_arg_cols= 0; // Fetch this value from first argument
@@ -1448,7 +1462,7 @@ protected:
KEY_PART *key_part,
Item_func::Functype type, Item *value);
public:
- Item_func_null_predicate(Item *a) :Item_bool_func(a) { }
+ Item_func_null_predicate(THD *thd, Item *a): Item_bool_func(thd, a) { }
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
table_map usable_tables, SARGABLE_PARAM **sargables);
SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
@@ -1462,7 +1476,7 @@ public:
class Item_func_isnull :public Item_func_null_predicate
{
public:
- Item_func_isnull(Item *a) :Item_func_null_predicate(a) {}
+ Item_func_isnull(THD *thd, Item *a): Item_func_null_predicate(thd, a) {}
longlong val_int();
enum Functype functype() const { return ISNULL_FUNC; }
void fix_length_and_dec()
@@ -1504,8 +1518,8 @@ class Item_is_not_null_test :public Item_func_isnull
{
Item_in_subselect* owner;
public:
- Item_is_not_null_test(Item_in_subselect* ow, Item *a)
- :Item_func_isnull(a), owner(ow)
+ Item_is_not_null_test(THD *thd, Item_in_subselect* ow, Item *a):
+ Item_func_isnull(thd, a), owner(ow)
{}
enum Functype functype() const { return ISNOTNULLTEST_FUNC; }
longlong val_int();
@@ -1524,7 +1538,8 @@ class Item_func_isnotnull :public Item_func_null_predicate
{
bool abort_on_null;
public:
- Item_func_isnotnull(Item *a) :Item_func_null_predicate(a), abort_on_null(0)
+ Item_func_isnotnull(THD *thd, Item *a):
+ Item_func_null_predicate(thd, a), abort_on_null(0)
{ }
longlong val_int();
enum Functype functype() const { return ISNOTNULL_FUNC; }
@@ -1569,10 +1584,10 @@ protected:
public:
int escape;
- Item_func_like(Item *a,Item *b, Item *escape_arg, bool escape_used)
- :Item_bool_func2(a,b), canDoTurboBM(FALSE), pattern(0), pattern_len(0),
- bmGs(0), bmBc(0), escape_item(escape_arg),
- escape_used_in_parsing(escape_used), use_sampling(0) {}
+ Item_func_like(THD *thd, Item *a, Item *b, Item *escape_arg, bool escape_used):
+ Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0),
+ bmGs(0), bmBc(0), escape_item(escape_arg),
+ escape_used_in_parsing(escape_used), use_sampling(0) {}
longlong val_int();
enum Functype functype() const { return LIKE_FUNC; }
void print(String *str, enum_query_type query_type)
@@ -1728,7 +1743,7 @@ class Item_func_regex :public Item_bool_func
Regexp_processor_pcre re;
DTCollation cmp_collation;
public:
- Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b)
+ Item_func_regex(THD *thd, Item *a, Item *b): Item_bool_func(thd, a, b)
{}
void cleanup()
{
@@ -1755,7 +1770,7 @@ class Item_func_regexp_instr :public Item_int_func
Regexp_processor_pcre re;
DTCollation cmp_collation;
public:
- Item_func_regexp_instr(Item *a, Item *b) :Item_int_func(a, b)
+ Item_func_regexp_instr(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b)
{}
void cleanup()
{
@@ -1781,17 +1796,17 @@ protected:
public:
/* Item_cond() is only used to create top level items */
- Item_cond(): Item_bool_func(), abort_on_null(1)
+ Item_cond(THD *thd): Item_bool_func(thd), abort_on_null(1)
{ const_item_cache=0; }
- Item_cond(Item *i1,Item *i2)
- :Item_bool_func(), abort_on_null(0)
+ Item_cond(THD *thd, Item *i1, Item *i2):
+ Item_bool_func(thd), abort_on_null(0)
{
list.push_back(i1);
list.push_back(i2);
}
Item_cond(THD *thd, Item_cond *item);
- Item_cond(List<Item> &nlist)
- :Item_bool_func(), list(nlist), abort_on_null(0) {}
+ Item_cond(THD *thd, List<Item> &nlist):
+ Item_bool_func(thd), list(nlist), abort_on_null(0) {}
bool add(Item *item)
{
DBUG_ASSERT(item);
@@ -1841,12 +1856,12 @@ public:
bool top_level() { return abort_on_null; }
void copy_andor_arguments(THD *thd, Item_cond *item);
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
- Item *transform(Item_transformer transformer, uchar *arg);
+ Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
void traverse_cond(Cond_traverser, void *arg, traverse_order order);
void neg_arguments(THD *thd);
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
bool subst_argument_checker(uchar **arg) { return TRUE; }
- Item *compile(Item_analyzer analyzer, uchar **arg_p,
+ Item *compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t);
bool eval_not_null_tables(uchar *opt_arg);
};
@@ -1992,8 +2007,8 @@ public:
COND_EQUAL *upper_levels; /* multiple equalities of upper and levels */
- Item_equal(THD *thd_arg, Item *f1, Item *f2, bool with_const_item);
- Item_equal(THD *thd_arg, Item_equal *item_equal);
+ Item_equal(THD *thd, Item *f1, Item *f2, bool with_const_item);
+ Item_equal(THD *thd, Item_equal *item_equal);
/* Currently the const item is always the first in the list of equal items */
inline Item* get_const() { return with_const ? equal_items.head() : NULL; }
void add_const(THD *thd, Item *c, Item *f = NULL);
@@ -2023,7 +2038,7 @@ public:
SARGABLE_PARAM **sargables);
SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
- Item *transform(Item_transformer transformer, uchar *arg);
+ Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
virtual void print(String *str, enum_query_type query_type);
CHARSET_INFO *compare_collation() const;
@@ -2033,8 +2048,9 @@ public:
bool count_sargable_conds(uchar *arg);
friend class Item_equal_iterator<List_iterator_fast,Item>;
friend class Item_equal_iterator<List_iterator,Item>;
- friend Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
- Item_equal *item_equal);
+ friend Item *eliminate_item_equal(THD *thd, COND *cond,
+ COND_EQUAL *upper_levels,
+ Item_equal *item_equal);
friend bool setup_sj_materialization_part1(struct st_join_table *tab);
friend bool setup_sj_materialization_part2(struct st_join_table *tab);
};
@@ -2153,10 +2169,10 @@ public:
COND_EQUAL m_cond_equal; /* contains list of Item_equal objects for
the current and level and reference
to multiple equalities of upper and levels */
- Item_cond_and() :Item_cond() {}
- Item_cond_and(Item *i1,Item *i2) :Item_cond(i1,i2) {}
- Item_cond_and(THD *thd, Item_cond_and *item) :Item_cond(thd, item) {}
- Item_cond_and(List<Item> &list_arg): Item_cond(list_arg) {}
+ Item_cond_and(THD *thd): Item_cond(thd) {}
+ Item_cond_and(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {}
+ Item_cond_and(THD *thd, Item_cond_and *item): Item_cond(thd, item) {}
+ Item_cond_and(THD *thd, List<Item> &list_arg): Item_cond(thd, list_arg) {}
enum Functype functype() const { return COND_AND_FUNC; }
longlong val_int();
const char *func_name() const { return "and"; }
@@ -2193,10 +2209,10 @@ inline bool is_cond_and(Item *item)
class Item_cond_or :public Item_cond
{
public:
- Item_cond_or() :Item_cond() {}
- Item_cond_or(Item *i1,Item *i2) :Item_cond(i1,i2) {}
- Item_cond_or(THD *thd, Item_cond_or *item) :Item_cond(thd, item) {}
- Item_cond_or(List<Item> &list_arg): Item_cond(list_arg) {}
+ Item_cond_or(THD *thd): Item_cond(thd) {}
+ Item_cond_or(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {}
+ Item_cond_or(THD *thd, Item_cond_or *item): Item_cond(thd, item) {}
+ Item_cond_or(THD *thd, List<Item> &list_arg): Item_cond(thd, list_arg) {}
enum Functype functype() const { return COND_OR_FUNC; }
longlong val_int();
const char *func_name() const { return "or"; }
@@ -2214,7 +2230,7 @@ public:
class Item_func_dyncol_check :public Item_bool_func
{
public:
- Item_func_dyncol_check(Item *str) :Item_bool_func(str) {}
+ Item_func_dyncol_check(THD *thd, Item *str): Item_bool_func(thd, str) {}
longlong val_int();
const char *func_name() const { return "column_check"; }
};
@@ -2222,7 +2238,8 @@ public:
class Item_func_dyncol_exists :public Item_bool_func
{
public:
- Item_func_dyncol_exists(Item *str, Item *num) :Item_bool_func(str, num) {}
+ Item_func_dyncol_exists(THD *thd, Item *str, Item *num):
+ Item_bool_func(thd, str, num) {}
longlong val_int();
const char *func_name() const { return "column_exists"; }
};
@@ -2238,11 +2255,11 @@ inline bool is_cond_or(Item *item)
/* Some useful inline functions */
-inline Item *and_conds(Item *a, Item *b)
+inline Item *and_conds(THD *thd, Item *a, Item *b)
{
if (!b) return a;
if (!a) return b;
- return new Item_cond_and(a, b);
+ return new Item_cond_and(thd, a, b);
}
@@ -2264,12 +2281,12 @@ public:
/**
Create operation with given arguments.
*/
- virtual Item_bool_rowready_func2* create(MEM_ROOT *, Item *a, Item *b)
+ virtual Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b)
const = 0;
/**
Create operation with given arguments in swap order.
*/
- virtual Item_bool_rowready_func2* create_swap(MEM_ROOT *, Item *a, Item *b)
+ virtual Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b)
const = 0;
virtual const char* symbol(bool invert) const = 0;
virtual bool eqne_op() const = 0;
@@ -2281,14 +2298,8 @@ class Eq_creator :public Comp_creator
public:
Eq_creator() {} /* Remove gcc warning */
virtual ~Eq_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_eq(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_eq(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? "<>" : "="; }
bool eqne_op() const { return 1; }
bool l_op() const { return 0; }
@@ -2299,14 +2310,8 @@ class Ne_creator :public Comp_creator
public:
Ne_creator() {} /* Remove gcc warning */
virtual ~Ne_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_ne(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_ne(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? "=" : "<>"; }
bool eqne_op() const { return 1; }
bool l_op() const { return 0; }
@@ -2317,14 +2322,8 @@ class Gt_creator :public Comp_creator
public:
Gt_creator() {} /* Remove gcc warning */
virtual ~Gt_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_gt(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_lt(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? "<=" : ">"; }
bool eqne_op() const { return 0; }
bool l_op() const { return 0; }
@@ -2335,14 +2334,8 @@ class Lt_creator :public Comp_creator
public:
Lt_creator() {} /* Remove gcc warning */
virtual ~Lt_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_lt(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_gt(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? ">=" : "<"; }
bool eqne_op() const { return 0; }
bool l_op() const { return 1; }
@@ -2353,14 +2346,8 @@ class Ge_creator :public Comp_creator
public:
Ge_creator() {} /* Remove gcc warning */
virtual ~Ge_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_ge(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_le(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? "<" : ">="; }
bool eqne_op() const { return 0; }
bool l_op() const { return 0; }
@@ -2371,14 +2358,8 @@ class Le_creator :public Comp_creator
public:
Le_creator() {} /* Remove gcc warning */
virtual ~Le_creator() {} /* Remove gcc warning */
- Item_bool_rowready_func2* create(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_le(a, b);
- }
- Item_bool_rowready_func2* create_swap(MEM_ROOT *root, Item *a, Item *b) const
- {
- return new(root) Item_func_ge(b, a);
- }
+ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const;
+ Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const;
const char* symbol(bool invert) const { return invert? ">" : "<="; }
bool eqne_op() const { return 0; }
bool l_op() const { return 1; }