MDEV-8010 - Avoid sql_alloc() in Items (Patch #1)
Added mandatory thd parameter to Item (and all derivative classes) constructor. Added thd parameter to all routines that may create items. Also removed "current_thd" from Item::Item. This reduced number of pthread_getspecific() calls from 290 to 177 per OLTP RO transaction.
This commit is contained in:
parent
4374da63f0
commit
31e365efae
@ -99,20 +99,20 @@ static COND* make_cond(THD *thd, TABLE_LIST *tables, LEX_STRING *filter)
|
||||
nrc.init();
|
||||
nrc.resolve_in_table_list_only(tables);
|
||||
|
||||
res= new Item_cond_or();
|
||||
res= new Item_cond_or(thd);
|
||||
if (!res)
|
||||
return OOM;
|
||||
|
||||
for (; filter->str; filter++)
|
||||
{
|
||||
Item_field *fld= new Item_field(thd, &nrc, db, table, field);
|
||||
Item_string *pattern= new Item_string(filter->str, filter->length, cs);
|
||||
Item_string *escape= new Item_string("\\", 1, cs);
|
||||
Item_string *pattern= new Item_string(thd, filter->str, filter->length, cs);
|
||||
Item_string *escape= new Item_string(thd, "\\", 1, cs);
|
||||
|
||||
if (!fld || !pattern || !escape)
|
||||
return OOM;
|
||||
|
||||
Item_func_like *like= new Item_func_like(fld, pattern, escape, 0);
|
||||
Item_func_like *like= new Item_func_like(thd, fld, pattern, escape, 0);
|
||||
|
||||
if (!like)
|
||||
return OOM;
|
||||
|
@ -106,10 +106,10 @@ struct tablevec_entry {
|
||||
|
||||
struct expr_user_lock : private noncopyable {
|
||||
expr_user_lock(THD *thd, int timeout)
|
||||
: lck_key("handlersocket_wr", 16, &my_charset_latin1),
|
||||
lck_timeout(timeout),
|
||||
lck_func_get_lock(&lck_key, &lck_timeout),
|
||||
lck_func_release_lock(&lck_key)
|
||||
: lck_key(thd, "handlersocket_wr", 16, &my_charset_latin1),
|
||||
lck_timeout(thd, timeout),
|
||||
lck_func_get_lock(thd, &lck_key, &lck_timeout),
|
||||
lck_func_release_lock(thd, &lck_key)
|
||||
{
|
||||
lck_key.fix_fields(thd, 0);
|
||||
lck_timeout.fix_fields(thd, 0);
|
||||
|
@ -639,29 +639,30 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol)
|
||||
if (et->get_create_event(thd, &show_str))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
field_list.push_back(new Item_empty_string("Event", NAME_CHAR_LEN));
|
||||
field_list.push_back(new Item_empty_string(thd, "Event", NAME_CHAR_LEN));
|
||||
|
||||
if (sql_mode_string_representation(thd, et->sql_mode, &sql_mode))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
field_list.push_back(new Item_empty_string("sql_mode", (uint) sql_mode.length));
|
||||
field_list.push_back(new Item_empty_string(thd, "sql_mode",
|
||||
(uint) sql_mode.length));
|
||||
|
||||
tz_name= et->time_zone->get_name();
|
||||
|
||||
field_list.push_back(new Item_empty_string("time_zone",
|
||||
field_list.push_back(new Item_empty_string(thd, "time_zone",
|
||||
tz_name->length()));
|
||||
|
||||
field_list.push_back(new Item_empty_string("Create Event",
|
||||
field_list.push_back(new Item_empty_string(thd, "Create Event",
|
||||
show_str.length()));
|
||||
|
||||
field_list.push_back(
|
||||
new Item_empty_string("character_set_client", MY_CS_NAME_SIZE));
|
||||
new Item_empty_string(thd, "character_set_client", MY_CS_NAME_SIZE));
|
||||
|
||||
field_list.push_back(
|
||||
new Item_empty_string("collation_connection", MY_CS_NAME_SIZE));
|
||||
new Item_empty_string(thd, "collation_connection", MY_CS_NAME_SIZE));
|
||||
|
||||
field_list.push_back(
|
||||
new Item_empty_string("Database Collation", MY_CS_NAME_SIZE));
|
||||
new Item_empty_string(thd, "Database Collation", MY_CS_NAME_SIZE));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
|
@ -9987,7 +9987,7 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
|
||||
|
||||
/** Create a field suitable for create of table. */
|
||||
|
||||
Create_field::Create_field(Field *old_field,Field *orig_field)
|
||||
Create_field::Create_field(THD *thd, Field *old_field, Field *orig_field)
|
||||
{
|
||||
field= old_field;
|
||||
field_name=change=old_field->field_name;
|
||||
@ -10039,7 +10039,6 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
|
||||
case MYSQL_TYPE_YEAR:
|
||||
if (length != 4)
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
|
||||
my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
@ -10098,7 +10097,7 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
|
||||
StringBuffer<MAX_FIELD_WIDTH> tmp(charset);
|
||||
String *res= orig_field->val_str(&tmp);
|
||||
char *pos= (char*) sql_strmake(res->ptr(), res->length());
|
||||
def= new Item_string(pos, res->length(), charset);
|
||||
def= new Item_string(thd, pos, res->length(), charset);
|
||||
}
|
||||
orig_field->move_field_offset(-diff); // Back to record[0]
|
||||
}
|
||||
|
@ -3050,7 +3050,7 @@ public:
|
||||
interval_list.empty();
|
||||
}
|
||||
|
||||
Create_field(Field *field, Field *orig_field);
|
||||
Create_field(THD *thd, Field *field, Field *orig_field);
|
||||
/* Used to make a clone of this object for ALTER/CREATE TABLE */
|
||||
Create_field *clone(MEM_ROOT *mem_root) const;
|
||||
void create_length_to_internal_length(void);
|
||||
|
@ -1983,10 +1983,14 @@ bool mysql_xa_recover(THD *thd)
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("mysql_xa_recover");
|
||||
|
||||
field_list.push_back(new Item_int("formatID", 0, MY_INT32_NUM_DECIMAL_DIGITS));
|
||||
field_list.push_back(new Item_int("gtrid_length", 0, MY_INT32_NUM_DECIMAL_DIGITS));
|
||||
field_list.push_back(new Item_int("bqual_length", 0, MY_INT32_NUM_DECIMAL_DIGITS));
|
||||
field_list.push_back(new Item_empty_string("data",XIDDATASIZE));
|
||||
field_list.push_back(new Item_int(thd, "formatID", 0,
|
||||
MY_INT32_NUM_DECIMAL_DIGITS));
|
||||
field_list.push_back(new Item_int(thd, "gtrid_length", 0,
|
||||
MY_INT32_NUM_DECIMAL_DIGITS));
|
||||
field_list.push_back(new Item_int(thd, "bqual_length", 0,
|
||||
MY_INT32_NUM_DECIMAL_DIGITS));
|
||||
field_list.push_back(new Item_empty_string(thd, "data",
|
||||
XIDDATASIZE));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
@ -5523,9 +5527,9 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
|
||||
Protocol *protocol= thd->protocol;
|
||||
bool result;
|
||||
|
||||
field_list.push_back(new Item_empty_string("Type",10));
|
||||
field_list.push_back(new Item_empty_string("Name",FN_REFLEN));
|
||||
field_list.push_back(new Item_empty_string("Status",10));
|
||||
field_list.push_back(new Item_empty_string(thd, "Type", 10));
|
||||
field_list.push_back(new Item_empty_string(thd, "Name", FN_REFLEN));
|
||||
field_list.push_back(new Item_empty_string(thd, "Status", 10));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
|
331
sql/item.cc
331
sql/item.cc
@ -411,10 +411,11 @@ int Item::save_str_value_in_field(Field *field, String *result)
|
||||
}
|
||||
|
||||
|
||||
Item::Item():
|
||||
Item::Item(THD *thd):
|
||||
is_expensive_cache(-1), rsize(0), name(0), orig_name(0), name_length(0),
|
||||
fixed(0), is_autogenerated_name(TRUE)
|
||||
{
|
||||
DBUG_ASSERT(thd);
|
||||
marker= 0;
|
||||
maybe_null=null_value=with_sum_func=with_field=0;
|
||||
in_rollup= 0;
|
||||
@ -424,7 +425,6 @@ Item::Item():
|
||||
join_tab_idx= MAX_TABLES;
|
||||
|
||||
/* Put item in free list so that we can free all items at end */
|
||||
THD *thd= current_thd;
|
||||
next= thd->free_list;
|
||||
thd->free_list= this;
|
||||
/*
|
||||
@ -666,11 +666,11 @@ Item_result Item::cmp_type() const
|
||||
pointer to newly allocated item is returned.
|
||||
*/
|
||||
|
||||
Item* Item::transform(Item_transformer transformer, uchar *arg)
|
||||
Item* Item::transform(THD *thd, Item_transformer transformer, uchar *arg)
|
||||
{
|
||||
DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
|
||||
DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
|
||||
|
||||
return (this->*transformer)(arg);
|
||||
return (this->*transformer)(thd, arg);
|
||||
}
|
||||
|
||||
|
||||
@ -693,7 +693,7 @@ Item* Item::set_expr_cache(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("Item::set_expr_cache");
|
||||
Item_cache_wrapper *wrapper;
|
||||
if ((wrapper= new Item_cache_wrapper(this)) &&
|
||||
if ((wrapper= new Item_cache_wrapper(thd, this)) &&
|
||||
!wrapper->fix_fields(thd, (Item**)&wrapper))
|
||||
{
|
||||
if (wrapper->set_cache(thd))
|
||||
@ -704,10 +704,11 @@ Item* Item::set_expr_cache(THD *thd)
|
||||
}
|
||||
|
||||
|
||||
Item_ident::Item_ident(Name_resolution_context *context_arg,
|
||||
Item_ident::Item_ident(THD *thd, Name_resolution_context *context_arg,
|
||||
const char *db_name_arg,const char *table_name_arg,
|
||||
const char *field_name_arg)
|
||||
:orig_db_name(db_name_arg), orig_table_name(table_name_arg),
|
||||
:Item_result_field(thd), orig_db_name(db_name_arg),
|
||||
orig_table_name(table_name_arg),
|
||||
orig_field_name(field_name_arg), context(context_arg),
|
||||
db_name(db_name_arg), table_name(table_name_arg),
|
||||
field_name(field_name_arg),
|
||||
@ -718,8 +719,9 @@ Item_ident::Item_ident(Name_resolution_context *context_arg,
|
||||
}
|
||||
|
||||
|
||||
Item_ident::Item_ident(TABLE_LIST *view_arg, const char *field_name_arg)
|
||||
:orig_db_name(NullS), orig_table_name(view_arg->table_name),
|
||||
Item_ident::Item_ident(THD *thd, TABLE_LIST *view_arg, const char *field_name_arg)
|
||||
:Item_result_field(thd), orig_db_name(NullS),
|
||||
orig_table_name(view_arg->table_name),
|
||||
orig_field_name(field_name_arg), context(&view_arg->view->select_lex.context),
|
||||
db_name(NullS), table_name(view_arg->alias),
|
||||
field_name(field_name_arg),
|
||||
@ -1040,11 +1042,11 @@ bool Item::eq(const Item *item, bool binary_cmp) const
|
||||
}
|
||||
|
||||
|
||||
Item *Item::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
Item *Item::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
|
||||
{
|
||||
if (!needs_charset_converter(tocs))
|
||||
return this;
|
||||
Item_func_conv_charset *conv= new Item_func_conv_charset(this, tocs, 1);
|
||||
Item_func_conv_charset *conv= new Item_func_conv_charset(thd, this, tocs, 1);
|
||||
return conv->safe ? conv : NULL;
|
||||
}
|
||||
|
||||
@ -1069,17 +1071,17 @@ Item *Item::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
TODO: we should eventually check all other use cases of change_item_tree().
|
||||
Perhaps some more potentially dangerous substitution examples exist.
|
||||
*/
|
||||
Item *Item_cache::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
Item *Item_cache::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
|
||||
{
|
||||
if (!example)
|
||||
return Item::safe_charset_converter(tocs);
|
||||
Item *conv= example->safe_charset_converter(tocs);
|
||||
return Item::safe_charset_converter(thd, tocs);
|
||||
Item *conv= example->safe_charset_converter(thd, tocs);
|
||||
if (conv == example)
|
||||
return this;
|
||||
Item_cache *cache;
|
||||
if (!conv || !(cache= new Item_cache_str(conv)))
|
||||
if (!conv || !(cache= new Item_cache_str(thd, conv)))
|
||||
return NULL; // Safe conversion is not possible, or OEM
|
||||
cache->setup(conv);
|
||||
cache->setup(thd, conv);
|
||||
cache->fixed= false; // Make Item::fix_fields() happy
|
||||
return cache;
|
||||
}
|
||||
@ -1096,7 +1098,7 @@ Item *Item_cache::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
the latter returns a non-fixed Item, so val_str() crashes afterwards.
|
||||
Override Item_num method, to return a fixed item.
|
||||
*/
|
||||
Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
Item *Item_num::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
|
||||
{
|
||||
/*
|
||||
Item_num returns pure ASCII result,
|
||||
@ -1107,7 +1109,7 @@ Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
return this;
|
||||
|
||||
Item *conv;
|
||||
if ((conv= const_charset_converter(tocs, true)))
|
||||
if ((conv= const_charset_converter(thd, tocs, true)))
|
||||
conv->fix_char_length(max_char_length());
|
||||
return conv;
|
||||
}
|
||||
@ -1125,7 +1127,7 @@ Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
NULL, if safe conversion is not possible, or
|
||||
a new item representing the converted constant.
|
||||
*/
|
||||
Item *Item::const_charset_converter(CHARSET_INFO *tocs,
|
||||
Item *Item::const_charset_converter(THD *thd, CHARSET_INFO *tocs,
|
||||
bool lossless,
|
||||
const char *func_name)
|
||||
{
|
||||
@ -1134,7 +1136,7 @@ Item *Item::const_charset_converter(CHARSET_INFO *tocs,
|
||||
StringBuffer<64>tmp;
|
||||
String *s= val_str(&tmp);
|
||||
if (!s)
|
||||
return new Item_null((char *) func_name, tocs);
|
||||
return new Item_null(thd, (char *) func_name, tocs);
|
||||
|
||||
if (!needs_charset_converter(s->length(), tocs))
|
||||
{
|
||||
@ -1146,11 +1148,11 @@ Item *Item::const_charset_converter(CHARSET_INFO *tocs,
|
||||
|
||||
uint conv_errors;
|
||||
Item_string *conv= func_name ?
|
||||
new Item_static_string_func(func_name,
|
||||
new Item_static_string_func(thd, func_name,
|
||||
s, tocs, &conv_errors,
|
||||
collation.derivation,
|
||||
collation.repertoire) :
|
||||
new Item_string(s, tocs, &conv_errors,
|
||||
new Item_string(thd, s, tocs, &conv_errors,
|
||||
collation.derivation,
|
||||
collation.repertoire);
|
||||
|
||||
@ -1171,7 +1173,7 @@ Item *Item::const_charset_converter(CHARSET_INFO *tocs,
|
||||
}
|
||||
|
||||
|
||||
Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
Item *Item_param::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
|
||||
{
|
||||
/*
|
||||
Return "this" if in prepare. result_type may change at execition time,
|
||||
@ -1185,7 +1187,7 @@ Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
and INT_RESULT at execution time.
|
||||
*/
|
||||
return !const_item() || state == NULL_VALUE ?
|
||||
this : const_charset_converter(tocs, true);
|
||||
this : const_charset_converter(thd, tocs, true);
|
||||
}
|
||||
|
||||
|
||||
@ -1318,9 +1320,9 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
|
||||
Item_sp_variable methods
|
||||
*****************************************************************************/
|
||||
|
||||
Item_sp_variable::Item_sp_variable(char *sp_var_name_str,
|
||||
uint sp_var_name_length)
|
||||
:m_thd(0)
|
||||
Item_sp_variable::Item_sp_variable(THD *thd, char *sp_var_name_str,
|
||||
uint sp_var_name_length):
|
||||
Item(thd), m_thd(0)
|
||||
#ifndef DBUG_OFF
|
||||
, m_sp(0)
|
||||
#endif
|
||||
@ -1425,13 +1427,13 @@ bool Item_sp_variable::is_null()
|
||||
Item_splocal methods
|
||||
*****************************************************************************/
|
||||
|
||||
Item_splocal::Item_splocal(const LEX_STRING &sp_var_name,
|
||||
Item_splocal::Item_splocal(THD *thd, const LEX_STRING &sp_var_name,
|
||||
uint sp_var_idx,
|
||||
enum_field_types sp_var_type,
|
||||
uint pos_in_q, uint len_in_q)
|
||||
:Item_sp_variable(sp_var_name.str, sp_var_name.length),
|
||||
Rewritable_query_parameter(pos_in_q, len_in_q),
|
||||
m_var_idx(sp_var_idx)
|
||||
uint pos_in_q, uint len_in_q):
|
||||
Item_sp_variable(thd, sp_var_name.str, sp_var_name.length),
|
||||
Rewritable_query_parameter(pos_in_q, len_in_q),
|
||||
m_var_idx(sp_var_idx)
|
||||
{
|
||||
maybe_null= TRUE;
|
||||
|
||||
@ -1487,9 +1489,9 @@ bool Item_splocal::set_value(THD *thd, sp_rcontext *ctx, Item **it)
|
||||
Item_case_expr methods
|
||||
*****************************************************************************/
|
||||
|
||||
Item_case_expr::Item_case_expr(uint case_expr_id)
|
||||
:Item_sp_variable( C_STRING_WITH_LEN("case_expr")),
|
||||
m_case_expr_id(case_expr_id)
|
||||
Item_case_expr::Item_case_expr(THD *thd, uint case_expr_id):
|
||||
Item_sp_variable(thd, C_STRING_WITH_LEN("case_expr")),
|
||||
m_case_expr_id(case_expr_id)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1577,8 +1579,8 @@ bool Item_name_const::is_null()
|
||||
}
|
||||
|
||||
|
||||
Item_name_const::Item_name_const(Item *name_arg, Item *val):
|
||||
value_item(val), name_item(name_arg)
|
||||
Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val):
|
||||
Item(thd), value_item(val), name_item(name_arg)
|
||||
{
|
||||
Item::maybe_null= TRUE;
|
||||
valid_args= true;
|
||||
@ -1689,9 +1691,10 @@ void Item_name_const::print(String *str, enum_query_type query_type)
|
||||
class Item_aggregate_ref : public Item_ref
|
||||
{
|
||||
public:
|
||||
Item_aggregate_ref(Name_resolution_context *context_arg, Item **item,
|
||||
const char *table_name_arg, const char *field_name_arg)
|
||||
:Item_ref(context_arg, item, table_name_arg, field_name_arg) {}
|
||||
Item_aggregate_ref(THD *thd, Name_resolution_context *context_arg,
|
||||
Item **item, const char *table_name_arg,
|
||||
const char *field_name_arg):
|
||||
Item_ref(thd, context_arg, item, table_name_arg, field_name_arg) {}
|
||||
|
||||
virtual inline void print (String *str, enum_query_type query_type)
|
||||
{
|
||||
@ -1794,7 +1797,8 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
|
||||
Item *real_itm= real_item();
|
||||
|
||||
ref_pointer_array[el]= real_itm;
|
||||
if (!(item_ref= new Item_aggregate_ref(&thd->lex->current_select->context,
|
||||
if (!(item_ref= new Item_aggregate_ref(thd,
|
||||
&thd->lex->current_select->context,
|
||||
ref_pointer_array + el, 0, name)))
|
||||
return; // fatal_error is set
|
||||
if (type() == SUM_FUNC_ITEM)
|
||||
@ -2083,11 +2087,11 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
|
||||
|
||||
for (i= 0, arg= args; i < nargs; i++, arg+= item_sep)
|
||||
{
|
||||
Item* conv= (*arg)->safe_charset_converter(coll.collation);
|
||||
Item* conv= (*arg)->safe_charset_converter(thd, coll.collation);
|
||||
if (conv == *arg)
|
||||
continue;
|
||||
if (!conv && ((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
|
||||
conv= new Item_func_conv_charset(*arg, coll.collation, 1);
|
||||
conv= new Item_func_conv_charset(thd, *arg, coll.collation, 1);
|
||||
|
||||
if (!conv)
|
||||
{
|
||||
@ -2185,8 +2189,8 @@ void Item_ident_for_show::make_field(Send_field *tmp_field)
|
||||
|
||||
/**********************************************/
|
||||
|
||||
Item_field::Item_field(Field *f)
|
||||
:Item_ident(0, NullS, *f->table_name, f->field_name),
|
||||
Item_field::Item_field(THD *thd, Field *f)
|
||||
:Item_ident(thd, 0, NullS, *f->table_name, f->field_name),
|
||||
item_equal(0), no_const_subst(0),
|
||||
have_privileges(0), any_privileges(0)
|
||||
{
|
||||
@ -2209,7 +2213,7 @@ Item_field::Item_field(Field *f)
|
||||
|
||||
Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
|
||||
Field *f)
|
||||
:Item_ident(context_arg, f->table->s->db.str, *f->table_name, f->field_name),
|
||||
:Item_ident(thd, context_arg, f->table->s->db.str, *f->table_name, f->field_name),
|
||||
item_equal(0), no_const_subst(0),
|
||||
have_privileges(0), any_privileges(0)
|
||||
{
|
||||
@ -2252,7 +2256,7 @@ Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
|
||||
Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
|
||||
const char *db_arg,const char *table_name_arg,
|
||||
const char *field_name_arg)
|
||||
:Item_ident(context_arg, db_arg,table_name_arg,field_name_arg),
|
||||
:Item_ident(thd, context_arg, db_arg, table_name_arg, field_name_arg),
|
||||
field(0), item_equal(0), no_const_subst(0),
|
||||
have_privileges(0), any_privileges(0)
|
||||
{
|
||||
@ -2681,7 +2685,8 @@ longlong Item_field::val_int_endpoint(bool left_endp, bool *incl_endp)
|
||||
This is always 'signed'. Unsigned values are created with Item_uint()
|
||||
*/
|
||||
|
||||
Item_int::Item_int(const char *str_arg, uint length)
|
||||
Item_int::Item_int(THD *thd, const char *str_arg, uint length):
|
||||
Item_num(thd)
|
||||
{
|
||||
char *end_ptr= (char*) str_arg + length;
|
||||
int error;
|
||||
@ -2714,15 +2719,15 @@ void Item_int::print(String *str, enum_query_type query_type)
|
||||
}
|
||||
|
||||
|
||||
Item_uint::Item_uint(const char *str_arg, uint length):
|
||||
Item_int(str_arg, length)
|
||||
Item_uint::Item_uint(THD *thd, const char *str_arg, uint length):
|
||||
Item_int(thd, str_arg, length)
|
||||
{
|
||||
unsigned_flag= 1;
|
||||
}
|
||||
|
||||
|
||||
Item_uint::Item_uint(const char *str_arg, longlong i, uint length):
|
||||
Item_int(str_arg, i, length)
|
||||
Item_uint::Item_uint(THD *thd, const char *str_arg, longlong i, uint length):
|
||||
Item_int(thd, str_arg, i, length)
|
||||
{
|
||||
unsigned_flag= 1;
|
||||
}
|
||||
@ -2745,8 +2750,9 @@ void Item_uint::print(String *str, enum_query_type query_type)
|
||||
}
|
||||
|
||||
|
||||
Item_decimal::Item_decimal(const char *str_arg, uint length,
|
||||
CHARSET_INFO *charset)
|
||||
Item_decimal::Item_decimal(THD *thd, const char *str_arg, uint length,
|
||||
CHARSET_INFO *charset):
|
||||
Item_num(thd)
|
||||
{
|
||||
str2my_decimal(E_DEC_FATAL_ERROR, str_arg, length, charset, &decimal_value);
|
||||
name= (char*) str_arg;
|
||||
@ -2758,7 +2764,8 @@ Item_decimal::Item_decimal(const char *str_arg, uint length,
|
||||
unsigned_flag);
|
||||
}
|
||||
|
||||
Item_decimal::Item_decimal(longlong val, bool unsig)
|
||||
Item_decimal::Item_decimal(THD *thd, longlong val, bool unsig):
|
||||
Item_num(thd)
|
||||
{
|
||||
int2my_decimal(E_DEC_FATAL_ERROR, val, unsig, &decimal_value);
|
||||
decimals= (uint8) decimal_value.frac;
|
||||
@ -2770,7 +2777,8 @@ Item_decimal::Item_decimal(longlong val, bool unsig)
|
||||
}
|
||||
|
||||
|
||||
Item_decimal::Item_decimal(double val, int precision, int scale)
|
||||
Item_decimal::Item_decimal(THD *thd, double val, int precision, int scale):
|
||||
Item_num(thd)
|
||||
{
|
||||
double2my_decimal(E_DEC_FATAL_ERROR, val, &decimal_value);
|
||||
decimals= (uint8) decimal_value.frac;
|
||||
@ -2782,8 +2790,9 @@ Item_decimal::Item_decimal(double val, int precision, int scale)
|
||||
}
|
||||
|
||||
|
||||
Item_decimal::Item_decimal(const char *str, const my_decimal *val_arg,
|
||||
uint decimal_par, uint length)
|
||||
Item_decimal::Item_decimal(THD *thd, const char *str, const my_decimal *val_arg,
|
||||
uint decimal_par, uint length):
|
||||
Item_num(thd)
|
||||
{
|
||||
my_decimal2decimal(val_arg, &decimal_value);
|
||||
name= (char*) str;
|
||||
@ -2793,7 +2802,8 @@ Item_decimal::Item_decimal(const char *str, const my_decimal *val_arg,
|
||||
}
|
||||
|
||||
|
||||
Item_decimal::Item_decimal(my_decimal *value_par)
|
||||
Item_decimal::Item_decimal(THD *thd, my_decimal *value_par):
|
||||
Item_num(thd)
|
||||
{
|
||||
my_decimal2decimal(value_par, &decimal_value);
|
||||
decimals= (uint8) decimal_value.frac;
|
||||
@ -2805,7 +2815,8 @@ Item_decimal::Item_decimal(my_decimal *value_par)
|
||||
}
|
||||
|
||||
|
||||
Item_decimal::Item_decimal(const uchar *bin, int precision, int scale)
|
||||
Item_decimal::Item_decimal(THD *thd, const uchar *bin, int precision, int scale):
|
||||
Item_num(thd)
|
||||
{
|
||||
binary2my_decimal(E_DEC_FATAL_ERROR, bin,
|
||||
&decimal_value, precision, scale);
|
||||
@ -3068,7 +3079,7 @@ my_decimal *Item_null::val_decimal(my_decimal *decimal_value)
|
||||
}
|
||||
|
||||
|
||||
Item *Item_null::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
Item *Item_null::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
@ -3089,7 +3100,8 @@ default_set_param_func(Item_param *param,
|
||||
}
|
||||
|
||||
|
||||
Item_param::Item_param(uint pos_in_query_arg) :
|
||||
Item_param::Item_param(THD *thd, uint pos_in_query_arg):
|
||||
Item_basic_value(thd),
|
||||
Rewritable_query_parameter(pos_in_query_arg, 1),
|
||||
state(NO_VALUE),
|
||||
item_result_type(STRING_RESULT),
|
||||
@ -3687,22 +3699,22 @@ bool Item_param::basic_const_item() const
|
||||
|
||||
|
||||
Item *
|
||||
Item_param::clone_item()
|
||||
Item_param::clone_item(THD *thd)
|
||||
{
|
||||
/* see comments in the header file */
|
||||
switch (state) {
|
||||
case NULL_VALUE:
|
||||
return new Item_null(name);
|
||||
return new Item_null(thd, name);
|
||||
case INT_VALUE:
|
||||
return (unsigned_flag ?
|
||||
new Item_uint(name, value.integer, max_length) :
|
||||
new Item_int(name, value.integer, max_length));
|
||||
new Item_uint(thd, name, value.integer, max_length) :
|
||||
new Item_int(thd, name, value.integer, max_length));
|
||||
case REAL_VALUE:
|
||||
return new Item_float(name, value.real, decimals, max_length);
|
||||
return new Item_float(thd, name, value.real, decimals, max_length);
|
||||
case STRING_VALUE:
|
||||
case LONG_DATA_VALUE:
|
||||
return new Item_string(name, str_value.c_ptr_quick(), str_value.length(),
|
||||
str_value.charset(),
|
||||
return new Item_string(thd, name, str_value.c_ptr_quick(),
|
||||
str_value.length(), str_value.charset(),
|
||||
collation.derivation, collation.repertoire);
|
||||
case TIME_VALUE:
|
||||
break;
|
||||
@ -3955,19 +3967,20 @@ bool Item_param::append_for_log(THD *thd, String *str)
|
||||
Item_copy
|
||||
****************************************************************************/
|
||||
|
||||
Item_copy *Item_copy::create (Item *item)
|
||||
Item_copy *Item_copy::create(THD *thd, Item *item)
|
||||
{
|
||||
switch (item->result_type())
|
||||
{
|
||||
case STRING_RESULT:
|
||||
return new Item_copy_string (item);
|
||||
case REAL_RESULT:
|
||||
return new Item_copy_float (item);
|
||||
return new Item_copy_string(thd, item);
|
||||
case REAL_RESULT:
|
||||
return new Item_copy_float(thd, item);
|
||||
case INT_RESULT:
|
||||
return item->unsigned_flag ?
|
||||
new Item_copy_uint (item) : new Item_copy_int (item);
|
||||
return item->unsigned_flag ?
|
||||
new Item_copy_uint(thd, item) :
|
||||
new Item_copy_int(thd, item);
|
||||
case DECIMAL_RESULT:
|
||||
return new Item_copy_decimal (item);
|
||||
return new Item_copy_decimal(thd, item);
|
||||
case TIME_RESULT:
|
||||
case ROW_RESULT:
|
||||
case IMPOSSIBLE_RESULT:
|
||||
@ -4765,7 +4778,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
|
||||
fix_inner_refs() function.
|
||||
*/
|
||||
;
|
||||
if (!(rf= new Item_outer_ref(context, this)))
|
||||
if (!(rf= new Item_outer_ref(thd, context, this)))
|
||||
return -1;
|
||||
thd->change_item_tree(reference, rf);
|
||||
select->inner_refs_list.push_back(rf);
|
||||
@ -4872,12 +4885,12 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
|
||||
save= *ref;
|
||||
*ref= NULL; // Don't call set_properties()
|
||||
rf= (place == IN_HAVING ?
|
||||
new Item_ref(context, ref, (char*) table_name,
|
||||
new Item_ref(thd, context, ref, (char*) table_name,
|
||||
(char*) field_name, alias_name_used) :
|
||||
(!select->group_list.elements ?
|
||||
new Item_direct_ref(context, ref, (char*) table_name,
|
||||
new Item_direct_ref(thd, context, ref, (char*) table_name,
|
||||
(char*) field_name, alias_name_used) :
|
||||
new Item_outer_ref(context, ref, (char*) table_name,
|
||||
new Item_outer_ref(thd, context, ref, (char*) table_name,
|
||||
(char*) field_name, alias_name_used)));
|
||||
*ref= save;
|
||||
if (!rf)
|
||||
@ -4911,7 +4924,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
|
||||
if (last_checked_context->select_lex->having_fix_field)
|
||||
{
|
||||
Item_ref *rf;
|
||||
rf= new Item_ref(context, (*from_field)->table->s->db.str,
|
||||
rf= new Item_ref(thd, context, (*from_field)->table->s->db.str,
|
||||
(*from_field)->table->alias.c_ptr(),
|
||||
(char*) field_name);
|
||||
if (!rf)
|
||||
@ -5045,7 +5058,8 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
|
||||
Item_ref to point to the Item in the select list and replace the
|
||||
Item_field created by the parser with the new Item_ref.
|
||||
*/
|
||||
Item_ref *rf= new Item_ref(context, db_name,table_name,field_name);
|
||||
Item_ref *rf= new Item_ref(thd, context, db_name, table_name,
|
||||
field_name);
|
||||
if (!rf)
|
||||
return 1;
|
||||
bool err= rf->fix_fields(thd, (Item **) &rf) || rf->check_cols(1);
|
||||
@ -5329,19 +5343,19 @@ bool Item_field::subst_argument_checker(uchar **arg)
|
||||
the field reference when propagating equalities.
|
||||
*/
|
||||
|
||||
static void convert_zerofill_number_to_string(Item **item, Field_num *field)
|
||||
static void convert_zerofill_number_to_string(THD *thd, Item **item, Field_num *field)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH],*pos;
|
||||
String tmp(buff,sizeof(buff), field->charset()), *res;
|
||||
|
||||
res= (*item)->val_str(&tmp);
|
||||
if ((*item)->is_null())
|
||||
*item= new Item_null();
|
||||
*item= new Item_null(thd);
|
||||
else
|
||||
{
|
||||
field->prepend_zeros(res);
|
||||
pos= (char *) sql_strmake (res->ptr(), res->length());
|
||||
*item= new Item_string(pos, res->length(), field->charset());
|
||||
*item= new Item_string(thd, pos, res->length(), field->charset());
|
||||
}
|
||||
}
|
||||
|
||||
@ -5370,7 +5384,7 @@ static void convert_zerofill_number_to_string(Item **item, Field_num *field)
|
||||
- pointer to the field item, otherwise.
|
||||
*/
|
||||
|
||||
Item *Item_field::equal_fields_propagator(uchar *arg)
|
||||
Item *Item_field::equal_fields_propagator(THD *thd, uchar *arg)
|
||||
{
|
||||
if (no_const_subst)
|
||||
return this;
|
||||
@ -5392,7 +5406,7 @@ Item *Item_field::equal_fields_propagator(uchar *arg)
|
||||
else if (field && (field->flags & ZEROFILL_FLAG) && IS_NUM(field->type()))
|
||||
{
|
||||
if (item && (cmp_context == STRING_RESULT || cmp_context == IMPOSSIBLE_RESULT))
|
||||
convert_zerofill_number_to_string(&item, (Field_num *)field);
|
||||
convert_zerofill_number_to_string(thd, &item, (Field_num *)field);
|
||||
else
|
||||
item= this;
|
||||
}
|
||||
@ -5440,7 +5454,7 @@ bool Item_field::set_no_const_sub(uchar *arg)
|
||||
- this - otherwise.
|
||||
*/
|
||||
|
||||
Item *Item_field::replace_equal_field(uchar *arg)
|
||||
Item *Item_field::replace_equal_field(THD *thd, uchar *arg)
|
||||
{
|
||||
REPLACE_EQUAL_FIELD_ARG* param= (REPLACE_EQUAL_FIELD_ARG*)arg;
|
||||
if (item_equal && item_equal == param->item_equal)
|
||||
@ -6068,7 +6082,7 @@ int Item_decimal::save_in_field(Field *field, bool no_conversions)
|
||||
}
|
||||
|
||||
|
||||
Item *Item_int_with_ref::clone_item()
|
||||
Item *Item_int_with_ref::clone_item(THD *thd)
|
||||
{
|
||||
DBUG_ASSERT(ref->const_item());
|
||||
/*
|
||||
@ -6076,15 +6090,15 @@ Item *Item_int_with_ref::clone_item()
|
||||
parameter markers.
|
||||
*/
|
||||
return (ref->unsigned_flag ?
|
||||
new Item_uint(ref->name, ref->val_int(), ref->max_length) :
|
||||
new Item_int(ref->name, ref->val_int(), ref->max_length));
|
||||
new Item_uint(thd, ref->name, ref->val_int(), ref->max_length) :
|
||||
new Item_int(thd, ref->name, ref->val_int(), ref->max_length));
|
||||
}
|
||||
|
||||
|
||||
Item_num *Item_uint::neg()
|
||||
Item_num *Item_uint::neg(THD *thd)
|
||||
{
|
||||
Item_decimal *item= new Item_decimal(value, 1);
|
||||
return item->neg();
|
||||
Item_decimal *item= new Item_decimal(thd, value, 1);
|
||||
return item->neg(thd);
|
||||
}
|
||||
|
||||
|
||||
@ -6142,7 +6156,8 @@ static uint nr_of_decimals(const char *str, const char *end)
|
||||
Item->name should be fixed to use LEX_STRING eventually.
|
||||
*/
|
||||
|
||||
Item_float::Item_float(const char *str_arg, uint length)
|
||||
Item_float::Item_float(THD *thd, const char *str_arg, uint length):
|
||||
Item_num(thd)
|
||||
{
|
||||
int error;
|
||||
char *end_not_used;
|
||||
@ -6285,7 +6300,8 @@ void Item_hex_string::print(String *str, enum_query_type query_type)
|
||||
In number context this is a longlong value.
|
||||
*/
|
||||
|
||||
Item_bin_string::Item_bin_string(const char *str, uint str_length)
|
||||
Item_bin_string::Item_bin_string(THD *thd, const char *str, uint str_length):
|
||||
Item_hex_hybrid(thd)
|
||||
{
|
||||
const char *end= str + str_length - 1;
|
||||
uchar bits= 0;
|
||||
@ -6567,15 +6583,15 @@ bool Item::cache_const_expr_analyzer(uchar **arg)
|
||||
@return this otherwise.
|
||||
*/
|
||||
|
||||
Item* Item::cache_const_expr_transformer(uchar *arg)
|
||||
Item* Item::cache_const_expr_transformer(THD *thd, uchar *arg)
|
||||
{
|
||||
if (*(bool*)arg)
|
||||
{
|
||||
*((bool*)arg)= FALSE;
|
||||
Item_cache *cache= Item_cache::get_cache(this);
|
||||
Item_cache *cache= Item_cache::get_cache(thd, this);
|
||||
if (!cache)
|
||||
return NULL;
|
||||
cache->setup(this);
|
||||
cache->setup(thd, this);
|
||||
cache->store(this);
|
||||
return cache;
|
||||
}
|
||||
@ -6634,7 +6650,7 @@ void Item_field::update_null_value()
|
||||
this field otherwise
|
||||
*/
|
||||
|
||||
Item *Item_field::update_value_transformer(uchar *select_arg)
|
||||
Item *Item_field::update_value_transformer(THD *thd, uchar *select_arg)
|
||||
{
|
||||
SELECT_LEX *select= (SELECT_LEX*)select_arg;
|
||||
DBUG_ASSERT(fixed);
|
||||
@ -6649,7 +6665,7 @@ Item *Item_field::update_value_transformer(uchar *select_arg)
|
||||
|
||||
ref_pointer_array[el]= (Item*)this;
|
||||
all_fields->push_front((Item*)this);
|
||||
ref= new Item_ref(&select->context, ref_pointer_array + el,
|
||||
ref= new Item_ref(thd, &select->context, ref_pointer_array + el,
|
||||
table_name, field_name);
|
||||
return ref;
|
||||
}
|
||||
@ -6668,12 +6684,12 @@ void Item_field::print(String *str, enum_query_type query_type)
|
||||
}
|
||||
|
||||
|
||||
Item_ref::Item_ref(Name_resolution_context *context_arg,
|
||||
Item_ref::Item_ref(THD *thd, Name_resolution_context *context_arg,
|
||||
Item **item, const char *table_name_arg,
|
||||
const char *field_name_arg,
|
||||
bool alias_name_used_arg)
|
||||
:Item_ident(context_arg, NullS, table_name_arg, field_name_arg),
|
||||
ref(item), reference_trough_name(0)
|
||||
bool alias_name_used_arg):
|
||||
Item_ident(thd, context_arg, NullS, table_name_arg, field_name_arg),
|
||||
ref(item), reference_trough_name(0)
|
||||
{
|
||||
alias_name_used= alias_name_used_arg;
|
||||
/*
|
||||
@ -6714,10 +6730,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
Item_ref::Item_ref(TABLE_LIST *view_arg, Item **item,
|
||||
const char *field_name_arg, bool alias_name_used_arg)
|
||||
:Item_ident(view_arg, field_name_arg),
|
||||
ref(item), reference_trough_name(0)
|
||||
Item_ref::Item_ref(THD *thd, TABLE_LIST *view_arg, Item **item,
|
||||
const char *field_name_arg, bool alias_name_used_arg):
|
||||
Item_ident(thd, view_arg, field_name_arg),
|
||||
ref(item), reference_trough_name(0)
|
||||
{
|
||||
alias_name_used= alias_name_used_arg;
|
||||
/*
|
||||
@ -6943,7 +6959,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
|
||||
if (from_field != not_found_field)
|
||||
{
|
||||
Item_field* fld;
|
||||
if (!(fld= new Item_field(from_field)))
|
||||
if (!(fld= new Item_field(thd, from_field)))
|
||||
goto error;
|
||||
thd->change_item_tree(reference, fld);
|
||||
mark_as_dependent(thd, last_checked_context->select_lex,
|
||||
@ -7080,13 +7096,13 @@ void Item_ref::cleanup()
|
||||
@retval NULL Out of memory error
|
||||
*/
|
||||
|
||||
Item* Item_ref::transform(Item_transformer transformer, uchar *arg)
|
||||
Item* Item_ref::transform(THD *thd, Item_transformer transformer, uchar *arg)
|
||||
{
|
||||
DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
|
||||
DBUG_ASSERT((*ref) != NULL);
|
||||
|
||||
/* Transform the object we are referencing. */
|
||||
Item *new_item= (*ref)->transform(transformer, arg);
|
||||
Item *new_item= (*ref)->transform(thd, transformer, arg);
|
||||
if (!new_item)
|
||||
return NULL;
|
||||
|
||||
@ -7097,10 +7113,10 @@ Item* Item_ref::transform(Item_transformer transformer, uchar *arg)
|
||||
change records at each execution.
|
||||
*/
|
||||
if (*ref != new_item)
|
||||
current_thd->change_item_tree(ref, new_item);
|
||||
thd->change_item_tree(ref, new_item);
|
||||
|
||||
/* Transform the item ref object. */
|
||||
return (this->*transformer)(arg);
|
||||
return (this->*transformer)(thd, arg);
|
||||
}
|
||||
|
||||
|
||||
@ -7126,7 +7142,7 @@ Item* Item_ref::transform(Item_transformer transformer, uchar *arg)
|
||||
@return Item returned as the result of transformation of the Item_ref object
|
||||
*/
|
||||
|
||||
Item* Item_ref::compile(Item_analyzer analyzer, uchar **arg_p,
|
||||
Item* Item_ref::compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
|
||||
Item_transformer transformer, uchar *arg_t)
|
||||
{
|
||||
/* Analyze this Item object. */
|
||||
@ -7138,13 +7154,13 @@ Item* Item_ref::compile(Item_analyzer analyzer, uchar **arg_p,
|
||||
if (*arg_p)
|
||||
{
|
||||
uchar *arg_v= *arg_p;
|
||||
Item *new_item= (*ref)->compile(analyzer, &arg_v, transformer, arg_t);
|
||||
Item *new_item= (*ref)->compile(thd, analyzer, &arg_v, transformer, arg_t);
|
||||
if (new_item && *ref != new_item)
|
||||
current_thd->change_item_tree(ref, new_item);
|
||||
thd->change_item_tree(ref, new_item);
|
||||
}
|
||||
|
||||
/* Transform this Item object. */
|
||||
return (this->*transformer)(arg_t);
|
||||
return (this->*transformer)(thd, arg_t);
|
||||
}
|
||||
|
||||
|
||||
@ -7390,7 +7406,7 @@ Item *Item_ref::get_tmp_table_item(THD *thd)
|
||||
if (!result_field)
|
||||
return (*ref)->get_tmp_table_item(thd);
|
||||
|
||||
Item_field *item= new Item_field(result_field);
|
||||
Item_field *item= new Item_field(thd, result_field);
|
||||
if (item)
|
||||
{
|
||||
item->table_name= table_name;
|
||||
@ -7475,8 +7491,8 @@ Item_cache_wrapper::~Item_cache_wrapper()
|
||||
DBUG_ASSERT(expr_cache == 0);
|
||||
}
|
||||
|
||||
Item_cache_wrapper::Item_cache_wrapper(Item *item_arg)
|
||||
:orig_item(item_arg), expr_cache(NULL), expr_value(NULL)
|
||||
Item_cache_wrapper::Item_cache_wrapper(THD *thd, Item *item_arg):
|
||||
Item_result_field(thd), orig_item(item_arg), expr_cache(NULL), expr_value(NULL)
|
||||
{
|
||||
DBUG_ASSERT(orig_item->fixed);
|
||||
Type_std_attributes::set(orig_item);
|
||||
@ -7487,8 +7503,8 @@ Item_cache_wrapper::Item_cache_wrapper(Item *item_arg)
|
||||
name_length= item_arg->name_length;
|
||||
with_subselect= orig_item->with_subselect;
|
||||
|
||||
if ((expr_value= Item_cache::get_cache(orig_item)))
|
||||
expr_value->setup(orig_item);
|
||||
if ((expr_value= Item_cache::get_cache(thd, orig_item)))
|
||||
expr_value->setup(thd, orig_item);
|
||||
|
||||
fixed= 1;
|
||||
}
|
||||
@ -7871,7 +7887,7 @@ int Item_cache_wrapper::save_in_field(Field *to, bool no_conversions)
|
||||
Item* Item_cache_wrapper::get_tmp_table_item(THD *thd_arg)
|
||||
{
|
||||
if (!orig_item->with_sum_func && !orig_item->const_item())
|
||||
return new Item_field(result_field);
|
||||
return new Item_field(thd_arg, result_field);
|
||||
return copy_or_same(thd_arg);
|
||||
}
|
||||
|
||||
@ -8118,12 +8134,12 @@ bool Item_direct_view_ref::subst_argument_checker(uchar **arg)
|
||||
- pointer to the field item, otherwise.
|
||||
*/
|
||||
|
||||
Item *Item_direct_view_ref::equal_fields_propagator(uchar *arg)
|
||||
Item *Item_direct_view_ref::equal_fields_propagator(THD *thd, uchar *arg)
|
||||
{
|
||||
Item *field_item= real_item();
|
||||
if (field_item->type() != FIELD_ITEM)
|
||||
return this;
|
||||
Item *item= field_item->equal_fields_propagator(arg);
|
||||
Item *item= field_item->equal_fields_propagator(thd, arg);
|
||||
set_item_equal(field_item->get_item_equal());
|
||||
field_item->set_item_equal(NULL);
|
||||
if (item != field_item)
|
||||
@ -8162,13 +8178,13 @@ Item *Item_direct_view_ref::equal_fields_propagator(uchar *arg)
|
||||
- this - otherwise.
|
||||
*/
|
||||
|
||||
Item *Item_direct_view_ref::replace_equal_field(uchar *arg)
|
||||
Item *Item_direct_view_ref::replace_equal_field(THD *thd, uchar *arg)
|
||||
{
|
||||
Item *field_item= real_item();
|
||||
if (field_item->type() != FIELD_ITEM)
|
||||
return this;
|
||||
field_item->set_item_equal(item_equal);
|
||||
Item *item= field_item->replace_equal_field(arg);
|
||||
Item *item= field_item->replace_equal_field(thd, arg);
|
||||
field_item->set_item_equal(0);
|
||||
return item != field_item ? item : this;
|
||||
}
|
||||
@ -8290,9 +8306,10 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
|
||||
same time it can replace some nodes in the tree.
|
||||
*/
|
||||
|
||||
Item *Item_default_value::transform(Item_transformer transformer, uchar *args)
|
||||
Item *Item_default_value::transform(THD *thd, Item_transformer transformer,
|
||||
uchar *args)
|
||||
{
|
||||
DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
|
||||
DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
|
||||
|
||||
/*
|
||||
If the value of arg is NULL, then this object represents a constant,
|
||||
@ -8301,7 +8318,7 @@ Item *Item_default_value::transform(Item_transformer transformer, uchar *args)
|
||||
if (!arg)
|
||||
return 0;
|
||||
|
||||
Item *new_item= arg->transform(transformer, args);
|
||||
Item *new_item= arg->transform(thd, transformer, args);
|
||||
if (!new_item)
|
||||
return 0;
|
||||
|
||||
@ -8312,8 +8329,8 @@ Item *Item_default_value::transform(Item_transformer transformer, uchar *args)
|
||||
change records at each execution.
|
||||
*/
|
||||
if (arg != new_item)
|
||||
current_thd->change_item_tree(&arg, new_item);
|
||||
return (this->*transformer)(args);
|
||||
thd->change_item_tree(&arg, new_item);
|
||||
return (this->*transformer)(thd, args);
|
||||
}
|
||||
|
||||
|
||||
@ -8572,7 +8589,7 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
||||
/* the following call creates a constant and puts it in new_item */
|
||||
get_datetime_value(thd, &ref_copy, &new_item, comp_item, &is_null);
|
||||
if (is_null)
|
||||
new_item= new Item_null(name);
|
||||
new_item= new Item_null(thd, name);
|
||||
break;
|
||||
}
|
||||
case STRING_RESULT:
|
||||
@ -8581,12 +8598,12 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
||||
String tmp(buff,sizeof(buff),&my_charset_bin),*result;
|
||||
result=item->val_str(&tmp);
|
||||
if (item->null_value)
|
||||
new_item= new Item_null(name);
|
||||
new_item= new Item_null(thd, name);
|
||||
else
|
||||
{
|
||||
uint length= result->length();
|
||||
char *tmp_str= sql_strmake(result->ptr(), length);
|
||||
new_item= new Item_string(name, tmp_str, length, result->charset());
|
||||
new_item= new Item_string(thd, name, tmp_str, length, result->charset());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -8595,8 +8612,8 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
||||
longlong result=item->val_int();
|
||||
uint length=item->max_length;
|
||||
bool null_value=item->null_value;
|
||||
new_item= (null_value ? (Item*) new Item_null(name) :
|
||||
(Item*) new Item_int(name, result, length));
|
||||
new_item= (null_value ? (Item*) new Item_null(thd, name) :
|
||||
(Item*) new Item_int(thd, name, result, length));
|
||||
break;
|
||||
}
|
||||
case ROW_RESULT:
|
||||
@ -8634,8 +8651,8 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
||||
double result= item->val_real();
|
||||
uint length=item->max_length,decimals=item->decimals;
|
||||
bool null_value=item->null_value;
|
||||
new_item= (null_value ? (Item*) new Item_null(name) : (Item*)
|
||||
new Item_float(name, result, decimals, length));
|
||||
new_item= (null_value ? (Item*) new Item_null(thd, name) : (Item*)
|
||||
new Item_float(thd, name, result, decimals, length));
|
||||
break;
|
||||
}
|
||||
case DECIMAL_RESULT:
|
||||
@ -8645,8 +8662,8 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
||||
uint length= item->max_length, decimals= item->decimals;
|
||||
bool null_value= item->null_value;
|
||||
new_item= (null_value ?
|
||||
(Item*) new Item_null(name) :
|
||||
(Item*) new Item_decimal(name, result, length, decimals));
|
||||
(Item*) new Item_null(thd, name) :
|
||||
(Item*) new Item_decimal(thd, name, result, length, decimals));
|
||||
break;
|
||||
}
|
||||
case IMPOSSIBLE_RESULT:
|
||||
@ -8771,9 +8788,9 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
|
||||
return 0;
|
||||
}
|
||||
|
||||
Item_cache* Item_cache::get_cache(const Item *item)
|
||||
Item_cache* Item_cache::get_cache(THD *thd, const Item *item)
|
||||
{
|
||||
return get_cache(item, item->cmp_type());
|
||||
return get_cache(thd, item, item->cmp_type());
|
||||
}
|
||||
|
||||
|
||||
@ -8786,21 +8803,21 @@ Item_cache* Item_cache::get_cache(const Item *item)
|
||||
@return cache item
|
||||
*/
|
||||
|
||||
Item_cache* Item_cache::get_cache(const Item *item, const Item_result type)
|
||||
Item_cache* Item_cache::get_cache(THD *thd, const Item *item, const Item_result type)
|
||||
{
|
||||
switch (type) {
|
||||
case INT_RESULT:
|
||||
return new Item_cache_int(item->field_type());
|
||||
return new Item_cache_int(thd, item->field_type());
|
||||
case REAL_RESULT:
|
||||
return new Item_cache_real();
|
||||
return new Item_cache_real(thd);
|
||||
case DECIMAL_RESULT:
|
||||
return new Item_cache_decimal();
|
||||
return new Item_cache_decimal(thd);
|
||||
case STRING_RESULT:
|
||||
return new Item_cache_str(item);
|
||||
return new Item_cache_str(thd, item);
|
||||
case ROW_RESULT:
|
||||
return new Item_cache_row();
|
||||
return new Item_cache_row(thd);
|
||||
case TIME_RESULT:
|
||||
return new Item_cache_temporal(item->field_type());
|
||||
return new Item_cache_temporal(thd, item->field_type());
|
||||
case IMPOSSIBLE_RESULT:
|
||||
DBUG_ASSERT(0);
|
||||
break;
|
||||
@ -8905,8 +8922,8 @@ int Item_cache_int::save_in_field(Field *field, bool no_conversions)
|
||||
}
|
||||
|
||||
|
||||
Item_cache_temporal::Item_cache_temporal(enum_field_types field_type_arg):
|
||||
Item_cache_int(field_type_arg)
|
||||
Item_cache_temporal::Item_cache_temporal(THD *thd, enum_field_types field_type_arg):
|
||||
Item_cache_int(thd, field_type_arg)
|
||||
{
|
||||
if (mysql_type_to_time_type(cached_field_type) == MYSQL_TIMESTAMP_ERROR)
|
||||
cached_field_type= MYSQL_TYPE_DATETIME;
|
||||
@ -9226,7 +9243,7 @@ bool Item_cache_row::allocate(uint num)
|
||||
}
|
||||
|
||||
|
||||
bool Item_cache_row::setup(Item * item)
|
||||
bool Item_cache_row::setup(THD *thd, Item *item)
|
||||
{
|
||||
example= item;
|
||||
if (!values && allocate(item->cols()))
|
||||
@ -9235,9 +9252,9 @@ bool Item_cache_row::setup(Item * item)
|
||||
{
|
||||
Item *el= item->element_index(i);
|
||||
Item_cache *tmp;
|
||||
if (!(tmp= values[i]= Item_cache::get_cache(el)))
|
||||
if (!(tmp= values[i]= Item_cache::get_cache(thd, el)))
|
||||
return 1;
|
||||
tmp->setup(el);
|
||||
tmp->setup(thd, el);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
481
sql/item.h
481
sql/item.h
File diff suppressed because it is too large
Load Diff
@ -442,7 +442,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
|
||||
|
||||
if (0 == field_cmp)
|
||||
{
|
||||
Item *tmp= new Item_int_with_ref(field->val_int(), *item,
|
||||
Item *tmp= new Item_int_with_ref(thd, field->val_int(), *item,
|
||||
MY_TEST(field->flags & UNSIGNED_FLAG));
|
||||
if (tmp)
|
||||
thd->change_item_tree(item, tmp);
|
||||
@ -789,8 +789,8 @@ Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value,
|
||||
(*value)->const_item() && type != (*value)->result_type() &&
|
||||
type != TIME_RESULT)
|
||||
{
|
||||
Item_cache *cache= Item_cache::get_cache(*value, type);
|
||||
cache->setup(*value);
|
||||
Item_cache *cache= Item_cache::get_cache(thd_arg, *value, type);
|
||||
cache->setup(thd_arg, *value);
|
||||
*cache_item= cache;
|
||||
return cache_item;
|
||||
}
|
||||
@ -878,7 +878,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
{
|
||||
Query_arena backup;
|
||||
Query_arena *save_arena= thd->switch_to_arena_for_cached_items(&backup);
|
||||
Item_cache_temporal *cache= new Item_cache_temporal(f_type);
|
||||
Item_cache_temporal *cache= new Item_cache_temporal(thd, f_type);
|
||||
if (save_arena)
|
||||
thd->set_query_arena(save_arena);
|
||||
|
||||
@ -1411,11 +1411,11 @@ bool Item_in_optimizer::fix_left(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("Item_in_optimizer::fix_left");
|
||||
if ((!args[0]->fixed && args[0]->fix_fields(thd, args)) ||
|
||||
(!cache && !(cache= Item_cache::get_cache(args[0]))))
|
||||
(!cache && !(cache= Item_cache::get_cache(thd, args[0]))))
|
||||
DBUG_RETURN(1);
|
||||
DBUG_PRINT("info", ("actual fix fields"));
|
||||
|
||||
cache->setup(args[0]);
|
||||
cache->setup(thd, args[0]);
|
||||
if (cache->cols() == 1)
|
||||
{
|
||||
DBUG_ASSERT(args[0]->type() != ROW_ITEM);
|
||||
@ -1542,9 +1542,8 @@ bool Item_in_optimizer::invisible_mode()
|
||||
this item - otherwise
|
||||
*/
|
||||
|
||||
Item *Item_in_optimizer::expr_cache_insert_transformer(uchar *thd_arg)
|
||||
Item *Item_in_optimizer::expr_cache_insert_transformer(THD *thd, uchar *unused)
|
||||
{
|
||||
THD *thd= (THD*) thd_arg;
|
||||
DBUG_ENTER("Item_in_optimizer::expr_cache_insert_transformer");
|
||||
|
||||
if (invisible_mode())
|
||||
@ -1802,16 +1801,16 @@ bool Item_in_optimizer::is_null()
|
||||
@retval NULL if an error occurred
|
||||
*/
|
||||
|
||||
Item *Item_in_optimizer::transform(Item_transformer transformer,
|
||||
Item *Item_in_optimizer::transform(THD *thd, Item_transformer transformer,
|
||||
uchar *argument)
|
||||
{
|
||||
Item *new_item;
|
||||
|
||||
DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
|
||||
DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
|
||||
DBUG_ASSERT(arg_count == 2);
|
||||
|
||||
/* Transform the left IN operand. */
|
||||
new_item= (*args)->transform(transformer, argument);
|
||||
new_item= (*args)->transform(thd, transformer, argument);
|
||||
if (!new_item)
|
||||
return 0;
|
||||
/*
|
||||
@ -1821,16 +1820,16 @@ Item *Item_in_optimizer::transform(Item_transformer transformer,
|
||||
change records at each execution.
|
||||
*/
|
||||
if ((*args) != new_item)
|
||||
current_thd->change_item_tree(args, new_item);
|
||||
thd->change_item_tree(args, new_item);
|
||||
|
||||
if (invisible_mode())
|
||||
{
|
||||
/* MAX/MIN transformed => pass through */
|
||||
new_item= args[1]->transform(transformer, argument);
|
||||
new_item= args[1]->transform(thd, transformer, argument);
|
||||
if (!new_item)
|
||||
return 0;
|
||||
if (args[1] != new_item)
|
||||
current_thd->change_item_tree(args + 1, new_item);
|
||||
thd->change_item_tree(args + 1, new_item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1852,7 +1851,7 @@ Item *Item_in_optimizer::transform(Item_transformer transformer,
|
||||
Item_in_subselect *in_arg= (Item_in_subselect*)args[1];
|
||||
current_thd->change_item_tree(&in_arg->left_expr, args[0]);
|
||||
}
|
||||
return (this->*transformer)(argument);
|
||||
return (this->*transformer)(thd, argument);
|
||||
}
|
||||
|
||||
|
||||
@ -4285,7 +4284,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
|
||||
Query_arena backup, *arena;
|
||||
Item *new_item;
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
if ((new_item= new Item_func_ne(item, new Item_int(0, 1))))
|
||||
if ((new_item= new Item_func_ne(thd, item, new Item_int(thd, 0, 1))))
|
||||
li.replace(item= new_item);
|
||||
if (arena)
|
||||
thd->restore_active_arena(arena, &backup);
|
||||
@ -4450,15 +4449,15 @@ bool Item_cond_and::walk_top_and(Item_processor processor, uchar *arg)
|
||||
Item returned as the result of transformation of the root node
|
||||
*/
|
||||
|
||||
Item *Item_cond::transform(Item_transformer transformer, uchar *arg)
|
||||
Item *Item_cond::transform(THD *thd, Item_transformer transformer, uchar *arg)
|
||||
{
|
||||
DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
|
||||
DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
|
||||
|
||||
List_iterator<Item> li(list);
|
||||
Item *item;
|
||||
while ((item= li++))
|
||||
{
|
||||
Item *new_item= item->transform(transformer, arg);
|
||||
Item *new_item= item->transform(thd, transformer, arg);
|
||||
if (!new_item)
|
||||
return 0;
|
||||
|
||||
@ -4469,9 +4468,9 @@ Item *Item_cond::transform(Item_transformer transformer, uchar *arg)
|
||||
change records at each execution.
|
||||
*/
|
||||
if (new_item != item)
|
||||
current_thd->change_item_tree(li.ref(), new_item);
|
||||
thd->change_item_tree(li.ref(), new_item);
|
||||
}
|
||||
return Item_func::transform(transformer, arg);
|
||||
return Item_func::transform(thd, transformer, arg);
|
||||
}
|
||||
|
||||
|
||||
@ -4499,7 +4498,7 @@ Item *Item_cond::transform(Item_transformer transformer, uchar *arg)
|
||||
Item returned as the result of transformation of the root node
|
||||
*/
|
||||
|
||||
Item *Item_cond::compile(Item_analyzer analyzer, uchar **arg_p,
|
||||
Item *Item_cond::compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
|
||||
Item_transformer transformer, uchar *arg_t)
|
||||
{
|
||||
if (!(this->*analyzer)(arg_p))
|
||||
@ -4514,11 +4513,11 @@ Item *Item_cond::compile(Item_analyzer analyzer, uchar **arg_p,
|
||||
to analyze any argument of the condition formula.
|
||||
*/
|
||||
uchar *arg_v= *arg_p;
|
||||
Item *new_item= item->compile(analyzer, &arg_v, transformer, arg_t);
|
||||
Item *new_item= item->compile(thd, analyzer, &arg_v, transformer, arg_t);
|
||||
if (new_item && new_item != item)
|
||||
current_thd->change_item_tree(li.ref(), new_item);
|
||||
thd->change_item_tree(li.ref(), new_item);
|
||||
}
|
||||
return Item_func::transform(transformer, arg_t);
|
||||
return Item_func::transform(thd, transformer, arg_t);
|
||||
}
|
||||
|
||||
void Item_cond::traverse_cond(Cond_traverser traverser,
|
||||
@ -4607,7 +4606,7 @@ void Item_cond::neg_arguments(THD *thd)
|
||||
Item *new_item= item->neg_transformer(thd);
|
||||
if (!new_item)
|
||||
{
|
||||
if (!(new_item= new Item_func_not(item)))
|
||||
if (!(new_item= new Item_func_not(thd, item)))
|
||||
return; // Fatal OEM error
|
||||
}
|
||||
(void) li.replace(new_item);
|
||||
@ -4703,14 +4702,14 @@ longlong Item_cond_or::val_int()
|
||||
Item
|
||||
*/
|
||||
|
||||
Item *and_expressions(Item *a, Item *b, Item **org_item)
|
||||
Item *and_expressions(THD *thd, Item *a, Item *b, Item **org_item)
|
||||
{
|
||||
if (!a)
|
||||
return (*org_item= (Item*) b);
|
||||
if (a == *org_item)
|
||||
{
|
||||
Item_cond *res;
|
||||
if ((res= new Item_cond_and(a, (Item*) b)))
|
||||
if ((res= new Item_cond_and(thd, a, (Item*) b)))
|
||||
{
|
||||
res->used_tables_cache= a->used_tables() | b->used_tables();
|
||||
res->not_null_tables_cache= a->not_null_tables() | b->not_null_tables();
|
||||
@ -5528,7 +5527,7 @@ bool Item_func_not::fix_fields(THD *thd, Item **ref)
|
||||
Item *new_item;
|
||||
bool rc= TRUE;
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
if ((new_item= new Item_func_eq(args[0], new Item_int(0, 1))))
|
||||
if ((new_item= new Item_func_eq(thd, args[0], new Item_int(thd, 0, 1))))
|
||||
{
|
||||
new_item->name= name;
|
||||
rc= (*ref= new_item)->fix_fields(thd, ref);
|
||||
@ -5543,7 +5542,7 @@ bool Item_func_not::fix_fields(THD *thd, Item **ref)
|
||||
|
||||
Item *Item_bool_rowready_func2::neg_transformer(THD *thd)
|
||||
{
|
||||
Item *item= negated_item();
|
||||
Item *item= negated_item(thd);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -5562,14 +5561,14 @@ Item *Item_func_xor::neg_transformer(THD *thd)
|
||||
Item_func_xor *new_item;
|
||||
if ((neg_operand= args[0]->neg_transformer(thd)))
|
||||
// args[0] has neg_tranformer
|
||||
new_item= new(thd->mem_root) Item_func_xor(neg_operand, args[1]);
|
||||
new_item= new(thd->mem_root) Item_func_xor(thd, neg_operand, args[1]);
|
||||
else if ((neg_operand= args[1]->neg_transformer(thd)))
|
||||
// args[1] has neg_tranformer
|
||||
new_item= new(thd->mem_root) Item_func_xor(args[0], neg_operand);
|
||||
new_item= new(thd->mem_root) Item_func_xor(thd, args[0], neg_operand);
|
||||
else
|
||||
{
|
||||
neg_operand= new(thd->mem_root) Item_func_not(args[0]);
|
||||
new_item= new(thd->mem_root) Item_func_xor(neg_operand, args[1]);
|
||||
neg_operand= new(thd->mem_root) Item_func_not(thd, args[0]);
|
||||
new_item= new(thd->mem_root) Item_func_xor(thd, neg_operand, args[1]);
|
||||
}
|
||||
return new_item;
|
||||
}
|
||||
@ -5580,7 +5579,7 @@ Item *Item_func_xor::neg_transformer(THD *thd)
|
||||
*/
|
||||
Item *Item_func_isnull::neg_transformer(THD *thd)
|
||||
{
|
||||
Item *item= new Item_func_isnotnull(args[0]);
|
||||
Item *item= new Item_func_isnotnull(thd, args[0]);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -5590,7 +5589,7 @@ Item *Item_func_isnull::neg_transformer(THD *thd)
|
||||
*/
|
||||
Item *Item_func_isnotnull::neg_transformer(THD *thd)
|
||||
{
|
||||
Item *item= new Item_func_isnull(args[0]);
|
||||
Item *item= new Item_func_isnull(thd, args[0]);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -5599,7 +5598,7 @@ Item *Item_cond_and::neg_transformer(THD *thd) /* NOT(a AND b AND ...) -> */
|
||||
/* NOT a OR NOT b OR ... */
|
||||
{
|
||||
neg_arguments(thd);
|
||||
Item *item= new Item_cond_or(list);
|
||||
Item *item= new Item_cond_or(thd, list);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -5608,7 +5607,7 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */
|
||||
/* NOT a AND NOT b AND ... */
|
||||
{
|
||||
neg_arguments(thd);
|
||||
Item *item= new Item_cond_and(list);
|
||||
Item *item= new Item_cond_and(thd, list);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -5616,7 +5615,7 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */
|
||||
Item *Item_func_nop_all::neg_transformer(THD *thd)
|
||||
{
|
||||
/* "NOT (e $cmp$ ANY (SELECT ...)) -> e $rev_cmp$" ALL (SELECT ...) */
|
||||
Item_func_not_all *new_item= new Item_func_not_all(args[0]);
|
||||
Item_func_not_all *new_item= new Item_func_not_all(thd, args[0]);
|
||||
Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
|
||||
allany->create_comp_func(FALSE);
|
||||
allany->all= !allany->all;
|
||||
@ -5627,7 +5626,7 @@ Item *Item_func_nop_all::neg_transformer(THD *thd)
|
||||
Item *Item_func_not_all::neg_transformer(THD *thd)
|
||||
{
|
||||
/* "NOT (e $cmp$ ALL (SELECT ...)) -> e $rev_cmp$" ANY (SELECT ...) */
|
||||
Item_func_nop_all *new_item= new Item_func_nop_all(args[0]);
|
||||
Item_func_nop_all *new_item= new Item_func_nop_all(thd, args[0]);
|
||||
Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
|
||||
allany->all= !allany->all;
|
||||
allany->create_comp_func(TRUE);
|
||||
@ -5635,45 +5634,45 @@ Item *Item_func_not_all::neg_transformer(THD *thd)
|
||||
return new_item;
|
||||
}
|
||||
|
||||
Item *Item_func_eq::negated_item() /* a = b -> a != b */
|
||||
Item *Item_func_eq::negated_item(THD *thd) /* a = b -> a != b */
|
||||
{
|
||||
return new Item_func_ne(args[0], args[1]);
|
||||
return new Item_func_ne(thd, args[0], args[1]);
|
||||
}
|
||||
|
||||
|
||||
Item *Item_func_ne::negated_item() /* a != b -> a = b */
|
||||
Item *Item_func_ne::negated_item(THD *thd) /* a != b -> a = b */
|
||||
{
|
||||
return new Item_func_eq(args[0], args[1]);
|
||||
return new Item_func_eq(thd, args[0], args[1]);
|
||||
}
|
||||
|
||||
|
||||
Item *Item_func_lt::negated_item() /* a < b -> a >= b */
|
||||
Item *Item_func_lt::negated_item(THD *thd) /* a < b -> a >= b */
|
||||
{
|
||||
return new Item_func_ge(args[0], args[1]);
|
||||
return new Item_func_ge(thd, args[0], args[1]);
|
||||
}
|
||||
|
||||
|
||||
Item *Item_func_ge::negated_item() /* a >= b -> a < b */
|
||||
Item *Item_func_ge::negated_item(THD *thd) /* a >= b -> a < b */
|
||||
{
|
||||
return new Item_func_lt(args[0], args[1]);
|
||||
return new Item_func_lt(thd, args[0], args[1]);
|
||||
}
|
||||
|
||||
|
||||
Item *Item_func_gt::negated_item() /* a > b -> a <= b */
|
||||
Item *Item_func_gt::negated_item(THD *thd) /* a > b -> a <= b */
|
||||
{
|
||||
return new Item_func_le(args[0], args[1]);
|
||||
return new Item_func_le(thd, args[0], args[1]);
|
||||
}
|
||||
|
||||
|
||||
Item *Item_func_le::negated_item() /* a <= b -> a > b */
|
||||
Item *Item_func_le::negated_item(THD *thd) /* a <= b -> a > b */
|
||||
{
|
||||
return new Item_func_gt(args[0], args[1]);
|
||||
return new Item_func_gt(thd, args[0], args[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
just fake method, should never be called.
|
||||
*/
|
||||
Item *Item_bool_rowready_func2::negated_item()
|
||||
Item *Item_bool_rowready_func2::negated_item(THD *thd)
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return 0;
|
||||
@ -5696,14 +5695,14 @@ Item *Item_bool_rowready_func2::negated_item()
|
||||
of the type Item_field or Item_direct_view_ref(Item_field).
|
||||
*/
|
||||
|
||||
Item_equal::Item_equal(THD *thd_arg, Item *f1, Item *f2, bool with_const_item)
|
||||
: Item_bool_func(), eval_item(0), cond_false(0), cond_true(0),
|
||||
context_field(NULL), link_equal_fields(FALSE)
|
||||
Item_equal::Item_equal(THD *thd, Item *f1, Item *f2, bool with_const_item):
|
||||
Item_bool_func(thd), eval_item(0), cond_false(0), cond_true(0),
|
||||
context_field(NULL), link_equal_fields(FALSE)
|
||||
{
|
||||
const_item_cache= 0;
|
||||
with_const= with_const_item;
|
||||
equal_items.push_back(f1, thd_arg->mem_root);
|
||||
equal_items.push_back(f2, thd_arg->mem_root);
|
||||
equal_items.push_back(f1, thd->mem_root);
|
||||
equal_items.push_back(f2, thd->mem_root);
|
||||
compare_as_dates= with_const_item && f2->cmp_type() == TIME_RESULT;
|
||||
upper_levels= NULL;
|
||||
}
|
||||
@ -5721,16 +5720,16 @@ Item_equal::Item_equal(THD *thd_arg, Item *f1, Item *f2, bool with_const_item)
|
||||
outer join).
|
||||
*/
|
||||
|
||||
Item_equal::Item_equal(THD *thd_arg, Item_equal *item_equal)
|
||||
: Item_bool_func(), eval_item(0), cond_false(0), cond_true(0),
|
||||
context_field(NULL), link_equal_fields(FALSE)
|
||||
Item_equal::Item_equal(THD *thd, Item_equal *item_equal):
|
||||
Item_bool_func(thd), eval_item(0), cond_false(0), cond_true(0),
|
||||
context_field(NULL), link_equal_fields(FALSE)
|
||||
{
|
||||
const_item_cache= 0;
|
||||
List_iterator_fast<Item> li(item_equal->equal_items);
|
||||
Item *item;
|
||||
while ((item= li++))
|
||||
{
|
||||
equal_items.push_back(item, thd_arg->mem_root);
|
||||
equal_items.push_back(item, thd->mem_root);
|
||||
}
|
||||
with_const= item_equal->with_const;
|
||||
compare_as_dates= item_equal->compare_as_dates;
|
||||
@ -5776,7 +5775,7 @@ void Item_equal::add_const(THD *thd, Item *c, Item *f)
|
||||
}
|
||||
else
|
||||
{
|
||||
Item_func_eq *func= new (thd->mem_root) Item_func_eq(c, const_item);
|
||||
Item_func_eq *func= new (thd->mem_root) Item_func_eq(thd, c, const_item);
|
||||
if (func->set_cmp_func())
|
||||
{
|
||||
/*
|
||||
@ -6216,15 +6215,15 @@ bool Item_equal::walk(Item_processor processor, bool walk_subquery, uchar *arg)
|
||||
}
|
||||
|
||||
|
||||
Item *Item_equal::transform(Item_transformer transformer, uchar *arg)
|
||||
Item *Item_equal::transform(THD *thd, Item_transformer transformer, uchar *arg)
|
||||
{
|
||||
DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
|
||||
DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
|
||||
|
||||
Item *item;
|
||||
Item_equal_fields_iterator it(*this);
|
||||
while ((item= it++))
|
||||
{
|
||||
Item *new_item= item->transform(transformer, arg);
|
||||
Item *new_item= item->transform(thd, transformer, arg);
|
||||
if (!new_item)
|
||||
return 0;
|
||||
|
||||
@ -6235,9 +6234,9 @@ Item *Item_equal::transform(Item_transformer transformer, uchar *arg)
|
||||
change records at each execution.
|
||||
*/
|
||||
if (new_item != item)
|
||||
current_thd->change_item_tree((Item **) it.ref(), new_item);
|
||||
thd->change_item_tree((Item **) it.ref(), new_item);
|
||||
}
|
||||
return Item_func::transform(transformer, arg);
|
||||
return Item_func::transform(thd, transformer, arg);
|
||||
}
|
||||
|
||||
|
||||
@ -6477,3 +6476,75 @@ null:
|
||||
null_value= TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2 *Eq_creator::create(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_eq(thd, a, b);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Eq_creator::create_swap(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_eq(thd, b, a);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Ne_creator::create(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_ne(thd, a, b);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Ne_creator::create_swap(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_ne(thd, b, a);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Gt_creator::create(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_gt(thd, a, b);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Gt_creator::create_swap(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_lt(thd, b, a);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Lt_creator::create(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_lt(thd, a, b);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Lt_creator::create_swap(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_gt(thd, b, a);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Ge_creator::create(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_ge(thd, a, b);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Ge_creator::create_swap(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_le(thd, b, a);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Le_creator::create(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_le(thd, a, b);
|
||||
}
|
||||
|
||||
|
||||
Item_bool_rowready_func2* Le_creator::create_swap(THD *thd, Item *a, Item *b) const
|
||||
{
|
||||
return new(thd->mem_root) Item_func_ge(thd, b, a);
|
||||
}
|
||||
|
@ -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; }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -319,11 +319,11 @@ void Item_func::traverse_cond(Cond_traverser traverser,
|
||||
}
|
||||
|
||||
|
||||
bool Item_args::transform_args(Item_transformer transformer, uchar *arg)
|
||||
bool Item_args::transform_args(THD *thd, Item_transformer transformer, uchar *arg)
|
||||
{
|
||||
for (uint i= 0; i < arg_count; i++)
|
||||
{
|
||||
Item *new_item= args[i]->transform(transformer, arg);
|
||||
Item *new_item= args[i]->transform(thd, transformer, arg);
|
||||
if (!new_item)
|
||||
return true;
|
||||
/*
|
||||
@ -333,7 +333,7 @@ bool Item_args::transform_args(Item_transformer transformer, uchar *arg)
|
||||
change records at each execution.
|
||||
*/
|
||||
if (args[i] != new_item)
|
||||
current_thd->change_item_tree(&args[i], new_item);
|
||||
thd->change_item_tree(&args[i], new_item);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -356,12 +356,12 @@ bool Item_args::transform_args(Item_transformer transformer, uchar *arg)
|
||||
Item returned as the result of transformation of the root node
|
||||
*/
|
||||
|
||||
Item *Item_func::transform(Item_transformer transformer, uchar *argument)
|
||||
Item *Item_func::transform(THD *thd, Item_transformer transformer, uchar *argument)
|
||||
{
|
||||
DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
|
||||
if (transform_args(transformer, argument))
|
||||
DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
|
||||
if (transform_args(thd, transformer, argument))
|
||||
return 0;
|
||||
return (this->*transformer)(argument);
|
||||
return (this->*transformer)(thd, argument);
|
||||
}
|
||||
|
||||
|
||||
@ -391,7 +391,7 @@ Item *Item_func::transform(Item_transformer transformer, uchar *argument)
|
||||
Item returned as the result of transformation of the root node
|
||||
*/
|
||||
|
||||
Item *Item_func::compile(Item_analyzer analyzer, uchar **arg_p,
|
||||
Item *Item_func::compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
|
||||
Item_transformer transformer, uchar *arg_t)
|
||||
{
|
||||
if (!(this->*analyzer)(arg_p))
|
||||
@ -406,12 +406,13 @@ Item *Item_func::compile(Item_analyzer analyzer, uchar **arg_p,
|
||||
to analyze any argument of the condition formula.
|
||||
*/
|
||||
uchar *arg_v= *arg_p;
|
||||
Item *new_item= (*arg)->compile(analyzer, &arg_v, transformer, arg_t);
|
||||
Item *new_item= (*arg)->compile(thd, analyzer, &arg_v, transformer,
|
||||
arg_t);
|
||||
if (new_item && *arg != new_item)
|
||||
current_thd->change_item_tree(arg, new_item);
|
||||
thd->change_item_tree(arg, new_item);
|
||||
}
|
||||
}
|
||||
return (this->*transformer)(arg_t);
|
||||
return (this->*transformer)(thd, arg_t);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -726,7 +727,7 @@ void Item_func::signal_divide_by_null()
|
||||
Item *Item_func::get_tmp_table_item(THD *thd)
|
||||
{
|
||||
if (!with_sum_func && !const_item())
|
||||
return new Item_field(result_field);
|
||||
return new Item_field(thd, result_field);
|
||||
return copy_or_same(thd);
|
||||
}
|
||||
|
||||
@ -5533,8 +5534,8 @@ get_var_with_binlog(THD *thd, enum_sql_command sql_command,
|
||||
LEX *sav_lex= thd->lex, lex_tmp;
|
||||
thd->lex= &lex_tmp;
|
||||
lex_start(thd);
|
||||
tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name,
|
||||
new Item_null())));
|
||||
tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(thd, name,
|
||||
new Item_null(thd))));
|
||||
/* Create the variable */
|
||||
if (sql_set_variables(thd, &tmp_var_list, false))
|
||||
{
|
||||
@ -5698,7 +5699,7 @@ bool Item_func_get_user_var::eq(const Item *item, bool binary_cmp) const
|
||||
bool Item_func_get_user_var::set_value(THD *thd,
|
||||
sp_rcontext * /*ctx*/, Item **it)
|
||||
{
|
||||
Item_func_set_user_var *suv= new Item_func_set_user_var(get_name(), *it);
|
||||
Item_func_set_user_var *suv= new Item_func_set_user_var(thd, get_name(), *it);
|
||||
/*
|
||||
Item_func_set_user_var is not fixed after construction, call
|
||||
fix_fields().
|
||||
@ -5779,11 +5780,11 @@ void Item_user_var_as_out_param::print_for_load(THD *thd, String *str)
|
||||
|
||||
|
||||
Item_func_get_system_var::
|
||||
Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
|
||||
Item_func_get_system_var(THD *thd, sys_var *var_arg, enum_var_type var_type_arg,
|
||||
LEX_STRING *component_arg, const char *name_arg,
|
||||
size_t name_len_arg)
|
||||
:var(var_arg), var_type(var_type_arg), orig_var_type(var_type_arg),
|
||||
component(*component_arg), cache_present(0)
|
||||
size_t name_len_arg):
|
||||
Item_func(thd), var(var_arg), var_type(var_type_arg),
|
||||
orig_var_type(var_type_arg), component(*component_arg), cache_present(0)
|
||||
{
|
||||
/* set_name() will allocate the name */
|
||||
set_name(name_arg, (uint) name_len_arg, system_charset_info);
|
||||
@ -6095,7 +6096,7 @@ void Item_func_get_system_var::cleanup()
|
||||
}
|
||||
|
||||
|
||||
void Item_func_match::init_search(bool no_order)
|
||||
void Item_func_match::init_search(THD *thd, bool no_order)
|
||||
{
|
||||
DBUG_ENTER("Item_func_match::init_search");
|
||||
|
||||
@ -6113,10 +6114,10 @@ void Item_func_match::init_search(bool no_order)
|
||||
if (key == NO_SUCH_KEY)
|
||||
{
|
||||
List<Item> fields;
|
||||
fields.push_back(new Item_string(" ", 1, cmp_collation.collation));
|
||||
fields.push_back(new Item_string(thd, " ", 1, cmp_collation.collation));
|
||||
for (uint i= 1; i < arg_count; i++)
|
||||
fields.push_back(args[i]);
|
||||
concat_ws= new Item_func_concat_ws(fields);
|
||||
concat_ws= new Item_func_concat_ws(thd, fields);
|
||||
/*
|
||||
Above function used only to get value and do not need fix_fields for it:
|
||||
Item_string - basic constant
|
||||
@ -6129,7 +6130,7 @@ void Item_func_match::init_search(bool no_order)
|
||||
if (master)
|
||||
{
|
||||
join_key= master->join_key= join_key | master->join_key;
|
||||
master->init_search(no_order);
|
||||
master->init_search(thd, no_order);
|
||||
ft_handler= master->ft_handler;
|
||||
join_key= master->join_key;
|
||||
DBUG_VOID_RETURN;
|
||||
@ -6464,7 +6465,7 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
|
||||
|
||||
set_if_smaller(component_name->length, MAX_SYS_VAR_LENGTH);
|
||||
|
||||
return new Item_func_get_system_var(var, var_type, component_name,
|
||||
return new Item_func_get_system_var(thd, var, var_type, component_name,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
@ -6480,8 +6481,9 @@ longlong Item_func_row_count::val_int()
|
||||
|
||||
|
||||
|
||||
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
|
||||
:Item_func(), context(context_arg), m_name(name), m_sp(NULL), sp_result_field(NULL)
|
||||
Item_func_sp::Item_func_sp(THD *thd, Name_resolution_context *context_arg,
|
||||
sp_name *name):
|
||||
Item_func(thd), context(context_arg), m_name(name), m_sp(NULL), sp_result_field(NULL)
|
||||
{
|
||||
maybe_null= 1;
|
||||
m_name->init_qname(current_thd);
|
||||
@ -6490,10 +6492,10 @@ Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
|
||||
}
|
||||
|
||||
|
||||
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
|
||||
sp_name *name_arg, List<Item> &list)
|
||||
:Item_func(list), context(context_arg), m_name(name_arg), m_sp(NULL),
|
||||
sp_result_field(NULL)
|
||||
Item_func_sp::Item_func_sp(THD *thd, Name_resolution_context *context_arg,
|
||||
sp_name *name_arg, List<Item> &list):
|
||||
Item_func(thd, list), context(context_arg), m_name(name_arg), m_sp(NULL),
|
||||
sp_result_field(NULL)
|
||||
{
|
||||
maybe_null= 1;
|
||||
m_name->init_qname(current_thd);
|
||||
|
395
sql/item_func.h
395
sql/item_func.h
File diff suppressed because it is too large
Load Diff
@ -32,11 +32,12 @@
|
||||
class Item_geometry_func: public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_geometry_func() :Item_str_func() {}
|
||||
Item_geometry_func(Item *a) :Item_str_func(a) {}
|
||||
Item_geometry_func(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_geometry_func(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
|
||||
Item_geometry_func(List<Item> &list) :Item_str_func(list) {}
|
||||
Item_geometry_func(THD *thd): Item_str_func(thd) {}
|
||||
Item_geometry_func(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
Item_geometry_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
Item_geometry_func(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_str_func(thd, a, b, c) {}
|
||||
Item_geometry_func(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
|
||||
void fix_length_and_dec();
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
|
||||
Field *tmp_table_field(TABLE *t_arg);
|
||||
@ -46,8 +47,9 @@ public:
|
||||
class Item_func_geometry_from_text: public Item_geometry_func
|
||||
{
|
||||
public:
|
||||
Item_func_geometry_from_text(Item *a) :Item_geometry_func(a) {}
|
||||
Item_func_geometry_from_text(Item *a, Item *srid) :Item_geometry_func(a, srid) {}
|
||||
Item_func_geometry_from_text(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
Item_func_geometry_from_text(THD *thd, Item *a, Item *srid):
|
||||
Item_geometry_func(thd, a, srid) {}
|
||||
const char *func_name() const { return "st_geometryfromtext"; }
|
||||
String *val_str(String *);
|
||||
};
|
||||
@ -55,8 +57,9 @@ public:
|
||||
class Item_func_geometry_from_wkb: public Item_geometry_func
|
||||
{
|
||||
public:
|
||||
Item_func_geometry_from_wkb(Item *a): Item_geometry_func(a) {}
|
||||
Item_func_geometry_from_wkb(Item *a, Item *srid): Item_geometry_func(a, srid) {}
|
||||
Item_func_geometry_from_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
Item_func_geometry_from_wkb(THD *thd, Item *a, Item *srid):
|
||||
Item_geometry_func(thd, a, srid) {}
|
||||
const char *func_name() const { return "st_geometryfromwkb"; }
|
||||
String *val_str(String *);
|
||||
};
|
||||
@ -64,7 +67,7 @@ public:
|
||||
class Item_func_as_wkt: public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
Item_func_as_wkt(Item *a): Item_str_ascii_func(a) {}
|
||||
Item_func_as_wkt(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
|
||||
const char *func_name() const { return "st_astext"; }
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec();
|
||||
@ -73,7 +76,7 @@ public:
|
||||
class Item_func_as_wkb: public Item_geometry_func
|
||||
{
|
||||
public:
|
||||
Item_func_as_wkb(Item *a): Item_geometry_func(a) {}
|
||||
Item_func_as_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
const char *func_name() const { return "st_aswkb"; }
|
||||
String *val_str(String *);
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
|
||||
@ -82,7 +85,7 @@ public:
|
||||
class Item_func_geometry_type: public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
Item_func_geometry_type(Item *a): Item_str_ascii_func(a) {}
|
||||
Item_func_geometry_type(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
|
||||
String *val_str_ascii(String *);
|
||||
const char *func_name() const { return "st_geometrytype"; }
|
||||
void fix_length_and_dec()
|
||||
@ -118,7 +121,7 @@ class Item_func_convexhull: public Item_geometry_func
|
||||
ch_node *new_ch_node() { return (ch_node *) res_heap.new_item(); }
|
||||
int add_node_to_line(ch_node **p_cur, int dir, const Gcalc_heap::Info *pi);
|
||||
public:
|
||||
Item_func_convexhull(Item *a): Item_geometry_func(a),
|
||||
Item_func_convexhull(THD *thd, Item *a): Item_geometry_func(thd, a),
|
||||
res_heap(8192, sizeof(ch_node))
|
||||
{}
|
||||
const char *func_name() const { return "st_convexhull"; }
|
||||
@ -129,7 +132,7 @@ public:
|
||||
class Item_func_centroid: public Item_geometry_func
|
||||
{
|
||||
public:
|
||||
Item_func_centroid(Item *a): Item_geometry_func(a) {}
|
||||
Item_func_centroid(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
const char *func_name() const { return "st_centroid"; }
|
||||
String *val_str(String *);
|
||||
Field::geometry_type get_geometry_type() const;
|
||||
@ -138,7 +141,7 @@ public:
|
||||
class Item_func_envelope: public Item_geometry_func
|
||||
{
|
||||
public:
|
||||
Item_func_envelope(Item *a): Item_geometry_func(a) {}
|
||||
Item_func_envelope(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
const char *func_name() const { return "st_envelope"; }
|
||||
String *val_str(String *);
|
||||
Field::geometry_type get_geometry_type() const;
|
||||
@ -170,7 +173,7 @@ class Item_func_boundary: public Item_geometry_func
|
||||
};
|
||||
Gcalc_result_receiver res_receiver;
|
||||
public:
|
||||
Item_func_boundary(Item *a): Item_geometry_func(a) {}
|
||||
Item_func_boundary(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
const char *func_name() const { return "st_boundary"; }
|
||||
String *val_str(String *);
|
||||
};
|
||||
@ -179,8 +182,9 @@ public:
|
||||
class Item_func_point: public Item_geometry_func
|
||||
{
|
||||
public:
|
||||
Item_func_point(Item *a, Item *b): Item_geometry_func(a, b) {}
|
||||
Item_func_point(Item *a, Item *b, Item *srid): Item_geometry_func(a, b, srid) {}
|
||||
Item_func_point(THD *thd, Item *a, Item *b): Item_geometry_func(thd, a, b) {}
|
||||
Item_func_point(THD *thd, Item *a, Item *b, Item *srid):
|
||||
Item_geometry_func(thd, a, b, srid) {}
|
||||
const char *func_name() const { return "point"; }
|
||||
String *val_str(String *);
|
||||
Field::geometry_type get_geometry_type() const;
|
||||
@ -190,8 +194,8 @@ class Item_func_spatial_decomp: public Item_geometry_func
|
||||
{
|
||||
enum Functype decomp_func;
|
||||
public:
|
||||
Item_func_spatial_decomp(Item *a, Item_func::Functype ft) :
|
||||
Item_geometry_func(a) { decomp_func = ft; }
|
||||
Item_func_spatial_decomp(THD *thd, Item *a, Item_func::Functype ft):
|
||||
Item_geometry_func(thd, a) { decomp_func = ft; }
|
||||
const char *func_name() const
|
||||
{
|
||||
switch (decomp_func)
|
||||
@ -214,8 +218,8 @@ class Item_func_spatial_decomp_n: public Item_geometry_func
|
||||
{
|
||||
enum Functype decomp_func_n;
|
||||
public:
|
||||
Item_func_spatial_decomp_n(Item *a, Item *b, Item_func::Functype ft):
|
||||
Item_geometry_func(a, b) { decomp_func_n = ft; }
|
||||
Item_func_spatial_decomp_n(THD *thd, Item *a, Item *b, Item_func::Functype ft):
|
||||
Item_geometry_func(thd, a, b) { decomp_func_n = ft; }
|
||||
const char *func_name() const
|
||||
{
|
||||
switch (decomp_func_n)
|
||||
@ -240,9 +244,9 @@ class Item_func_spatial_collection: public Item_geometry_func
|
||||
enum Geometry::wkbType coll_type;
|
||||
enum Geometry::wkbType item_type;
|
||||
public:
|
||||
Item_func_spatial_collection(
|
||||
Item_func_spatial_collection(THD *thd,
|
||||
List<Item> &list, enum Geometry::wkbType ct, enum Geometry::wkbType it):
|
||||
Item_geometry_func(list)
|
||||
Item_geometry_func(thd, list)
|
||||
{
|
||||
coll_type=ct;
|
||||
item_type=it;
|
||||
@ -281,8 +285,8 @@ protected:
|
||||
KEY_PART *key_part,
|
||||
Item_func::Functype type, Item *value);
|
||||
public:
|
||||
Item_func_spatial_rel(Item *a, Item *b, enum Functype sp_rel)
|
||||
:Item_bool_func2(a, b), spatial_rel(sp_rel)
|
||||
Item_func_spatial_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
|
||||
Item_bool_func2(thd, a, b), spatial_rel(sp_rel)
|
||||
{ }
|
||||
enum Functype functype() const { return spatial_rel; }
|
||||
enum Functype rev_functype() const { return spatial_rel; }
|
||||
@ -300,8 +304,8 @@ public:
|
||||
class Item_func_spatial_mbr_rel: public Item_func_spatial_rel
|
||||
{
|
||||
public:
|
||||
Item_func_spatial_mbr_rel(Item *a, Item *b, enum Functype sp_rel)
|
||||
:Item_func_spatial_rel(a, b, sp_rel)
|
||||
Item_func_spatial_mbr_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
|
||||
Item_func_spatial_rel(thd, a, b, sp_rel)
|
||||
{ }
|
||||
longlong val_int();
|
||||
const char *func_name() const;
|
||||
@ -314,8 +318,8 @@ class Item_func_spatial_precise_rel: public Item_func_spatial_rel
|
||||
Gcalc_scan_iterator scan_it;
|
||||
Gcalc_function func;
|
||||
public:
|
||||
Item_func_spatial_precise_rel(Item *a, Item *b, enum Functype sp_rel)
|
||||
:Item_func_spatial_rel(a, b, sp_rel), collector()
|
||||
Item_func_spatial_precise_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
|
||||
Item_func_spatial_rel(thd, a, b, sp_rel), collector()
|
||||
{ }
|
||||
longlong val_int();
|
||||
const char *func_name() const;
|
||||
@ -329,8 +333,8 @@ class Item_func_spatial_relate: public Item_bool_func
|
||||
Gcalc_function func;
|
||||
String tmp_value1, tmp_value2, tmp_matrix;
|
||||
public:
|
||||
Item_func_spatial_relate(Item *a, Item *b, Item *matrix)
|
||||
:Item_bool_func(a, b, matrix)
|
||||
Item_func_spatial_relate(THD *thd, Item *a, Item *b, Item *matrix):
|
||||
Item_bool_func(thd, a, b, matrix)
|
||||
{ }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_relate"; }
|
||||
@ -352,8 +356,9 @@ public:
|
||||
Gcalc_operation_reducer operation;
|
||||
String tmp_value1,tmp_value2;
|
||||
public:
|
||||
Item_func_spatial_operation(Item *a,Item *b, Gcalc_function::op_type sp_op) :
|
||||
Item_geometry_func(a, b), spatial_op(sp_op)
|
||||
Item_func_spatial_operation(THD *thd, Item *a,Item *b,
|
||||
Gcalc_function::op_type sp_op):
|
||||
Item_geometry_func(thd, a, b), spatial_op(sp_op)
|
||||
{}
|
||||
virtual ~Item_func_spatial_operation();
|
||||
String *val_str(String *);
|
||||
@ -409,8 +414,8 @@ protected:
|
||||
String tmp_value;
|
||||
|
||||
public:
|
||||
Item_func_buffer(Item *obj, Item *distance):
|
||||
Item_geometry_func(obj, distance) {}
|
||||
Item_func_buffer(THD *thd, Item *obj, Item *distance):
|
||||
Item_geometry_func(thd, obj, distance) {}
|
||||
const char *func_name() const { return "st_buffer"; }
|
||||
String *val_str(String *);
|
||||
};
|
||||
@ -419,7 +424,7 @@ public:
|
||||
class Item_func_isempty: public Item_bool_func
|
||||
{
|
||||
public:
|
||||
Item_func_isempty(Item *a): Item_bool_func(a) {}
|
||||
Item_func_isempty(THD *thd, Item *a): Item_bool_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_isempty"; }
|
||||
void fix_length_and_dec() { maybe_null= 1; }
|
||||
@ -432,7 +437,7 @@ class Item_func_issimple: public Item_int_func
|
||||
Gcalc_scan_iterator scan_it;
|
||||
String tmp;
|
||||
public:
|
||||
Item_func_issimple(Item *a): Item_int_func(a) {}
|
||||
Item_func_issimple(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_issimple"; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=2; }
|
||||
@ -442,7 +447,7 @@ public:
|
||||
class Item_func_isclosed: public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_isclosed(Item *a): Item_int_func(a) {}
|
||||
Item_func_isclosed(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_isclosed"; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=2; }
|
||||
@ -452,7 +457,7 @@ public:
|
||||
class Item_func_isring: public Item_func_issimple
|
||||
{
|
||||
public:
|
||||
Item_func_isring(Item *a): Item_func_issimple(a) {}
|
||||
Item_func_isring(THD *thd, Item *a): Item_func_issimple(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_isring"; }
|
||||
};
|
||||
@ -461,7 +466,7 @@ class Item_func_dimension: public Item_int_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_dimension(Item *a): Item_int_func(a) {}
|
||||
Item_func_dimension(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_dimension"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -471,7 +476,7 @@ class Item_func_x: public Item_real_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_x(Item *a): Item_real_func(a) {}
|
||||
Item_func_x(THD *thd, Item *a): Item_real_func(thd, a) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_x"; }
|
||||
void fix_length_and_dec()
|
||||
@ -486,7 +491,7 @@ class Item_func_y: public Item_real_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_y(Item *a): Item_real_func(a) {}
|
||||
Item_func_y(THD *thd, Item *a): Item_real_func(thd, a) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_y"; }
|
||||
void fix_length_and_dec()
|
||||
@ -501,7 +506,7 @@ class Item_func_numgeometries: public Item_int_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_numgeometries(Item *a): Item_int_func(a) {}
|
||||
Item_func_numgeometries(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_numgeometries"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -512,7 +517,7 @@ class Item_func_numinteriorring: public Item_int_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_numinteriorring(Item *a): Item_int_func(a) {}
|
||||
Item_func_numinteriorring(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_numinteriorrings"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -523,7 +528,7 @@ class Item_func_numpoints: public Item_int_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_numpoints(Item *a): Item_int_func(a) {}
|
||||
Item_func_numpoints(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_numpoints"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -534,7 +539,7 @@ class Item_func_area: public Item_real_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_area(Item *a): Item_real_func(a) {}
|
||||
Item_func_area(THD *thd, Item *a): Item_real_func(thd, a) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_area"; }
|
||||
void fix_length_and_dec()
|
||||
@ -549,7 +554,7 @@ class Item_func_glength: public Item_real_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_glength(Item *a): Item_real_func(a) {}
|
||||
Item_func_glength(THD *thd, Item *a): Item_real_func(thd, a) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_length"; }
|
||||
void fix_length_and_dec()
|
||||
@ -564,7 +569,7 @@ class Item_func_srid: public Item_int_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_srid(Item *a): Item_int_func(a) {}
|
||||
Item_func_srid(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "srid"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -579,7 +584,7 @@ class Item_func_distance: public Item_real_func
|
||||
Gcalc_function func;
|
||||
Gcalc_scan_iterator scan_it;
|
||||
public:
|
||||
Item_func_distance(Item *a, Item *b): Item_real_func(a, b) {}
|
||||
Item_func_distance(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_distance"; }
|
||||
};
|
||||
@ -592,7 +597,7 @@ class Item_func_pointonsurface: public Item_geometry_func
|
||||
Gcalc_function func;
|
||||
Gcalc_scan_iterator scan_it;
|
||||
public:
|
||||
Item_func_pointonsurface(Item *a): Item_geometry_func(a) {}
|
||||
Item_func_pointonsurface(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
const char *func_name() const { return "st_pointonsurface"; }
|
||||
String *val_str(String *);
|
||||
Field::geometry_type get_geometry_type() const;
|
||||
@ -603,7 +608,8 @@ public:
|
||||
class Item_func_gis_debug: public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_gis_debug(Item *a) :Item_int_func(a) { null_value= false; }
|
||||
Item_func_gis_debug(THD *thd, Item *a): Item_int_func(thd, a)
|
||||
{ null_value= false; }
|
||||
const char *func_name() const { return "st_gis_debug"; }
|
||||
longlong val_int();
|
||||
};
|
||||
|
@ -27,7 +27,7 @@
|
||||
class Item_func_inet_aton : public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_inet_aton(Item *a) :Item_int_func(a) {}
|
||||
Item_func_inet_aton(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "inet_aton"; }
|
||||
void fix_length_and_dec()
|
||||
@ -47,8 +47,7 @@ public:
|
||||
class Item_func_inet_ntoa : public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_inet_ntoa(Item *a)
|
||||
: Item_str_func(a)
|
||||
Item_func_inet_ntoa(THD *thd, Item *a): Item_str_func(thd, a)
|
||||
{ }
|
||||
String* val_str(String* str);
|
||||
const char *func_name() const { return "inet_ntoa"; }
|
||||
@ -69,8 +68,8 @@ public:
|
||||
class Item_func_inet_bool_base : public Item_bool_func
|
||||
{
|
||||
public:
|
||||
inline Item_func_inet_bool_base(Item *ip_addr)
|
||||
: Item_bool_func(ip_addr)
|
||||
inline Item_func_inet_bool_base(THD *thd, Item *ip_addr):
|
||||
Item_bool_func(thd, ip_addr)
|
||||
{
|
||||
null_value= false;
|
||||
}
|
||||
@ -91,8 +90,8 @@ protected:
|
||||
class Item_func_inet_str_base : public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
inline Item_func_inet_str_base(Item *arg)
|
||||
: Item_str_ascii_func(arg)
|
||||
inline Item_func_inet_str_base(THD *thd, Item *arg):
|
||||
Item_str_ascii_func(thd, arg)
|
||||
{ }
|
||||
|
||||
public:
|
||||
@ -110,8 +109,8 @@ protected:
|
||||
class Item_func_inet6_aton : public Item_func_inet_str_base
|
||||
{
|
||||
public:
|
||||
inline Item_func_inet6_aton(Item *ip_addr)
|
||||
: Item_func_inet_str_base(ip_addr)
|
||||
inline Item_func_inet6_aton(THD *thd, Item *ip_addr):
|
||||
Item_func_inet_str_base(thd, ip_addr)
|
||||
{ }
|
||||
|
||||
public:
|
||||
@ -137,8 +136,8 @@ protected:
|
||||
class Item_func_inet6_ntoa : public Item_func_inet_str_base
|
||||
{
|
||||
public:
|
||||
inline Item_func_inet6_ntoa(Item *ip_addr)
|
||||
: Item_func_inet_str_base(ip_addr)
|
||||
inline Item_func_inet6_ntoa(THD *thd, Item *ip_addr):
|
||||
Item_func_inet_str_base(thd, ip_addr)
|
||||
{ }
|
||||
|
||||
public:
|
||||
@ -169,8 +168,8 @@ protected:
|
||||
class Item_func_is_ipv4 : public Item_func_inet_bool_base
|
||||
{
|
||||
public:
|
||||
inline Item_func_is_ipv4(Item *ip_addr)
|
||||
: Item_func_inet_bool_base(ip_addr)
|
||||
inline Item_func_is_ipv4(THD *thd, Item *ip_addr):
|
||||
Item_func_inet_bool_base(thd, ip_addr)
|
||||
{ }
|
||||
|
||||
public:
|
||||
@ -189,8 +188,8 @@ protected:
|
||||
class Item_func_is_ipv6 : public Item_func_inet_bool_base
|
||||
{
|
||||
public:
|
||||
inline Item_func_is_ipv6(Item *ip_addr)
|
||||
: Item_func_inet_bool_base(ip_addr)
|
||||
inline Item_func_is_ipv6(THD *thd, Item *ip_addr):
|
||||
Item_func_inet_bool_base(thd, ip_addr)
|
||||
{ }
|
||||
|
||||
public:
|
||||
@ -209,8 +208,8 @@ protected:
|
||||
class Item_func_is_ipv4_compat : public Item_func_inet_bool_base
|
||||
{
|
||||
public:
|
||||
inline Item_func_is_ipv4_compat(Item *ip_addr)
|
||||
: Item_func_inet_bool_base(ip_addr)
|
||||
inline Item_func_is_ipv4_compat(THD *thd, Item *ip_addr):
|
||||
Item_func_inet_bool_base(thd, ip_addr)
|
||||
{ }
|
||||
|
||||
public:
|
||||
@ -229,8 +228,8 @@ protected:
|
||||
class Item_func_is_ipv4_mapped : public Item_func_inet_bool_base
|
||||
{
|
||||
public:
|
||||
inline Item_func_is_ipv4_mapped(Item *ip_addr)
|
||||
: Item_func_inet_bool_base(ip_addr)
|
||||
inline Item_func_is_ipv4_mapped(THD *thd, Item *ip_addr):
|
||||
Item_func_inet_bool_base(thd, ip_addr)
|
||||
{ }
|
||||
|
||||
public:
|
||||
|
@ -146,13 +146,13 @@ void Item_row::print(String *str, enum_query_type query_type)
|
||||
}
|
||||
|
||||
|
||||
Item *Item_row::transform(Item_transformer transformer, uchar *arg)
|
||||
Item *Item_row::transform(THD *thd, Item_transformer transformer, uchar *arg)
|
||||
{
|
||||
DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
|
||||
DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
|
||||
|
||||
if (transform_args(transformer, arg))
|
||||
if (transform_args(thd, transformer, arg))
|
||||
return 0;
|
||||
return (this->*transformer)(arg);
|
||||
return (this->*transformer)(thd, arg);
|
||||
}
|
||||
|
||||
void Item_row::bring_value()
|
||||
|
@ -35,10 +35,11 @@ class Item_row: public Item,
|
||||
table_map not_null_tables_cache;
|
||||
bool with_null;
|
||||
public:
|
||||
Item_row(List<Item> &list)
|
||||
:Item_args(list), not_null_tables_cache(0), with_null(0)
|
||||
Item_row(THD *thd, List<Item> &list):
|
||||
Item(thd), Item_args(list), not_null_tables_cache(0), with_null(0)
|
||||
{ }
|
||||
Item_row(Item_row *item):
|
||||
Item_row(THD *thd, Item_row *item):
|
||||
Item(thd),
|
||||
Item_args(item),
|
||||
Used_tables_and_const_cache(item),
|
||||
not_null_tables_cache(0),
|
||||
@ -95,7 +96,7 @@ public:
|
||||
return true;
|
||||
return (this->*processor)(arg);
|
||||
}
|
||||
Item *transform(Item_transformer transformer, uchar *arg);
|
||||
Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
|
||||
bool eval_not_null_tables(uchar *opt_arg);
|
||||
|
||||
uint cols() { return arg_count; }
|
||||
|
@ -4273,9 +4273,9 @@ String *Item_func_uuid::val_str(String *str)
|
||||
}
|
||||
|
||||
|
||||
Item_func_dyncol_create::Item_func_dyncol_create(List<Item> &args,
|
||||
DYNCALL_CREATE_DEF *dfs)
|
||||
: Item_str_func(args), defs(dfs), vals(0), keys_num(NULL), keys_str(NULL),
|
||||
Item_func_dyncol_create::Item_func_dyncol_create(THD *thd, List<Item> &args,
|
||||
DYNCALL_CREATE_DEF *dfs):
|
||||
Item_str_func(thd, args), defs(dfs), vals(0), keys_num(NULL), keys_str(NULL),
|
||||
names(FALSE), force_names(FALSE)
|
||||
{
|
||||
DBUG_ASSERT((args.elements & 0x1) == 0); // even number of arguments
|
||||
|
@ -49,13 +49,18 @@ protected:
|
||||
return &str_value;
|
||||
}
|
||||
public:
|
||||
Item_str_func() :Item_func() { decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(Item *a) :Item_func(a) {decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(Item *a,Item *b) :Item_func(a,b) { decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(Item *a,Item *b,Item *c) :Item_func(a,b,c) { decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(Item *a,Item *b,Item *c,Item *d) :Item_func(a,b,c,d) {decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(Item *a,Item *b,Item *c,Item *d, Item* e) :Item_func(a,b,c,d,e) {decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(List<Item> &list) :Item_func(list) {decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(THD *thd): Item_func(thd) { decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(THD *thd, Item *a): Item_func(thd, a) {decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(THD *thd, Item *a, Item *b):
|
||||
Item_func(thd, a, b) { decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_func(thd, a, b, c) { decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(THD *thd, Item *a, Item *b, Item *c, Item *d):
|
||||
Item_func(thd, a, b, c, d) { decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e):
|
||||
Item_func(thd, a, b, c, d, e) { decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(THD *thd, List<Item> &list):
|
||||
Item_func(thd, list) { decimals=NOT_FIXED_DEC; }
|
||||
longlong val_int();
|
||||
double val_real();
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
@ -73,10 +78,11 @@ class Item_str_ascii_func :public Item_str_func
|
||||
{
|
||||
String ascii_buf;
|
||||
public:
|
||||
Item_str_ascii_func() :Item_str_func() {}
|
||||
Item_str_ascii_func(Item *a) :Item_str_func(a) {}
|
||||
Item_str_ascii_func(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_str_ascii_func(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
|
||||
Item_str_ascii_func(THD *thd): Item_str_func(thd) {}
|
||||
Item_str_ascii_func(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
Item_str_ascii_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
Item_str_ascii_func(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_str_func(thd, a, b, c) {}
|
||||
String *val_str(String *str)
|
||||
{
|
||||
return val_str_from_val_str_ascii(str, &ascii_buf);
|
||||
@ -89,7 +95,7 @@ class Item_func_md5 :public Item_str_ascii_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_md5(Item *a) :Item_str_ascii_func(a) {}
|
||||
Item_func_md5(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "md5"; }
|
||||
@ -99,7 +105,7 @@ public:
|
||||
class Item_func_sha :public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
Item_func_sha(Item *a) :Item_str_ascii_func(a) {}
|
||||
Item_func_sha(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "sha"; }
|
||||
@ -108,7 +114,7 @@ public:
|
||||
class Item_func_sha2 :public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
Item_func_sha2(Item *a, Item *b) :Item_str_ascii_func(a, b) {}
|
||||
Item_func_sha2(THD *thd, Item *a, Item *b): Item_str_ascii_func(thd, a, b) {}
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "sha2"; }
|
||||
@ -118,7 +124,7 @@ class Item_func_to_base64 :public Item_str_ascii_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_to_base64(Item *a) :Item_str_ascii_func(a) {}
|
||||
Item_func_to_base64(THD *thd, Item *a): Item_str_ascii_func(thd, a) {}
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "to_base64"; }
|
||||
@ -128,7 +134,7 @@ class Item_func_from_base64 :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_from_base64(Item *a) :Item_str_func(a) {}
|
||||
Item_func_from_base64(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "from_base64"; }
|
||||
@ -147,14 +153,15 @@ protected:
|
||||
int no_padding);
|
||||
|
||||
public:
|
||||
Item_aes_crypt(Item *a, Item *b) :Item_str_func(a,b) {}
|
||||
Item_aes_crypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
String *val_str(String *);
|
||||
};
|
||||
|
||||
class Item_func_aes_encrypt :public Item_aes_crypt
|
||||
{
|
||||
public:
|
||||
Item_func_aes_encrypt(Item *a, Item *b) :Item_aes_crypt(a,b) {}
|
||||
Item_func_aes_encrypt(THD *thd, Item *a, Item *b):
|
||||
Item_aes_crypt(thd, a, b) {}
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "aes_encrypt"; }
|
||||
};
|
||||
@ -162,7 +169,8 @@ public:
|
||||
class Item_func_aes_decrypt :public Item_aes_crypt
|
||||
{
|
||||
public:
|
||||
Item_func_aes_decrypt(Item *a, Item *b) :Item_aes_crypt(a,b) {}
|
||||
Item_func_aes_decrypt(THD *thd, Item *a, Item *b):
|
||||
Item_aes_crypt(thd, a, b) {}
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "aes_decrypt"; }
|
||||
};
|
||||
@ -172,8 +180,8 @@ class Item_func_concat :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_concat(List<Item> &list) :Item_str_func(list) {}
|
||||
Item_func_concat(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_func_concat(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
|
||||
Item_func_concat(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "concat"; }
|
||||
@ -183,8 +191,8 @@ class Item_func_decode_histogram :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_decode_histogram(Item *a, Item *b)
|
||||
:Item_str_func(a, b) {}
|
||||
Item_func_decode_histogram(THD *thd, Item *a, Item *b):
|
||||
Item_str_func(thd, a, b) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -199,7 +207,7 @@ class Item_func_concat_ws :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_concat_ws(List<Item> &list) :Item_str_func(list) {}
|
||||
Item_func_concat_ws(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "concat_ws"; }
|
||||
@ -210,7 +218,7 @@ class Item_func_reverse :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_reverse(Item *a) :Item_str_func(a) {}
|
||||
Item_func_reverse(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "reverse"; }
|
||||
@ -221,8 +229,8 @@ class Item_func_replace :public Item_str_func
|
||||
{
|
||||
String tmp_value,tmp_value2;
|
||||
public:
|
||||
Item_func_replace(Item *org,Item *find,Item *replace)
|
||||
:Item_str_func(org,find,replace) {}
|
||||
Item_func_replace(THD *thd, Item *org, Item *find, Item *replace):
|
||||
Item_str_func(thd, org, find, replace) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "replace"; }
|
||||
@ -236,8 +244,8 @@ class Item_func_regexp_replace :public Item_str_func
|
||||
const LEX_CSTRING *source,
|
||||
const LEX_CSTRING *replace);
|
||||
public:
|
||||
Item_func_regexp_replace(Item *a, Item *b, Item *c)
|
||||
:Item_str_func(a, b, c)
|
||||
Item_func_regexp_replace(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_str_func(thd, a, b, c)
|
||||
{}
|
||||
void cleanup()
|
||||
{
|
||||
@ -256,8 +264,8 @@ class Item_func_regexp_substr :public Item_str_func
|
||||
{
|
||||
Regexp_processor_pcre re;
|
||||
public:
|
||||
Item_func_regexp_substr(Item *a, Item *b)
|
||||
:Item_str_func(a, b)
|
||||
Item_func_regexp_substr(THD *thd, Item *a, Item *b):
|
||||
Item_str_func(thd, a, b)
|
||||
{}
|
||||
void cleanup()
|
||||
{
|
||||
@ -276,8 +284,9 @@ class Item_func_insert :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_insert(Item *org,Item *start,Item *length,Item *new_str)
|
||||
:Item_str_func(org,start,length,new_str) {}
|
||||
Item_func_insert(THD *thd, Item *org, Item *start, Item *length,
|
||||
Item *new_str):
|
||||
Item_str_func(thd, org, start, length, new_str) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "insert"; }
|
||||
@ -291,7 +300,7 @@ protected:
|
||||
my_charset_conv_case converter;
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_str_conv(Item *item) :Item_str_func(item) {}
|
||||
Item_str_conv(THD *thd, Item *item): Item_str_func(thd, item) {}
|
||||
String *val_str(String *);
|
||||
};
|
||||
|
||||
@ -299,7 +308,7 @@ public:
|
||||
class Item_func_lcase :public Item_str_conv
|
||||
{
|
||||
public:
|
||||
Item_func_lcase(Item *item) :Item_str_conv(item) {}
|
||||
Item_func_lcase(THD *thd, Item *item): Item_str_conv(thd, item) {}
|
||||
const char *func_name() const { return "lcase"; }
|
||||
void fix_length_and_dec();
|
||||
};
|
||||
@ -307,7 +316,7 @@ public:
|
||||
class Item_func_ucase :public Item_str_conv
|
||||
{
|
||||
public:
|
||||
Item_func_ucase(Item *item) :Item_str_conv(item) {}
|
||||
Item_func_ucase(THD *thd, Item *item): Item_str_conv(thd, item) {}
|
||||
const char *func_name() const { return "ucase"; }
|
||||
void fix_length_and_dec();
|
||||
};
|
||||
@ -317,7 +326,7 @@ class Item_func_left :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_left(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_func_left(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "left"; }
|
||||
@ -328,7 +337,7 @@ class Item_func_right :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_right(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_func_right(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "right"; }
|
||||
@ -339,8 +348,8 @@ class Item_func_substr :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_substr(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_func_substr(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
|
||||
Item_func_substr(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
Item_func_substr(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "substr"; }
|
||||
@ -351,7 +360,8 @@ class Item_func_substr_index :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_substr_index(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
|
||||
Item_func_substr_index(THD *thd, Item *a,Item *b,Item *c):
|
||||
Item_str_func(thd, a, b, c) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "substring_index"; }
|
||||
@ -379,8 +389,8 @@ protected:
|
||||
return trimmed_value(res, 0, res->length());
|
||||
}
|
||||
public:
|
||||
Item_func_trim(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_func_trim(Item *a) :Item_str_func(a) {}
|
||||
Item_func_trim(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
Item_func_trim(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "trim"; }
|
||||
@ -392,8 +402,8 @@ public:
|
||||
class Item_func_ltrim :public Item_func_trim
|
||||
{
|
||||
public:
|
||||
Item_func_ltrim(Item *a,Item *b) :Item_func_trim(a,b) {}
|
||||
Item_func_ltrim(Item *a) :Item_func_trim(a) {}
|
||||
Item_func_ltrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {}
|
||||
Item_func_ltrim(THD *thd, Item *a): Item_func_trim(thd, a) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "ltrim"; }
|
||||
const char *mode_name() const { return "leading"; }
|
||||
@ -403,8 +413,8 @@ public:
|
||||
class Item_func_rtrim :public Item_func_trim
|
||||
{
|
||||
public:
|
||||
Item_func_rtrim(Item *a,Item *b) :Item_func_trim(a,b) {}
|
||||
Item_func_rtrim(Item *a) :Item_func_trim(a) {}
|
||||
Item_func_rtrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {}
|
||||
Item_func_rtrim(THD *thd, Item *a): Item_func_trim(thd, a) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "rtrim"; }
|
||||
const char *mode_name() const { return "trailing"; }
|
||||
@ -428,9 +438,10 @@ private:
|
||||
enum PW_Alg alg;
|
||||
bool deflt;
|
||||
public:
|
||||
Item_func_password(Item *a) :Item_str_ascii_func(a), alg(NEW), deflt(1) {}
|
||||
Item_func_password(Item *a, PW_Alg al) :Item_str_ascii_func(a),
|
||||
alg(al), deflt(0) {}
|
||||
Item_func_password(THD *thd, Item *a):
|
||||
Item_str_ascii_func(thd, a), alg(NEW), deflt(1) {}
|
||||
Item_func_password(THD *thd, Item *a, PW_Alg al):
|
||||
Item_str_ascii_func(thd, a), alg(al), deflt(0) {}
|
||||
String *val_str_ascii(String *str);
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
void fix_length_and_dec()
|
||||
@ -452,8 +463,8 @@ class Item_func_des_encrypt :public Item_str_func
|
||||
{
|
||||
String tmp_value,tmp_arg;
|
||||
public:
|
||||
Item_func_des_encrypt(Item *a) :Item_str_func(a) {}
|
||||
Item_func_des_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
|
||||
Item_func_des_encrypt(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
Item_func_des_encrypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -468,8 +479,8 @@ class Item_func_des_decrypt :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_des_decrypt(Item *a) :Item_str_func(a) {}
|
||||
Item_func_des_decrypt(Item *a, Item *b): Item_str_func(a,b) {}
|
||||
Item_func_des_decrypt(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
Item_func_des_decrypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -492,11 +503,11 @@ class Item_func_encrypt :public Item_str_func
|
||||
collation.set(&my_charset_bin);
|
||||
}
|
||||
public:
|
||||
Item_func_encrypt(Item *a) :Item_str_func(a)
|
||||
Item_func_encrypt(THD *thd, Item *a): Item_str_func(thd, a)
|
||||
{
|
||||
constructor_helper();
|
||||
}
|
||||
Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b)
|
||||
Item_func_encrypt(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b)
|
||||
{
|
||||
constructor_helper();
|
||||
}
|
||||
@ -520,8 +531,8 @@ private:
|
||||
protected:
|
||||
SQL_CRYPT sql_crypt;
|
||||
public:
|
||||
Item_func_encode(Item *a, Item *seed_arg):
|
||||
Item_str_func(a, seed_arg) {}
|
||||
Item_func_encode(THD *thd, Item *a, Item *seed_arg):
|
||||
Item_str_func(thd, a, seed_arg) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "encode"; }
|
||||
@ -536,7 +547,7 @@ private:
|
||||
class Item_func_decode :public Item_func_encode
|
||||
{
|
||||
public:
|
||||
Item_func_decode(Item *a, Item *seed_arg): Item_func_encode(a, seed_arg) {}
|
||||
Item_func_decode(THD *thd, Item *a, Item *seed_arg): Item_func_encode(thd, a, seed_arg) {}
|
||||
const char *func_name() const { return "decode"; }
|
||||
protected:
|
||||
void crypto_transform(String *);
|
||||
@ -546,11 +557,11 @@ protected:
|
||||
class Item_func_sysconst :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_sysconst()
|
||||
Item_func_sysconst(THD *thd): Item_str_func(thd)
|
||||
{ collation.set(system_charset_info,DERIVATION_SYSCONST); }
|
||||
Item *safe_charset_converter(CHARSET_INFO *tocs)
|
||||
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
|
||||
{
|
||||
return const_charset_converter(tocs, true, fully_qualified_func_name());
|
||||
return const_charset_converter(thd, tocs, true, fully_qualified_func_name());
|
||||
}
|
||||
/*
|
||||
Used to create correct Item name in new converted item in
|
||||
@ -569,7 +580,7 @@ public:
|
||||
class Item_func_database :public Item_func_sysconst
|
||||
{
|
||||
public:
|
||||
Item_func_database() :Item_func_sysconst() {}
|
||||
Item_func_database(THD *thd): Item_func_sysconst(thd) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -587,7 +598,7 @@ protected:
|
||||
bool init (const char *user, const char *host);
|
||||
|
||||
public:
|
||||
Item_func_user()
|
||||
Item_func_user(THD *thd): Item_func_sysconst(thd)
|
||||
{
|
||||
str_value.set("", 0, system_charset_info);
|
||||
}
|
||||
@ -616,8 +627,8 @@ class Item_func_current_user :public Item_func_user
|
||||
Name_resolution_context *context;
|
||||
|
||||
public:
|
||||
Item_func_current_user(Name_resolution_context *context_arg)
|
||||
: context(context_arg) {}
|
||||
Item_func_current_user(THD *thd, Name_resolution_context *context_arg):
|
||||
Item_func_user(thd), context(context_arg) {}
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
const char *func_name() const { return "current_user"; }
|
||||
const char *fully_qualified_func_name() const { return "current_user()"; }
|
||||
@ -629,8 +640,8 @@ class Item_func_current_role :public Item_func_sysconst
|
||||
Name_resolution_context *context;
|
||||
|
||||
public:
|
||||
Item_func_current_role(Name_resolution_context *context_arg)
|
||||
: context(context_arg) {}
|
||||
Item_func_current_role(THD *thd, Name_resolution_context *context_arg):
|
||||
Item_func_sysconst(thd), context(context_arg) {}
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
void fix_length_and_dec()
|
||||
{ max_length= username_char_length * SYSTEM_CHARSET_MBMAXLEN; }
|
||||
@ -650,7 +661,7 @@ class Item_func_soundex :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_soundex(Item *a) :Item_str_func(a) {}
|
||||
Item_func_soundex(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "soundex"; }
|
||||
@ -660,7 +671,7 @@ public:
|
||||
class Item_func_elt :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_elt(List<Item> &list) :Item_str_func(list) {}
|
||||
Item_func_elt(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *str);
|
||||
@ -674,7 +685,7 @@ class Item_func_make_set :public Item_str_func
|
||||
String tmp_str;
|
||||
|
||||
public:
|
||||
Item_func_make_set(List<Item> &list) :Item_str_func(list) {}
|
||||
Item_func_make_set(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
|
||||
String *val_str(String *str);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "make_set"; }
|
||||
@ -686,10 +697,11 @@ class Item_func_format :public Item_str_ascii_func
|
||||
String tmp_str;
|
||||
MY_LOCALE *locale;
|
||||
public:
|
||||
Item_func_format(Item *org, Item *dec): Item_str_ascii_func(org, dec) {}
|
||||
Item_func_format(Item *org, Item *dec, Item *lang):
|
||||
Item_str_ascii_func(org, dec, lang) {}
|
||||
|
||||
Item_func_format(THD *thd, Item *org, Item *dec):
|
||||
Item_str_ascii_func(thd, org, dec) {}
|
||||
Item_func_format(THD *thd, Item *org, Item *dec, Item *lang):
|
||||
Item_str_ascii_func(thd, org, dec, lang) {}
|
||||
|
||||
MY_LOCALE *get_locale(Item *item);
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec();
|
||||
@ -701,10 +713,11 @@ public:
|
||||
class Item_func_char :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_char(List<Item> &list) :Item_str_func(list)
|
||||
Item_func_char(THD *thd, List<Item> &list): Item_str_func(thd, list)
|
||||
{ collation.set(&my_charset_bin); }
|
||||
Item_func_char(List<Item> &list, CHARSET_INFO *cs) :Item_str_func(list)
|
||||
{ collation.set(cs); }
|
||||
Item_func_char(THD *thd, List<Item> &list, CHARSET_INFO *cs):
|
||||
Item_str_func(thd, list)
|
||||
{ collation.set(cs); }
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -718,7 +731,8 @@ class Item_func_repeat :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_repeat(Item *arg1,Item *arg2) :Item_str_func(arg1,arg2) {}
|
||||
Item_func_repeat(THD *thd, Item *arg1, Item *arg2):
|
||||
Item_str_func(thd, arg1, arg2) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "repeat"; }
|
||||
@ -728,7 +742,7 @@ public:
|
||||
class Item_func_space :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_space(Item *arg1):Item_str_func(arg1) {}
|
||||
Item_func_space(THD *thd, Item *arg1): Item_str_func(thd, arg1) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "space"; }
|
||||
@ -739,7 +753,8 @@ class Item_func_binlog_gtid_pos :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_binlog_gtid_pos(Item *arg1,Item *arg2) :Item_str_func(arg1,arg2) {}
|
||||
Item_func_binlog_gtid_pos(THD *thd, Item *arg1, Item *arg2):
|
||||
Item_str_func(thd, arg1, arg2) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "binlog_gtid_pos"; }
|
||||
@ -750,8 +765,8 @@ class Item_func_rpad :public Item_str_func
|
||||
{
|
||||
String tmp_value, rpad_str;
|
||||
public:
|
||||
Item_func_rpad(Item *arg1,Item *arg2,Item *arg3)
|
||||
:Item_str_func(arg1,arg2,arg3) {}
|
||||
Item_func_rpad(THD *thd, Item *arg1, Item *arg2, Item *arg3):
|
||||
Item_str_func(thd, arg1, arg2, arg3) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "rpad"; }
|
||||
@ -762,8 +777,8 @@ class Item_func_lpad :public Item_str_func
|
||||
{
|
||||
String tmp_value, lpad_str;
|
||||
public:
|
||||
Item_func_lpad(Item *arg1,Item *arg2,Item *arg3)
|
||||
:Item_str_func(arg1,arg2,arg3) {}
|
||||
Item_func_lpad(THD *thd, Item *arg1, Item *arg2, Item *arg3):
|
||||
Item_str_func(thd, arg1, arg2, arg3) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "lpad"; }
|
||||
@ -773,7 +788,8 @@ public:
|
||||
class Item_func_conv :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_conv(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
|
||||
Item_func_conv(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_str_func(thd, a, b, c) {}
|
||||
const char *func_name() const { return "conv"; }
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
@ -789,7 +805,8 @@ class Item_func_hex :public Item_str_ascii_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_hex(Item *a) :Item_str_ascii_func(a) {}
|
||||
Item_func_hex(THD *thd, Item *a):
|
||||
Item_str_ascii_func(thd, a) {}
|
||||
const char *func_name() const { return "hex"; }
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec()
|
||||
@ -804,10 +821,10 @@ class Item_func_unhex :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_unhex(Item *a) :Item_str_func(a)
|
||||
{
|
||||
Item_func_unhex(THD *thd, Item *a): Item_str_func(thd, a)
|
||||
{
|
||||
/* there can be bad hex strings */
|
||||
maybe_null= 1;
|
||||
maybe_null= 1;
|
||||
}
|
||||
const char *func_name() const { return "unhex"; }
|
||||
String *val_str(String *);
|
||||
@ -828,8 +845,8 @@ protected:
|
||||
String max_str;
|
||||
const bool is_min;
|
||||
public:
|
||||
Item_func_like_range(Item *a, Item *b, bool is_min_arg)
|
||||
:Item_str_func(a, b), is_min(is_min_arg)
|
||||
Item_func_like_range(THD *thd, Item *a, Item *b, bool is_min_arg):
|
||||
Item_str_func(thd, a, b), is_min(is_min_arg)
|
||||
{ maybe_null= 1; }
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
@ -844,8 +861,8 @@ public:
|
||||
class Item_func_like_range_min :public Item_func_like_range
|
||||
{
|
||||
public:
|
||||
Item_func_like_range_min(Item *a, Item *b)
|
||||
:Item_func_like_range(a, b, true) { }
|
||||
Item_func_like_range_min(THD *thd, Item *a, Item *b):
|
||||
Item_func_like_range(thd, a, b, true) { }
|
||||
const char *func_name() const { return "like_range_min"; }
|
||||
};
|
||||
|
||||
@ -853,8 +870,8 @@ public:
|
||||
class Item_func_like_range_max :public Item_func_like_range
|
||||
{
|
||||
public:
|
||||
Item_func_like_range_max(Item *a, Item *b)
|
||||
:Item_func_like_range(a, b, false) { }
|
||||
Item_func_like_range_max(THD *thd, Item *a, Item *b):
|
||||
Item_func_like_range(thd, a, b, false) { }
|
||||
const char *func_name() const { return "like_range_max"; }
|
||||
};
|
||||
#endif
|
||||
@ -863,7 +880,7 @@ public:
|
||||
class Item_func_binary :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_binary(Item *a) :Item_str_func(a) {}
|
||||
Item_func_binary(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
String *val_str(String *a)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
@ -887,7 +904,7 @@ class Item_load_file :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_load_file(Item *a) :Item_str_func(a) {}
|
||||
Item_load_file(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "load_file"; }
|
||||
void fix_length_and_dec()
|
||||
@ -906,9 +923,12 @@ public:
|
||||
class Item_func_export_set: public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_export_set(Item *a,Item *b,Item* c) :Item_str_func(a,b,c) {}
|
||||
Item_func_export_set(Item *a,Item *b,Item* c,Item* d) :Item_str_func(a,b,c,d) {}
|
||||
Item_func_export_set(Item *a,Item *b,Item* c,Item* d,Item* e) :Item_str_func(a,b,c,d,e) {}
|
||||
Item_func_export_set(THD *thd, Item *a, Item *b, Item* c):
|
||||
Item_str_func(thd, a, b, c) {}
|
||||
Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d):
|
||||
Item_str_func(thd, a, b, c, d) {}
|
||||
Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d, Item* e):
|
||||
Item_str_func(thd, a, b, c, d, e) {}
|
||||
String *val_str(String *str);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "export_set"; }
|
||||
@ -919,7 +939,7 @@ class Item_func_quote :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_quote(Item *a) :Item_str_func(a) {}
|
||||
Item_func_quote(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
const char *func_name() const { return "quote"; }
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
@ -938,10 +958,11 @@ class Item_func_conv_charset :public Item_str_func
|
||||
public:
|
||||
bool safe;
|
||||
CHARSET_INFO *conv_charset; // keep it public
|
||||
Item_func_conv_charset(Item *a, CHARSET_INFO *cs) :Item_str_func(a)
|
||||
Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs):
|
||||
Item_str_func(thd, a)
|
||||
{ conv_charset= cs; use_cached_value= 0; safe= 0; }
|
||||
Item_func_conv_charset(Item *a, CHARSET_INFO *cs, bool cache_if_const)
|
||||
:Item_str_func(a)
|
||||
Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs, bool cache_if_const):
|
||||
Item_str_func(thd, a)
|
||||
{
|
||||
conv_charset= cs;
|
||||
if (cache_if_const && args[0]->const_item() && !args[0]->is_expensive())
|
||||
@ -1013,7 +1034,8 @@ public:
|
||||
class Item_func_set_collation :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_set_collation(Item *a, Item *b) :Item_str_func(a,b) {};
|
||||
Item_func_set_collation(THD *thd, Item *a, Item *b):
|
||||
Item_str_func(thd, a, b) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
@ -1030,7 +1052,7 @@ public:
|
||||
class Item_func_charset :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_charset(Item *a) :Item_str_func(a) {}
|
||||
Item_func_charset(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "charset"; }
|
||||
void fix_length_and_dec()
|
||||
@ -1045,7 +1067,7 @@ public:
|
||||
class Item_func_collation :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_collation(Item *a) :Item_str_func(a) {}
|
||||
Item_func_collation(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "collation"; }
|
||||
void fix_length_and_dec()
|
||||
@ -1064,9 +1086,9 @@ class Item_func_weight_string :public Item_str_func
|
||||
uint nweights;
|
||||
uint result_length;
|
||||
public:
|
||||
Item_func_weight_string(Item *a, uint result_length_arg,
|
||||
uint nweights_arg, uint flags_arg)
|
||||
:Item_str_func(a)
|
||||
Item_func_weight_string(THD *thd, Item *a, uint result_length_arg,
|
||||
uint nweights_arg, uint flags_arg):
|
||||
Item_str_func(thd, a)
|
||||
{
|
||||
nweights= nweights_arg;
|
||||
flags= flags_arg;
|
||||
@ -1090,7 +1112,8 @@ class Item_func_crc32 :public Item_int_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_crc32(Item *a) :Item_int_func(a) { unsigned_flag= 1; }
|
||||
Item_func_crc32(THD *thd, Item *a): Item_int_func(thd, a)
|
||||
{ unsigned_flag= 1; }
|
||||
const char *func_name() const { return "crc32"; }
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
longlong val_int();
|
||||
@ -1100,7 +1123,7 @@ class Item_func_uncompressed_length : public Item_int_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_uncompressed_length(Item *a):Item_int_func(a){}
|
||||
Item_func_uncompressed_length(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
const char *func_name() const{return "uncompressed_length";}
|
||||
void fix_length_and_dec() { max_length=10; maybe_null= true; }
|
||||
longlong val_int();
|
||||
@ -1116,7 +1139,7 @@ class Item_func_compress: public Item_str_func
|
||||
{
|
||||
String buffer;
|
||||
public:
|
||||
Item_func_compress(Item *a):Item_str_func(a){}
|
||||
Item_func_compress(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
|
||||
const char *func_name() const{return "compress";}
|
||||
String *val_str(String *) ZLIB_DEPENDED_FUNCTION
|
||||
@ -1126,7 +1149,7 @@ class Item_func_uncompress: public Item_str_func
|
||||
{
|
||||
String buffer;
|
||||
public:
|
||||
Item_func_uncompress(Item *a): Item_str_func(a){}
|
||||
Item_func_uncompress(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; }
|
||||
const char *func_name() const{return "uncompress";}
|
||||
String *val_str(String *) ZLIB_DEPENDED_FUNCTION
|
||||
@ -1136,7 +1159,7 @@ public:
|
||||
class Item_func_uuid: public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_uuid(): Item_str_func() {}
|
||||
Item_func_uuid(THD *thd): Item_str_func(thd) {}
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
collation.set(system_charset_info,
|
||||
@ -1163,7 +1186,7 @@ protected:
|
||||
bool prepare_arguments(bool force_names);
|
||||
void print_arguments(String *str, enum_query_type query_type);
|
||||
public:
|
||||
Item_func_dyncol_create(List<Item> &args, DYNCALL_CREATE_DEF *dfs);
|
||||
Item_func_dyncol_create(THD *thd, List<Item> &args, DYNCALL_CREATE_DEF *dfs);
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const{ return "column_create"; }
|
||||
@ -1176,8 +1199,8 @@ public:
|
||||
class Item_func_dyncol_add: public Item_func_dyncol_create
|
||||
{
|
||||
public:
|
||||
Item_func_dyncol_add(List<Item> &args_arg, DYNCALL_CREATE_DEF *dfs)
|
||||
:Item_func_dyncol_create(args_arg, dfs)
|
||||
Item_func_dyncol_add(THD *thd, List<Item> &args_arg, DYNCALL_CREATE_DEF *dfs):
|
||||
Item_func_dyncol_create(thd, args_arg, dfs)
|
||||
{}
|
||||
const char *func_name() const{ return "column_add"; }
|
||||
String *val_str(String *);
|
||||
@ -1187,7 +1210,7 @@ public:
|
||||
class Item_func_dyncol_json: public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_dyncol_json(Item *str) :Item_str_func(str) {}
|
||||
Item_func_dyncol_json(THD *thd, Item *str): Item_str_func(thd, str) {}
|
||||
const char *func_name() const{ return "column_json"; }
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec()
|
||||
@ -1206,8 +1229,7 @@ public:
|
||||
class Item_dyncol_get: public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_dyncol_get(Item *str, Item *num)
|
||||
:Item_str_func(str, num)
|
||||
Item_dyncol_get(THD *thd, Item *str, Item *num): Item_str_func(thd, str, num)
|
||||
{}
|
||||
void fix_length_and_dec()
|
||||
{ maybe_null= 1;; max_length= MAX_BLOB_WIDTH; }
|
||||
@ -1228,7 +1250,7 @@ public:
|
||||
class Item_func_dyncol_list: public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_dyncol_list(Item *str) :Item_str_func(str) {};
|
||||
Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str) {};
|
||||
void fix_length_and_dec() { maybe_null= 1; max_length= MAX_BLOB_WIDTH; };
|
||||
const char *func_name() const{ return "column_list"; }
|
||||
String *val_str(String *);
|
||||
|
@ -48,9 +48,9 @@ const char *exists_outer_expr_name= "<exists outer expr>";
|
||||
|
||||
int check_and_do_in_subquery_rewrites(JOIN *join);
|
||||
|
||||
Item_subselect::Item_subselect():
|
||||
Item_result_field(), Used_tables_and_const_cache(),
|
||||
value_assigned(0), own_engine(0), thd(0), old_engine(0),
|
||||
Item_subselect::Item_subselect(THD *thd_arg):
|
||||
Item_result_field(thd_arg), Used_tables_and_const_cache(),
|
||||
value_assigned(0), own_engine(0), thd(0), old_engine(0),
|
||||
have_to_be_excluded(0),
|
||||
inside_first_fix_fields(0), done_first_fix_fields(FALSE),
|
||||
expr_cache(0), forced_const(FALSE), substitution(0), engine(0), eliminated(FALSE),
|
||||
@ -875,7 +875,7 @@ bool Item_subselect::const_item() const
|
||||
Item *Item_subselect::get_tmp_table_item(THD *thd_arg)
|
||||
{
|
||||
if (!with_sum_func && !const_item())
|
||||
return new Item_field(result_field);
|
||||
return new Item_field(thd_arg, result_field);
|
||||
return copy_or_same(thd_arg);
|
||||
}
|
||||
|
||||
@ -922,12 +922,11 @@ void Item_subselect::print(String *str, enum_query_type query_type)
|
||||
}
|
||||
|
||||
|
||||
Item_singlerow_subselect::Item_singlerow_subselect(THD *thd_arg, st_select_lex *select_lex)
|
||||
:Item_subselect(), value(0)
|
||||
Item_singlerow_subselect::Item_singlerow_subselect(THD *thd, st_select_lex *select_lex):
|
||||
Item_subselect(thd), value(0)
|
||||
{
|
||||
DBUG_ENTER("Item_singlerow_subselect::Item_singlerow_subselect");
|
||||
init(select_lex, new (thd_arg->mem_root) select_singlerow_subselect(thd_arg,
|
||||
this));
|
||||
init(select_lex, new (thd->mem_root) select_singlerow_subselect(thd, this));
|
||||
maybe_null= 1;
|
||||
max_columns= UINT_MAX;
|
||||
DBUG_VOID_RETURN;
|
||||
@ -953,16 +952,16 @@ Item_singlerow_subselect::invalidate_and_restore_select_lex()
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
Item_maxmin_subselect::Item_maxmin_subselect(THD *thd_param,
|
||||
Item_maxmin_subselect::Item_maxmin_subselect(THD *thd,
|
||||
Item_subselect *parent,
|
||||
st_select_lex *select_lex,
|
||||
bool max_arg)
|
||||
:Item_singlerow_subselect(), was_values(TRUE)
|
||||
bool max_arg):
|
||||
Item_singlerow_subselect(thd), was_values(TRUE)
|
||||
{
|
||||
DBUG_ENTER("Item_maxmin_subselect::Item_maxmin_subselect");
|
||||
max= max_arg;
|
||||
init(select_lex,
|
||||
new (thd_param->mem_root) select_max_min_finder_subselect(thd_param,
|
||||
new (thd->mem_root) select_max_min_finder_subselect(thd,
|
||||
this, max_arg, parent->substype() == Item_subselect::ALL_SUBS));
|
||||
max_columns= 1;
|
||||
maybe_null= 1;
|
||||
@ -975,12 +974,6 @@ Item_maxmin_subselect::Item_maxmin_subselect(THD *thd_param,
|
||||
used_tables_cache= parent->get_used_tables_cache();
|
||||
const_item_cache= parent->const_item();
|
||||
|
||||
/*
|
||||
this subquery always creates during preparation, so we can assign
|
||||
thd here
|
||||
*/
|
||||
thd= thd_param;
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -1020,7 +1013,7 @@ void Item_maxmin_subselect::no_rows_in_result()
|
||||
*/
|
||||
if (parsing_place != SELECT_LIST || const_item())
|
||||
return;
|
||||
value= Item_cache::get_cache(new Item_null());
|
||||
value= Item_cache::get_cache(thd, new Item_null(thd));
|
||||
null_value= 0;
|
||||
was_values= 0;
|
||||
make_const();
|
||||
@ -1038,7 +1031,7 @@ void Item_singlerow_subselect::no_rows_in_result()
|
||||
*/
|
||||
if (parsing_place != SELECT_LIST || const_item())
|
||||
return;
|
||||
value= Item_cache::get_cache(new Item_null());
|
||||
value= Item_cache::get_cache(thd, new Item_null(thd));
|
||||
reset();
|
||||
make_const();
|
||||
}
|
||||
@ -1192,9 +1185,9 @@ void Item_singlerow_subselect::fix_length_and_dec()
|
||||
this item - otherwise
|
||||
*/
|
||||
|
||||
Item* Item_singlerow_subselect::expr_cache_insert_transformer(uchar *thd_arg)
|
||||
Item* Item_singlerow_subselect::expr_cache_insert_transformer(THD *tmp_thd,
|
||||
uchar *unused)
|
||||
{
|
||||
THD *tmp_thd= (THD*) thd_arg;
|
||||
DBUG_ENTER("Item_singlerow_subselect::expr_cache_insert_transformer");
|
||||
|
||||
DBUG_ASSERT(thd == tmp_thd);
|
||||
@ -1351,13 +1344,13 @@ bool Item_singlerow_subselect::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
|
||||
}
|
||||
|
||||
|
||||
Item_exists_subselect::Item_exists_subselect(THD *thd_arg,
|
||||
Item_exists_subselect::Item_exists_subselect(THD *thd,
|
||||
st_select_lex *select_lex):
|
||||
Item_subselect(), upper_not(NULL), abort_on_null(0),
|
||||
Item_subselect(thd), upper_not(NULL), abort_on_null(0),
|
||||
emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0)
|
||||
{
|
||||
DBUG_ENTER("Item_exists_subselect::Item_exists_subselect");
|
||||
init(select_lex, new (thd_arg->mem_root) select_exists_subselect(thd_arg, this));
|
||||
init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this));
|
||||
max_columns= UINT_MAX;
|
||||
null_value= FALSE; //can't be NULL
|
||||
maybe_null= 0; //can't be NULL
|
||||
@ -1388,9 +1381,9 @@ bool Item_in_subselect::test_limit(st_select_lex_unit *unit_arg)
|
||||
return(0);
|
||||
}
|
||||
|
||||
Item_in_subselect::Item_in_subselect(THD *thd_arg, Item * left_exp,
|
||||
Item_in_subselect::Item_in_subselect(THD *thd, Item * left_exp,
|
||||
st_select_lex *select_lex):
|
||||
Item_exists_subselect(), left_expr_cache(0), first_execution(TRUE),
|
||||
Item_exists_subselect(thd), left_expr_cache(0), first_execution(TRUE),
|
||||
in_strategy(SUBS_NOT_TRANSFORMED),
|
||||
pushed_cond_guards(NULL), is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE),
|
||||
is_flattenable_semijoin(FALSE), is_registered_semijoin(FALSE),
|
||||
@ -1400,8 +1393,7 @@ Item_in_subselect::Item_in_subselect(THD *thd_arg, Item * left_exp,
|
||||
DBUG_PRINT("info", ("in_strategy: %u", (uint)in_strategy));
|
||||
left_expr= left_exp;
|
||||
func= &eq_creator;
|
||||
init(select_lex, new (thd_arg->mem_root) select_exists_subselect(thd_arg,
|
||||
this));
|
||||
init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this));
|
||||
max_columns= UINT_MAX;
|
||||
maybe_null= 1;
|
||||
reset();
|
||||
@ -1415,17 +1407,16 @@ int Item_in_subselect::get_identifier()
|
||||
return engine->get_identifier();
|
||||
}
|
||||
|
||||
Item_allany_subselect::Item_allany_subselect(THD *thd_arg, Item * left_exp,
|
||||
Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp,
|
||||
chooser_compare_func_creator fc,
|
||||
st_select_lex *select_lex,
|
||||
bool all_arg)
|
||||
:Item_in_subselect(), func_creator(fc), all(all_arg)
|
||||
bool all_arg):
|
||||
Item_in_subselect(thd), func_creator(fc), all(all_arg)
|
||||
{
|
||||
DBUG_ENTER("Item_allany_subselect::Item_allany_subselect");
|
||||
left_expr= left_exp;
|
||||
func= func_creator(all_arg);
|
||||
init(select_lex, new (thd_arg->mem_root) select_exists_subselect(thd_arg,
|
||||
this));
|
||||
init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this));
|
||||
max_columns= 1;
|
||||
abort_on_null= 0;
|
||||
reset();
|
||||
@ -1457,7 +1448,7 @@ void Item_exists_subselect::fix_length_and_dec()
|
||||
an IN always requires LIMIT 1)
|
||||
*/
|
||||
thd->change_item_tree(&unit->global_parameters()->select_limit,
|
||||
new Item_int((int32) 1));
|
||||
new Item_int(thd, (int32) 1));
|
||||
DBUG_PRINT("info", ("Set limit to 1"));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -1493,9 +1484,9 @@ void Item_in_subselect::fix_length_and_dec()
|
||||
this item - otherwise
|
||||
*/
|
||||
|
||||
Item* Item_exists_subselect::expr_cache_insert_transformer(uchar *thd_arg)
|
||||
Item* Item_exists_subselect::expr_cache_insert_transformer(THD *tmp_thd,
|
||||
uchar *unused)
|
||||
{
|
||||
THD *tmp_thd= (THD*) thd_arg;
|
||||
DBUG_ENTER("Item_exists_subselect::expr_cache_insert_transformer");
|
||||
DBUG_ASSERT(thd == tmp_thd);
|
||||
|
||||
@ -1789,7 +1780,7 @@ Item_in_subselect::single_value_transformer(JOIN *join)
|
||||
of the statement. Thus one of 'substitution' arguments
|
||||
can be broken in case of PS.
|
||||
*/
|
||||
substitution= func->create(thd->mem_root, left_expr, where_item);
|
||||
substitution= func->create(thd, left_expr, where_item);
|
||||
have_to_be_excluded= 1;
|
||||
if (thd->lex->describe)
|
||||
{
|
||||
@ -1828,7 +1819,7 @@ Item_in_subselect::single_value_transformer(JOIN *join)
|
||||
As far as Item_in_optimizer does not substitute itself on fix_fields
|
||||
we can use same item for all selects.
|
||||
*/
|
||||
expr= new Item_direct_ref(&select_lex->context,
|
||||
expr= new Item_direct_ref(thd, &select_lex->context,
|
||||
(Item**)optimizer->get_cache(),
|
||||
(char *)"<no matter>",
|
||||
(char *)in_left_expr_name);
|
||||
@ -1866,7 +1857,6 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
|
||||
if (!test_strategy(SUBS_MAXMIN_INJECTED | SUBS_MAXMIN_ENGINE))
|
||||
DBUG_RETURN(false);
|
||||
Item **place= optimizer->arguments() + 1;
|
||||
THD *thd= join->thd;
|
||||
SELECT_LEX *select_lex= join->select_lex;
|
||||
Item *subs;
|
||||
|
||||
@ -1897,7 +1887,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
|
||||
(ALL && (> || =>)) || (ANY && (< || =<))
|
||||
for ALL condition is inverted
|
||||
*/
|
||||
item= new Item_sum_max(*select_lex->ref_pointer_array);
|
||||
item= new Item_sum_max(thd, *select_lex->ref_pointer_array);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1905,7 +1895,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
|
||||
(ALL && (< || =<)) || (ANY && (> || =>))
|
||||
for ALL condition is inverted
|
||||
*/
|
||||
item= new Item_sum_min(*select_lex->ref_pointer_array);
|
||||
item= new Item_sum_min(thd, *select_lex->ref_pointer_array);
|
||||
}
|
||||
if (upper_item)
|
||||
upper_item->set_sum_test(item);
|
||||
@ -1959,7 +1949,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
|
||||
The swap is needed for expressions of type 'f1 < ALL ( SELECT ....)'
|
||||
where we want to evaluate the sub query even if f1 would be null.
|
||||
*/
|
||||
subs= func->create_swap(thd->mem_root, *(optimizer->get_cache()), subs);
|
||||
subs= func->create_swap(thd, *(optimizer->get_cache()), subs);
|
||||
thd->change_item_tree(place, subs);
|
||||
if (subs->fix_fields(thd, &subs))
|
||||
DBUG_RETURN(true);
|
||||
@ -2051,8 +2041,9 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
|
||||
if (join_having || select_lex->with_sum_func ||
|
||||
select_lex->group_list.elements)
|
||||
{
|
||||
Item *item= func->create(thd->mem_root, expr,
|
||||
Item *item= func->create(thd, expr,
|
||||
new (thd->mem_root) Item_ref_null_helper(
|
||||
thd,
|
||||
&select_lex->context,
|
||||
this,
|
||||
select_lex->
|
||||
@ -2065,7 +2056,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
|
||||
We can encounter "NULL IN (SELECT ...)". Wrap the added condition
|
||||
within a trig_cond.
|
||||
*/
|
||||
item= new Item_func_trig_cond(item, get_cond_guard(0));
|
||||
item= new Item_func_trig_cond(thd, item, get_cond_guard(0));
|
||||
}
|
||||
|
||||
if (!join_having)
|
||||
@ -2083,13 +2074,13 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
|
||||
Item *having= item;
|
||||
Item *orig_item= item;
|
||||
|
||||
item= func->create(thd->mem_root, expr, item);
|
||||
item= func->create(thd, expr, item);
|
||||
if (!abort_on_null && orig_item->maybe_null)
|
||||
{
|
||||
having= new (thd->mem_root) Item_is_not_null_test(this, having);
|
||||
having= new (thd->mem_root) Item_is_not_null_test(thd, this, having);
|
||||
if (left_expr->maybe_null)
|
||||
{
|
||||
if (!(having= new (thd->mem_root) Item_func_trig_cond(having,
|
||||
if (!(having= new (thd->mem_root) Item_func_trig_cond(thd, having,
|
||||
get_cond_guard(0))))
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
@ -2098,8 +2089,8 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
|
||||
DBUG_RETURN(true);
|
||||
*having_item= having;
|
||||
|
||||
item= new (thd->mem_root) Item_cond_or(item,
|
||||
new (thd->mem_root) Item_func_isnull(orig_item));
|
||||
item= new (thd->mem_root) Item_cond_or(thd, item,
|
||||
new (thd->mem_root) Item_func_isnull(thd, orig_item));
|
||||
}
|
||||
/*
|
||||
If we may encounter NULL IN (SELECT ...) and care whether subquery
|
||||
@ -2107,7 +2098,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
|
||||
*/
|
||||
if (!abort_on_null && left_expr->maybe_null)
|
||||
{
|
||||
if (!(item= new (thd->mem_root) Item_func_trig_cond(item,
|
||||
if (!(item= new (thd->mem_root) Item_func_trig_cond(thd, item,
|
||||
get_cond_guard(0))))
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
@ -2127,8 +2118,8 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
|
||||
if (select_lex->master_unit()->is_union())
|
||||
{
|
||||
Item *new_having=
|
||||
func->create(thd->mem_root, expr,
|
||||
new (thd->mem_root) Item_ref_null_helper(
|
||||
func->create(thd, expr,
|
||||
new (thd->mem_root) Item_ref_null_helper(thd,
|
||||
&select_lex->context,
|
||||
this,
|
||||
select_lex->ref_pointer_array,
|
||||
@ -2136,7 +2127,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join,
|
||||
(char *)"<result>"));
|
||||
if (!abort_on_null && left_expr->maybe_null)
|
||||
{
|
||||
if (!(new_having= new (thd->mem_root) Item_func_trig_cond(new_having,
|
||||
if (!(new_having= new (thd->mem_root) Item_func_trig_cond(thd, new_having,
|
||||
get_cond_guard(0))))
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
@ -2309,34 +2300,34 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
|
||||
check_cols(left_expr->element_index(i)->cols()))
|
||||
DBUG_RETURN(true);
|
||||
Item *item_eq=
|
||||
new Item_func_eq(new
|
||||
Item_direct_ref(&select_lex->context,
|
||||
new Item_func_eq(thd, new
|
||||
Item_direct_ref(thd, &select_lex->context,
|
||||
(*optimizer->get_cache())->
|
||||
addr(i),
|
||||
(char *)"<no matter>",
|
||||
(char *)in_left_expr_name),
|
||||
new
|
||||
Item_ref(&select_lex->context,
|
||||
Item_ref(thd, &select_lex->context,
|
||||
select_lex->ref_pointer_array + i,
|
||||
(char *)"<no matter>",
|
||||
(char *)"<list ref>"));
|
||||
Item *item_isnull=
|
||||
new Item_func_isnull(new
|
||||
Item_ref(&select_lex->context,
|
||||
new Item_func_isnull(thd, new
|
||||
Item_ref(thd, &select_lex->context,
|
||||
select_lex->ref_pointer_array+i,
|
||||
(char *)"<no matter>",
|
||||
(char *)"<list ref>"));
|
||||
Item *col_item= new Item_cond_or(item_eq, item_isnull);
|
||||
Item *col_item= new Item_cond_or(thd, item_eq, item_isnull);
|
||||
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
|
||||
{
|
||||
if (!(col_item= new Item_func_trig_cond(col_item, get_cond_guard(i))))
|
||||
if (!(col_item= new Item_func_trig_cond(thd, col_item, get_cond_guard(i))))
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
*having_item= and_items(*having_item, col_item);
|
||||
*having_item= and_items(thd, *having_item, col_item);
|
||||
|
||||
Item *item_nnull_test=
|
||||
new Item_is_not_null_test(this,
|
||||
new Item_ref(&select_lex->context,
|
||||
new Item_is_not_null_test(thd, this,
|
||||
new Item_ref(thd, &select_lex->context,
|
||||
select_lex->
|
||||
ref_pointer_array + i,
|
||||
(char *)"<no matter>",
|
||||
@ -2344,13 +2335,13 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
|
||||
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
|
||||
{
|
||||
if (!(item_nnull_test=
|
||||
new Item_func_trig_cond(item_nnull_test, get_cond_guard(i))))
|
||||
new Item_func_trig_cond(thd, item_nnull_test, get_cond_guard(i))))
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
item_having_part2= and_items(item_having_part2, item_nnull_test);
|
||||
item_having_part2= and_items(thd, item_having_part2, item_nnull_test);
|
||||
item_having_part2->top_level_item();
|
||||
}
|
||||
*having_item= and_items(*having_item, item_having_part2);
|
||||
*having_item= and_items(thd, *having_item, item_having_part2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2366,14 +2357,14 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
|
||||
check_cols(left_expr->element_index(i)->cols()))
|
||||
DBUG_RETURN(true);
|
||||
item=
|
||||
new Item_func_eq(new
|
||||
Item_direct_ref(&select_lex->context,
|
||||
new Item_func_eq(thd, new
|
||||
Item_direct_ref(thd, &select_lex->context,
|
||||
(*optimizer->get_cache())->
|
||||
addr(i),
|
||||
(char *)"<no matter>",
|
||||
(char *)in_left_expr_name),
|
||||
new
|
||||
Item_direct_ref(&select_lex->context,
|
||||
Item_direct_ref(thd, &select_lex->context,
|
||||
select_lex->
|
||||
ref_pointer_array+i,
|
||||
(char *)"<no matter>",
|
||||
@ -2381,38 +2372,38 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
|
||||
if (!abort_on_null && select_lex->ref_pointer_array[i]->maybe_null)
|
||||
{
|
||||
Item *having_col_item=
|
||||
new Item_is_not_null_test(this,
|
||||
new Item_is_not_null_test(thd, this,
|
||||
new
|
||||
Item_ref(&select_lex->context,
|
||||
Item_ref(thd, &select_lex->context,
|
||||
select_lex->ref_pointer_array + i,
|
||||
(char *)"<no matter>",
|
||||
(char *)"<list ref>"));
|
||||
|
||||
|
||||
item_isnull= new
|
||||
Item_func_isnull(new
|
||||
Item_direct_ref(&select_lex->context,
|
||||
Item_func_isnull(thd, new
|
||||
Item_direct_ref(thd, &select_lex->context,
|
||||
select_lex->
|
||||
ref_pointer_array+i,
|
||||
(char *)"<no matter>",
|
||||
(char *)"<list ref>"));
|
||||
item= new Item_cond_or(item, item_isnull);
|
||||
item= new Item_cond_or(thd, item, item_isnull);
|
||||
if (left_expr->element_index(i)->maybe_null)
|
||||
{
|
||||
if (!(item= new Item_func_trig_cond(item, get_cond_guard(i))))
|
||||
if (!(item= new Item_func_trig_cond(thd, item, get_cond_guard(i))))
|
||||
DBUG_RETURN(true);
|
||||
if (!(having_col_item=
|
||||
new Item_func_trig_cond(having_col_item, get_cond_guard(i))))
|
||||
if (!(having_col_item=
|
||||
new Item_func_trig_cond(thd, having_col_item, get_cond_guard(i))))
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
*having_item= and_items(*having_item, having_col_item);
|
||||
*having_item= and_items(thd, *having_item, having_col_item);
|
||||
}
|
||||
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
|
||||
{
|
||||
if (!(item= new Item_func_trig_cond(item, get_cond_guard(i))))
|
||||
if (!(item= new Item_func_trig_cond(thd, item, get_cond_guard(i))))
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
*where_item= and_items(*where_item, item);
|
||||
*where_item= and_items(thd, *where_item, item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2542,7 +2533,7 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
|
||||
and_args->disjoin((List<Item> *) &join_arg->cond_equal->current_level);
|
||||
}
|
||||
|
||||
where_item= and_items(join_arg->conds, where_item);
|
||||
where_item= and_items(thd, join_arg->conds, where_item);
|
||||
if (!where_item->fixed && where_item->fix_fields(thd, 0))
|
||||
DBUG_RETURN(true);
|
||||
// TIMOUR TODO: call optimize_cond() for the new where clause
|
||||
@ -2567,7 +2558,7 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
|
||||
if (having_item)
|
||||
{
|
||||
Item* join_having= join_arg->having ? join_arg->having:join_arg->tmp_having;
|
||||
having_item= and_items(join_having, having_item);
|
||||
having_item= and_items(thd, join_having, having_item);
|
||||
if (fix_having(having_item, select_lex))
|
||||
DBUG_RETURN(true);
|
||||
// TIMOUR TODO: call optimize_cond() for the new having clause
|
||||
@ -2576,7 +2567,7 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
|
||||
join_arg->having= select_lex->having;
|
||||
}
|
||||
join_arg->thd->change_item_tree(&unit->global_parameters()->select_limit,
|
||||
new Item_int((int32) 1));
|
||||
new Item_int(thd, (int32) 1));
|
||||
unit->select_limit_cnt= 1;
|
||||
|
||||
DBUG_RETURN(false);
|
||||
@ -2603,7 +2594,7 @@ bool Item_exists_subselect::select_prepare_to_be_in()
|
||||
Query_arena *arena, backup;
|
||||
bool result;
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
result= (!(optimizer= new Item_in_optimizer(new Item_int(1), this)));
|
||||
result= (!(optimizer= new Item_in_optimizer(thd, new Item_int(thd, 1), this)));
|
||||
if (arena)
|
||||
thd->restore_active_arena(arena, &backup);
|
||||
if (result)
|
||||
@ -2823,10 +2814,10 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
|
||||
|
||||
/* remove the parts from condition */
|
||||
if (!upper_not || !local_field->maybe_null)
|
||||
*eq_ref= new Item_int(1);
|
||||
*eq_ref= new Item_int(thd, 1);
|
||||
else
|
||||
{
|
||||
*eq_ref= new Item_func_isnotnull(
|
||||
*eq_ref= new Item_func_isnotnull(thd,
|
||||
new Item_field(thd,
|
||||
((Item_field*)(local_field->real_item()))->context,
|
||||
((Item_field*)(local_field->real_item()))->field));
|
||||
@ -2849,7 +2840,7 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
|
||||
left_exp= outer_exp;
|
||||
else
|
||||
{
|
||||
if (!(left_exp= new Item_row(outer)))
|
||||
if (!(left_exp= new Item_row(thd, outer)))
|
||||
{
|
||||
res= TRUE;
|
||||
goto out;
|
||||
@ -2861,7 +2852,7 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
|
||||
|
||||
first_select->select_limit= NULL;
|
||||
if (!(in_subs= new (thd->mem_root) Item_in_subselect(thd, left_exp,
|
||||
first_select)))
|
||||
first_select)))
|
||||
{
|
||||
res= TRUE;
|
||||
goto out;
|
||||
@ -2891,7 +2882,7 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
|
||||
As far as Item_ref_in_optimizer do not substitute itself on fix_fields
|
||||
we can use same item for all selects.
|
||||
*/
|
||||
in_subs->expr= new Item_direct_ref(&first_select->context,
|
||||
in_subs->expr= new Item_direct_ref(thd, &first_select->context,
|
||||
(Item**)optimizer->get_cache(),
|
||||
(char *)"<no matter>",
|
||||
(char *)in_left_expr_name);
|
||||
@ -2957,9 +2948,9 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
|
||||
{
|
||||
exp= (optimizer->arguments()[0]->maybe_null ?
|
||||
(Item*)
|
||||
new Item_cond_and(
|
||||
new Item_func_isnotnull(
|
||||
new Item_direct_ref(&unit->outer_select()->context,
|
||||
new Item_cond_and(thd,
|
||||
new Item_func_isnotnull(thd,
|
||||
new Item_direct_ref(thd, &unit->outer_select()->context,
|
||||
optimizer->arguments(),
|
||||
(char *)"<no matter>",
|
||||
(char *)exists_outer_expr_name)),
|
||||
@ -2980,8 +2971,8 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
|
||||
{
|
||||
and_list->
|
||||
push_front(
|
||||
new Item_func_isnotnull(
|
||||
new Item_direct_ref(&unit->outer_select()->context,
|
||||
new Item_func_isnotnull(thd,
|
||||
new Item_direct_ref(thd, &unit->outer_select()->context,
|
||||
optimizer->arguments()[0]->addr(i),
|
||||
(char *)"<no matter>",
|
||||
(char *)exists_outer_expr_name)));
|
||||
@ -2990,7 +2981,7 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
|
||||
if (and_list->elements > 0)
|
||||
{
|
||||
and_list->push_front(optimizer);
|
||||
exp= new Item_cond_and(*and_list);
|
||||
exp= new Item_cond_and(thd, *and_list);
|
||||
}
|
||||
else
|
||||
exp= optimizer;
|
||||
@ -3065,7 +3056,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
if (!optimizer)
|
||||
{
|
||||
result= (!(optimizer= new Item_in_optimizer(left_expr, this)));
|
||||
result= (!(optimizer= new Item_in_optimizer(thd, left_expr, this)));
|
||||
if (result)
|
||||
goto out;
|
||||
}
|
||||
@ -3127,12 +3118,12 @@ void Item_in_subselect::print(String *str, enum_query_type query_type)
|
||||
Item_subselect::print(str, query_type);
|
||||
}
|
||||
|
||||
bool Item_exists_subselect::fix_fields(THD *thd_arg, Item **ref)
|
||||
bool Item_exists_subselect::fix_fields(THD *thd, Item **ref)
|
||||
{
|
||||
DBUG_ENTER("Item_exists_subselect::fix_fields");
|
||||
if (exists_transformed)
|
||||
DBUG_RETURN( !( (*ref)= new Item_int(1)));
|
||||
DBUG_RETURN(Item_subselect::fix_fields(thd_arg, ref));
|
||||
DBUG_RETURN( !( (*ref)= new Item_int(thd, 1)));
|
||||
DBUG_RETURN(Item_subselect::fix_fields(thd, ref));
|
||||
}
|
||||
|
||||
|
||||
@ -3143,7 +3134,7 @@ bool Item_in_subselect::fix_fields(THD *thd_arg, Item **ref)
|
||||
DBUG_ENTER("Item_in_subselect::fix_fields");
|
||||
|
||||
if (test_strategy(SUBS_SEMI_JOIN))
|
||||
DBUG_RETURN( !( (*ref)= new Item_int(1)) );
|
||||
DBUG_RETURN( !( (*ref)= new Item_int(thd, 1)) );
|
||||
|
||||
/*
|
||||
Check if the outer and inner IN operands match in those cases when we
|
||||
@ -3574,9 +3565,9 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
|
||||
item->decimals= sel_item->decimals;
|
||||
item->unsigned_flag= sel_item->unsigned_flag;
|
||||
maybe_null= sel_item->maybe_null;
|
||||
if (!(row[i]= Item_cache::get_cache(sel_item, sel_item->cmp_type())))
|
||||
if (!(row[i]= Item_cache::get_cache(thd, sel_item, sel_item->cmp_type())))
|
||||
return;
|
||||
row[i]->setup(sel_item);
|
||||
row[i]->setup(thd, sel_item);
|
||||
//psergey-backport-timours: row[i]->store(sel_item);
|
||||
}
|
||||
if (item_list.elements > 1)
|
||||
@ -4897,7 +4888,7 @@ bool subselect_hash_sj_engine::make_semi_join_conds()
|
||||
DBUG_ENTER("subselect_hash_sj_engine::make_semi_join_conds");
|
||||
DBUG_ASSERT(semi_join_conds == NULL);
|
||||
|
||||
if (!(semi_join_conds= new Item_cond_and))
|
||||
if (!(semi_join_conds= new Item_cond_and(thd)))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (!(tmp_table_ref= (TABLE_LIST*) thd->alloc(sizeof(TABLE_LIST))))
|
||||
@ -4922,7 +4913,7 @@ bool subselect_hash_sj_engine::make_semi_join_conds()
|
||||
Item_field *right_col_item;
|
||||
|
||||
if (!(right_col_item= new Item_field(thd, context, tmp_table->field[i])) ||
|
||||
!(eq_cond= new Item_func_eq(item_in->left_expr->element_index(i),
|
||||
!(eq_cond= new Item_func_eq(thd, item_in->left_expr->element_index(i),
|
||||
right_col_item)) ||
|
||||
(((Item_cond_and*)semi_join_conds)->add(eq_cond)))
|
||||
{
|
||||
@ -5529,9 +5520,9 @@ bool Ordered_key::init(MY_BITMAP *columns_to_index)
|
||||
{
|
||||
if (!bitmap_is_set(columns_to_index, i))
|
||||
continue;
|
||||
cur_tmp_field= new Item_field(tbl->field[i]);
|
||||
cur_tmp_field= new Item_field(thd, tbl->field[i]);
|
||||
/* Create the predicate (tmp_column[i] < outer_ref[i]). */
|
||||
fn_less_than= new Item_func_lt(cur_tmp_field,
|
||||
fn_less_than= new Item_func_lt(thd, cur_tmp_field,
|
||||
search_key->element_index(i));
|
||||
fn_less_than->fix_fields(thd, (Item**) &fn_less_than);
|
||||
key_columns[cur_key_col]= cur_tmp_field;
|
||||
@ -5563,9 +5554,9 @@ bool Ordered_key::init(int col_idx)
|
||||
key_columns= (Item_field**) thd->alloc(sizeof(Item_field*));
|
||||
compare_pred= (Item_func_lt**) thd->alloc(sizeof(Item_func_lt*));
|
||||
|
||||
key_columns[0]= new Item_field(tbl->field[col_idx]);
|
||||
key_columns[0]= new Item_field(thd, tbl->field[col_idx]);
|
||||
/* Create the predicate (tmp_column[i] < outer_ref[i]). */
|
||||
compare_pred[0]= new Item_func_lt(key_columns[0],
|
||||
compare_pred[0]= new Item_func_lt(thd, key_columns[0],
|
||||
search_key->element_index(col_idx));
|
||||
compare_pred[0]->fix_fields(thd, (Item**)&compare_pred[0]);
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
enum subs_type {UNKNOWN_SUBS, SINGLEROW_SUBS,
|
||||
EXISTS_SUBS, IN_SUBS, ALL_SUBS, ANY_SUBS};
|
||||
|
||||
Item_subselect();
|
||||
Item_subselect(THD *thd);
|
||||
|
||||
virtual subs_type substype() { return UNKNOWN_SUBS; }
|
||||
bool is_in_predicate()
|
||||
@ -269,7 +269,7 @@ protected:
|
||||
Item_cache *value, **row;
|
||||
public:
|
||||
Item_singlerow_subselect(THD *thd_arg, st_select_lex *select_lex);
|
||||
Item_singlerow_subselect() :Item_subselect(), value(0), row (0)
|
||||
Item_singlerow_subselect(THD *thd_arg): Item_subselect(thd_arg), value(0), row (0)
|
||||
{}
|
||||
|
||||
void cleanup();
|
||||
@ -311,7 +311,7 @@ public:
|
||||
*/
|
||||
st_select_lex* invalidate_and_restore_select_lex();
|
||||
|
||||
Item* expr_cache_insert_transformer(uchar *thd_arg);
|
||||
Item* expr_cache_insert_transformer(THD *thd, uchar *unused);
|
||||
|
||||
friend class select_singlerow_subselect;
|
||||
};
|
||||
@ -364,8 +364,8 @@ public:
|
||||
bool exists_transformed;
|
||||
|
||||
Item_exists_subselect(THD *thd_arg, st_select_lex *select_lex);
|
||||
Item_exists_subselect()
|
||||
:Item_subselect(), upper_not(NULL),abort_on_null(0),
|
||||
Item_exists_subselect(THD *thd_arg):
|
||||
Item_subselect(thd_arg), upper_not(NULL), abort_on_null(0),
|
||||
emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0)
|
||||
{}
|
||||
|
||||
@ -391,7 +391,7 @@ public:
|
||||
inline bool is_top_level_item() { return abort_on_null; }
|
||||
bool exists2in_processor(uchar *opt_arg);
|
||||
|
||||
Item* expr_cache_insert_transformer(uchar *thd_arg);
|
||||
Item* expr_cache_insert_transformer(THD *thd, uchar *unused);
|
||||
|
||||
void mark_as_condition_AND_part(TABLE_LIST *embedding)
|
||||
{
|
||||
@ -570,8 +570,8 @@ public:
|
||||
Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery
|
||||
|
||||
Item_in_subselect(THD *thd_arg, Item * left_expr, st_select_lex *select_lex);
|
||||
Item_in_subselect()
|
||||
:Item_exists_subselect(), left_expr_cache(0), first_execution(TRUE),
|
||||
Item_in_subselect(THD *thd_arg):
|
||||
Item_exists_subselect(thd_arg), left_expr_cache(0), first_execution(TRUE),
|
||||
in_strategy(SUBS_NOT_TRANSFORMED),
|
||||
pushed_cond_guards(NULL), func(NULL), is_jtbm_merged(FALSE),
|
||||
is_jtbm_const_tab(FALSE), upper_item(0) {}
|
||||
|
@ -401,7 +401,7 @@ bool Item_sum::collect_outer_ref_processor(uchar *param)
|
||||
}
|
||||
|
||||
|
||||
Item_sum::Item_sum(List<Item> &list) :Item_func_or_sum(list),
|
||||
Item_sum::Item_sum(THD *thd, List<Item> &list): Item_func_or_sum(thd, list),
|
||||
forced_const(FALSE)
|
||||
{
|
||||
if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count)))
|
||||
@ -490,7 +490,7 @@ Item *Item_sum::get_tmp_table_item(THD *thd)
|
||||
if (arg->type() == Item::FIELD_ITEM)
|
||||
((Item_field*) arg)->field= result_field_tmp++;
|
||||
else
|
||||
sum_item->args[i]= new Item_field(result_field_tmp++);
|
||||
sum_item->args[i]= new Item_field(thd, result_field_tmp++);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1197,7 +1197,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
|
||||
case IMPOSSIBLE_RESULT:
|
||||
DBUG_ASSERT(0);
|
||||
};
|
||||
setup_hybrid(args[0], NULL);
|
||||
setup_hybrid(thd, args[0], NULL);
|
||||
/* MIN/MAX can return NULL for empty set indepedent of the used column */
|
||||
maybe_null= 1;
|
||||
unsigned_flag=item->unsigned_flag;
|
||||
@ -1236,18 +1236,18 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
|
||||
and Item_sum_min::add() to use different values!
|
||||
*/
|
||||
|
||||
void Item_sum_hybrid::setup_hybrid(Item *item, Item *value_arg)
|
||||
void Item_sum_hybrid::setup_hybrid(THD *thd, Item *item, Item *value_arg)
|
||||
{
|
||||
if (!(value= Item_cache::get_cache(item, item->cmp_type())))
|
||||
if (!(value= Item_cache::get_cache(thd, item, item->cmp_type())))
|
||||
return;
|
||||
value->setup(item);
|
||||
value->setup(thd, item);
|
||||
value->store(value_arg);
|
||||
/* Don't cache value, as it will change */
|
||||
if (!item->const_item())
|
||||
value->set_used_tables(RAND_TABLE_BIT);
|
||||
if (!(arg_cache= Item_cache::get_cache(item, item->cmp_type())))
|
||||
if (!(arg_cache= Item_cache::get_cache(thd, item, item->cmp_type())))
|
||||
return;
|
||||
arg_cache->setup(item);
|
||||
arg_cache->setup(thd, item);
|
||||
/* Don't cache value, as it will change */
|
||||
if (!item->const_item())
|
||||
arg_cache->set_used_tables(RAND_TABLE_BIT);
|
||||
@ -2088,7 +2088,7 @@ void Item_sum_hybrid::restore_to_before_no_rows_in_result()
|
||||
Item *Item_sum_min::copy_or_same(THD* thd)
|
||||
{
|
||||
Item_sum_min *item= new (thd->mem_root) Item_sum_min(thd, this);
|
||||
item->setup_hybrid(args[0], value);
|
||||
item->setup_hybrid(thd, args[0], value);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -2111,7 +2111,7 @@ bool Item_sum_min::add()
|
||||
Item *Item_sum_max::copy_or_same(THD* thd)
|
||||
{
|
||||
Item_sum_max *item= new (thd->mem_root) Item_sum_max(thd, this);
|
||||
item->setup_hybrid(args[0], value);
|
||||
item->setup_hybrid(thd, args[0], value);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -2591,7 +2591,9 @@ Item_sum_hybrid::min_max_update_decimal_field()
|
||||
}
|
||||
|
||||
|
||||
Item_avg_field::Item_avg_field(Item_result res_type, Item_sum_avg *item)
|
||||
Item_avg_field::Item_avg_field(THD *thd, Item_result res_type,
|
||||
Item_sum_avg *item):
|
||||
Item_result_field(thd)
|
||||
{
|
||||
name=item->name;
|
||||
decimals=item->decimals;
|
||||
@ -2664,8 +2666,8 @@ String *Item_avg_field::val_str(String *str)
|
||||
}
|
||||
|
||||
|
||||
Item_std_field::Item_std_field(Item_sum_std *item)
|
||||
: Item_variance_field(item)
|
||||
Item_std_field::Item_std_field(THD *thd, Item_sum_std *item):
|
||||
Item_variance_field(thd, item)
|
||||
{
|
||||
}
|
||||
|
||||
@ -2703,7 +2705,8 @@ my_decimal *Item_std_field::val_decimal(my_decimal *dec_buf)
|
||||
}
|
||||
|
||||
|
||||
Item_variance_field::Item_variance_field(Item_sum_variance *item)
|
||||
Item_variance_field::Item_variance_field(THD *thd, Item_sum_variance *item):
|
||||
Item_result_field(thd)
|
||||
{
|
||||
name=item->name;
|
||||
decimals=item->decimals;
|
||||
@ -3147,11 +3150,11 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
|
||||
*/
|
||||
|
||||
Item_func_group_concat::
|
||||
Item_func_group_concat(Name_resolution_context *context_arg,
|
||||
Item_func_group_concat(THD *thd, Name_resolution_context *context_arg,
|
||||
bool distinct_arg, List<Item> *select_list,
|
||||
const SQL_I_List<ORDER> &order_list,
|
||||
String *separator_arg)
|
||||
:tmp_table_param(0), separator(separator_arg), tree(0),
|
||||
:Item_sum(thd), tmp_table_param(0), separator(separator_arg), tree(0),
|
||||
unique_filter(NULL), table(0),
|
||||
order(0), context(context_arg),
|
||||
arg_count_order(order_list.elements),
|
||||
|
174
sql/item_sum.h
174
sql/item_sum.h
@ -381,24 +381,24 @@ protected:
|
||||
public:
|
||||
|
||||
void mark_as_sum_func();
|
||||
Item_sum() :Item_func_or_sum(), quick_group(1), forced_const(FALSE)
|
||||
Item_sum(THD *thd): Item_func_or_sum(thd), quick_group(1), forced_const(FALSE)
|
||||
{
|
||||
mark_as_sum_func();
|
||||
init_aggregator();
|
||||
}
|
||||
Item_sum(Item *a) :Item_func_or_sum(a), quick_group(1),
|
||||
Item_sum(THD *thd, Item *a): Item_func_or_sum(thd, a), quick_group(1),
|
||||
orig_args(tmp_orig_args), forced_const(FALSE)
|
||||
{
|
||||
mark_as_sum_func();
|
||||
init_aggregator();
|
||||
}
|
||||
Item_sum(Item *a, Item *b) :Item_func_or_sum(a, b), quick_group(1),
|
||||
orig_args(tmp_orig_args), forced_const(FALSE)
|
||||
Item_sum(THD *thd, Item *a, Item *b): Item_func_or_sum(thd, a, b),
|
||||
quick_group(1), orig_args(tmp_orig_args), forced_const(FALSE)
|
||||
{
|
||||
mark_as_sum_func();
|
||||
init_aggregator();
|
||||
}
|
||||
Item_sum(List<Item> &list);
|
||||
Item_sum(THD *thd, List<Item> &list);
|
||||
//Copy constructor, need to perform subselects with temporary tables
|
||||
Item_sum(THD *thd, Item_sum *item);
|
||||
enum Type type() const { return SUM_FUNC_ITEM; }
|
||||
@ -431,8 +431,8 @@ public:
|
||||
virtual void update_field()=0;
|
||||
virtual bool keep_field_type(void) const { return 0; }
|
||||
virtual void fix_length_and_dec() { maybe_null=1; null_value=1; }
|
||||
virtual Item *result_item(Field *field)
|
||||
{ return new Item_field(field); }
|
||||
virtual Item *result_item(THD *thd, Field *field)
|
||||
{ return new Item_field(thd, field); }
|
||||
/*
|
||||
Return bitmap of tables that are needed to evaluate the item.
|
||||
|
||||
@ -694,14 +694,15 @@ protected:
|
||||
*/
|
||||
bool is_evaluated;
|
||||
public:
|
||||
Item_sum_num() :Item_sum(),is_evaluated(FALSE) {}
|
||||
Item_sum_num(Item *item_par)
|
||||
:Item_sum(item_par), is_evaluated(FALSE) {}
|
||||
Item_sum_num(Item *a, Item* b) :Item_sum(a,b),is_evaluated(FALSE) {}
|
||||
Item_sum_num(List<Item> &list)
|
||||
:Item_sum(list), is_evaluated(FALSE) {}
|
||||
Item_sum_num(THD *thd, Item_sum_num *item)
|
||||
:Item_sum(thd, item),is_evaluated(item->is_evaluated) {}
|
||||
Item_sum_num(THD *thd): Item_sum(thd), is_evaluated(FALSE) {}
|
||||
Item_sum_num(THD *thd, Item *item_par):
|
||||
Item_sum(thd, item_par), is_evaluated(FALSE) {}
|
||||
Item_sum_num(THD *thd, Item *a, Item* b):
|
||||
Item_sum(thd, a, b), is_evaluated(FALSE) {}
|
||||
Item_sum_num(THD *thd, List<Item> &list):
|
||||
Item_sum(thd, list), is_evaluated(FALSE) {}
|
||||
Item_sum_num(THD *thd, Item_sum_num *item):
|
||||
Item_sum(thd, item),is_evaluated(item->is_evaluated) {}
|
||||
bool fix_fields(THD *, Item **);
|
||||
longlong val_int()
|
||||
{
|
||||
@ -717,8 +718,8 @@ public:
|
||||
class Item_sum_int :public Item_sum_num
|
||||
{
|
||||
public:
|
||||
Item_sum_int(Item *item_par) :Item_sum_num(item_par) {}
|
||||
Item_sum_int(List<Item> &list) :Item_sum_num(list) {}
|
||||
Item_sum_int(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {}
|
||||
Item_sum_int(THD *thd, List<Item> &list): Item_sum_num(thd, list) {}
|
||||
Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item) {}
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
String *val_str(String*str);
|
||||
@ -739,7 +740,8 @@ protected:
|
||||
void fix_length_and_dec();
|
||||
|
||||
public:
|
||||
Item_sum_sum(Item *item_par, bool distinct) :Item_sum_num(item_par)
|
||||
Item_sum_sum(THD *thd, Item *item_par, bool distinct):
|
||||
Item_sum_num(thd, item_par)
|
||||
{
|
||||
set_distinct(distinct);
|
||||
}
|
||||
@ -777,8 +779,8 @@ class Item_sum_count :public Item_sum_int
|
||||
void cleanup();
|
||||
|
||||
public:
|
||||
Item_sum_count(Item *item_par)
|
||||
:Item_sum_int(item_par),count(0)
|
||||
Item_sum_count(THD *thd, Item *item_par):
|
||||
Item_sum_int(thd, item_par), count(0)
|
||||
{}
|
||||
|
||||
/**
|
||||
@ -789,13 +791,13 @@ class Item_sum_count :public Item_sum_int
|
||||
This constructor is called by the parser only for COUNT (DISTINCT).
|
||||
*/
|
||||
|
||||
Item_sum_count(List<Item> &list)
|
||||
:Item_sum_int(list),count(0)
|
||||
Item_sum_count(THD *thd, List<Item> &list):
|
||||
Item_sum_int(thd, list), count(0)
|
||||
{
|
||||
set_distinct(TRUE);
|
||||
}
|
||||
Item_sum_count(THD *thd, Item_sum_count *item)
|
||||
:Item_sum_int(thd, item), count(item->count)
|
||||
Item_sum_count(THD *thd, Item_sum_count *item):
|
||||
Item_sum_int(thd, item), count(item->count)
|
||||
{}
|
||||
enum Sumfunctype sum_func () const
|
||||
{
|
||||
@ -829,7 +831,7 @@ public:
|
||||
Item_result hybrid_type;
|
||||
uint f_precision, f_scale, dec_bin_size;
|
||||
uint prec_increment;
|
||||
Item_avg_field(Item_result res_type, Item_sum_avg *item);
|
||||
Item_avg_field(THD *thd, Item_result res_type, Item_sum_avg *item);
|
||||
enum Type type() const { return FIELD_AVG_ITEM; }
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
@ -856,8 +858,8 @@ public:
|
||||
uint prec_increment;
|
||||
uint f_precision, f_scale, dec_bin_size;
|
||||
|
||||
Item_sum_avg(Item *item_par, bool distinct)
|
||||
:Item_sum_sum(item_par, distinct), count(0)
|
||||
Item_sum_avg(THD *thd, Item *item_par, bool distinct):
|
||||
Item_sum_sum(thd, item_par, distinct), count(0)
|
||||
{}
|
||||
Item_sum_avg(THD *thd, Item_sum_avg *item)
|
||||
:Item_sum_sum(thd, item), count(item->count),
|
||||
@ -877,8 +879,8 @@ public:
|
||||
String *val_str(String *str);
|
||||
void reset_field();
|
||||
void update_field();
|
||||
Item *result_item(Field *field)
|
||||
{ return new Item_avg_field(hybrid_type, this); }
|
||||
Item *result_item(THD *thd, Field *field)
|
||||
{ return new Item_avg_field(thd, hybrid_type, this); }
|
||||
void no_rows_in_result() {}
|
||||
const char *func_name() const
|
||||
{
|
||||
@ -905,7 +907,7 @@ public:
|
||||
uint dec_bin_size0, dec_bin_size1;
|
||||
uint sample;
|
||||
uint prec_increment;
|
||||
Item_variance_field(Item_sum_variance *item);
|
||||
Item_variance_field(THD *thd, Item_sum_variance *item);
|
||||
enum Type type() const {return FIELD_VARIANCE_ITEM; }
|
||||
double val_real();
|
||||
longlong val_int()
|
||||
@ -963,8 +965,9 @@ public:
|
||||
uint sample;
|
||||
uint prec_increment;
|
||||
|
||||
Item_sum_variance(Item *item_par, uint sample_arg) :Item_sum_num(item_par),
|
||||
hybrid_type(REAL_RESULT), count(0), sample(sample_arg)
|
||||
Item_sum_variance(THD *thd, Item *item_par, uint sample_arg):
|
||||
Item_sum_num(thd, item_par), hybrid_type(REAL_RESULT), count(0),
|
||||
sample(sample_arg)
|
||||
{}
|
||||
Item_sum_variance(THD *thd, Item_sum_variance *item);
|
||||
enum Sumfunctype sum_func () const { return VARIANCE_FUNC; }
|
||||
@ -974,8 +977,8 @@ public:
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
void reset_field();
|
||||
void update_field();
|
||||
Item *result_item(Field *field)
|
||||
{ return new Item_variance_field(this); }
|
||||
Item *result_item(THD *thd, Field *field)
|
||||
{ return new Item_variance_field(thd, this); }
|
||||
void no_rows_in_result() {}
|
||||
const char *func_name() const
|
||||
{ return sample ? "var_samp(" : "variance("; }
|
||||
@ -994,7 +997,7 @@ class Item_sum_std;
|
||||
class Item_std_field :public Item_variance_field
|
||||
{
|
||||
public:
|
||||
Item_std_field(Item_sum_std *item);
|
||||
Item_std_field(THD *thd, Item_sum_std *item);
|
||||
enum Type type() const { return FIELD_STD_ITEM; }
|
||||
double val_real();
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
@ -1009,15 +1012,15 @@ public:
|
||||
class Item_sum_std :public Item_sum_variance
|
||||
{
|
||||
public:
|
||||
Item_sum_std(Item *item_par, uint sample_arg)
|
||||
:Item_sum_variance(item_par, sample_arg) {}
|
||||
Item_sum_std(THD *thd, Item *item_par, uint sample_arg):
|
||||
Item_sum_variance(thd, item_par, sample_arg) {}
|
||||
Item_sum_std(THD *thd, Item_sum_std *item)
|
||||
:Item_sum_variance(thd, item)
|
||||
{}
|
||||
enum Sumfunctype sum_func () const { return STD_FUNC; }
|
||||
double val_real();
|
||||
Item *result_item(Field *field)
|
||||
{ return new Item_std_field(this); }
|
||||
Item *result_item(THD *thd, Field *field)
|
||||
{ return new Item_std_field(thd, this); }
|
||||
const char *func_name() const { return "std("; }
|
||||
Item *copy_or_same(THD* thd);
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
@ -1039,8 +1042,8 @@ protected:
|
||||
bool was_null_value;
|
||||
|
||||
public:
|
||||
Item_sum_hybrid(Item *item_par,int sign)
|
||||
:Item_sum(item_par), value(0), arg_cache(0), cmp(0),
|
||||
Item_sum_hybrid(THD *thd, Item *item_par,int sign):
|
||||
Item_sum(thd, item_par), value(0), arg_cache(0), cmp(0),
|
||||
hybrid_type(INT_RESULT), hybrid_field_type(MYSQL_TYPE_LONGLONG),
|
||||
cmp_sign(sign), was_values(TRUE)
|
||||
{ collation.set(&my_charset_bin); }
|
||||
@ -1050,7 +1053,7 @@ protected:
|
||||
cmp_sign(item->cmp_sign), was_values(item->was_values)
|
||||
{ }
|
||||
bool fix_fields(THD *, Item **);
|
||||
void setup_hybrid(Item *item, Item *value_arg);
|
||||
void setup_hybrid(THD *thd, Item *item, Item *value_arg);
|
||||
void clear();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
@ -1077,7 +1080,7 @@ protected:
|
||||
class Item_sum_min :public Item_sum_hybrid
|
||||
{
|
||||
public:
|
||||
Item_sum_min(Item *item_par) :Item_sum_hybrid(item_par,1) {}
|
||||
Item_sum_min(THD *thd, Item *item_par): Item_sum_hybrid(thd, item_par, 1) {}
|
||||
Item_sum_min(THD *thd, Item_sum_min *item) :Item_sum_hybrid(thd, item) {}
|
||||
enum Sumfunctype sum_func () const {return MIN_FUNC;}
|
||||
|
||||
@ -1090,7 +1093,7 @@ public:
|
||||
class Item_sum_max :public Item_sum_hybrid
|
||||
{
|
||||
public:
|
||||
Item_sum_max(Item *item_par) :Item_sum_hybrid(item_par,-1) {}
|
||||
Item_sum_max(THD *thd, Item *item_par): Item_sum_hybrid(thd, item_par, -1) {}
|
||||
Item_sum_max(THD *thd, Item_sum_max *item) :Item_sum_hybrid(thd, item) {}
|
||||
enum Sumfunctype sum_func () const {return MAX_FUNC;}
|
||||
|
||||
@ -1106,8 +1109,8 @@ protected:
|
||||
ulonglong reset_bits,bits;
|
||||
|
||||
public:
|
||||
Item_sum_bit(Item *item_par,ulonglong reset_arg)
|
||||
:Item_sum_int(item_par),reset_bits(reset_arg),bits(reset_arg) {}
|
||||
Item_sum_bit(THD *thd, Item *item_par, ulonglong reset_arg):
|
||||
Item_sum_int(thd, item_par), reset_bits(reset_arg), bits(reset_arg) {}
|
||||
Item_sum_bit(THD *thd, Item_sum_bit *item):
|
||||
Item_sum_int(thd, item), reset_bits(item->reset_bits), bits(item->bits) {}
|
||||
enum Sumfunctype sum_func () const {return SUM_BIT_FUNC;}
|
||||
@ -1128,7 +1131,7 @@ public:
|
||||
class Item_sum_or :public Item_sum_bit
|
||||
{
|
||||
public:
|
||||
Item_sum_or(Item *item_par) :Item_sum_bit(item_par, 0) {}
|
||||
Item_sum_or(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
|
||||
Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {}
|
||||
bool add();
|
||||
const char *func_name() const { return "bit_or("; }
|
||||
@ -1139,7 +1142,8 @@ public:
|
||||
class Item_sum_and :public Item_sum_bit
|
||||
{
|
||||
public:
|
||||
Item_sum_and(Item *item_par) :Item_sum_bit(item_par, ULONGLONG_MAX) {}
|
||||
Item_sum_and(THD *thd, Item *item_par):
|
||||
Item_sum_bit(thd, item_par, ULONGLONG_MAX) {}
|
||||
Item_sum_and(THD *thd, Item_sum_and *item) :Item_sum_bit(thd, item) {}
|
||||
bool add();
|
||||
const char *func_name() const { return "bit_and("; }
|
||||
@ -1149,7 +1153,7 @@ class Item_sum_and :public Item_sum_bit
|
||||
class Item_sum_xor :public Item_sum_bit
|
||||
{
|
||||
public:
|
||||
Item_sum_xor(Item *item_par) :Item_sum_bit(item_par, 0) {}
|
||||
Item_sum_xor(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
|
||||
Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {}
|
||||
bool add();
|
||||
const char *func_name() const { return "bit_xor("; }
|
||||
@ -1169,11 +1173,11 @@ protected:
|
||||
udf_handler udf;
|
||||
|
||||
public:
|
||||
Item_udf_sum(udf_func *udf_arg)
|
||||
:Item_sum(), udf(udf_arg)
|
||||
Item_udf_sum(THD *thd, udf_func *udf_arg):
|
||||
Item_sum(thd), udf(udf_arg)
|
||||
{ quick_group=0; }
|
||||
Item_udf_sum(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_sum(list), udf(udf_arg)
|
||||
Item_udf_sum(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_sum(thd, list), udf(udf_arg)
|
||||
{ quick_group=0;}
|
||||
Item_udf_sum(THD *thd, Item_udf_sum *item)
|
||||
:Item_sum(thd, item), udf(item->udf)
|
||||
@ -1208,10 +1212,10 @@ public:
|
||||
class Item_sum_udf_float :public Item_udf_sum
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_float(udf_func *udf_arg)
|
||||
:Item_udf_sum(udf_arg) {}
|
||||
Item_sum_udf_float(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_udf_sum(udf_arg, list) {}
|
||||
Item_sum_udf_float(THD *thd, udf_func *udf_arg):
|
||||
Item_udf_sum(thd, udf_arg) {}
|
||||
Item_sum_udf_float(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_udf_sum(thd, udf_arg, list) {}
|
||||
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
|
||||
:Item_udf_sum(thd, item) {}
|
||||
longlong val_int()
|
||||
@ -1230,10 +1234,10 @@ class Item_sum_udf_float :public Item_udf_sum
|
||||
class Item_sum_udf_int :public Item_udf_sum
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_int(udf_func *udf_arg)
|
||||
:Item_udf_sum(udf_arg) {}
|
||||
Item_sum_udf_int(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_udf_sum(udf_arg, list) {}
|
||||
Item_sum_udf_int(THD *thd, udf_func *udf_arg):
|
||||
Item_udf_sum(thd, udf_arg) {}
|
||||
Item_sum_udf_int(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_udf_sum(thd, udf_arg, list) {}
|
||||
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
|
||||
:Item_udf_sum(thd, item) {}
|
||||
longlong val_int();
|
||||
@ -1250,10 +1254,10 @@ public:
|
||||
class Item_sum_udf_str :public Item_udf_sum
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_str(udf_func *udf_arg)
|
||||
:Item_udf_sum(udf_arg) {}
|
||||
Item_sum_udf_str(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_udf_sum(udf_arg,list) {}
|
||||
Item_sum_udf_str(THD *thd, udf_func *udf_arg):
|
||||
Item_udf_sum(thd, udf_arg) {}
|
||||
Item_sum_udf_str(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_udf_sum(thd, udf_arg, list) {}
|
||||
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
|
||||
:Item_udf_sum(thd, item) {}
|
||||
String *val_str(String *);
|
||||
@ -1289,10 +1293,10 @@ public:
|
||||
class Item_sum_udf_decimal :public Item_udf_sum
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_decimal(udf_func *udf_arg)
|
||||
:Item_udf_sum(udf_arg) {}
|
||||
Item_sum_udf_decimal(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_udf_sum(udf_arg, list) {}
|
||||
Item_sum_udf_decimal(THD *thd, udf_func *udf_arg):
|
||||
Item_udf_sum(thd, udf_arg) {}
|
||||
Item_sum_udf_decimal(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_udf_sum(thd, udf_arg, list) {}
|
||||
Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item)
|
||||
:Item_udf_sum(thd, item) {}
|
||||
String *val_str(String *);
|
||||
@ -1309,9 +1313,10 @@ public:
|
||||
class Item_sum_udf_float :public Item_sum_num
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_float(udf_func *udf_arg)
|
||||
:Item_sum_num() {}
|
||||
Item_sum_udf_float(udf_func *udf_arg, List<Item> &list) :Item_sum_num() {}
|
||||
Item_sum_udf_float(THD *thd, udf_func *udf_arg):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_udf_float(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
|
||||
@ -1325,9 +1330,10 @@ class Item_sum_udf_float :public Item_sum_num
|
||||
class Item_sum_udf_int :public Item_sum_num
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_int(udf_func *udf_arg)
|
||||
:Item_sum_num() {}
|
||||
Item_sum_udf_int(udf_func *udf_arg, List<Item> &list) :Item_sum_num() {}
|
||||
Item_sum_udf_int(THD *thd, udf_func *udf_arg):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_udf_int(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
|
||||
@ -1342,10 +1348,10 @@ public:
|
||||
class Item_sum_udf_decimal :public Item_sum_num
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_decimal(udf_func *udf_arg)
|
||||
:Item_sum_num() {}
|
||||
Item_sum_udf_decimal(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_sum_num() {}
|
||||
Item_sum_udf_decimal(THD *thd, udf_func *udf_arg):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_udf_decimal(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_udf_decimal(THD *thd, Item_sum_udf_float *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
|
||||
@ -1360,10 +1366,10 @@ class Item_sum_udf_decimal :public Item_sum_num
|
||||
class Item_sum_udf_str :public Item_sum_num
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_str(udf_func *udf_arg)
|
||||
:Item_sum_num() {}
|
||||
Item_sum_udf_str(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_sum_num() {}
|
||||
Item_sum_udf_str(THD *thd, udf_func *udf_arg):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_udf_str(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
String *val_str(String *)
|
||||
@ -1434,7 +1440,7 @@ class Item_func_group_concat : public Item_sum
|
||||
void* item_arg);
|
||||
|
||||
public:
|
||||
Item_func_group_concat(Name_resolution_context *context_arg,
|
||||
Item_func_group_concat(THD *thd, Name_resolution_context *context_arg,
|
||||
bool is_distinct, List<Item> *is_select,
|
||||
const SQL_I_List<ORDER> &is_order, String *is_separator);
|
||||
|
||||
|
@ -46,7 +46,7 @@ bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval);
|
||||
class Item_func_period_add :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_period_add(Item *a,Item *b) :Item_int_func(a,b) {}
|
||||
Item_func_period_add(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "period_add"; }
|
||||
void fix_length_and_dec()
|
||||
@ -59,7 +59,7 @@ public:
|
||||
class Item_func_period_diff :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_period_diff(Item *a,Item *b) :Item_int_func(a,b) {}
|
||||
Item_func_period_diff(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "period_diff"; }
|
||||
void fix_length_and_dec()
|
||||
@ -73,7 +73,7 @@ public:
|
||||
class Item_func_to_days :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_to_days(Item *a) :Item_int_func(a) {}
|
||||
Item_func_to_days(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "to_days"; }
|
||||
void fix_length_and_dec()
|
||||
@ -96,7 +96,7 @@ public:
|
||||
class Item_func_to_seconds :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_to_seconds(Item *a) :Item_int_func(a) {}
|
||||
Item_func_to_seconds(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "to_seconds"; }
|
||||
void fix_length_and_dec()
|
||||
@ -129,7 +129,7 @@ public:
|
||||
class Item_func_dayofmonth :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_dayofmonth(Item *a) :Item_int_func(a) {}
|
||||
Item_func_dayofmonth(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "dayofmonth"; }
|
||||
void fix_length_and_dec()
|
||||
@ -150,7 +150,8 @@ public:
|
||||
class Item_func_month :public Item_func
|
||||
{
|
||||
public:
|
||||
Item_func_month(Item *a) :Item_func(a) { collation.set_numeric(); }
|
||||
Item_func_month(THD *thd, Item *a): Item_func(thd, a)
|
||||
{ collation.set_numeric(); }
|
||||
longlong val_int();
|
||||
double val_real()
|
||||
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
|
||||
@ -183,7 +184,7 @@ class Item_func_monthname :public Item_str_func
|
||||
{
|
||||
MY_LOCALE *locale;
|
||||
public:
|
||||
Item_func_monthname(Item *a) :Item_str_func(a) {}
|
||||
Item_func_monthname(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
const char *func_name() const { return "monthname"; }
|
||||
String *val_str(String *str);
|
||||
void fix_length_and_dec();
|
||||
@ -199,7 +200,7 @@ public:
|
||||
class Item_func_dayofyear :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_dayofyear(Item *a) :Item_int_func(a) {}
|
||||
Item_func_dayofyear(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "dayofyear"; }
|
||||
void fix_length_and_dec()
|
||||
@ -220,7 +221,7 @@ public:
|
||||
class Item_func_hour :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_hour(Item *a) :Item_int_func(a) {}
|
||||
Item_func_hour(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "hour"; }
|
||||
void fix_length_and_dec()
|
||||
@ -241,7 +242,7 @@ public:
|
||||
class Item_func_minute :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_minute(Item *a) :Item_int_func(a) {}
|
||||
Item_func_minute(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "minute"; }
|
||||
void fix_length_and_dec()
|
||||
@ -262,7 +263,7 @@ public:
|
||||
class Item_func_quarter :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_quarter(Item *a) :Item_int_func(a) {}
|
||||
Item_func_quarter(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "quarter"; }
|
||||
void fix_length_and_dec()
|
||||
@ -283,7 +284,7 @@ public:
|
||||
class Item_func_second :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_second(Item *a) :Item_int_func(a) {}
|
||||
Item_func_second(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "second"; }
|
||||
void fix_length_and_dec()
|
||||
@ -304,7 +305,7 @@ public:
|
||||
class Item_func_week :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_week(Item *a,Item *b) :Item_int_func(a,b) {}
|
||||
Item_func_week(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "week"; }
|
||||
void fix_length_and_dec()
|
||||
@ -318,7 +319,7 @@ public:
|
||||
class Item_func_yearweek :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_yearweek(Item *a,Item *b) :Item_int_func(a,b) {}
|
||||
Item_func_yearweek(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "yearweek"; }
|
||||
void fix_length_and_dec()
|
||||
@ -339,7 +340,7 @@ public:
|
||||
class Item_func_year :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_year(Item *a) :Item_int_func(a) {}
|
||||
Item_func_year(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "year"; }
|
||||
enum_monotonicity_info get_monotonicity_info() const;
|
||||
@ -363,8 +364,8 @@ class Item_func_weekday :public Item_func
|
||||
{
|
||||
bool odbc_type;
|
||||
public:
|
||||
Item_func_weekday(Item *a,bool type_arg)
|
||||
:Item_func(a), odbc_type(type_arg) { collation.set_numeric(); }
|
||||
Item_func_weekday(THD *thd, Item *a, bool type_arg):
|
||||
Item_func(thd, a), odbc_type(type_arg) { collation.set_numeric(); }
|
||||
longlong val_int();
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
String *val_str(String *str)
|
||||
@ -396,7 +397,7 @@ class Item_func_dayname :public Item_func_weekday
|
||||
{
|
||||
MY_LOCALE *locale;
|
||||
public:
|
||||
Item_func_dayname(Item *a) :Item_func_weekday(a,0) {}
|
||||
Item_func_dayname(THD *thd, Item *a): Item_func_weekday(thd, a, 0) {}
|
||||
const char *func_name() const { return "dayname"; }
|
||||
String *val_str(String *str);
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
@ -411,8 +412,8 @@ class Item_func_seconds_hybrid: public Item_func_numhybrid
|
||||
protected:
|
||||
virtual enum_field_types arg0_expected_type() const = 0;
|
||||
public:
|
||||
Item_func_seconds_hybrid() :Item_func_numhybrid() {}
|
||||
Item_func_seconds_hybrid(Item *a) :Item_func_numhybrid(a) {}
|
||||
Item_func_seconds_hybrid(THD *thd): Item_func_numhybrid(thd) {}
|
||||
Item_func_seconds_hybrid(THD *thd, Item *a): Item_func_numhybrid(thd, a) {}
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
if (arg_count)
|
||||
@ -434,8 +435,9 @@ class Item_func_unix_timestamp :public Item_func_seconds_hybrid
|
||||
protected:
|
||||
enum_field_types arg0_expected_type() const { return MYSQL_TYPE_DATETIME; }
|
||||
public:
|
||||
Item_func_unix_timestamp() :Item_func_seconds_hybrid() {}
|
||||
Item_func_unix_timestamp(Item *a) :Item_func_seconds_hybrid(a) {}
|
||||
Item_func_unix_timestamp(THD *thd): Item_func_seconds_hybrid(thd) {}
|
||||
Item_func_unix_timestamp(THD *thd, Item *a):
|
||||
Item_func_seconds_hybrid(thd, a) {}
|
||||
const char *func_name() const { return "unix_timestamp"; }
|
||||
enum_monotonicity_info get_monotonicity_info() const;
|
||||
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
|
||||
@ -467,7 +469,8 @@ class Item_func_time_to_sec :public Item_func_seconds_hybrid
|
||||
protected:
|
||||
enum_field_types arg0_expected_type() const { return MYSQL_TYPE_TIME; }
|
||||
public:
|
||||
Item_func_time_to_sec(Item *item) :Item_func_seconds_hybrid(item) {}
|
||||
Item_func_time_to_sec(THD *thd, Item *item):
|
||||
Item_func_seconds_hybrid(thd, item) {}
|
||||
const char *func_name() const { return "time_to_sec"; }
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
|
||||
@ -484,10 +487,10 @@ class Item_temporal_func: public Item_func
|
||||
{
|
||||
ulonglong sql_mode;
|
||||
public:
|
||||
Item_temporal_func() :Item_func() {}
|
||||
Item_temporal_func(Item *a) :Item_func(a) {}
|
||||
Item_temporal_func(Item *a, Item *b) :Item_func(a,b) {}
|
||||
Item_temporal_func(Item *a, Item *b, Item *c) :Item_func(a,b,c) {}
|
||||
Item_temporal_func(THD *thd): Item_func(thd) {}
|
||||
Item_temporal_func(THD *thd, Item *a): Item_func(thd, a) {}
|
||||
Item_temporal_func(THD *thd, Item *a, Item *b): Item_func(thd, a, b) {}
|
||||
Item_temporal_func(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b, c) {}
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
||||
Item_result cmp_type() const { return TIME_RESULT; }
|
||||
@ -515,8 +518,8 @@ protected:
|
||||
enum_field_types cached_field_type; // TIME, DATE, DATETIME or STRING
|
||||
String ascii_buf; // Conversion buffer
|
||||
public:
|
||||
Item_temporal_hybrid_func(Item *a,Item *b)
|
||||
:Item_temporal_func(a,b) {}
|
||||
Item_temporal_hybrid_func(THD *thd, Item *a, Item *b):
|
||||
Item_temporal_func(thd, a, b) {}
|
||||
enum_field_types field_type() const { return cached_field_type; }
|
||||
Item_result cmp_type() const
|
||||
{
|
||||
@ -557,8 +560,8 @@ public:
|
||||
class Item_datefunc :public Item_temporal_func
|
||||
{
|
||||
public:
|
||||
Item_datefunc() :Item_temporal_func() { }
|
||||
Item_datefunc(Item *a) :Item_temporal_func(a) { }
|
||||
Item_datefunc(THD *thd): Item_temporal_func(thd) { }
|
||||
Item_datefunc(THD *thd, Item *a): Item_temporal_func(thd, a) { }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
};
|
||||
|
||||
@ -566,10 +569,11 @@ public:
|
||||
class Item_timefunc :public Item_temporal_func
|
||||
{
|
||||
public:
|
||||
Item_timefunc() :Item_temporal_func() {}
|
||||
Item_timefunc(Item *a) :Item_temporal_func(a) {}
|
||||
Item_timefunc(Item *a,Item *b) :Item_temporal_func(a,b) {}
|
||||
Item_timefunc(Item *a, Item *b, Item *c) :Item_temporal_func(a, b ,c) {}
|
||||
Item_timefunc(THD *thd): Item_temporal_func(thd) {}
|
||||
Item_timefunc(THD *thd, Item *a): Item_temporal_func(thd, a) {}
|
||||
Item_timefunc(THD *thd, Item *a, Item *b): Item_temporal_func(thd, a, b) {}
|
||||
Item_timefunc(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_temporal_func(thd, a, b ,c) {}
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
};
|
||||
|
||||
@ -580,7 +584,7 @@ class Item_func_curtime :public Item_timefunc
|
||||
{
|
||||
MYSQL_TIME ltime;
|
||||
public:
|
||||
Item_func_curtime(uint dec) :Item_timefunc() { decimals= dec; }
|
||||
Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd) { decimals= dec; }
|
||||
bool fix_fields(THD *, Item **);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -605,7 +609,7 @@ public:
|
||||
class Item_func_curtime_local :public Item_func_curtime
|
||||
{
|
||||
public:
|
||||
Item_func_curtime_local(uint dec) :Item_func_curtime(dec) {}
|
||||
Item_func_curtime_local(THD *thd, uint dec): Item_func_curtime(thd, dec) {}
|
||||
const char *func_name() const { return "curtime"; }
|
||||
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||
};
|
||||
@ -614,7 +618,7 @@ public:
|
||||
class Item_func_curtime_utc :public Item_func_curtime
|
||||
{
|
||||
public:
|
||||
Item_func_curtime_utc(uint dec) :Item_func_curtime(dec) {}
|
||||
Item_func_curtime_utc(THD *thd, uint dec): Item_func_curtime(thd, dec) {}
|
||||
const char *func_name() const { return "utc_time"; }
|
||||
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||
};
|
||||
@ -626,7 +630,7 @@ class Item_func_curdate :public Item_datefunc
|
||||
{
|
||||
MYSQL_TIME ltime;
|
||||
public:
|
||||
Item_func_curdate() :Item_datefunc() {}
|
||||
Item_func_curdate(THD *thd): Item_datefunc(thd) {}
|
||||
void fix_length_and_dec();
|
||||
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
|
||||
virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
|
||||
@ -640,7 +644,7 @@ public:
|
||||
class Item_func_curdate_local :public Item_func_curdate
|
||||
{
|
||||
public:
|
||||
Item_func_curdate_local() :Item_func_curdate() {}
|
||||
Item_func_curdate_local(THD *thd): Item_func_curdate(thd) {}
|
||||
const char *func_name() const { return "curdate"; }
|
||||
void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||
};
|
||||
@ -649,7 +653,7 @@ public:
|
||||
class Item_func_curdate_utc :public Item_func_curdate
|
||||
{
|
||||
public:
|
||||
Item_func_curdate_utc() :Item_func_curdate() {}
|
||||
Item_func_curdate_utc(THD *thd): Item_func_curdate(thd) {}
|
||||
const char *func_name() const { return "utc_date"; }
|
||||
void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||
};
|
||||
@ -662,7 +666,7 @@ class Item_func_now :public Item_temporal_func
|
||||
{
|
||||
MYSQL_TIME ltime;
|
||||
public:
|
||||
Item_func_now(uint dec) :Item_temporal_func() { decimals= dec; }
|
||||
Item_func_now(THD *thd, uint dec): Item_temporal_func(thd) { decimals= dec; }
|
||||
bool fix_fields(THD *, Item **);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -682,7 +686,7 @@ public:
|
||||
class Item_func_now_local :public Item_func_now
|
||||
{
|
||||
public:
|
||||
Item_func_now_local(uint dec) :Item_func_now(dec) {}
|
||||
Item_func_now_local(THD *thd, uint dec): Item_func_now(thd, dec) {}
|
||||
const char *func_name() const { return "now"; }
|
||||
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||
virtual enum Functype functype() const { return NOW_FUNC; }
|
||||
@ -692,7 +696,7 @@ public:
|
||||
class Item_func_now_utc :public Item_func_now
|
||||
{
|
||||
public:
|
||||
Item_func_now_utc(uint dec) :Item_func_now(dec) {}
|
||||
Item_func_now_utc(THD *thd, uint dec): Item_func_now(thd, dec) {}
|
||||
const char *func_name() const { return "utc_timestamp"; }
|
||||
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||
};
|
||||
@ -705,7 +709,7 @@ public:
|
||||
class Item_func_sysdate_local :public Item_func_now
|
||||
{
|
||||
public:
|
||||
Item_func_sysdate_local(uint dec) :Item_func_now(dec) {}
|
||||
Item_func_sysdate_local(THD *thd, uint dec): Item_func_now(thd, dec) {}
|
||||
bool const_item() const { return 0; }
|
||||
const char *func_name() const { return "sysdate"; }
|
||||
void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||
@ -722,7 +726,7 @@ public:
|
||||
class Item_func_from_days :public Item_datefunc
|
||||
{
|
||||
public:
|
||||
Item_func_from_days(Item *a) :Item_datefunc(a) {}
|
||||
Item_func_from_days(THD *thd, Item *a): Item_datefunc(thd, a) {}
|
||||
const char *func_name() const { return "from_days"; }
|
||||
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
@ -741,8 +745,8 @@ class Item_func_date_format :public Item_str_func
|
||||
const bool is_time_format;
|
||||
String value;
|
||||
public:
|
||||
Item_func_date_format(Item *a,Item *b,bool is_time_format_arg)
|
||||
:Item_str_func(a,b),is_time_format(is_time_format_arg) {}
|
||||
Item_func_date_format(THD *thd, Item *a, Item *b, bool is_time_format_arg):
|
||||
Item_str_func(thd, a, b), is_time_format(is_time_format_arg) {}
|
||||
String *val_str(String *str);
|
||||
const char *func_name() const
|
||||
{ return is_time_format ? "time_format" : "date_format"; }
|
||||
@ -756,7 +760,7 @@ class Item_func_from_unixtime :public Item_temporal_func
|
||||
{
|
||||
Time_zone *tz;
|
||||
public:
|
||||
Item_func_from_unixtime(Item *a) :Item_temporal_func(a) {}
|
||||
Item_func_from_unixtime(THD *thd, Item *a): Item_temporal_func(thd, a) {}
|
||||
const char *func_name() const { return "from_unixtime"; }
|
||||
void fix_length_and_dec();
|
||||
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
|
||||
@ -788,8 +792,8 @@ class Item_func_convert_tz :public Item_temporal_func
|
||||
bool from_tz_cached, to_tz_cached;
|
||||
Time_zone *from_tz, *to_tz;
|
||||
public:
|
||||
Item_func_convert_tz(Item *a, Item *b, Item *c):
|
||||
Item_temporal_func(a, b, c), from_tz_cached(0), to_tz_cached(0) {}
|
||||
Item_func_convert_tz(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_temporal_func(thd, a, b, c), from_tz_cached(0), to_tz_cached(0) {}
|
||||
const char *func_name() const { return "convert_tz"; }
|
||||
void fix_length_and_dec();
|
||||
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
|
||||
@ -800,7 +804,7 @@ class Item_func_convert_tz :public Item_temporal_func
|
||||
class Item_func_sec_to_time :public Item_timefunc
|
||||
{
|
||||
public:
|
||||
Item_func_sec_to_time(Item *item) :Item_timefunc(item) {}
|
||||
Item_func_sec_to_time(THD *thd, Item *item): Item_timefunc(thd, item) {}
|
||||
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -816,8 +820,10 @@ class Item_date_add_interval :public Item_temporal_hybrid_func
|
||||
public:
|
||||
const interval_type int_type; // keep it public
|
||||
const bool date_sub_interval; // keep it public
|
||||
Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg)
|
||||
:Item_temporal_hybrid_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {}
|
||||
Item_date_add_interval(THD *thd, Item *a, Item *b, interval_type type_arg,
|
||||
bool neg_arg):
|
||||
Item_temporal_hybrid_func(thd, a, b),int_type(type_arg),
|
||||
date_sub_interval(neg_arg) {}
|
||||
const char *func_name() const { return "date_add_interval"; }
|
||||
void fix_length_and_dec();
|
||||
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
|
||||
@ -831,8 +837,8 @@ class Item_extract :public Item_int_func
|
||||
bool date_value;
|
||||
public:
|
||||
const interval_type int_type; // keep it public
|
||||
Item_extract(interval_type type_arg, Item *a)
|
||||
:Item_int_func(a), int_type(type_arg) {}
|
||||
Item_extract(THD *thd, interval_type type_arg, Item *a):
|
||||
Item_int_func(thd, a), int_type(type_arg) {}
|
||||
longlong val_int();
|
||||
enum Functype functype() const { return EXTRACT_FUNC; }
|
||||
const char *func_name() const { return "extract"; }
|
||||
@ -892,8 +898,8 @@ class Item_char_typecast :public Item_str_func
|
||||
uint adjusted_length_with_warn(uint length);
|
||||
void check_truncation_with_warn(String *src, uint dstlen);
|
||||
public:
|
||||
Item_char_typecast(Item *a, uint length_arg, CHARSET_INFO *cs_arg)
|
||||
:Item_str_func(a), cast_length(length_arg), cast_cs(cs_arg) {}
|
||||
Item_char_typecast(THD *thd, Item *a, uint length_arg, CHARSET_INFO *cs_arg):
|
||||
Item_str_func(thd, a), cast_length(length_arg), cast_cs(cs_arg) {}
|
||||
enum Functype functype() const { return CHAR_TYPECAST_FUNC; }
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
const char *func_name() const { return "cast_as_char"; }
|
||||
@ -906,7 +912,7 @@ public:
|
||||
class Item_temporal_typecast: public Item_temporal_func
|
||||
{
|
||||
public:
|
||||
Item_temporal_typecast(Item *a) :Item_temporal_func(a) {}
|
||||
Item_temporal_typecast(THD *thd, Item *a): Item_temporal_func(thd, a) {}
|
||||
virtual const char *cast_type() const = 0;
|
||||
void print(String *str, enum_query_type query_type);
|
||||
void fix_length_and_dec()
|
||||
@ -920,7 +926,7 @@ public:
|
||||
class Item_date_typecast :public Item_temporal_typecast
|
||||
{
|
||||
public:
|
||||
Item_date_typecast(Item *a) :Item_temporal_typecast(a) {}
|
||||
Item_date_typecast(THD *thd, Item *a): Item_temporal_typecast(thd, a) {}
|
||||
const char *func_name() const { return "cast_as_date"; }
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
|
||||
const char *cast_type() const { return "date"; }
|
||||
@ -931,8 +937,8 @@ public:
|
||||
class Item_time_typecast :public Item_temporal_typecast
|
||||
{
|
||||
public:
|
||||
Item_time_typecast(Item *a, uint dec_arg)
|
||||
:Item_temporal_typecast(a) { decimals= dec_arg; }
|
||||
Item_time_typecast(THD *thd, Item *a, uint dec_arg):
|
||||
Item_temporal_typecast(thd, a) { decimals= dec_arg; }
|
||||
const char *func_name() const { return "cast_as_time"; }
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
|
||||
const char *cast_type() const { return "time"; }
|
||||
@ -943,8 +949,8 @@ public:
|
||||
class Item_datetime_typecast :public Item_temporal_typecast
|
||||
{
|
||||
public:
|
||||
Item_datetime_typecast(Item *a, uint dec_arg)
|
||||
:Item_temporal_typecast(a) { decimals= dec_arg; }
|
||||
Item_datetime_typecast(THD *thd, Item *a, uint dec_arg):
|
||||
Item_temporal_typecast(thd, a) { decimals= dec_arg; }
|
||||
const char *func_name() const { return "cast_as_datetime"; }
|
||||
const char *cast_type() const { return "datetime"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
||||
@ -955,7 +961,8 @@ public:
|
||||
class Item_func_makedate :public Item_temporal_func
|
||||
{
|
||||
public:
|
||||
Item_func_makedate(Item *a,Item *b) :Item_temporal_func(a,b) {}
|
||||
Item_func_makedate(THD *thd, Item *a, Item *b):
|
||||
Item_temporal_func(thd, a, b) {}
|
||||
const char *func_name() const { return "makedate"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
|
||||
@ -968,8 +975,9 @@ class Item_func_add_time :public Item_temporal_hybrid_func
|
||||
int sign;
|
||||
|
||||
public:
|
||||
Item_func_add_time(Item *a, Item *b, bool type_arg, bool neg_arg)
|
||||
:Item_temporal_hybrid_func(a, b), is_date(type_arg) { sign= neg_arg ? -1 : 1; }
|
||||
Item_func_add_time(THD *thd, Item *a, Item *b, bool type_arg, bool neg_arg):
|
||||
Item_temporal_hybrid_func(thd, a, b), is_date(type_arg)
|
||||
{ sign= neg_arg ? -1 : 1; }
|
||||
void fix_length_and_dec();
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
|
||||
void print(String *str, enum_query_type query_type);
|
||||
@ -979,8 +987,7 @@ public:
|
||||
class Item_func_timediff :public Item_timefunc
|
||||
{
|
||||
public:
|
||||
Item_func_timediff(Item *a, Item *b)
|
||||
:Item_timefunc(a, b) {}
|
||||
Item_func_timediff(THD *thd, Item *a, Item *b): Item_timefunc(thd, a, b) {}
|
||||
const char *func_name() const { return "timediff"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -994,8 +1001,8 @@ public:
|
||||
class Item_func_maketime :public Item_timefunc
|
||||
{
|
||||
public:
|
||||
Item_func_maketime(Item *a, Item *b, Item *c)
|
||||
:Item_timefunc(a, b, c)
|
||||
Item_func_maketime(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_timefunc(thd, a, b, c)
|
||||
{}
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@ -1010,7 +1017,7 @@ public:
|
||||
class Item_func_microsecond :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_microsecond(Item *a) :Item_int_func(a) {}
|
||||
Item_func_microsecond(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "microsecond"; }
|
||||
void fix_length_and_dec()
|
||||
@ -1031,8 +1038,8 @@ class Item_func_timestamp_diff :public Item_int_func
|
||||
{
|
||||
const interval_type int_type;
|
||||
public:
|
||||
Item_func_timestamp_diff(Item *a,Item *b,interval_type type_arg)
|
||||
:Item_int_func(a,b), int_type(type_arg) {}
|
||||
Item_func_timestamp_diff(THD *thd, Item *a, Item *b, interval_type type_arg):
|
||||
Item_int_func(thd, a, b), int_type(type_arg) {}
|
||||
const char *func_name() const { return "timestampdiff"; }
|
||||
longlong val_int();
|
||||
void fix_length_and_dec()
|
||||
@ -1053,8 +1060,8 @@ class Item_func_get_format :public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
const timestamp_type type; // keep it public
|
||||
Item_func_get_format(timestamp_type type_arg, Item *a)
|
||||
:Item_str_ascii_func(a), type(type_arg)
|
||||
Item_func_get_format(THD *thd, timestamp_type type_arg, Item *a):
|
||||
Item_str_ascii_func(thd, a), type(type_arg)
|
||||
{}
|
||||
String *val_str_ascii(String *str);
|
||||
const char *func_name() const { return "get_format"; }
|
||||
@ -1076,8 +1083,8 @@ class Item_func_str_to_date :public Item_temporal_hybrid_func
|
||||
String format_converter;
|
||||
CHARSET_INFO *internal_charset;
|
||||
public:
|
||||
Item_func_str_to_date(Item *a, Item *b)
|
||||
:Item_temporal_hybrid_func(a, b), const_item(false),
|
||||
Item_func_str_to_date(THD *thd, Item *a, Item *b):
|
||||
Item_temporal_hybrid_func(thd, a, b), const_item(false),
|
||||
internal_charset(NULL)
|
||||
{}
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
|
||||
@ -1089,7 +1096,7 @@ public:
|
||||
class Item_func_last_day :public Item_datefunc
|
||||
{
|
||||
public:
|
||||
Item_func_last_day(Item *a) :Item_datefunc(a) {}
|
||||
Item_func_last_day(THD *thd, Item *a): Item_datefunc(thd, a) {}
|
||||
const char *func_name() const { return "last_day"; }
|
||||
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
|
||||
};
|
||||
|
@ -99,6 +99,7 @@ typedef struct my_xpath_function_names_st
|
||||
/* XPath query parser */
|
||||
typedef struct my_xpath_st
|
||||
{
|
||||
THD *thd;
|
||||
int debug;
|
||||
MY_XPATH_LEX query; /* Whole query */
|
||||
MY_XPATH_LEX lasttok; /* last scanned token */
|
||||
@ -166,13 +167,14 @@ protected:
|
||||
public:
|
||||
String *pxml;
|
||||
String context_cache;
|
||||
Item_nodeset_func(String *pxml_arg) :Item_str_func(), pxml(pxml_arg) {}
|
||||
Item_nodeset_func(Item *a, String *pxml_arg)
|
||||
:Item_str_func(a), pxml(pxml_arg) {}
|
||||
Item_nodeset_func(Item *a, Item *b, String *pxml_arg)
|
||||
:Item_str_func(a, b), pxml(pxml_arg) {}
|
||||
Item_nodeset_func(Item *a, Item *b, Item *c, String *pxml_arg)
|
||||
:Item_str_func(a,b,c), pxml(pxml_arg) {}
|
||||
Item_nodeset_func(THD *thd, String *pxml_arg):
|
||||
Item_str_func(thd), pxml(pxml_arg) {}
|
||||
Item_nodeset_func(THD *thd, Item *a, String *pxml_arg):
|
||||
Item_str_func(thd, a), pxml(pxml_arg) {}
|
||||
Item_nodeset_func(THD *thd, Item *a, Item *b, String *pxml_arg):
|
||||
Item_str_func(thd, a, b), pxml(pxml_arg) {}
|
||||
Item_nodeset_func(THD *thd, Item *a, Item *b, Item *c, String *pxml_arg):
|
||||
Item_str_func(thd, a, b, c), pxml(pxml_arg) {}
|
||||
void prepare_nodes()
|
||||
{
|
||||
nodebeg= (MY_XML_NODE*) pxml->ptr();
|
||||
@ -244,7 +246,8 @@ public:
|
||||
class Item_nodeset_func_rootelement :public Item_nodeset_func
|
||||
{
|
||||
public:
|
||||
Item_nodeset_func_rootelement(String *pxml): Item_nodeset_func(pxml) {}
|
||||
Item_nodeset_func_rootelement(THD *thd, String *pxml):
|
||||
Item_nodeset_func(thd, pxml) {}
|
||||
const char *func_name() const { return "xpath_rootelement"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
};
|
||||
@ -254,8 +257,8 @@ public:
|
||||
class Item_nodeset_func_union :public Item_nodeset_func
|
||||
{
|
||||
public:
|
||||
Item_nodeset_func_union(Item *a, Item *b, String *pxml)
|
||||
:Item_nodeset_func(a, b, pxml) {}
|
||||
Item_nodeset_func_union(THD *thd, Item *a, Item *b, String *pxml):
|
||||
Item_nodeset_func(thd, a, b, pxml) {}
|
||||
const char *func_name() const { return "xpath_union"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
};
|
||||
@ -267,9 +270,9 @@ class Item_nodeset_func_axisbyname :public Item_nodeset_func
|
||||
const char *node_name;
|
||||
uint node_namelen;
|
||||
public:
|
||||
Item_nodeset_func_axisbyname(Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func(a, pxml), node_name(n_arg), node_namelen(l_arg) { }
|
||||
Item_nodeset_func_axisbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func(thd, a, pxml), node_name(n_arg), node_namelen(l_arg) { }
|
||||
const char *func_name() const { return "xpath_axisbyname"; }
|
||||
bool validname(MY_XML_NODE *n)
|
||||
{
|
||||
@ -285,9 +288,9 @@ public:
|
||||
class Item_nodeset_func_selfbyname: public Item_nodeset_func_axisbyname
|
||||
{
|
||||
public:
|
||||
Item_nodeset_func_selfbyname(Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
|
||||
Item_nodeset_func_selfbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
|
||||
const char *func_name() const { return "xpath_selfbyname"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
};
|
||||
@ -297,9 +300,9 @@ public:
|
||||
class Item_nodeset_func_childbyname: public Item_nodeset_func_axisbyname
|
||||
{
|
||||
public:
|
||||
Item_nodeset_func_childbyname(Item *a, const char *n_arg, uint l_arg,
|
||||
Item_nodeset_func_childbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
|
||||
const char *func_name() const { return "xpath_childbyname"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
};
|
||||
@ -310,9 +313,9 @@ class Item_nodeset_func_descendantbyname: public Item_nodeset_func_axisbyname
|
||||
{
|
||||
bool need_self;
|
||||
public:
|
||||
Item_nodeset_func_descendantbyname(Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml, bool need_self_arg):
|
||||
Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml),
|
||||
Item_nodeset_func_descendantbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml, bool need_self_arg):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml),
|
||||
need_self(need_self_arg) {}
|
||||
const char *func_name() const { return "xpath_descendantbyname"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
@ -324,9 +327,9 @@ class Item_nodeset_func_ancestorbyname: public Item_nodeset_func_axisbyname
|
||||
{
|
||||
bool need_self;
|
||||
public:
|
||||
Item_nodeset_func_ancestorbyname(Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml, bool need_self_arg):
|
||||
Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml),
|
||||
Item_nodeset_func_ancestorbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml, bool need_self_arg):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml),
|
||||
need_self(need_self_arg) {}
|
||||
const char *func_name() const { return "xpath_ancestorbyname"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
@ -337,9 +340,9 @@ public:
|
||||
class Item_nodeset_func_parentbyname: public Item_nodeset_func_axisbyname
|
||||
{
|
||||
public:
|
||||
Item_nodeset_func_parentbyname(Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
|
||||
Item_nodeset_func_parentbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
|
||||
const char *func_name() const { return "xpath_parentbyname"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
};
|
||||
@ -349,9 +352,9 @@ public:
|
||||
class Item_nodeset_func_attributebyname: public Item_nodeset_func_axisbyname
|
||||
{
|
||||
public:
|
||||
Item_nodeset_func_attributebyname(Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
|
||||
Item_nodeset_func_attributebyname(THD *thd, Item *a, const char *n_arg,
|
||||
uint l_arg, String *pxml):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
|
||||
const char *func_name() const { return "xpath_attributebyname"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
};
|
||||
@ -365,8 +368,8 @@ public:
|
||||
class Item_nodeset_func_predicate :public Item_nodeset_func
|
||||
{
|
||||
public:
|
||||
Item_nodeset_func_predicate(Item *a, Item *b, String *pxml):
|
||||
Item_nodeset_func(a, b, pxml) {}
|
||||
Item_nodeset_func_predicate(THD *thd, Item *a, Item *b, String *pxml):
|
||||
Item_nodeset_func(thd, a, b, pxml) {}
|
||||
const char *func_name() const { return "xpath_predicate"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
};
|
||||
@ -376,8 +379,8 @@ public:
|
||||
class Item_nodeset_func_elementbyindex :public Item_nodeset_func
|
||||
{
|
||||
public:
|
||||
Item_nodeset_func_elementbyindex(Item *a, Item *b, String *pxml):
|
||||
Item_nodeset_func(a, b, pxml) { }
|
||||
Item_nodeset_func_elementbyindex(THD *thd, Item *a, Item *b, String *pxml):
|
||||
Item_nodeset_func(thd, a, b, pxml) { }
|
||||
const char *func_name() const { return "xpath_elementbyindex"; }
|
||||
String *val_nodeset(String *nodeset);
|
||||
};
|
||||
@ -390,7 +393,7 @@ public:
|
||||
class Item_bool :public Item_int
|
||||
{
|
||||
public:
|
||||
Item_bool(int32 i): Item_int(i) {}
|
||||
Item_bool(THD *thd, int32 i): Item_int(thd, i) {}
|
||||
const char *func_name() const { return "xpath_bool"; }
|
||||
bool is_bool_type() { return true; }
|
||||
};
|
||||
@ -407,8 +410,8 @@ class Item_xpath_cast_bool :public Item_bool_func
|
||||
String *pxml;
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_xpath_cast_bool(Item *a, String *pxml_arg)
|
||||
:Item_bool_func(a), pxml(pxml_arg) {}
|
||||
Item_xpath_cast_bool(THD *thd, Item *a, String *pxml_arg):
|
||||
Item_bool_func(thd, a), pxml(pxml_arg) {}
|
||||
const char *func_name() const { return "xpath_cast_bool"; }
|
||||
longlong val_int()
|
||||
{
|
||||
@ -428,7 +431,7 @@ public:
|
||||
class Item_xpath_cast_number :public Item_real_func
|
||||
{
|
||||
public:
|
||||
Item_xpath_cast_number(Item *a): Item_real_func(a) {}
|
||||
Item_xpath_cast_number(THD *thd, Item *a): Item_real_func(thd, a) {}
|
||||
const char *func_name() const { return "xpath_cast_number"; }
|
||||
virtual double val_real() { return args[0]->val_real(); }
|
||||
};
|
||||
@ -441,8 +444,8 @@ class Item_nodeset_context_cache :public Item_nodeset_func
|
||||
{
|
||||
public:
|
||||
String *string_cache;
|
||||
Item_nodeset_context_cache(String *str_arg, String *pxml):
|
||||
Item_nodeset_func(pxml), string_cache(str_arg) { }
|
||||
Item_nodeset_context_cache(THD *thd, String *str_arg, String *pxml):
|
||||
Item_nodeset_func(thd, pxml), string_cache(str_arg) { }
|
||||
String *val_nodeset(String *res)
|
||||
{ return string_cache; }
|
||||
void fix_length_and_dec() { max_length= MAX_BLOB_WIDTH; }
|
||||
@ -454,8 +457,8 @@ class Item_func_xpath_position :public Item_int_func
|
||||
String *pxml;
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_xpath_position(Item *a, String *p)
|
||||
:Item_int_func(a), pxml(p) {}
|
||||
Item_func_xpath_position(THD *thd, Item *a, String *p):
|
||||
Item_int_func(thd, a), pxml(p) {}
|
||||
const char *func_name() const { return "xpath_position"; }
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
longlong val_int()
|
||||
@ -473,8 +476,8 @@ class Item_func_xpath_count :public Item_int_func
|
||||
String *pxml;
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_xpath_count(Item *a, String *p)
|
||||
:Item_int_func(a), pxml(p) {}
|
||||
Item_func_xpath_count(THD *thd, Item *a, String *p):
|
||||
Item_int_func(thd, a), pxml(p) {}
|
||||
const char *func_name() const { return "xpath_count"; }
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
longlong val_int()
|
||||
@ -494,8 +497,8 @@ class Item_func_xpath_sum :public Item_real_func
|
||||
String *pxml;
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_xpath_sum(Item *a, String *p)
|
||||
:Item_real_func(a), pxml(p) {}
|
||||
Item_func_xpath_sum(THD *thd, Item *a, String *p):
|
||||
Item_real_func(thd, a), pxml(p) {}
|
||||
|
||||
const char *func_name() const { return "xpath_sum"; }
|
||||
double val_real()
|
||||
@ -538,8 +541,9 @@ public:
|
||||
class Item_string_xml_non_const: public Item_string
|
||||
{
|
||||
public:
|
||||
Item_string_xml_non_const(const char *str, uint length, CHARSET_INFO *cs)
|
||||
:Item_string(str, length, cs)
|
||||
Item_string_xml_non_const(THD *thd, const char *str, uint length,
|
||||
CHARSET_INFO *cs):
|
||||
Item_string(thd, str, length, cs)
|
||||
{ }
|
||||
bool const_item() const { return false ; }
|
||||
bool basic_const_item() const { return false; }
|
||||
@ -547,7 +551,7 @@ public:
|
||||
{
|
||||
str_value.set(str, length, cs);
|
||||
}
|
||||
Item *safe_charset_converter(CHARSET_INFO *tocs)
|
||||
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
|
||||
{
|
||||
/*
|
||||
Item_string::safe_charset_converter() does not accept non-constants.
|
||||
@ -563,8 +567,9 @@ class Item_nodeset_to_const_comparator :public Item_bool_func
|
||||
String *pxml;
|
||||
String tmp_nodeset;
|
||||
public:
|
||||
Item_nodeset_to_const_comparator(Item *nodeset, Item *cmpfunc, String *p)
|
||||
:Item_bool_func(nodeset,cmpfunc), pxml(p) {}
|
||||
Item_nodeset_to_const_comparator(THD *thd, Item *nodeset, Item *cmpfunc,
|
||||
String *p):
|
||||
Item_bool_func(thd, nodeset, cmpfunc), pxml(p) {}
|
||||
enum Type type() const { return XPATH_NODESET_CMP; };
|
||||
const char *func_name() const { return "xpath_nodeset_to_const_comparator"; }
|
||||
bool check_vcol_func_processor(uchar *int_arg)
|
||||
@ -835,7 +840,7 @@ String *Item_nodeset_func_elementbyindex::val_nodeset(String *nodeset)
|
||||
static Item* nodeset2bool(MY_XPATH *xpath, Item *item)
|
||||
{
|
||||
if (item->type() == Item::XPATH_NODESET)
|
||||
return new Item_xpath_cast_bool(item, xpath->pxml);
|
||||
return new Item_xpath_cast_bool(xpath->thd, item, xpath->pxml);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -905,16 +910,16 @@ static Item* nodeset2bool(MY_XPATH *xpath, Item *item)
|
||||
RETURN
|
||||
The newly created item.
|
||||
*/
|
||||
static Item *eq_func(int oper, Item *a, Item *b)
|
||||
static Item *eq_func(THD *thd, int oper, Item *a, Item *b)
|
||||
{
|
||||
switch (oper)
|
||||
{
|
||||
case '=': return new Item_func_eq(a, b);
|
||||
case '!': return new Item_func_ne(a, b);
|
||||
case MY_XPATH_LEX_GE: return new Item_func_ge(a, b);
|
||||
case MY_XPATH_LEX_LE: return new Item_func_le(a, b);
|
||||
case MY_XPATH_LEX_GREATER: return new Item_func_gt(a, b);
|
||||
case MY_XPATH_LEX_LESS: return new Item_func_lt(a, b);
|
||||
case '=': return new Item_func_eq(thd, a, b);
|
||||
case '!': return new Item_func_ne(thd, a, b);
|
||||
case MY_XPATH_LEX_GE: return new Item_func_ge(thd, a, b);
|
||||
case MY_XPATH_LEX_LE: return new Item_func_le(thd, a, b);
|
||||
case MY_XPATH_LEX_GREATER: return new Item_func_gt(thd, a, b);
|
||||
case MY_XPATH_LEX_LESS: return new Item_func_lt(thd, a, b);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -932,16 +937,16 @@ static Item *eq_func(int oper, Item *a, Item *b)
|
||||
RETURN
|
||||
The newly created item.
|
||||
*/
|
||||
static Item *eq_func_reverse(int oper, Item *a, Item *b)
|
||||
static Item *eq_func_reverse(THD *thd, int oper, Item *a, Item *b)
|
||||
{
|
||||
switch (oper)
|
||||
{
|
||||
case '=': return new Item_func_eq(a, b);
|
||||
case '!': return new Item_func_ne(a, b);
|
||||
case MY_XPATH_LEX_GE: return new Item_func_le(a, b);
|
||||
case MY_XPATH_LEX_LE: return new Item_func_ge(a, b);
|
||||
case MY_XPATH_LEX_GREATER: return new Item_func_lt(a, b);
|
||||
case MY_XPATH_LEX_LESS: return new Item_func_gt(a, b);
|
||||
case '=': return new Item_func_eq(thd, a, b);
|
||||
case '!': return new Item_func_ne(thd, a, b);
|
||||
case MY_XPATH_LEX_GE: return new Item_func_le(thd, a, b);
|
||||
case MY_XPATH_LEX_LE: return new Item_func_ge(thd, a, b);
|
||||
case MY_XPATH_LEX_GREATER: return new Item_func_lt(thd, a, b);
|
||||
case MY_XPATH_LEX_LESS: return new Item_func_gt(thd, a, b);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -964,7 +969,7 @@ static Item *create_comparator(MY_XPATH *xpath,
|
||||
if (a->type() != Item::XPATH_NODESET &&
|
||||
b->type() != Item::XPATH_NODESET)
|
||||
{
|
||||
return eq_func(oper, a, b); // two scalar arguments
|
||||
return eq_func(xpath->thd, oper, a, b); // two scalar arguments
|
||||
}
|
||||
else if (a->type() == Item::XPATH_NODESET &&
|
||||
b->type() == Item::XPATH_NODESET)
|
||||
@ -987,22 +992,24 @@ static Item *create_comparator(MY_XPATH *xpath,
|
||||
in a loop through all of the nodes in the node set.
|
||||
*/
|
||||
|
||||
Item_string *fake= new Item_string_xml_non_const("", 0, xpath->cs);
|
||||
Item_string *fake= new Item_string_xml_non_const(xpath->thd, "", 0,
|
||||
xpath->cs);
|
||||
Item_nodeset_func *nodeset;
|
||||
Item *scalar, *comp;
|
||||
if (a->type() == Item::XPATH_NODESET)
|
||||
{
|
||||
nodeset= (Item_nodeset_func*) a;
|
||||
scalar= b;
|
||||
comp= eq_func(oper, (Item*)fake, scalar);
|
||||
comp= eq_func(xpath->thd, oper, (Item*)fake, scalar);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeset= (Item_nodeset_func*) b;
|
||||
scalar= a;
|
||||
comp= eq_func_reverse(oper, fake, scalar);
|
||||
comp= eq_func_reverse(xpath->thd, oper, fake, scalar);
|
||||
}
|
||||
return new Item_nodeset_to_const_comparator(nodeset, comp, xpath->pxml);
|
||||
return new Item_nodeset_to_const_comparator(xpath->thd, nodeset, comp,
|
||||
xpath->pxml);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1028,28 +1035,36 @@ static Item* nametestfunc(MY_XPATH *xpath,
|
||||
switch (type)
|
||||
{
|
||||
case MY_XPATH_AXIS_ANCESTOR:
|
||||
res= new Item_nodeset_func_ancestorbyname(arg, beg, len, xpath->pxml, 0);
|
||||
res= new Item_nodeset_func_ancestorbyname(xpath->thd, arg, beg, len,
|
||||
xpath->pxml, 0);
|
||||
break;
|
||||
case MY_XPATH_AXIS_ANCESTOR_OR_SELF:
|
||||
res= new Item_nodeset_func_ancestorbyname(arg, beg, len, xpath->pxml, 1);
|
||||
res= new Item_nodeset_func_ancestorbyname(xpath->thd, arg, beg, len,
|
||||
xpath->pxml, 1);
|
||||
break;
|
||||
case MY_XPATH_AXIS_PARENT:
|
||||
res= new Item_nodeset_func_parentbyname(arg, beg, len, xpath->pxml);
|
||||
res= new Item_nodeset_func_parentbyname(xpath->thd, arg, beg, len,
|
||||
xpath->pxml);
|
||||
break;
|
||||
case MY_XPATH_AXIS_DESCENDANT:
|
||||
res= new Item_nodeset_func_descendantbyname(arg, beg, len, xpath->pxml, 0);
|
||||
res= new Item_nodeset_func_descendantbyname(xpath->thd, arg, beg, len,
|
||||
xpath->pxml, 0);
|
||||
break;
|
||||
case MY_XPATH_AXIS_DESCENDANT_OR_SELF:
|
||||
res= new Item_nodeset_func_descendantbyname(arg, beg, len, xpath->pxml, 1);
|
||||
res= new Item_nodeset_func_descendantbyname(xpath->thd, arg, beg, len,
|
||||
xpath->pxml, 1);
|
||||
break;
|
||||
case MY_XPATH_AXIS_ATTRIBUTE:
|
||||
res= new Item_nodeset_func_attributebyname(arg, beg, len, xpath->pxml);
|
||||
res= new Item_nodeset_func_attributebyname(xpath->thd, arg, beg, len,
|
||||
xpath->pxml);
|
||||
break;
|
||||
case MY_XPATH_AXIS_SELF:
|
||||
res= new Item_nodeset_func_selfbyname(arg, beg, len, xpath->pxml);
|
||||
res= new Item_nodeset_func_selfbyname(xpath->thd, arg, beg, len,
|
||||
xpath->pxml);
|
||||
break;
|
||||
default:
|
||||
res= new Item_nodeset_func_childbyname(arg, beg, len, xpath->pxml);
|
||||
res= new Item_nodeset_func_childbyname(xpath->thd, arg, beg, len,
|
||||
xpath->pxml);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -1157,101 +1172,106 @@ my_xpath_keyword(MY_XPATH *x,
|
||||
*/
|
||||
|
||||
static Item *create_func_true(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_bool(1);
|
||||
{
|
||||
return new Item_bool(xpath->thd, 1);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_false(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_bool(0);
|
||||
{
|
||||
return new Item_bool(xpath->thd, 0);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_not(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_func_not(nodeset2bool(xpath, args[0]));
|
||||
{
|
||||
return new Item_func_not(xpath->thd, nodeset2bool(xpath, args[0]));
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_ceiling(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_func_ceiling(args[0]);
|
||||
return new Item_func_ceiling(xpath->thd, args[0]);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_floor(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_func_floor(args[0]);
|
||||
return new Item_func_floor(xpath->thd, args[0]);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_bool(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_xpath_cast_bool(args[0], xpath->pxml);
|
||||
return new Item_xpath_cast_bool(xpath->thd, args[0], xpath->pxml);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_number(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_xpath_cast_number(args[0]);
|
||||
return new Item_xpath_cast_number(xpath->thd, args[0]);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_string_length(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
static Item *create_func_string_length(MY_XPATH *xpath, Item **args,
|
||||
uint nargs)
|
||||
{
|
||||
Item *arg= nargs ? args[0] : xpath->context;
|
||||
return arg ? new Item_func_char_length(arg) : 0;
|
||||
return arg ? new Item_func_char_length(xpath->thd, arg) : 0;
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_round(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_func_round(args[0], new Item_int((char*)"0",0,1),0);
|
||||
return new Item_func_round(xpath->thd, args[0],
|
||||
new Item_int(xpath->thd, (char *) "0", 0, 1), 0);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_last(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return xpath->context ?
|
||||
new Item_func_xpath_count(xpath->context, xpath->pxml) : NULL;
|
||||
return xpath->context ?
|
||||
new Item_func_xpath_count(xpath->thd, xpath->context, xpath->pxml) :
|
||||
NULL;
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_position(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return xpath->context ?
|
||||
new Item_func_xpath_position(xpath->context, xpath->pxml) : NULL;
|
||||
return xpath->context ?
|
||||
new Item_func_xpath_position(xpath->thd, xpath->context,
|
||||
xpath->pxml) : NULL;
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_contains(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_xpath_cast_bool(new Item_func_locate(args[0], args[1]),
|
||||
xpath->pxml);
|
||||
return new Item_xpath_cast_bool(xpath->thd,
|
||||
new Item_func_locate(xpath->thd, args[0],
|
||||
args[1]), xpath->pxml);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_concat(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
return new Item_func_concat(args[0], args[1]);
|
||||
{
|
||||
return new Item_func_concat(xpath->thd, args[0], args[1]);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_substr(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
if (nargs == 2)
|
||||
return new Item_func_substr(args[0], args[1]);
|
||||
return new Item_func_substr(xpath->thd, args[0], args[1]);
|
||||
else
|
||||
return new Item_func_substr(args[0], args[1], args[2]);
|
||||
return new Item_func_substr(xpath->thd, args[0], args[1], args[2]);
|
||||
}
|
||||
|
||||
|
||||
static Item *create_func_count(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
{
|
||||
if (args[0]->type() != Item::XPATH_NODESET)
|
||||
return 0;
|
||||
return new Item_func_xpath_count(args[0], xpath->pxml);
|
||||
return new Item_func_xpath_count(xpath->thd, args[0], xpath->pxml);
|
||||
}
|
||||
|
||||
|
||||
@ -1259,7 +1279,7 @@ static Item *create_func_sum(MY_XPATH *xpath, Item **args, uint nargs)
|
||||
{
|
||||
if (args[0]->type() != Item::XPATH_NODESET)
|
||||
return 0;
|
||||
return new Item_func_xpath_sum(args[0], xpath->pxml);
|
||||
return new Item_func_xpath_sum(xpath->thd, args[0], xpath->pxml);
|
||||
}
|
||||
|
||||
|
||||
@ -1632,7 +1652,8 @@ static int my_xpath_parse_AbsoluteLocationPath(MY_XPATH *xpath)
|
||||
|
||||
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
|
||||
{
|
||||
xpath->context= new Item_nodeset_func_descendantbyname(xpath->context,
|
||||
xpath->context= new Item_nodeset_func_descendantbyname(xpath->thd,
|
||||
xpath->context,
|
||||
"*", 1,
|
||||
xpath->pxml, 1);
|
||||
return my_xpath_parse_RelativeLocationPath(xpath);
|
||||
@ -1673,7 +1694,8 @@ static int my_xpath_parse_RelativeLocationPath(MY_XPATH *xpath)
|
||||
while (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
|
||||
{
|
||||
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
|
||||
xpath->context= new Item_nodeset_func_descendantbyname(xpath->context,
|
||||
xpath->context= new Item_nodeset_func_descendantbyname(xpath->thd,
|
||||
xpath->context,
|
||||
"*", 1,
|
||||
xpath->pxml, 1);
|
||||
if (!my_xpath_parse_Step(xpath))
|
||||
@ -1713,7 +1735,8 @@ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath)
|
||||
Item *prev_context= xpath->context;
|
||||
String *context_cache;
|
||||
context_cache= &((Item_nodeset_func*)xpath->context)->context_cache;
|
||||
xpath->context= new Item_nodeset_context_cache(context_cache, xpath->pxml);
|
||||
xpath->context= new Item_nodeset_context_cache(xpath->thd, context_cache,
|
||||
xpath->pxml);
|
||||
xpath->context_cache= context_cache;
|
||||
|
||||
if(!my_xpath_parse_PredicateExpr(xpath))
|
||||
@ -1732,13 +1755,14 @@ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath)
|
||||
|
||||
if (xpath->item->is_bool_type())
|
||||
{
|
||||
xpath->context= new Item_nodeset_func_predicate(prev_context,
|
||||
xpath->context= new Item_nodeset_func_predicate(xpath->thd, prev_context,
|
||||
xpath->item,
|
||||
xpath->pxml);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpath->context= new Item_nodeset_func_elementbyindex(prev_context,
|
||||
xpath->context= new Item_nodeset_func_elementbyindex(xpath->thd,
|
||||
prev_context,
|
||||
xpath->item,
|
||||
xpath->pxml);
|
||||
}
|
||||
@ -1748,7 +1772,7 @@ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath)
|
||||
|
||||
|
||||
static int my_xpath_parse_Step(MY_XPATH *xpath)
|
||||
{
|
||||
{
|
||||
return
|
||||
my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(xpath) ||
|
||||
my_xpath_parse_AbbreviatedStep(xpath);
|
||||
@ -1862,8 +1886,9 @@ static int my_xpath_parse_AbbreviatedStep(MY_XPATH *xpath)
|
||||
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT))
|
||||
return 0;
|
||||
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT))
|
||||
xpath->context= new Item_nodeset_func_parentbyname(xpath->context, "*", 1,
|
||||
xpath->pxml);
|
||||
xpath->context= new Item_nodeset_func_parentbyname(xpath->thd,
|
||||
xpath->context, "*",
|
||||
1, xpath->pxml);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1892,7 +1917,7 @@ static int my_xpath_parse_PrimaryExpr_literal(MY_XPATH *xpath)
|
||||
{
|
||||
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_STRING))
|
||||
return 0;
|
||||
xpath->item= new Item_string(xpath->prevtok.beg + 1,
|
||||
xpath->item= new Item_string(xpath->thd, xpath->prevtok.beg + 1,
|
||||
xpath->prevtok.end - xpath->prevtok.beg - 2,
|
||||
xpath->cs);
|
||||
return 1;
|
||||
@ -1987,7 +2012,8 @@ static int my_xpath_parse_UnionExpr(MY_XPATH *xpath)
|
||||
xpath->error= 1;
|
||||
return 0;
|
||||
}
|
||||
xpath->item= new Item_nodeset_func_union(prev, xpath->item, xpath->pxml);
|
||||
xpath->item= new Item_nodeset_func_union(xpath->thd, prev, xpath->item,
|
||||
xpath->pxml);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -2033,8 +2059,10 @@ my_xpath_parse_FilterExpr_opt_slashes_RelativeLocationPath(MY_XPATH *xpath)
|
||||
|
||||
/* treat double slash (//) as /descendant-or-self::node()/ */
|
||||
if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
|
||||
xpath->context= new Item_nodeset_func_descendantbyname(xpath->context,
|
||||
"*", 1, xpath->pxml, 1);
|
||||
xpath->context= new Item_nodeset_func_descendantbyname(xpath->thd,
|
||||
xpath->context,
|
||||
"*", 1,
|
||||
xpath->pxml, 1);
|
||||
rc= my_xpath_parse_RelativeLocationPath(xpath);
|
||||
|
||||
/* push back the context and restore the item */
|
||||
@ -2096,7 +2124,7 @@ static int my_xpath_parse_OrExpr(MY_XPATH *xpath)
|
||||
xpath->error= 1;
|
||||
return 0;
|
||||
}
|
||||
xpath->item= new Item_cond_or(nodeset2bool(xpath, prev),
|
||||
xpath->item= new Item_cond_or(xpath->thd, nodeset2bool(xpath, prev),
|
||||
nodeset2bool(xpath, xpath->item));
|
||||
}
|
||||
return 1;
|
||||
@ -2128,8 +2156,8 @@ static int my_xpath_parse_AndExpr(MY_XPATH *xpath)
|
||||
return 0;
|
||||
}
|
||||
|
||||
xpath->item= new Item_cond_and(nodeset2bool(xpath,prev),
|
||||
nodeset2bool(xpath,xpath->item));
|
||||
xpath->item= new Item_cond_and(xpath->thd, nodeset2bool(xpath, prev),
|
||||
nodeset2bool(xpath, xpath->item));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -2298,9 +2326,9 @@ static int my_xpath_parse_AdditiveExpr(MY_XPATH *xpath)
|
||||
}
|
||||
|
||||
if (oper == MY_XPATH_LEX_PLUS)
|
||||
xpath->item= new Item_func_plus(prev, xpath->item);
|
||||
xpath->item= new Item_func_plus(xpath->thd, prev, xpath->item);
|
||||
else
|
||||
xpath->item= new Item_func_minus(prev, xpath->item);
|
||||
xpath->item= new Item_func_minus(xpath->thd, prev, xpath->item);
|
||||
};
|
||||
return 1;
|
||||
}
|
||||
@ -2347,13 +2375,13 @@ static int my_xpath_parse_MultiplicativeExpr(MY_XPATH *xpath)
|
||||
switch (oper)
|
||||
{
|
||||
case MY_XPATH_LEX_ASTERISK:
|
||||
xpath->item= new Item_func_mul(prev, xpath->item);
|
||||
xpath->item= new Item_func_mul(xpath->thd, prev, xpath->item);
|
||||
break;
|
||||
case MY_XPATH_LEX_DIV:
|
||||
xpath->item= new Item_func_int_div(prev, xpath->item);
|
||||
xpath->item= new Item_func_int_div(xpath->thd, prev, xpath->item);
|
||||
break;
|
||||
case MY_XPATH_LEX_MOD:
|
||||
xpath->item= new Item_func_mod(prev, xpath->item);
|
||||
xpath->item= new Item_func_mod(xpath->thd, prev, xpath->item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2378,7 +2406,7 @@ static int my_xpath_parse_UnaryExpr(MY_XPATH *xpath)
|
||||
return my_xpath_parse_UnionExpr(xpath);
|
||||
if (!my_xpath_parse_UnaryExpr(xpath))
|
||||
return 0;
|
||||
xpath->item= new Item_func_neg(xpath->item);
|
||||
xpath->item= new Item_func_neg(xpath->thd, xpath->item);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2415,13 +2443,13 @@ static int my_xpath_parse_Number(MY_XPATH *xpath)
|
||||
beg= xpath->prevtok.beg;
|
||||
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT))
|
||||
{
|
||||
xpath->item= new Item_int(xpath->prevtok.beg,
|
||||
xpath->item= new Item_int(xpath->thd, xpath->prevtok.beg,
|
||||
xpath->prevtok.end - xpath->prevtok.beg);
|
||||
return 1;
|
||||
}
|
||||
my_xpath_parse_term(xpath, MY_XPATH_LEX_DIGITS);
|
||||
|
||||
xpath->item= new Item_float(beg, xpath->prevtok.end - beg);
|
||||
xpath->item= new Item_float(xpath->thd, beg, xpath->prevtok.end - beg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2525,7 +2553,7 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
|
||||
name.str= (char*) xpath->prevtok.beg;
|
||||
|
||||
if (user_var)
|
||||
xpath->item= new Item_func_get_user_var(name);
|
||||
xpath->item= new Item_func_get_user_var(xpath->thd, name);
|
||||
else
|
||||
{
|
||||
sp_variable *spv;
|
||||
@ -2535,7 +2563,8 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
|
||||
(spc= lex->spcont) &&
|
||||
(spv= spc->find_variable(name, false)))
|
||||
{
|
||||
Item_splocal *splocal= new Item_splocal(name, spv->offset, spv->type, 0);
|
||||
Item_splocal *splocal= new Item_splocal(xpath->thd, name, spv->offset,
|
||||
spv->type, 0);
|
||||
#ifndef DBUG_OFF
|
||||
if (splocal)
|
||||
splocal->m_sp= lex->sphead;
|
||||
@ -2614,7 +2643,8 @@ my_xpath_parse(MY_XPATH *xpath, const char *str, const char *strend)
|
||||
my_xpath_lex_init(&xpath->prevtok, str, strend);
|
||||
my_xpath_lex_scan(xpath, &xpath->lasttok, str, strend);
|
||||
|
||||
xpath->rootelement= new Item_nodeset_func_rootelement(xpath->pxml);
|
||||
xpath->rootelement= new Item_nodeset_func_rootelement(xpath->thd,
|
||||
xpath->pxml);
|
||||
|
||||
return
|
||||
my_xpath_parse_Expr(xpath) &&
|
||||
@ -2662,6 +2692,7 @@ bool Item_xml_str_func::fix_fields(THD *thd, Item **ref)
|
||||
if (!(xp= args[1]->val_str(&tmp)))
|
||||
return false; // Will return NULL
|
||||
my_xpath_init(&xpath);
|
||||
xpath.thd= thd;
|
||||
xpath.cs= collation.collation;
|
||||
xpath.debug= 0;
|
||||
xpath.pxml= xml.parsed();
|
||||
|
@ -76,13 +76,12 @@ protected:
|
||||
return xml_arg->parse(args[0], cache);
|
||||
}
|
||||
public:
|
||||
Item_xml_str_func(Item *a, Item *b):
|
||||
Item_str_func(a,b)
|
||||
Item_xml_str_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b)
|
||||
{
|
||||
maybe_null= TRUE;
|
||||
}
|
||||
Item_xml_str_func(Item *a, Item *b, Item *c):
|
||||
Item_str_func(a,b,c)
|
||||
Item_xml_str_func(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_str_func(thd, a, b, c)
|
||||
{
|
||||
maybe_null= TRUE;
|
||||
}
|
||||
@ -102,7 +101,8 @@ public:
|
||||
class Item_func_xml_extractvalue: public Item_xml_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {}
|
||||
Item_func_xml_extractvalue(THD *thd, Item *a, Item *b):
|
||||
Item_xml_str_func(thd, a, b) {}
|
||||
const char *func_name() const { return "extractvalue"; }
|
||||
String *val_str(String *);
|
||||
};
|
||||
@ -115,7 +115,8 @@ class Item_func_xml_update: public Item_xml_str_func
|
||||
const MY_XML_NODE *cut,
|
||||
const String *replace);
|
||||
public:
|
||||
Item_func_xml_update(Item *a,Item *b,Item *c) :Item_xml_str_func(a,b,c) {}
|
||||
Item_func_xml_update(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_xml_str_func(thd, a, b, c) {}
|
||||
const char *func_name() const { return "updatexml"; }
|
||||
String *val_str(String *);
|
||||
};
|
||||
|
@ -1034,18 +1034,19 @@ int Log_event::net_send(THD *thd, Protocol *protocol, const char* log_name,
|
||||
EVENTS.
|
||||
*/
|
||||
|
||||
void Log_event::init_show_field_list(List<Item>* field_list)
|
||||
void Log_event::init_show_field_list(THD *thd, List<Item>* field_list)
|
||||
{
|
||||
field_list->push_back(new Item_empty_string("Log_name", 20));
|
||||
field_list->push_back(new Item_return_int("Pos", MY_INT32_NUM_DECIMAL_DIGITS,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list->push_back(new Item_empty_string("Event_type", 20));
|
||||
field_list->push_back(new Item_return_int("Server_id", 10,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list->push_back(new Item_return_int("End_log_pos",
|
||||
field_list->push_back(new Item_empty_string(thd, "Log_name", 20));
|
||||
field_list->push_back(new Item_return_int(thd, "Pos",
|
||||
MY_INT32_NUM_DECIMAL_DIGITS,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list->push_back(new Item_empty_string("Info", 20));
|
||||
field_list->push_back(new Item_empty_string(thd, "Event_type", 20));
|
||||
field_list->push_back(new Item_return_int(thd, "Server_id", 10,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list->push_back(new Item_return_int(thd, "End_log_pos",
|
||||
MY_INT32_NUM_DECIMAL_DIGITS,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list->push_back(new Item_empty_string(thd, "Info", 20));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7853,33 +7854,33 @@ int User_var_log_event::do_apply_event(rpl_group_info *rgi)
|
||||
|
||||
if (is_null)
|
||||
{
|
||||
it= new Item_null();
|
||||
it= new Item_null(thd);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type) {
|
||||
case REAL_RESULT:
|
||||
float8get(real_val, val);
|
||||
it= new Item_float(real_val, 0);
|
||||
it= new Item_float(thd, real_val, 0);
|
||||
val= (char*) &real_val; // Pointer to value in native format
|
||||
val_len= 8;
|
||||
break;
|
||||
case INT_RESULT:
|
||||
int_val= (longlong) uint8korr(val);
|
||||
it= new Item_int(int_val);
|
||||
it= new Item_int(thd, int_val);
|
||||
val= (char*) &int_val; // Pointer to value in native format
|
||||
val_len= 8;
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
{
|
||||
Item_decimal *dec= new Item_decimal((uchar*) val+2, val[0], val[1]);
|
||||
Item_decimal *dec= new Item_decimal(thd, (uchar*) val+2, val[0], val[1]);
|
||||
it= dec;
|
||||
val= (char *)dec->val_decimal(NULL);
|
||||
val_len= sizeof(my_decimal);
|
||||
break;
|
||||
}
|
||||
case STRING_RESULT:
|
||||
it= new Item_string(val, val_len, charset);
|
||||
it= new Item_string(thd, val, val_len, charset);
|
||||
break;
|
||||
case ROW_RESULT:
|
||||
default:
|
||||
@ -7888,7 +7889,7 @@ int User_var_log_event::do_apply_event(rpl_group_info *rgi)
|
||||
}
|
||||
}
|
||||
|
||||
Item_func_set_user_var *e= new Item_func_set_user_var(user_var_name, it);
|
||||
Item_func_set_user_var *e= new Item_func_set_user_var(thd, user_var_name, it);
|
||||
/*
|
||||
Item_func_set_user_var can't substitute something else on its place =>
|
||||
0 can be passed as last argument (reference on item)
|
||||
|
@ -1177,7 +1177,7 @@ public:
|
||||
output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG
|
||||
EVENTS.
|
||||
*/
|
||||
static void init_show_field_list(List<Item>* field_list);
|
||||
static void init_show_field_list(THD *thd, List<Item>* field_list);
|
||||
#ifdef HAVE_REPLICATION
|
||||
int net_send(THD *thd, Protocol *protocol, const char* log_name,
|
||||
my_off_t pos);
|
||||
|
@ -181,8 +181,8 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
|
||||
Index condition, or NULL if no condition could be inferred.
|
||||
*/
|
||||
|
||||
Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
|
||||
bool other_tbls_ok)
|
||||
static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
|
||||
bool other_tbls_ok)
|
||||
{
|
||||
if (!cond)
|
||||
return NULL;
|
||||
@ -192,14 +192,14 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
|
||||
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
|
||||
{
|
||||
table_map used_tables= 0;
|
||||
Item_cond_and *new_cond=new Item_cond_and;
|
||||
Item_cond_and *new_cond= new Item_cond_and(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0;
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
Item *item;
|
||||
while ((item=li++))
|
||||
{
|
||||
Item *fix= make_cond_for_index(item, table, keyno, other_tbls_ok);
|
||||
Item *fix= make_cond_for_index(thd, item, table, keyno, other_tbls_ok);
|
||||
if (fix)
|
||||
{
|
||||
new_cond->argument_list()->push_back(fix);
|
||||
@ -227,14 +227,14 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
|
||||
}
|
||||
else /* It's OR */
|
||||
{
|
||||
Item_cond_or *new_cond=new Item_cond_or;
|
||||
Item_cond_or *new_cond= new Item_cond_or(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0;
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
Item *item;
|
||||
while ((item=li++))
|
||||
{
|
||||
Item *fix= make_cond_for_index(item, table, keyno, other_tbls_ok);
|
||||
Item *fix= make_cond_for_index(thd, item, table, keyno, other_tbls_ok);
|
||||
if (!fix)
|
||||
return (COND*) 0;
|
||||
new_cond->argument_list()->push_back(fix);
|
||||
@ -260,8 +260,8 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
|
||||
}
|
||||
|
||||
|
||||
Item *make_cond_remainder(Item *cond, TABLE *table, uint keyno,
|
||||
bool other_tbls_ok, bool exclude_index)
|
||||
static Item *make_cond_remainder(THD *thd, Item *cond, TABLE *table, uint keyno,
|
||||
bool other_tbls_ok, bool exclude_index)
|
||||
{
|
||||
if (cond->type() == Item::COND_ITEM)
|
||||
{
|
||||
@ -269,14 +269,14 @@ Item *make_cond_remainder(Item *cond, TABLE *table, uint keyno,
|
||||
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
|
||||
{
|
||||
/* Create new top level AND item */
|
||||
Item_cond_and *new_cond=new Item_cond_and;
|
||||
Item_cond_and *new_cond= new Item_cond_and(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0;
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
Item *item;
|
||||
while ((item=li++))
|
||||
{
|
||||
Item *fix= make_cond_remainder(item, table, keyno,
|
||||
Item *fix= make_cond_remainder(thd, item, table, keyno,
|
||||
other_tbls_ok, exclude_index);
|
||||
if (fix)
|
||||
{
|
||||
@ -297,14 +297,14 @@ Item *make_cond_remainder(Item *cond, TABLE *table, uint keyno,
|
||||
}
|
||||
else /* It's OR */
|
||||
{
|
||||
Item_cond_or *new_cond=new Item_cond_or;
|
||||
Item_cond_or *new_cond= new Item_cond_or(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0;
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
Item *item;
|
||||
while ((item=li++))
|
||||
{
|
||||
Item *fix= make_cond_remainder(item, table, keyno,
|
||||
Item *fix= make_cond_remainder(thd, item, table, keyno,
|
||||
other_tbls_ok, FALSE);
|
||||
if (!fix)
|
||||
return (COND*) 0;
|
||||
@ -366,8 +366,8 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
|
||||
DBUG_EXECUTE("where",
|
||||
print_where(tab->select_cond, "full cond", QT_ORDINARY););
|
||||
|
||||
idx_cond= make_cond_for_index(tab->select_cond, tab->table, keyno,
|
||||
tab->icp_other_tables_ok);
|
||||
idx_cond= make_cond_for_index(tab->join->thd, tab->select_cond, tab->table,
|
||||
keyno, tab->icp_other_tables_ok);
|
||||
|
||||
DBUG_EXECUTE("where",
|
||||
print_where(idx_cond, "idx cond", QT_ORDINARY););
|
||||
@ -406,7 +406,8 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
|
||||
tab->ref.disable_cache= TRUE;
|
||||
|
||||
Item *row_cond= tab->idx_cond_fact_out ?
|
||||
make_cond_remainder(tab->select_cond, tab->table, keyno,
|
||||
make_cond_remainder(tab->join->thd, tab->select_cond,
|
||||
tab->table, keyno,
|
||||
tab->icp_other_tables_ok, TRUE) :
|
||||
tab->pre_idx_push_select_cond;
|
||||
|
||||
@ -419,7 +420,8 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
|
||||
tab->select_cond= row_cond;
|
||||
else
|
||||
{
|
||||
COND *new_cond= new Item_cond_and(row_cond, idx_remainder_cond);
|
||||
COND *new_cond= new Item_cond_and(tab->join->thd, row_cond,
|
||||
idx_remainder_cond);
|
||||
tab->select_cond= new_cond;
|
||||
tab->select_cond->quick_fix_field();
|
||||
((Item_cond_and*)tab->select_cond)->used_tables_cache=
|
||||
|
@ -7039,7 +7039,7 @@ SEL_TREE *Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM *param,
|
||||
per-statement mem_root (while thd->mem_root is currently pointing
|
||||
to mem_root local to range optimizer).
|
||||
*/
|
||||
Item *value_item= array->create_item();
|
||||
Item *value_item= array->create_item(param->thd);
|
||||
param->thd->mem_root= tmp_root;
|
||||
|
||||
if (array->count > NOT_IN_IGNORE_THRESHOLD || !value_item)
|
||||
|
@ -461,7 +461,7 @@ void best_access_path(JOIN *join, JOIN_TAB *s,
|
||||
|
||||
static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
|
||||
Item_in_subselect *subq_pred);
|
||||
static void remove_sj_conds(Item **tree);
|
||||
static void remove_sj_conds(THD *thd, Item **tree);
|
||||
static bool is_cond_sj_in_equality(Item *item);
|
||||
static bool sj_table_is_included(JOIN *join, JOIN_TAB *join_tab);
|
||||
static Item *remove_additional_cond(Item* conds);
|
||||
@ -1135,7 +1135,8 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
|
||||
Item **tree= (in_subq->emb_on_expr_nest == NO_JOIN_NEST)?
|
||||
&join->conds : &(in_subq->emb_on_expr_nest->on_expr);
|
||||
Item *replace_me= in_subq->original_item();
|
||||
if (replace_where_subcondition(join, tree, replace_me, new Item_int(1),
|
||||
if (replace_where_subcondition(join, tree, replace_me,
|
||||
new Item_int(thd, 1),
|
||||
FALSE))
|
||||
goto restore_arena_and_fail;
|
||||
}
|
||||
@ -1594,9 +1595,10 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
|
||||
{
|
||||
nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr);
|
||||
Item_func_eq *item_eq=
|
||||
new Item_func_eq(subq_pred->left_expr, subq_lex->ref_pointer_array[0]);
|
||||
new Item_func_eq(thd, subq_pred->left_expr,
|
||||
subq_lex->ref_pointer_array[0]);
|
||||
item_eq->in_equality_no= 0;
|
||||
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
|
||||
sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1605,10 +1607,10 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
|
||||
nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr->
|
||||
element_index(i));
|
||||
Item_func_eq *item_eq=
|
||||
new Item_func_eq(subq_pred->left_expr->element_index(i),
|
||||
new Item_func_eq(thd, subq_pred->left_expr->element_index(i),
|
||||
subq_lex->ref_pointer_array[i]);
|
||||
item_eq->in_equality_no= i;
|
||||
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
|
||||
sj_nest->sj_on_expr= and_items(thd, sj_nest->sj_on_expr, item_eq);
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -1643,7 +1645,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
|
||||
/* Inject sj_on_expr into the parent's WHERE or ON */
|
||||
if (emb_tbl_nest)
|
||||
{
|
||||
emb_tbl_nest->on_expr= and_items(emb_tbl_nest->on_expr,
|
||||
emb_tbl_nest->on_expr= and_items(thd, emb_tbl_nest->on_expr,
|
||||
sj_nest->sj_on_expr);
|
||||
emb_tbl_nest->on_expr->top_level_item();
|
||||
if (!emb_tbl_nest->on_expr->fixed &&
|
||||
@ -1656,7 +1658,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
|
||||
else
|
||||
{
|
||||
/* Inject into the WHERE */
|
||||
parent_join->conds= and_items(parent_join->conds, sj_nest->sj_on_expr);
|
||||
parent_join->conds= and_items(thd, parent_join->conds, sj_nest->sj_on_expr);
|
||||
parent_join->conds->top_level_item();
|
||||
/*
|
||||
fix_fields must update the properties (e.g. st_select_lex::cond_count of
|
||||
@ -3650,9 +3652,9 @@ bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab)
|
||||
*/
|
||||
for (i= 0; i < sjm->tables; i++)
|
||||
{
|
||||
remove_sj_conds(&tab[i].select_cond);
|
||||
remove_sj_conds(thd, &tab[i].select_cond);
|
||||
if (tab[i].select)
|
||||
remove_sj_conds(&tab[i].select->cond);
|
||||
remove_sj_conds(thd, &tab[i].select->cond);
|
||||
}
|
||||
if (!(sjm->in_equality= create_subq_in_equalities(thd, sjm,
|
||||
emb_sj_nest->sj_subq_pred)))
|
||||
@ -3795,8 +3797,8 @@ static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
|
||||
Item *res= NULL;
|
||||
if (subq_pred->left_expr->cols() == 1)
|
||||
{
|
||||
if (!(res= new Item_func_eq(subq_pred->left_expr,
|
||||
new Item_field(sjm->table->field[0]))))
|
||||
if (!(res= new Item_func_eq(thd, subq_pred->left_expr,
|
||||
new Item_field(thd, sjm->table->field[0]))))
|
||||
return NULL; /* purecov: inspected */
|
||||
}
|
||||
else
|
||||
@ -3804,9 +3806,9 @@ static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
|
||||
Item *conj;
|
||||
for (uint i= 0; i < subq_pred->left_expr->cols(); i++)
|
||||
{
|
||||
if (!(conj= new Item_func_eq(subq_pred->left_expr->element_index(i),
|
||||
new Item_field(sjm->table->field[i]))) ||
|
||||
!(res= and_items(res, conj)))
|
||||
if (!(conj= new Item_func_eq(thd, subq_pred->left_expr->element_index(i),
|
||||
new Item_field(thd, sjm->table->field[i]))) ||
|
||||
!(res= and_items(thd, res, conj)))
|
||||
return NULL; /* purecov: inspected */
|
||||
}
|
||||
}
|
||||
@ -3818,7 +3820,7 @@ static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
|
||||
|
||||
|
||||
|
||||
static void remove_sj_conds(Item **tree)
|
||||
static void remove_sj_conds(THD *thd, Item **tree)
|
||||
{
|
||||
if (*tree)
|
||||
{
|
||||
@ -3834,7 +3836,7 @@ static void remove_sj_conds(Item **tree)
|
||||
while ((item= li++))
|
||||
{
|
||||
if (is_cond_sj_in_equality(item))
|
||||
li.replace(new Item_int(1));
|
||||
li.replace(new Item_int(thd, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5100,7 +5102,7 @@ TABLE *create_dummy_tmp_table(THD *thd)
|
||||
sjm_table_param.init();
|
||||
sjm_table_param.field_count= 1;
|
||||
List<Item> sjm_table_cols;
|
||||
Item *column_item= new Item_int(1);
|
||||
Item *column_item= new Item_int(thd, 1);
|
||||
sjm_table_cols.push_back(column_item);
|
||||
if (!(table= create_tmp_table(thd, &sjm_table_param,
|
||||
sjm_table_cols, (ORDER*) 0,
|
||||
@ -5143,16 +5145,16 @@ int select_value_catcher::setup(List<Item> *items)
|
||||
assigned= FALSE;
|
||||
n_elements= items->elements;
|
||||
|
||||
if (!(row= (Item_cache**) sql_alloc(sizeof(Item_cache*)*n_elements)))
|
||||
if (!(row= (Item_cache**) thd->alloc(sizeof(Item_cache*) * n_elements)))
|
||||
return TRUE;
|
||||
|
||||
Item *sel_item;
|
||||
List_iterator<Item> li(*items);
|
||||
for (uint i= 0; (sel_item= li++); i++)
|
||||
{
|
||||
if (!(row[i]= Item_cache::get_cache(sel_item)))
|
||||
if (!(row[i]= Item_cache::get_cache(thd, sel_item)))
|
||||
return TRUE;
|
||||
row[i]->setup(sel_item);
|
||||
row[i]->setup(thd, sel_item);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -5260,12 +5262,13 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
|
||||
Item *eq_cond;
|
||||
for (uint i= 0; i < subq_pred->left_expr->cols(); i++)
|
||||
{
|
||||
eq_cond= new Item_func_eq(subq_pred->left_expr->element_index(i),
|
||||
eq_cond= new Item_func_eq(join->thd,
|
||||
subq_pred->left_expr->element_index(i),
|
||||
new_sink->row[i]);
|
||||
if (!eq_cond)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (!((*join_where)= and_items(*join_where, eq_cond)) ||
|
||||
if (!((*join_where)= and_items(join->thd, *join_where, eq_cond)) ||
|
||||
(*join_where)->fix_fields(join->thd, join_where))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
@ -5304,7 +5307,7 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
|
||||
|
||||
Item *sj_conds= hash_sj_engine->semi_join_conds;
|
||||
|
||||
(*join_where)= and_items(*join_where, sj_conds);
|
||||
(*join_where)= and_items(join->thd, *join_where, sj_conds);
|
||||
if (!(*join_where)->fixed)
|
||||
(*join_where)->fix_fields(join->thd, join_where);
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ bool check_func_dependency(JOIN *join,
|
||||
TABLE_LIST *oj_tbl,
|
||||
Item* cond);
|
||||
static
|
||||
void build_eq_mods_for_cond(Dep_analysis_context *dac,
|
||||
void build_eq_mods_for_cond(THD *thd, Dep_analysis_context *dac,
|
||||
Dep_module_expr **eq_mod, uint *and_level,
|
||||
Item *cond);
|
||||
static
|
||||
@ -846,7 +846,7 @@ bool check_func_dependency(JOIN *join,
|
||||
Dep_value_field objects for the used fields.
|
||||
*/
|
||||
uint and_level=0;
|
||||
build_eq_mods_for_cond(&dac, &last_eq_mod, &and_level, cond);
|
||||
build_eq_mods_for_cond(join->thd, &dac, &last_eq_mod, &and_level, cond);
|
||||
if (!(dac.n_equality_mods= last_eq_mod - dac.equality_mods))
|
||||
return FALSE; /* No useful conditions */
|
||||
|
||||
@ -1149,7 +1149,7 @@ int compare_field_values(Dep_value_field *a, Dep_value_field *b, void *unused)
|
||||
*/
|
||||
|
||||
static
|
||||
void build_eq_mods_for_cond(Dep_analysis_context *ctx,
|
||||
void build_eq_mods_for_cond(THD *thd, Dep_analysis_context *ctx,
|
||||
Dep_module_expr **eq_mod,
|
||||
uint *and_level, Item *cond)
|
||||
{
|
||||
@ -1163,7 +1163,7 @@ void build_eq_mods_for_cond(Dep_analysis_context *ctx,
|
||||
{
|
||||
Item *item;
|
||||
while ((item=li++))
|
||||
build_eq_mods_for_cond(ctx, eq_mod, and_level, item);
|
||||
build_eq_mods_for_cond(thd, ctx, eq_mod, and_level, item);
|
||||
|
||||
for (Dep_module_expr *mod_exp= ctx->equality_mods + orig_offset;
|
||||
mod_exp != *eq_mod ; mod_exp++)
|
||||
@ -1175,12 +1175,12 @@ void build_eq_mods_for_cond(Dep_analysis_context *ctx,
|
||||
{
|
||||
Item *item;
|
||||
(*and_level)++;
|
||||
build_eq_mods_for_cond(ctx, eq_mod, and_level, li++);
|
||||
build_eq_mods_for_cond(thd, ctx, eq_mod, and_level, li++);
|
||||
while ((item=li++))
|
||||
{
|
||||
Dep_module_expr *start_key_fields= *eq_mod;
|
||||
(*and_level)++;
|
||||
build_eq_mods_for_cond(ctx, eq_mod, and_level, item);
|
||||
build_eq_mods_for_cond(thd, ctx, eq_mod, and_level, item);
|
||||
*eq_mod= merge_eq_mods(ctx->equality_mods + orig_offset,
|
||||
start_key_fields, *eq_mod,
|
||||
++(*and_level));
|
||||
@ -1217,7 +1217,7 @@ void build_eq_mods_for_cond(Dep_analysis_context *ctx,
|
||||
}
|
||||
case Item_func::ISNULL_FUNC:
|
||||
{
|
||||
Item *tmp=new Item_null;
|
||||
Item *tmp=new Item_null(thd);
|
||||
if (tmp)
|
||||
check_equality(ctx, eq_mod, *and_level, cond_func, args[0], tmp);
|
||||
break;
|
||||
|
@ -38,7 +38,7 @@
|
||||
class Item_proc :public Item
|
||||
{
|
||||
public:
|
||||
Item_proc(const char *name_par): Item()
|
||||
Item_proc(THD *thd, const char *name_par): Item(thd)
|
||||
{
|
||||
this->name=(char*) name_par;
|
||||
}
|
||||
@ -63,7 +63,8 @@ class Item_proc_real :public Item_proc
|
||||
{
|
||||
double value;
|
||||
public:
|
||||
Item_proc_real(const char *name_par,uint dec) : Item_proc(name_par)
|
||||
Item_proc_real(THD *thd, const char *name_par, uint dec):
|
||||
Item_proc(thd, name_par)
|
||||
{
|
||||
decimals=dec; max_length=float_length(dec);
|
||||
}
|
||||
@ -92,7 +93,7 @@ class Item_proc_int :public Item_proc
|
||||
{
|
||||
longlong value;
|
||||
public:
|
||||
Item_proc_int(const char *name_par) :Item_proc(name_par)
|
||||
Item_proc_int(THD *thd, const char *name_par): Item_proc(thd, name_par)
|
||||
{ max_length=11; }
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
@ -111,8 +112,8 @@ public:
|
||||
class Item_proc_string :public Item_proc
|
||||
{
|
||||
public:
|
||||
Item_proc_string(const char *name_par,uint length) :Item_proc(name_par)
|
||||
{ this->max_length=length; }
|
||||
Item_proc_string(THD *thd, const char *name_par, uint length):
|
||||
Item_proc(thd, name_par) { this->max_length=length; }
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
|
||||
void set(double nr) { str_value.set_real(nr, 2, default_charset()); }
|
||||
@ -156,7 +157,7 @@ public:
|
||||
virtual void add(void)=0;
|
||||
virtual void end_group(void)=0;
|
||||
virtual int send_row(List<Item> &fields)=0;
|
||||
virtual bool change_columns(List<Item> &fields)=0;
|
||||
virtual bool change_columns(THD *thd, List<Item> &fields)= 0;
|
||||
virtual void update_refs(void) {}
|
||||
virtual int end_of_records() { return 0; }
|
||||
};
|
||||
|
@ -1248,7 +1248,7 @@ bool Protocol_text::send_out_parameters(List<Item_param> *sp_params)
|
||||
continue; // It's an IN-parameter.
|
||||
|
||||
Item_func_set_user_var *suv=
|
||||
new Item_func_set_user_var(*user_var_name, item_param);
|
||||
new Item_func_set_user_var(thd, *user_var_name, item_param);
|
||||
/*
|
||||
Item_func_set_user_var is not fixed after construction, call
|
||||
fix_fields().
|
||||
|
@ -139,6 +139,10 @@ public:
|
||||
virtual enum enum_protocol_type type()= 0;
|
||||
|
||||
void end_statement();
|
||||
|
||||
friend int send_answer_1(Protocol *protocol, String *s1, String *s2,
|
||||
String *s3);
|
||||
friend int send_header_2(Protocol *protocol, bool for_category);
|
||||
};
|
||||
|
||||
|
||||
|
@ -232,16 +232,16 @@ bool show_slave_hosts(THD* thd)
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("show_slave_hosts");
|
||||
|
||||
field_list.push_back(new Item_return_int("Server_id", 10,
|
||||
field_list.push_back(new Item_return_int(thd, "Server_id", 10,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string("Host", 20));
|
||||
field_list.push_back(new Item_empty_string(thd, "Host", 20));
|
||||
if (opt_show_slave_auth_info)
|
||||
{
|
||||
field_list.push_back(new Item_empty_string("User",20));
|
||||
field_list.push_back(new Item_empty_string("Password",20));
|
||||
field_list.push_back(new Item_empty_string(thd, "User", 20));
|
||||
field_list.push_back(new Item_empty_string(thd, "Password", 20));
|
||||
}
|
||||
field_list.push_back(new Item_return_int("Port", 7, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int("Master_id", 10,
|
||||
field_list.push_back(new Item_return_int(thd, "Port", 7, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int(thd, "Master_id", 10,
|
||||
MYSQL_TYPE_LONG));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
|
@ -982,7 +982,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
|
||||
DBUG_ASSERT(tables->table->in_use == thd);
|
||||
|
||||
cond= make_cond_for_info_schema(cond, tables);
|
||||
cond= make_cond_for_info_schema(thd, cond, tables);
|
||||
thd->count_cuted_fields= CHECK_FIELD_WARN;
|
||||
mysql_rwlock_rdlock(&LOCK_system_variables_hash);
|
||||
|
||||
|
@ -285,7 +285,7 @@ public:
|
||||
} save_result;
|
||||
LEX_STRING base; /**< for structured variables, like keycache_name.variable_name */
|
||||
|
||||
set_var(enum_var_type type_arg, sys_var *var_arg,
|
||||
set_var(THD *thd, enum_var_type type_arg, sys_var *var_arg,
|
||||
const LEX_STRING *base_name_arg, Item *value_arg)
|
||||
:var(var_arg), type(type_arg), base(*base_name_arg)
|
||||
{
|
||||
@ -296,7 +296,8 @@ public:
|
||||
if (value_arg && value_arg->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
Item_field *item= (Item_field*) value_arg;
|
||||
if (!(value=new Item_string_sys(item->field_name))) // names are utf8
|
||||
// names are utf8
|
||||
if (!(value=new Item_string_sys(thd, item->field_name)))
|
||||
value=value_arg; /* Give error message later */
|
||||
}
|
||||
else
|
||||
|
119
sql/slave.cc
119
sql/slave.cc
@ -2519,102 +2519,109 @@ static bool send_show_master_info_header(THD *thd, bool full,
|
||||
|
||||
if (full)
|
||||
{
|
||||
field_list.push_back(new Item_empty_string("Connection_name",
|
||||
field_list.push_back(new Item_empty_string(thd, "Connection_name",
|
||||
MAX_CONNECTION_NAME));
|
||||
field_list.push_back(new Item_empty_string("Slave_SQL_State",
|
||||
field_list.push_back(new Item_empty_string(thd, "Slave_SQL_State",
|
||||
30));
|
||||
}
|
||||
|
||||
field_list.push_back(new Item_empty_string("Slave_IO_State",
|
||||
field_list.push_back(new Item_empty_string(thd, "Slave_IO_State",
|
||||
30));
|
||||
field_list.push_back(new Item_empty_string("Master_Host",
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_Host",
|
||||
sizeof(mi->host)));
|
||||
field_list.push_back(new Item_empty_string("Master_User",
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_User",
|
||||
sizeof(mi->user)));
|
||||
field_list.push_back(new Item_return_int("Master_Port", 7,
|
||||
field_list.push_back(new Item_return_int(thd, "Master_Port", 7,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int("Connect_Retry", 10,
|
||||
field_list.push_back(new Item_return_int(thd, "Connect_Retry", 10,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string("Master_Log_File",
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_Log_File",
|
||||
FN_REFLEN));
|
||||
field_list.push_back(new Item_return_int("Read_Master_Log_Pos", 10,
|
||||
field_list.push_back(new Item_return_int(thd, "Read_Master_Log_Pos", 10,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list.push_back(new Item_empty_string("Relay_Log_File",
|
||||
field_list.push_back(new Item_empty_string(thd, "Relay_Log_File",
|
||||
FN_REFLEN));
|
||||
field_list.push_back(new Item_return_int("Relay_Log_Pos", 10,
|
||||
field_list.push_back(new Item_return_int(thd, "Relay_Log_Pos", 10,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list.push_back(new Item_empty_string("Relay_Master_Log_File",
|
||||
field_list.push_back(new Item_empty_string(thd, "Relay_Master_Log_File",
|
||||
FN_REFLEN));
|
||||
field_list.push_back(new Item_empty_string("Slave_IO_Running", 3));
|
||||
field_list.push_back(new Item_empty_string("Slave_SQL_Running", 3));
|
||||
field_list.push_back(new Item_empty_string("Replicate_Do_DB", 20));
|
||||
field_list.push_back(new Item_empty_string("Replicate_Ignore_DB", 20));
|
||||
field_list.push_back(new Item_empty_string("Replicate_Do_Table", 20));
|
||||
field_list.push_back(new Item_empty_string("Replicate_Ignore_Table", 23));
|
||||
field_list.push_back(new Item_empty_string("Replicate_Wild_Do_Table", 24));
|
||||
field_list.push_back(new Item_empty_string("Replicate_Wild_Ignore_Table",
|
||||
field_list.push_back(new Item_empty_string(thd, "Slave_IO_Running", 3));
|
||||
field_list.push_back(new Item_empty_string(thd, "Slave_SQL_Running", 3));
|
||||
field_list.push_back(new Item_empty_string(thd, "Replicate_Do_DB", 20));
|
||||
field_list.push_back(new Item_empty_string(thd, "Replicate_Ignore_DB", 20));
|
||||
field_list.push_back(new Item_empty_string(thd, "Replicate_Do_Table", 20));
|
||||
field_list.push_back(new Item_empty_string(thd, "Replicate_Ignore_Table",
|
||||
23));
|
||||
field_list.push_back(new Item_empty_string(thd, "Replicate_Wild_Do_Table",
|
||||
24));
|
||||
field_list.push_back(new Item_empty_string(thd, "Replicate_Wild_Ignore_Table",
|
||||
28));
|
||||
field_list.push_back(new Item_return_int("Last_Errno", 4, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string("Last_Error", 20));
|
||||
field_list.push_back(new Item_return_int("Skip_Counter", 10,
|
||||
field_list.push_back(new Item_return_int(thd, "Last_Errno", 4,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int("Exec_Master_Log_Pos", 10,
|
||||
field_list.push_back(new Item_empty_string(thd, "Last_Error", 20));
|
||||
field_list.push_back(new Item_return_int(thd, "Skip_Counter", 10,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int(thd, "Exec_Master_Log_Pos", 10,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list.push_back(new Item_return_int("Relay_Log_Space", 10,
|
||||
field_list.push_back(new Item_return_int(thd, "Relay_Log_Space", 10,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list.push_back(new Item_empty_string("Until_Condition", 6));
|
||||
field_list.push_back(new Item_empty_string("Until_Log_File", FN_REFLEN));
|
||||
field_list.push_back(new Item_return_int("Until_Log_Pos", 10,
|
||||
field_list.push_back(new Item_empty_string(thd, "Until_Condition", 6));
|
||||
field_list.push_back(new Item_empty_string(thd, "Until_Log_File", FN_REFLEN));
|
||||
field_list.push_back(new Item_return_int(thd, "Until_Log_Pos", 10,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list.push_back(new Item_empty_string("Master_SSL_Allowed", 7));
|
||||
field_list.push_back(new Item_empty_string("Master_SSL_CA_File",
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_SSL_Allowed", 7));
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_SSL_CA_File",
|
||||
sizeof(mi->ssl_ca)));
|
||||
field_list.push_back(new Item_empty_string("Master_SSL_CA_Path",
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_SSL_CA_Path",
|
||||
sizeof(mi->ssl_capath)));
|
||||
field_list.push_back(new Item_empty_string("Master_SSL_Cert",
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_SSL_Cert",
|
||||
sizeof(mi->ssl_cert)));
|
||||
field_list.push_back(new Item_empty_string("Master_SSL_Cipher",
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_SSL_Cipher",
|
||||
sizeof(mi->ssl_cipher)));
|
||||
field_list.push_back(new Item_empty_string("Master_SSL_Key",
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_SSL_Key",
|
||||
sizeof(mi->ssl_key)));
|
||||
field_list.push_back(new Item_return_int("Seconds_Behind_Master", 10,
|
||||
field_list.push_back(new Item_return_int(thd, "Seconds_Behind_Master", 10,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list.push_back(new Item_empty_string("Master_SSL_Verify_Server_Cert",
|
||||
field_list.push_back(new Item_empty_string(thd,
|
||||
"Master_SSL_Verify_Server_Cert",
|
||||
3));
|
||||
field_list.push_back(new Item_return_int("Last_IO_Errno", 4, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string("Last_IO_Error", 20));
|
||||
field_list.push_back(new Item_return_int("Last_SQL_Errno", 4, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string("Last_SQL_Error", 20));
|
||||
field_list.push_back(new Item_empty_string("Replicate_Ignore_Server_Ids",
|
||||
FN_REFLEN));
|
||||
field_list.push_back(new Item_return_int("Master_Server_Id", sizeof(ulong),
|
||||
field_list.push_back(new Item_return_int(thd, "Last_IO_Errno", 4,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string("Master_SSL_Crl",
|
||||
field_list.push_back(new Item_empty_string(thd, "Last_IO_Error", 20));
|
||||
field_list.push_back(new Item_return_int(thd, "Last_SQL_Errno", 4,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string(thd, "Last_SQL_Error", 20));
|
||||
field_list.push_back(new Item_empty_string(thd, "Replicate_Ignore_Server_Ids",
|
||||
FN_REFLEN));
|
||||
field_list.push_back(new Item_return_int(thd, "Master_Server_Id",
|
||||
sizeof(ulong),
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_SSL_Crl",
|
||||
sizeof(mi->ssl_crl)));
|
||||
field_list.push_back(new Item_empty_string("Master_SSL_Crlpath",
|
||||
field_list.push_back(new Item_empty_string(thd, "Master_SSL_Crlpath",
|
||||
sizeof(mi->ssl_crlpath)));
|
||||
field_list.push_back(new Item_empty_string("Using_Gtid",
|
||||
field_list.push_back(new Item_empty_string(thd, "Using_Gtid",
|
||||
sizeof("Current_Pos")-1));
|
||||
field_list.push_back(new Item_empty_string("Gtid_IO_Pos", 30));
|
||||
field_list.push_back(new Item_empty_string("Replicate_Do_Domain_Ids",
|
||||
field_list.push_back(new Item_empty_string(thd, "Gtid_IO_Pos", 30));
|
||||
field_list.push_back(new Item_empty_string(thd, "Replicate_Do_Domain_Ids",
|
||||
FN_REFLEN));
|
||||
field_list.push_back(new Item_empty_string("Replicate_Ignore_Domain_Ids",
|
||||
field_list.push_back(new Item_empty_string(thd, "Replicate_Ignore_Domain_Ids",
|
||||
FN_REFLEN));
|
||||
field_list.push_back(new Item_empty_string("Parallel_Mode",
|
||||
field_list.push_back(new Item_empty_string(thd, "Parallel_Mode",
|
||||
sizeof("conservative")-1));
|
||||
if (full)
|
||||
{
|
||||
field_list.push_back(new Item_return_int("Retried_transactions",
|
||||
field_list.push_back(new Item_return_int(thd, "Retried_transactions",
|
||||
10, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int("Max_relay_log_size",
|
||||
field_list.push_back(new Item_return_int(thd, "Max_relay_log_size",
|
||||
10, MYSQL_TYPE_LONGLONG));
|
||||
field_list.push_back(new Item_return_int("Executed_log_entries",
|
||||
field_list.push_back(new Item_return_int(thd, "Executed_log_entries",
|
||||
10, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int("Slave_received_heartbeats",
|
||||
field_list.push_back(new Item_return_int(thd, "Slave_received_heartbeats",
|
||||
10, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_float("Slave_heartbeat_period",
|
||||
field_list.push_back(new Item_float(thd, "Slave_heartbeat_period",
|
||||
0.0, 3, 10));
|
||||
field_list.push_back(new Item_empty_string("Gtid_Slave_Pos",
|
||||
field_list.push_back(new Item_empty_string(thd, "Gtid_Slave_Pos",
|
||||
gtid_pos_length));
|
||||
}
|
||||
|
||||
|
@ -2021,7 +2021,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
||||
|
||||
if (spvar->mode == sp_variable::MODE_OUT)
|
||||
{
|
||||
Item_null *null_item= new Item_null();
|
||||
Item_null *null_item= new Item_null(thd);
|
||||
Item *tmp_item= null_item;
|
||||
|
||||
if (!null_item ||
|
||||
@ -2575,8 +2575,8 @@ sp_head::show_create_routine(THD *thd, int type)
|
||||
|
||||
/* Send header. */
|
||||
|
||||
fields.push_back(new Item_empty_string(col1_caption, NAME_CHAR_LEN));
|
||||
fields.push_back(new Item_empty_string("sql_mode", sql_mode.length));
|
||||
fields.push_back(new Item_empty_string(thd, col1_caption, NAME_CHAR_LEN));
|
||||
fields.push_back(new Item_empty_string(thd, "sql_mode", sql_mode.length));
|
||||
|
||||
{
|
||||
/*
|
||||
@ -2585,7 +2585,7 @@ sp_head::show_create_routine(THD *thd, int type)
|
||||
*/
|
||||
|
||||
Item_empty_string *stmt_fld=
|
||||
new Item_empty_string(col3_caption,
|
||||
new Item_empty_string(thd, col3_caption,
|
||||
MY_MAX(m_defstr.length, 1024));
|
||||
|
||||
stmt_fld->maybe_null= TRUE;
|
||||
@ -2593,13 +2593,13 @@ sp_head::show_create_routine(THD *thd, int type)
|
||||
fields.push_back(stmt_fld);
|
||||
}
|
||||
|
||||
fields.push_back(new Item_empty_string("character_set_client",
|
||||
fields.push_back(new Item_empty_string(thd, "character_set_client",
|
||||
MY_CS_NAME_SIZE));
|
||||
|
||||
fields.push_back(new Item_empty_string("collation_connection",
|
||||
fields.push_back(new Item_empty_string(thd, "collation_connection",
|
||||
MY_CS_NAME_SIZE));
|
||||
|
||||
fields.push_back(new Item_empty_string("Database Collation",
|
||||
fields.push_back(new Item_empty_string(thd, "Database Collation",
|
||||
MY_CS_NAME_SIZE));
|
||||
|
||||
if (protocol->send_result_set_metadata(&fields,
|
||||
@ -2783,9 +2783,9 @@ sp_head::show_routine_code(THD *thd)
|
||||
if (check_show_routine_access(thd, this, &full_access) || !full_access)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
field_list.push_back(new Item_uint("Pos", 9));
|
||||
field_list.push_back(new Item_uint(thd, "Pos", 9));
|
||||
// 1024 is for not to confuse old clients
|
||||
field_list.push_back(new Item_empty_string("Instruction",
|
||||
field_list.push_back(new Item_empty_string(thd, "Instruction",
|
||||
MY_MAX(buffer.length(), 1024)));
|
||||
if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS |
|
||||
Protocol::SEND_EOF))
|
||||
@ -3895,7 +3895,7 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp)
|
||||
initialized. Set to NULL so we can continue.
|
||||
*/
|
||||
|
||||
Item *null_item= new Item_null();
|
||||
Item *null_item= new Item_null(thd);
|
||||
|
||||
if (!null_item ||
|
||||
thd->spcont->set_case_expr(thd, m_case_expr_id, &null_item))
|
||||
|
@ -137,7 +137,7 @@ bool sp_rcontext::init_var_items(THD *thd)
|
||||
|
||||
for (uint idx = 0; idx < num_vars; ++idx)
|
||||
{
|
||||
if (!(m_var_items[idx]= new Item_field(m_var_table->field[idx])))
|
||||
if (!(m_var_items[idx]= new Item_field(thd, m_var_table->field[idx])))
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ Item_cache *sp_rcontext::create_case_expr_holder(THD *thd,
|
||||
|
||||
thd->set_n_backup_active_arena(thd->spcont->callers_arena, ¤t_arena);
|
||||
|
||||
holder= Item_cache::get_cache(item);
|
||||
holder= Item_cache::get_cache(thd, item);
|
||||
|
||||
thd->restore_active_arena(thd->spcont->callers_arena, ¤t_arena);
|
||||
|
||||
|
@ -7788,7 +7788,7 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
|
||||
}
|
||||
DBUG_ASSERT(rolename || username);
|
||||
|
||||
Item_string *field=new Item_string_ascii("", 0);
|
||||
Item_string *field=new Item_string_ascii(thd, "", 0);
|
||||
List<Item> field_list;
|
||||
field->name=buff;
|
||||
field->max_length=1024;
|
||||
|
@ -326,13 +326,14 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
DBUG_ENTER("mysql_admin_table");
|
||||
DBUG_PRINT("enter", ("extra_open_options: %u", extra_open_options));
|
||||
|
||||
field_list.push_back(item = new Item_empty_string("Table", NAME_CHAR_LEN*2));
|
||||
field_list.push_back(item = new Item_empty_string(thd, "Table",
|
||||
NAME_CHAR_LEN * 2));
|
||||
item->maybe_null = 1;
|
||||
field_list.push_back(item = new Item_empty_string("Op", 10));
|
||||
field_list.push_back(item = new Item_empty_string(thd, "Op", 10));
|
||||
item->maybe_null = 1;
|
||||
field_list.push_back(item = new Item_empty_string("Msg_type", 10));
|
||||
field_list.push_back(item = new Item_empty_string(thd, "Msg_type", 10));
|
||||
item->maybe_null = 1;
|
||||
field_list.push_back(item = new Item_empty_string("Msg_text",
|
||||
field_list.push_back(item = new Item_empty_string(thd, "Msg_text",
|
||||
SQL_ADMIN_MSG_TEXT_SIZE));
|
||||
item->maybe_null = 1;
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
|
@ -1166,23 +1166,23 @@ int collect_ulonglong(ulonglong *element,
|
||||
} // collect_ulonglong
|
||||
|
||||
|
||||
bool analyse::change_columns(List<Item> &field_list)
|
||||
bool analyse::change_columns(THD *thd, List<Item> &field_list)
|
||||
{
|
||||
field_list.empty();
|
||||
|
||||
func_items[0] = new Item_proc_string("Field_name", 255);
|
||||
func_items[1] = new Item_proc_string("Min_value", 255);
|
||||
func_items[0] = new Item_proc_string(thd, "Field_name", 255);
|
||||
func_items[1] = new Item_proc_string(thd, "Min_value", 255);
|
||||
func_items[1]->maybe_null = 1;
|
||||
func_items[2] = new Item_proc_string("Max_value", 255);
|
||||
func_items[2] = new Item_proc_string(thd, "Max_value", 255);
|
||||
func_items[2]->maybe_null = 1;
|
||||
func_items[3] = new Item_proc_int("Min_length");
|
||||
func_items[4] = new Item_proc_int("Max_length");
|
||||
func_items[5] = new Item_proc_int("Empties_or_zeros");
|
||||
func_items[6] = new Item_proc_int("Nulls");
|
||||
func_items[7] = new Item_proc_string("Avg_value_or_avg_length", 255);
|
||||
func_items[8] = new Item_proc_string("Std", 255);
|
||||
func_items[3] = new Item_proc_int(thd, "Min_length");
|
||||
func_items[4] = new Item_proc_int(thd, "Max_length");
|
||||
func_items[5] = new Item_proc_int(thd, "Empties_or_zeros");
|
||||
func_items[6] = new Item_proc_int(thd, "Nulls");
|
||||
func_items[7] = new Item_proc_string(thd, "Avg_value_or_avg_length", 255);
|
||||
func_items[8] = new Item_proc_string(thd, "Std", 255);
|
||||
func_items[8]->maybe_null = 1;
|
||||
func_items[9] = new Item_proc_string("Optimal_fieldtype",
|
||||
func_items[9] = new Item_proc_string(thd, "Optimal_fieldtype",
|
||||
MY_MAX(64, output_str_length));
|
||||
|
||||
for (uint i = 0; i < array_elements(func_items); i++)
|
||||
|
@ -356,7 +356,7 @@ public:
|
||||
}
|
||||
}
|
||||
virtual void add() {}
|
||||
virtual bool change_columns(List<Item> &fields);
|
||||
virtual bool change_columns(THD *thd, List<Item> &fields);
|
||||
virtual int send_row(List<Item> &field_list);
|
||||
virtual void end_group(void) {}
|
||||
virtual int end_of_records(void);
|
||||
|
@ -7304,7 +7304,7 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2,
|
||||
set_new_item_local_context(thd, item_ident_2, nj_col_2->table_ref))
|
||||
goto err;
|
||||
|
||||
if (!(eq_cond= new Item_func_eq(item_ident_1, item_ident_2)))
|
||||
if (!(eq_cond= new Item_func_eq(thd, item_ident_1, item_ident_2)))
|
||||
goto err; /* Out of memory. */
|
||||
|
||||
if (field_1 && field_1->vcol_info)
|
||||
@ -7317,8 +7317,8 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2,
|
||||
fix_fields() is applied to all ON conditions in setup_conds()
|
||||
so we don't do it here.
|
||||
*/
|
||||
add_join_on((table_ref_1->outer_join & JOIN_TYPE_RIGHT ?
|
||||
table_ref_1 : table_ref_2),
|
||||
add_join_on(thd, (table_ref_1->outer_join & JOIN_TYPE_RIGHT ?
|
||||
table_ref_1 : table_ref_2),
|
||||
eq_cond);
|
||||
|
||||
nj_col_1->is_common= nj_col_2->is_common= TRUE;
|
||||
@ -7651,7 +7651,7 @@ store_top_level_join_columns(THD *thd, TABLE_LIST *table_ref,
|
||||
/* Add a TRUE condition to outer joins that have no common columns. */
|
||||
if (table_ref_2->outer_join &&
|
||||
!table_ref_1->on_expr && !table_ref_2->on_expr)
|
||||
table_ref_2->on_expr= new Item_int((longlong) 1,1); /* Always true. */
|
||||
table_ref_2->on_expr= new Item_int(thd, (longlong) 1, 1); // Always true.
|
||||
|
||||
/* Change this table reference to become a leaf for name resolution. */
|
||||
if (left_neighbor)
|
||||
@ -7816,7 +7816,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
|
||||
|
||||
Item_int do not need fix_fields() because it is basic constant.
|
||||
*/
|
||||
it.replace(new Item_int("Not_used", (longlong) 1,
|
||||
it.replace(new Item_int(thd, "Not_used", (longlong) 1,
|
||||
MY_INT64_NUM_DECIMAL_DIGITS));
|
||||
}
|
||||
else if (insert_fields(thd, ((Item_field*) item)->context,
|
||||
@ -8510,7 +8510,7 @@ void wrap_ident(THD *thd, Item **conds)
|
||||
DBUG_ASSERT((*conds)->type() == Item::FIELD_ITEM || (*conds)->type() == Item::REF_ITEM);
|
||||
Query_arena *arena, backup;
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
if ((wrapper= new Item_direct_ref_to_ident((Item_ident *)(*conds))))
|
||||
if ((wrapper= new Item_direct_ref_to_ident(thd, (Item_ident *) (*conds))))
|
||||
(*conds)= (Item*) wrapper;
|
||||
if (arena)
|
||||
thd->restore_active_arena(arena, &backup);
|
||||
@ -9176,7 +9176,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order)
|
||||
DBUG_PRINT("info",("Performing FULLTEXT search"));
|
||||
|
||||
while ((ifm=li++))
|
||||
ifm->init_search(no_order);
|
||||
ifm->init_search(thd, no_order);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -2456,7 +2456,7 @@ int THD::send_explain_fields(select_result *result, uint8 explain_flags, bool is
|
||||
|
||||
void THD::make_explain_json_field_list(List<Item> &field_list, bool is_analyze)
|
||||
{
|
||||
Item *item= new Item_empty_string((is_analyze ?
|
||||
Item *item= new Item_empty_string(this, (is_analyze ?
|
||||
"ANALYZE" :
|
||||
"EXPLAIN"),
|
||||
78, system_charset_info);
|
||||
@ -2477,55 +2477,59 @@ void THD::make_explain_field_list(List<Item> &field_list, uint8 explain_flags,
|
||||
{
|
||||
Item *item;
|
||||
CHARSET_INFO *cs= system_charset_info;
|
||||
field_list.push_back(item= new Item_return_int("id",3, MYSQL_TYPE_LONGLONG));
|
||||
field_list.push_back(item= new Item_return_int(this, "id", 3,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
item->maybe_null= 1;
|
||||
field_list.push_back(new Item_empty_string("select_type", 19, cs));
|
||||
field_list.push_back(item= new Item_empty_string("table", NAME_CHAR_LEN, cs));
|
||||
field_list.push_back(new Item_empty_string(this, "select_type", 19, cs));
|
||||
field_list.push_back(item= new Item_empty_string(this, "table", NAME_CHAR_LEN,
|
||||
cs));
|
||||
item->maybe_null= 1;
|
||||
if (explain_flags & DESCRIBE_PARTITIONS)
|
||||
{
|
||||
/* Maximum length of string that make_used_partitions_str() can produce */
|
||||
item= new Item_empty_string("partitions", MAX_PARTITIONS * (1 + FN_LEN),
|
||||
cs);
|
||||
item= new Item_empty_string(this, "partitions",
|
||||
MAX_PARTITIONS * (1 + FN_LEN), cs);
|
||||
field_list.push_back(item);
|
||||
item->maybe_null= 1;
|
||||
}
|
||||
field_list.push_back(item= new Item_empty_string("type", 10, cs));
|
||||
field_list.push_back(item= new Item_empty_string(this, "type", 10, cs));
|
||||
item->maybe_null= 1;
|
||||
field_list.push_back(item=new Item_empty_string("possible_keys",
|
||||
field_list.push_back(item=new Item_empty_string(this, "possible_keys",
|
||||
NAME_CHAR_LEN*MAX_KEY, cs));
|
||||
item->maybe_null=1;
|
||||
field_list.push_back(item=new Item_empty_string("key", NAME_CHAR_LEN, cs));
|
||||
field_list.push_back(item=new Item_empty_string(this, "key", NAME_CHAR_LEN,
|
||||
cs));
|
||||
item->maybe_null=1;
|
||||
field_list.push_back(item=new Item_empty_string("key_len",
|
||||
field_list.push_back(item=new Item_empty_string(this, "key_len",
|
||||
NAME_CHAR_LEN*MAX_KEY));
|
||||
item->maybe_null=1;
|
||||
field_list.push_back(item=new Item_empty_string("ref",
|
||||
field_list.push_back(item=new Item_empty_string(this, "ref",
|
||||
NAME_CHAR_LEN*MAX_REF_PARTS,
|
||||
cs));
|
||||
item->maybe_null=1;
|
||||
field_list.push_back(item= new Item_return_int("rows", 10,
|
||||
field_list.push_back(item= new Item_return_int(this, "rows", 10,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
if (is_analyze)
|
||||
{
|
||||
field_list.push_back(item= new Item_float("r_rows", 0.1234, 10, 4));
|
||||
field_list.push_back(item= new Item_float(this, "r_rows", 0.1234, 10, 4));
|
||||
item->maybe_null=1;
|
||||
}
|
||||
|
||||
if (is_analyze || (explain_flags & DESCRIBE_EXTENDED))
|
||||
{
|
||||
field_list.push_back(item= new Item_float("filtered", 0.1234, 2, 4));
|
||||
field_list.push_back(item= new Item_float(this, "filtered", 0.1234, 2, 4));
|
||||
item->maybe_null=1;
|
||||
}
|
||||
|
||||
if (is_analyze)
|
||||
{
|
||||
field_list.push_back(item= new Item_float("r_filtered", 0.1234, 2, 4));
|
||||
field_list.push_back(item= new Item_float(this, "r_filtered", 0.1234, 2,
|
||||
4));
|
||||
item->maybe_null=1;
|
||||
}
|
||||
|
||||
item->maybe_null= 1;
|
||||
field_list.push_back(new Item_empty_string("Extra", 255, cs));
|
||||
field_list.push_back(new Item_empty_string(this, "Extra", 255, cs));
|
||||
}
|
||||
|
||||
|
||||
@ -3346,7 +3350,7 @@ int select_max_min_finder_subselect::send_data(List<Item> &items)
|
||||
{
|
||||
if (!cache)
|
||||
{
|
||||
cache= Item_cache::get_cache(val_item);
|
||||
cache= Item_cache::get_cache(thd, val_item);
|
||||
switch (val_item->result_type()) {
|
||||
case REAL_RESULT:
|
||||
op= &select_max_min_finder_subselect::cmp_real;
|
||||
@ -3803,7 +3807,7 @@ Statement_map::~Statement_map()
|
||||
|
||||
bool my_var_user::set(THD *thd, Item *item)
|
||||
{
|
||||
Item_func_set_user_var *suv= new Item_func_set_user_var(name, item);
|
||||
Item_func_set_user_var *suv= new Item_func_set_user_var(thd, name, item);
|
||||
suv->save_item_result(item);
|
||||
return suv->fix_fields(thd, 0) || suv->update();
|
||||
}
|
||||
|
@ -4088,6 +4088,8 @@ class JOIN;
|
||||
class select_result_sink: public Sql_alloc
|
||||
{
|
||||
public:
|
||||
THD *thd;
|
||||
select_result_sink(THD *thd_arg): thd(thd_arg) {}
|
||||
/*
|
||||
send_data returns 0 on ok, 1 on error and -1 if data was ignored, for
|
||||
example for a duplicate row entry written to a temp table.
|
||||
@ -4112,7 +4114,6 @@ public:
|
||||
class select_result :public select_result_sink
|
||||
{
|
||||
protected:
|
||||
THD *thd;
|
||||
/*
|
||||
All descendant classes have their send_data() skip the first
|
||||
unit->offset_limit_cnt rows sent. Select_materialize
|
||||
@ -4121,7 +4122,7 @@ protected:
|
||||
SELECT_LEX_UNIT *unit;
|
||||
/* Something used only by the parser: */
|
||||
public:
|
||||
select_result(THD *thd_arg): thd(thd_arg) {}
|
||||
select_result(THD *thd_arg): select_result_sink(thd_arg) {}
|
||||
virtual ~select_result() {};
|
||||
/**
|
||||
Change wrapped select_result.
|
||||
@ -4208,9 +4209,8 @@ class select_result_explain_buffer : public select_result_sink
|
||||
{
|
||||
public:
|
||||
select_result_explain_buffer(THD *thd_arg, TABLE *table_arg) :
|
||||
thd(thd_arg), dst_table(table_arg) {};
|
||||
select_result_sink(thd_arg), dst_table(table_arg) {};
|
||||
|
||||
THD *thd;
|
||||
TABLE *dst_table; /* table to write into */
|
||||
|
||||
/* The following is called in the child thread: */
|
||||
@ -4227,7 +4227,7 @@ public:
|
||||
class select_result_text_buffer : public select_result_sink
|
||||
{
|
||||
public:
|
||||
select_result_text_buffer(THD *thd_arg) : thd(thd_arg) {}
|
||||
select_result_text_buffer(THD *thd_arg): select_result_sink(thd_arg) {}
|
||||
int send_data(List<Item> &items);
|
||||
bool send_result_set_metadata(List<Item> &fields, uint flag);
|
||||
|
||||
@ -4235,7 +4235,6 @@ public:
|
||||
private:
|
||||
int append_row(List<Item> &items, bool send_names);
|
||||
|
||||
THD *thd;
|
||||
List<char*> rows;
|
||||
int n_columns;
|
||||
};
|
||||
|
@ -446,7 +446,7 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
if (derived->get_unit()->prepared)
|
||||
{
|
||||
Item *expr= derived->on_expr;
|
||||
expr= and_conds(expr, dt_select->join ? dt_select->join->conds : 0);
|
||||
expr= and_conds(thd, expr, dt_select->join ? dt_select->join->conds : 0);
|
||||
if (expr && (derived->prep_on_expr || expr != derived->on_expr))
|
||||
{
|
||||
derived->on_expr= expr;
|
||||
|
@ -818,9 +818,10 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
|
||||
|
||||
DBUG_ASSERT(thd->get_stmt_da()->is_warning_info_read_only());
|
||||
|
||||
field_list.push_back(new Item_empty_string("Level", 7));
|
||||
field_list.push_back(new Item_return_int("Code",4, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string("Message",MYSQL_ERRMSG_SIZE));
|
||||
field_list.push_back(new Item_empty_string(thd, "Level", 7));
|
||||
field_list.push_back(new Item_return_int(thd, "Code", 4, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string(thd, "Message",
|
||||
MYSQL_ERRMSG_SIZE));
|
||||
|
||||
if (thd->protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
|
@ -227,7 +227,8 @@ void Explain_query::print_explain_json(select_result_sink *output, bool is_analy
|
||||
CHARSET_INFO *cs= system_charset_info;
|
||||
List<Item> item_list;
|
||||
String *buf= &writer.output;
|
||||
item_list.push_back(new Item_string(buf->ptr(), buf->length(), cs));
|
||||
item_list.push_back(new Item_string(output->thd, buf->ptr(), buf->length(),
|
||||
cs));
|
||||
output->send_data(item_list);
|
||||
}
|
||||
|
||||
@ -257,19 +258,19 @@ bool Explain_query::print_explain_str(THD *thd, String *out_str,
|
||||
}
|
||||
|
||||
|
||||
static void push_str(List<Item> *item_list, const char *str)
|
||||
static void push_str(THD *thd, List<Item> *item_list, const char *str)
|
||||
{
|
||||
item_list->push_back(new Item_string_sys(str));
|
||||
item_list->push_back(new Item_string_sys(thd, str));
|
||||
}
|
||||
|
||||
|
||||
static void push_string(List<Item> *item_list, String *str)
|
||||
static void push_string(THD *thd, List<Item> *item_list, String *str)
|
||||
{
|
||||
item_list->push_back(new Item_string_sys(str->ptr(), str->length()));
|
||||
item_list->push_back(new Item_string_sys(thd, str->ptr(), str->length()));
|
||||
}
|
||||
|
||||
static void push_string_list(List<Item> *item_list, String_list &lines,
|
||||
String *buf)
|
||||
static void push_string_list(THD *thd, List<Item> *item_list,
|
||||
String_list &lines, String *buf)
|
||||
{
|
||||
List_iterator_fast<char> it(lines);
|
||||
char *line;
|
||||
@ -283,7 +284,7 @@ static void push_string_list(List<Item> *item_list, String_list &lines,
|
||||
|
||||
buf->append(line);
|
||||
}
|
||||
push_string(item_list, buf);
|
||||
push_string(thd, item_list, buf);
|
||||
}
|
||||
|
||||
|
||||
@ -316,51 +317,52 @@ int print_explain_row(select_result_sink *result,
|
||||
double r_filtered,
|
||||
const char *extra)
|
||||
{
|
||||
Item *item_null= new Item_null();
|
||||
THD *thd= result->thd;
|
||||
Item *item_null= new Item_null(thd);
|
||||
List<Item> item_list;
|
||||
Item *item;
|
||||
|
||||
item_list.push_back(new Item_int((int32) select_number));
|
||||
item_list.push_back(new Item_string_sys(select_type));
|
||||
item_list.push_back(new Item_string_sys(table_name));
|
||||
item_list.push_back(new Item_int(thd, (int32) select_number));
|
||||
item_list.push_back(new Item_string_sys(thd, select_type));
|
||||
item_list.push_back(new Item_string_sys(thd, table_name));
|
||||
if (options & DESCRIBE_PARTITIONS)
|
||||
{
|
||||
if (partitions)
|
||||
{
|
||||
item_list.push_back(new Item_string_sys(partitions));
|
||||
item_list.push_back(new Item_string_sys(thd, partitions));
|
||||
}
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
}
|
||||
|
||||
const char *jtype_str= join_type_str[jtype];
|
||||
item_list.push_back(new Item_string_sys(jtype_str));
|
||||
item_list.push_back(new Item_string_sys(thd, jtype_str));
|
||||
|
||||
/* 'possible_keys' */
|
||||
if (possible_keys && !possible_keys->is_empty())
|
||||
{
|
||||
StringBuffer<64> possible_keys_buf;
|
||||
push_string_list(&item_list, *possible_keys, &possible_keys_buf);
|
||||
push_string_list(thd, &item_list, *possible_keys, &possible_keys_buf);
|
||||
}
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
|
||||
/* 'index */
|
||||
item= index ? new Item_string_sys(index) : item_null;
|
||||
item= index ? new Item_string_sys(thd, index) : item_null;
|
||||
item_list.push_back(item);
|
||||
|
||||
/* 'key_len */
|
||||
item= key_len ? new Item_string_sys(key_len) : item_null;
|
||||
item= key_len ? new Item_string_sys(thd, key_len) : item_null;
|
||||
item_list.push_back(item);
|
||||
|
||||
/* 'ref' */
|
||||
item= ref ? new Item_string_sys(ref) : item_null;
|
||||
item= ref ? new Item_string_sys(thd, ref) : item_null;
|
||||
item_list.push_back(item);
|
||||
|
||||
/* 'rows' */
|
||||
if (rows)
|
||||
{
|
||||
item_list.push_back(new Item_int(*rows,
|
||||
item_list.push_back(new Item_int(thd, *rows,
|
||||
MY_INT64_NUM_DECIMAL_DIGITS));
|
||||
}
|
||||
else
|
||||
@ -370,7 +372,7 @@ int print_explain_row(select_result_sink *result,
|
||||
if (is_analyze)
|
||||
{
|
||||
if (r_rows)
|
||||
item_list.push_back(new Item_float(*r_rows, 2));
|
||||
item_list.push_back(new Item_float(thd, *r_rows, 2));
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
}
|
||||
@ -378,15 +380,15 @@ int print_explain_row(select_result_sink *result,
|
||||
/* 'filtered' */
|
||||
const double filtered=100.0;
|
||||
if (options & DESCRIBE_EXTENDED || is_analyze)
|
||||
item_list.push_back(new Item_float(filtered, 2));
|
||||
item_list.push_back(new Item_float(thd, filtered, 2));
|
||||
|
||||
/* 'r_filtered' */
|
||||
if (is_analyze)
|
||||
item_list.push_back(new Item_float(r_filtered, 2));
|
||||
item_list.push_back(new Item_float(thd, r_filtered, 2));
|
||||
|
||||
/* 'Extra' */
|
||||
if (extra)
|
||||
item_list.push_back(new Item_string_sys(extra));
|
||||
item_list.push_back(new Item_string_sys(thd, extra));
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
|
||||
@ -431,6 +433,7 @@ int Explain_union::print_explain(Explain_query *query,
|
||||
uint8 explain_flags,
|
||||
bool is_analyze)
|
||||
{
|
||||
THD *thd= output->thd;
|
||||
//CHARSET_INFO *cs= system_charset_info;
|
||||
char table_name_buffer[SAFE_NAME_LEN];
|
||||
|
||||
@ -446,24 +449,24 @@ int Explain_union::print_explain(Explain_query *query,
|
||||
|
||||
/* Print a line with "UNION RESULT" */
|
||||
List<Item> item_list;
|
||||
Item *item_null= new Item_null();
|
||||
Item *item_null= new Item_null(thd);
|
||||
|
||||
/* `id` column */
|
||||
item_list.push_back(item_null);
|
||||
|
||||
/* `select_type` column */
|
||||
push_str(&item_list, fake_select_type);
|
||||
push_str(thd, &item_list, fake_select_type);
|
||||
|
||||
/* `table` column: something like "<union1,2>" */
|
||||
uint len= make_union_table_name(table_name_buffer);
|
||||
item_list.push_back(new Item_string_sys(table_name_buffer, len));
|
||||
item_list.push_back(new Item_string_sys(thd, table_name_buffer, len));
|
||||
|
||||
/* `partitions` column */
|
||||
if (explain_flags & DESCRIBE_PARTITIONS)
|
||||
item_list.push_back(item_null);
|
||||
|
||||
/* `type` column */
|
||||
push_str(&item_list, join_type_str[JT_ALL]);
|
||||
push_str(thd, &item_list, join_type_str[JT_ALL]);
|
||||
|
||||
/* `possible_keys` column */
|
||||
item_list.push_back(item_null);
|
||||
@ -484,7 +487,7 @@ int Explain_union::print_explain(Explain_query *query,
|
||||
if (is_analyze)
|
||||
{
|
||||
double avg_rows= fake_select_lex_tracker.get_avg_rows();
|
||||
item_list.push_back(new Item_float(avg_rows, 2));
|
||||
item_list.push_back(new Item_float(thd, avg_rows, 2));
|
||||
}
|
||||
|
||||
/* `filtered` */
|
||||
@ -501,7 +504,8 @@ int Explain_union::print_explain(Explain_query *query,
|
||||
{
|
||||
extra_buf.append(STRING_WITH_LEN("Using filesort"));
|
||||
}
|
||||
item_list.push_back(new Item_string_sys(extra_buf.ptr(), extra_buf.length()));
|
||||
item_list.push_back(new Item_string_sys(thd, extra_buf.ptr(),
|
||||
extra_buf.length()));
|
||||
|
||||
//output->unit.offset_limit_cnt= 0;
|
||||
if (output->send_data(item_list))
|
||||
@ -696,13 +700,14 @@ int Explain_select::print_explain(Explain_query *query,
|
||||
select_result_sink *output,
|
||||
uint8 explain_flags, bool is_analyze)
|
||||
{
|
||||
THD *thd= output->thd;
|
||||
if (message)
|
||||
{
|
||||
List<Item> item_list;
|
||||
Item *item_null= new Item_null();
|
||||
Item *item_null= new Item_null(thd);
|
||||
|
||||
item_list.push_back(new Item_int((int32) select_id));
|
||||
item_list.push_back(new Item_string_sys(select_type));
|
||||
item_list.push_back(new Item_int(thd, (int32) select_id));
|
||||
item_list.push_back(new Item_string_sys(thd, select_type));
|
||||
for (uint i=0 ; i < 7; i++)
|
||||
item_list.push_back(item_null);
|
||||
if (explain_flags & DESCRIBE_PARTITIONS)
|
||||
@ -719,7 +724,7 @@ int Explain_select::print_explain(Explain_query *query,
|
||||
item_list.push_back(item_null);
|
||||
}
|
||||
|
||||
item_list.push_back(new Item_string_sys(message));
|
||||
item_list.push_back(new Item_string_sys(thd, message));
|
||||
|
||||
if (output->send_data(item_list))
|
||||
return 1;
|
||||
@ -1106,47 +1111,48 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
||||
uint select_id, const char *select_type,
|
||||
bool using_temporary, bool using_filesort)
|
||||
{
|
||||
THD *thd= output->thd;
|
||||
//CHARSET_INFO *cs= system_charset_info;
|
||||
|
||||
List<Item> item_list;
|
||||
Item *item_null= new Item_null();
|
||||
Item *item_null= new Item_null(thd);
|
||||
|
||||
/* `id` column */
|
||||
item_list.push_back(new Item_int((int32) select_id));
|
||||
item_list.push_back(new Item_int(thd, (int32) select_id));
|
||||
|
||||
/* `select_type` column */
|
||||
push_str(&item_list, select_type);
|
||||
push_str(thd, &item_list, select_type);
|
||||
|
||||
/* `table` column */
|
||||
push_string(&item_list, &table_name);
|
||||
push_string(thd, &item_list, &table_name);
|
||||
|
||||
/* `partitions` column */
|
||||
if (explain_flags & DESCRIBE_PARTITIONS)
|
||||
{
|
||||
if (used_partitions_set)
|
||||
{
|
||||
push_string(&item_list, &used_partitions);
|
||||
push_string(thd, &item_list, &used_partitions);
|
||||
}
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
}
|
||||
|
||||
/* `type` column */
|
||||
push_str(&item_list, join_type_str[type]);
|
||||
push_str(thd, &item_list, join_type_str[type]);
|
||||
|
||||
/* `possible_keys` column */
|
||||
StringBuffer<64> possible_keys_buf;
|
||||
if (possible_keys.is_empty())
|
||||
item_list.push_back(item_null);
|
||||
else
|
||||
push_string_list(&item_list, possible_keys, &possible_keys_buf);
|
||||
push_string_list(thd, &item_list, possible_keys, &possible_keys_buf);
|
||||
|
||||
/* `key` */
|
||||
StringBuffer<64> key_str;
|
||||
fill_key_str(&key_str, false);
|
||||
|
||||
if (key_str.length() > 0)
|
||||
push_string(&item_list, &key_str);
|
||||
push_string(thd, &item_list, &key_str);
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
|
||||
@ -1155,7 +1161,7 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
||||
fill_key_len_str(&key_len_str);
|
||||
|
||||
if (key_len_str.length() > 0)
|
||||
push_string(&item_list, &key_len_str);
|
||||
push_string(thd, &item_list, &key_len_str);
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
|
||||
@ -1166,18 +1172,18 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
||||
if (type == JT_FT)
|
||||
{
|
||||
/* Traditionally, EXPLAIN lines with type=fulltext have ref='' */
|
||||
push_str(&item_list, "");
|
||||
push_str(thd, &item_list, "");
|
||||
}
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
}
|
||||
else
|
||||
push_string_list(&item_list, ref_list, &ref_list_buf);
|
||||
push_string_list(thd, &item_list, ref_list, &ref_list_buf);
|
||||
|
||||
/* `rows` */
|
||||
if (rows_set)
|
||||
{
|
||||
item_list.push_back(new Item_int((longlong) (ulonglong) rows,
|
||||
item_list.push_back(new Item_int(thd, (longlong) (ulonglong) rows,
|
||||
MY_INT64_NUM_DECIMAL_DIGITS));
|
||||
}
|
||||
else
|
||||
@ -1193,7 +1199,7 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
||||
else
|
||||
{
|
||||
double avg_rows= tracker.get_avg_rows();
|
||||
item_list.push_back(new Item_float(avg_rows, 2));
|
||||
item_list.push_back(new Item_float(thd, avg_rows, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1202,7 +1208,7 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
||||
{
|
||||
if (filtered_set)
|
||||
{
|
||||
item_list.push_back(new Item_float(filtered, 2));
|
||||
item_list.push_back(new Item_float(thd, filtered, 2));
|
||||
}
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
@ -1220,7 +1226,7 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
||||
double r_filtered= tracker.get_filtered_after_where();
|
||||
if (bka_type.is_using_jbuf())
|
||||
r_filtered *= jbuf_tracker.get_filtered_after_where();
|
||||
item_list.push_back(new Item_float(r_filtered*100.0, 2));
|
||||
item_list.push_back(new Item_float(thd, r_filtered * 100.0, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1254,7 +1260,8 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
||||
extra_buf.append(STRING_WITH_LEN("Using filesort"));
|
||||
}
|
||||
|
||||
item_list.push_back(new Item_string_sys(extra_buf.ptr(), extra_buf.length()));
|
||||
item_list.push_back(new Item_string_sys(thd, extra_buf.ptr(),
|
||||
extra_buf.length()));
|
||||
|
||||
if (output->send_data(item_list))
|
||||
return 1;
|
||||
|
@ -161,7 +161,7 @@ void Expression_cache_tmptable::init()
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(cached_result= new Item_field(cache_table->field[0])))
|
||||
if (!(cached_result= new Item_field(table_thd, cache_table->field[0])))
|
||||
{
|
||||
DBUG_PRINT("error", ("Creating Item_field failed"));
|
||||
goto error;
|
||||
|
@ -174,7 +174,7 @@ Statement_information_item::get_value(THD *thd, const Diagnostics_area *da)
|
||||
case NUMBER:
|
||||
{
|
||||
ulong count= da->cond_count();
|
||||
value= new (thd->mem_root) Item_uint(count);
|
||||
value= new (thd->mem_root) Item_uint(thd, count);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
@ -183,7 +183,7 @@ Statement_information_item::get_value(THD *thd, const Diagnostics_area *da)
|
||||
REPLACE, LOAD).
|
||||
*/
|
||||
case ROW_COUNT:
|
||||
value= new (thd->mem_root) Item_int(thd->get_row_count_func());
|
||||
value= new (thd->mem_root) Item_int(thd, thd->get_row_count_func());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ Condition_information_item::make_utf8_string_item(THD *thd, const String *str)
|
||||
String tmp(str->ptr(), str->length(), from_cs);
|
||||
/* If necessary, convert the string (ignoring errors), then copy it over. */
|
||||
uint conv_errors;
|
||||
return new Item_string(&tmp, to_cs, &conv_errors,
|
||||
return new Item_string(thd, &tmp, to_cs, &conv_errors,
|
||||
DERIVATION_COERCIBLE, MY_REPERTOIRE_UNICODE30);
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ Condition_information_item::get_value(THD *thd, const Sql_condition *cond)
|
||||
value= make_utf8_string_item(thd, &(cond->m_message_text));
|
||||
break;
|
||||
case MYSQL_ERRNO:
|
||||
value= new (thd->mem_root) Item_uint(cond->m_sql_errno);
|
||||
value= new (thd->mem_root) Item_uint(thd, cond->m_sql_errno);
|
||||
break;
|
||||
case RETURNED_SQLSTATE:
|
||||
str.set_ascii(cond->get_sqlstate(), strlen(cond->get_sqlstate()));
|
||||
|
@ -449,11 +449,12 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname,
|
||||
|
||||
int send_answer_1(Protocol *protocol, String *s1, String *s2, String *s3)
|
||||
{
|
||||
THD *thd= protocol->thd;
|
||||
DBUG_ENTER("send_answer_1");
|
||||
List<Item> field_list;
|
||||
field_list.push_back(new Item_empty_string("name",64));
|
||||
field_list.push_back(new Item_empty_string("description",1000));
|
||||
field_list.push_back(new Item_empty_string("example",1000));
|
||||
field_list.push_back(new Item_empty_string(thd, "name", 64));
|
||||
field_list.push_back(new Item_empty_string(thd, "description", 1000));
|
||||
field_list.push_back(new Item_empty_string(thd, "example", 1000));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
@ -492,12 +493,14 @@ int send_answer_1(Protocol *protocol, String *s1, String *s2, String *s3)
|
||||
|
||||
int send_header_2(Protocol *protocol, bool for_category)
|
||||
{
|
||||
THD *thd= protocol->thd;
|
||||
DBUG_ENTER("send_header_2");
|
||||
List<Item> field_list;
|
||||
if (for_category)
|
||||
field_list.push_back(new Item_empty_string("source_category_name",64));
|
||||
field_list.push_back(new Item_empty_string("name",64));
|
||||
field_list.push_back(new Item_empty_string("is_it_category",1));
|
||||
field_list.push_back(new Item_empty_string(thd, "source_category_name",
|
||||
64));
|
||||
field_list.push_back(new Item_empty_string(thd, "name", 64));
|
||||
field_list.push_back(new Item_empty_string(thd, "is_it_category", 1));
|
||||
DBUG_RETURN(protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS |
|
||||
Protocol::SEND_EOF));
|
||||
}
|
||||
@ -625,9 +628,10 @@ SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, uint mlen,
|
||||
TABLE_LIST *tables, TABLE *table,
|
||||
Field *pfname, int *error)
|
||||
{
|
||||
Item *cond= new Item_func_like(new Item_field(pfname),
|
||||
new Item_string(mask,mlen,pfname->charset()),
|
||||
new Item_string_ascii("\\"),
|
||||
Item *cond= new Item_func_like(thd, new Item_field(thd, pfname),
|
||||
new Item_string(thd, mask, mlen,
|
||||
pfname->charset()),
|
||||
new Item_string_ascii(thd, "\\"),
|
||||
FALSE);
|
||||
if (thd->is_fatal_error)
|
||||
return 0; // OOM
|
||||
@ -763,11 +767,11 @@ bool mysqld_help(THD *thd, const char *mask)
|
||||
{
|
||||
Field *topic_cat_id= used_fields[help_topic_help_category_id].field;
|
||||
Item *cond_topic_by_cat=
|
||||
new Item_func_equal(new Item_field(topic_cat_id),
|
||||
new Item_int((int32)category_id));
|
||||
new Item_func_equal(thd, new Item_field(thd, topic_cat_id),
|
||||
new Item_int(thd, (int32) category_id));
|
||||
Item *cond_cat_by_cat=
|
||||
new Item_func_equal(new Item_field(cat_cat_id),
|
||||
new Item_int((int32)category_id));
|
||||
new Item_func_equal(thd, new Item_field(thd, cat_cat_id),
|
||||
new Item_int(thd, (int32) category_id));
|
||||
if (!(select= prepare_simple_select(thd, cond_topic_by_cat,
|
||||
tables[0].table, &error)))
|
||||
goto error;
|
||||
|
@ -3482,7 +3482,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
||||
|
||||
while ((item= li++))
|
||||
{
|
||||
item->transform(&Item::update_value_transformer,
|
||||
item->transform(thd, &Item::update_value_transformer,
|
||||
(uchar*)lex->current_select);
|
||||
}
|
||||
}
|
||||
@ -3950,9 +3950,10 @@ static TABLE *create_table_from_items(THD *thd,
|
||||
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
|
||||
0);
|
||||
if (!field ||
|
||||
!(cr_field=new Create_field(field,(item->type() == Item::FIELD_ITEM ?
|
||||
((Item_field *)item)->field :
|
||||
(Field*) 0))))
|
||||
!(cr_field=new Create_field(thd, field,
|
||||
(item->type() == Item::FIELD_ITEM ?
|
||||
((Item_field *) item)->field :
|
||||
(Field *) 0))))
|
||||
DBUG_RETURN(0);
|
||||
if (item->maybe_null)
|
||||
cr_field->flags &= ~NOT_NULL_FLAG;
|
||||
|
@ -2685,7 +2685,7 @@ mysql_execute_command(THD *thd)
|
||||
goto error;
|
||||
}
|
||||
if (v->var->session_is_default(thd))
|
||||
o= new set_var(v->type, v->var, &v->base, NULL);
|
||||
o= new set_var(thd,v->type, v->var, &v->base, NULL);
|
||||
else
|
||||
{
|
||||
switch (v->var->option.var_type & GET_TYPE_MASK)
|
||||
@ -2697,10 +2697,10 @@ mysql_execute_command(THD *thd)
|
||||
{
|
||||
bool null_value;
|
||||
longlong val= v->var->val_int(&null_value, thd, v->type, &v->base);
|
||||
o= new set_var(v->type, v->var, &v->base,
|
||||
o= new set_var(thd, v->type, v->var, &v->base,
|
||||
(null_value ?
|
||||
(Item *)new Item_null() :
|
||||
(Item *)new Item_int(val)));
|
||||
(Item *) new Item_null(thd) :
|
||||
(Item *) new Item_int(thd, val)));
|
||||
}
|
||||
break;
|
||||
case GET_UINT:
|
||||
@ -2709,20 +2709,20 @@ mysql_execute_command(THD *thd)
|
||||
{
|
||||
bool null_value;
|
||||
ulonglong val= v->var->val_int(&null_value, thd, v->type, &v->base);
|
||||
o= new set_var(v->type, v->var, &v->base,
|
||||
o= new set_var(thd, v->type, v->var, &v->base,
|
||||
(null_value ?
|
||||
(Item *)new Item_null() :
|
||||
(Item *)new Item_uint(val)));
|
||||
(Item *) new Item_null(thd) :
|
||||
(Item *) new Item_uint(thd, val)));
|
||||
}
|
||||
break;
|
||||
case GET_DOUBLE:
|
||||
{
|
||||
bool null_value;
|
||||
double val= v->var->val_real(&null_value, thd, v->type, &v->base);
|
||||
o= new set_var(v->type, v->var, &v->base,
|
||||
o= new set_var(thd, v->type, v->var, &v->base,
|
||||
(null_value ?
|
||||
(Item *)new Item_null() :
|
||||
(Item *)new Item_float(val, 1)));
|
||||
(Item *) new Item_null(thd) :
|
||||
(Item *) new Item_float(thd, val, 1)));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -2741,12 +2741,13 @@ mysql_execute_command(THD *thd)
|
||||
val= v->var->val_str(&tmp, thd, v->type, &v->base);
|
||||
if (val)
|
||||
{
|
||||
Item_string *str= new Item_string(v->var->charset(thd),
|
||||
Item_string *str= new Item_string(thd, v->var->charset(thd),
|
||||
val->ptr(), val->length());
|
||||
o= new set_var(v->type, v->var, &v->base, str);
|
||||
o= new set_var(thd, v->type, v->var, &v->base, str);
|
||||
}
|
||||
else
|
||||
o= new set_var(v->type, v->var, &v->base, new Item_null());
|
||||
o= new set_var(thd, v->type, v->var, &v->base,
|
||||
new Item_null(thd));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3002,7 +3003,7 @@ mysql_execute_command(THD *thd)
|
||||
my_error(ER_WRONG_ARGUMENTS, MYF(0), "PURGE LOGS BEFORE");
|
||||
goto error;
|
||||
}
|
||||
it= new Item_func_unix_timestamp(it);
|
||||
it= new Item_func_unix_timestamp(thd, it);
|
||||
it->fix_fields(thd, &it);
|
||||
res = purge_master_logs_before_date(thd, (ulong)it->val_int());
|
||||
break;
|
||||
@ -4087,7 +4088,7 @@ end_with_restore_list:
|
||||
/* condition will be TRUE on SP re-excuting */
|
||||
if (select_lex->item_list.elements != 0)
|
||||
select_lex->item_list.empty();
|
||||
if (add_item_to_list(thd, new Item_null()))
|
||||
if (add_item_to_list(thd, new Item_null(thd)))
|
||||
goto error;
|
||||
|
||||
THD_STAGE_INFO(thd, stage_init);
|
||||
@ -5745,7 +5746,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
|
||||
SELECT_LEX *param= lex->unit.global_parameters();
|
||||
if (!param->explicit_limit)
|
||||
param->select_limit=
|
||||
new (thd->mem_root) Item_int((ulonglong) thd->variables.select_limit);
|
||||
new (thd->mem_root) Item_int(thd,
|
||||
(ulonglong) thd->variables.select_limit);
|
||||
}
|
||||
if (!(res= open_and_lock_tables(thd, all_tables, TRUE, 0)))
|
||||
{
|
||||
@ -7867,14 +7869,14 @@ push_new_name_resolution_context(THD *thd,
|
||||
@return fixed condition
|
||||
*/
|
||||
|
||||
Item *normalize_cond(Item *cond)
|
||||
Item *normalize_cond(THD *thd, Item *cond)
|
||||
{
|
||||
if (cond)
|
||||
{
|
||||
Item::Type type= cond->type();
|
||||
if (type == Item::FIELD_ITEM || type == Item::REF_ITEM)
|
||||
{
|
||||
cond= new Item_func_ne(cond, new Item_int(0));
|
||||
cond= new Item_func_ne(thd, cond, new Item_int(thd, 0));
|
||||
}
|
||||
}
|
||||
return cond;
|
||||
@ -7895,11 +7897,11 @@ Item *normalize_cond(Item *cond)
|
||||
TRUE if all is OK
|
||||
*/
|
||||
|
||||
void add_join_on(TABLE_LIST *b, Item *expr)
|
||||
void add_join_on(THD *thd, TABLE_LIST *b, Item *expr)
|
||||
{
|
||||
if (expr)
|
||||
{
|
||||
expr= normalize_cond(expr);
|
||||
expr= normalize_cond(thd, expr);
|
||||
if (!b->on_expr)
|
||||
b->on_expr= expr;
|
||||
else
|
||||
@ -7909,7 +7911,7 @@ void add_join_on(TABLE_LIST *b, Item *expr)
|
||||
right and left join. If called later, it happens if we add more
|
||||
than one condition to the ON clause.
|
||||
*/
|
||||
b->on_expr= new Item_cond_and(b->on_expr,expr);
|
||||
b->on_expr= new Item_cond_and(thd, b->on_expr,expr);
|
||||
}
|
||||
b->on_expr->top_level_item();
|
||||
}
|
||||
@ -8279,16 +8281,17 @@ Item * all_any_subquery_creator(THD *thd, Item *left_expr,
|
||||
return new (thd->mem_root) Item_in_subselect(thd, left_expr, select_lex);
|
||||
|
||||
if ((cmp == &comp_ne_creator) && all) // <> ALL <=> NOT IN
|
||||
return new (thd->mem_root) Item_func_not(
|
||||
return new (thd->mem_root) Item_func_not(thd,
|
||||
new (thd->mem_root) Item_in_subselect(thd, left_expr, select_lex));
|
||||
|
||||
Item_allany_subselect *it=
|
||||
new (thd->mem_root) Item_allany_subselect(thd, left_expr, cmp, select_lex,
|
||||
all);
|
||||
if (all)
|
||||
return it->upper_item= new (thd->mem_root) Item_func_not_all(it); /* ALL */
|
||||
if (all) /* ALL */
|
||||
return it->upper_item= new (thd->mem_root) Item_func_not_all(thd, it);
|
||||
|
||||
return it->upper_item= new (thd->mem_root) Item_func_nop_all(it); /* ANY/SOME */
|
||||
/* ANY/SOME */
|
||||
return it->upper_item= new (thd->mem_root) Item_func_nop_all(thd, it);
|
||||
}
|
||||
|
||||
|
||||
@ -8816,12 +8819,12 @@ Item *negate_expression(THD *thd, Item *expr)
|
||||
if it is not boolean function then we have to emulate value of
|
||||
not(not(a)), it will be a != 0
|
||||
*/
|
||||
return new Item_func_ne(arg, new Item_int((char*) "0", 0, 1));
|
||||
return new Item_func_ne(thd, arg, new Item_int(thd, (char*) "0", 0, 1));
|
||||
}
|
||||
|
||||
if ((negated= expr->neg_transformer(thd)) != 0)
|
||||
return negated;
|
||||
return new Item_func_not(expr);
|
||||
return new Item_func_not(thd, expr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,7 +108,7 @@ bool append_file_to_dir(THD *thd, const char **filename_ptr,
|
||||
void execute_init_command(THD *thd, LEX_STRING *init_command,
|
||||
mysql_rwlock_t *var_lock);
|
||||
bool add_to_list(THD *thd, SQL_I_List<ORDER> &list, Item *group, bool asc);
|
||||
void add_join_on(TABLE_LIST *b,Item *expr);
|
||||
void add_join_on(THD *thd, TABLE_LIST *b, Item *expr);
|
||||
void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List<String> *using_fields,
|
||||
SELECT_LEX *lex);
|
||||
bool add_proc_to_list(THD *thd, Item *item);
|
||||
@ -118,7 +118,7 @@ bool push_new_name_resolution_context(THD *thd,
|
||||
void store_position_for_column(const char *name);
|
||||
void init_update_queries(void);
|
||||
bool check_simple_select();
|
||||
Item *normalize_cond(Item *cond);
|
||||
Item *normalize_cond(THD *thd, Item *cond);
|
||||
Item *negate_expression(THD *thd, Item *expr);
|
||||
bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
|
||||
|
||||
|
@ -202,7 +202,7 @@ Item* convert_charset_partition_constant(Item *item, CHARSET_INFO *cs)
|
||||
TABLE_LIST *save_list= context->table_list;
|
||||
const char *save_where= thd->where;
|
||||
|
||||
item= item->safe_charset_converter(cs);
|
||||
item= item->safe_charset_converter(thd, cs);
|
||||
context->table_list= NULL;
|
||||
thd->where= "convert character set partition constant";
|
||||
if (!item || item->fix_fields(thd, (Item**)NULL))
|
||||
|
@ -1542,7 +1542,7 @@ static int mysql_test_select(Prepared_statement *stmt,
|
||||
List<Item> fields(lex->select_lex.item_list);
|
||||
|
||||
/* Change columns if a procedure like analyse() */
|
||||
if (unit->last_procedure && unit->last_procedure->change_columns(fields))
|
||||
if (unit->last_procedure && unit->last_procedure->change_columns(thd, fields))
|
||||
goto error;
|
||||
|
||||
/*
|
||||
@ -1898,7 +1898,7 @@ static bool mysql_test_multidelete(Prepared_statement *stmt,
|
||||
TABLE_LIST *tables)
|
||||
{
|
||||
stmt->thd->lex->current_select= &stmt->thd->lex->select_lex;
|
||||
if (add_item_to_list(stmt->thd, new Item_null()))
|
||||
if (add_item_to_list(stmt->thd, new Item_null(stmt->thd)))
|
||||
{
|
||||
my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 0);
|
||||
goto error;
|
||||
|
@ -390,11 +390,12 @@ bool PROFILING::show_profiles()
|
||||
QUERY_PROFILE *prof;
|
||||
List<Item> field_list;
|
||||
|
||||
field_list.push_back(new Item_return_int("Query_ID", 10,
|
||||
field_list.push_back(new Item_return_int(thd, "Query_ID", 10,
|
||||
MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int("Duration", TIME_FLOAT_DIGITS-1,
|
||||
field_list.push_back(new Item_return_int(thd, "Duration",
|
||||
TIME_FLOAT_DIGITS - 1,
|
||||
MYSQL_TYPE_DOUBLE));
|
||||
field_list.push_back(new Item_empty_string("Query", 40));
|
||||
field_list.push_back(new Item_empty_string(thd, "Query", 40));
|
||||
|
||||
if (thd->protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
|
@ -3816,7 +3816,7 @@ bool mysql_show_binlog_events(THD* thd)
|
||||
|
||||
DBUG_ENTER("mysql_show_binlog_events");
|
||||
|
||||
Log_event::init_show_field_list(&field_list);
|
||||
Log_event::init_show_field_list(thd, &field_list);
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(TRUE);
|
||||
@ -4002,11 +4002,11 @@ bool show_binlog_info(THD* thd)
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("show_binlog_info");
|
||||
List<Item> field_list;
|
||||
field_list.push_back(new Item_empty_string("File", FN_REFLEN));
|
||||
field_list.push_back(new Item_return_int("Position",20,
|
||||
field_list.push_back(new Item_empty_string(thd, "File", FN_REFLEN));
|
||||
field_list.push_back(new Item_return_int(thd, "Position", 20,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
field_list.push_back(new Item_empty_string("Binlog_Do_DB",255));
|
||||
field_list.push_back(new Item_empty_string("Binlog_Ignore_DB",255));
|
||||
field_list.push_back(new Item_empty_string(thd, "Binlog_Do_DB", 255));
|
||||
field_list.push_back(new Item_empty_string(thd, "Binlog_Ignore_DB", 255));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
@ -4057,8 +4057,8 @@ bool show_binlogs(THD* thd)
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
field_list.push_back(new Item_empty_string("Log_name", 255));
|
||||
field_list.push_back(new Item_return_int("File_size", 20,
|
||||
field_list.push_back(new Item_empty_string(thd, "Log_name", 255));
|
||||
field_list.push_back(new Item_return_int(thd, "File_size", 20,
|
||||
MYSQL_TYPE_LONGLONG));
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
|
@ -116,7 +116,7 @@ static store_key *get_store_key(THD *thd,
|
||||
uint maybe_null);
|
||||
static bool make_outerjoin_info(JOIN *join);
|
||||
static Item*
|
||||
make_cond_after_sjm(Item *root_cond, Item *cond, table_map tables,
|
||||
make_cond_after_sjm(THD *thd, Item *root_cond, Item *cond, table_map tables,
|
||||
table_map sjm_tables, bool inside_or_clause);
|
||||
static bool make_join_select(JOIN *join,SQL_SELECT *select,COND *item);
|
||||
static void revise_cache_usage(JOIN_TAB *join_tab);
|
||||
@ -137,7 +137,7 @@ static COND *build_equal_items(JOIN *join, COND *cond,
|
||||
bool ignore_on_conds,
|
||||
COND_EQUAL **cond_equal_ref,
|
||||
bool link_equal_fields= FALSE);
|
||||
static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
|
||||
static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
|
||||
COND *cond,
|
||||
COND_EQUAL *cond_equal,
|
||||
void *table_join_idx);
|
||||
@ -512,9 +512,9 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
|
||||
direct_ref= TRUE;
|
||||
|
||||
new_ref= direct_ref ?
|
||||
new Item_direct_ref(ref->context, item_ref, ref->table_name,
|
||||
new Item_direct_ref(thd, ref->context, item_ref, ref->table_name,
|
||||
ref->field_name, ref->alias_name_used) :
|
||||
new Item_ref(ref->context, item_ref, ref->table_name,
|
||||
new Item_ref(thd, ref->context, item_ref, ref->table_name,
|
||||
ref->field_name, ref->alias_name_used);
|
||||
if (!new_ref)
|
||||
return TRUE;
|
||||
@ -1408,7 +1408,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
|
||||
if (!conds && outer_join)
|
||||
{
|
||||
/* Handle the case where we have an OUTER JOIN without a WHERE */
|
||||
conds=new Item_int((longlong) 1,1); // Always true
|
||||
conds= new Item_int(thd, (longlong) 1,1); // Always true
|
||||
}
|
||||
|
||||
if (impossible_where)
|
||||
@ -1442,7 +1442,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
|
||||
*/
|
||||
if (conds)
|
||||
{
|
||||
conds= substitute_for_best_equal_field(NO_PARTICULAR_TAB, conds,
|
||||
conds= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB, conds,
|
||||
cond_equal, map2table);
|
||||
if (thd->is_error())
|
||||
{
|
||||
@ -1466,7 +1466,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
|
||||
{
|
||||
if (*tab->on_expr_ref)
|
||||
{
|
||||
*tab->on_expr_ref= substitute_for_best_equal_field(NO_PARTICULAR_TAB,
|
||||
*tab->on_expr_ref= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB,
|
||||
*tab->on_expr_ref,
|
||||
tab->cond_equal,
|
||||
map2table);
|
||||
@ -1498,7 +1498,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
|
||||
JOIN_TAB *first_inner= tab->first_inner;
|
||||
while (equals)
|
||||
{
|
||||
ref_item= substitute_for_best_equal_field(tab, ref_item,
|
||||
ref_item= substitute_for_best_equal_field(thd, tab, ref_item,
|
||||
equals, map2table);
|
||||
if (first_inner)
|
||||
{
|
||||
@ -1544,7 +1544,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
|
||||
if (conds && const_table_map != found_const_table_map &&
|
||||
(select_options & SELECT_DESCRIBE))
|
||||
{
|
||||
conds=new Item_int((longlong) 0,1); // Always false
|
||||
conds=new Item_int(thd, (longlong) 0, 1); // Always false
|
||||
}
|
||||
|
||||
/* Cache constant expressions in WHERE, HAVING, ON clauses. */
|
||||
@ -2116,32 +2116,32 @@ bool JOIN::setup_subquery_caches()
|
||||
select_lex->expr_cache_may_be_used[NO_MATTER])
|
||||
{
|
||||
if (conds)
|
||||
conds= conds->transform(&Item::expr_cache_insert_transformer,
|
||||
(uchar*) thd);
|
||||
conds= conds->transform(thd, &Item::expr_cache_insert_transformer,
|
||||
NULL);
|
||||
JOIN_TAB *tab;
|
||||
for (tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES);
|
||||
tab; tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS))
|
||||
{
|
||||
if (tab->select_cond)
|
||||
tab->select_cond=
|
||||
tab->select_cond->transform(&Item::expr_cache_insert_transformer,
|
||||
(uchar*) thd);
|
||||
tab->select_cond->transform(thd, &Item::expr_cache_insert_transformer,
|
||||
NULL);
|
||||
if (tab->cache_select && tab->cache_select->cond)
|
||||
tab->cache_select->cond=
|
||||
tab->cache_select->
|
||||
cond->transform(&Item::expr_cache_insert_transformer,
|
||||
(uchar*) thd);
|
||||
cond->transform(thd, &Item::expr_cache_insert_transformer,
|
||||
NULL);
|
||||
|
||||
}
|
||||
|
||||
if (having)
|
||||
having= having->transform(&Item::expr_cache_insert_transformer,
|
||||
(uchar*) thd);
|
||||
having= having->transform(thd, &Item::expr_cache_insert_transformer,
|
||||
NULL);
|
||||
if (tmp_having)
|
||||
{
|
||||
DBUG_ASSERT(having == NULL);
|
||||
tmp_having= tmp_having->transform(&Item::expr_cache_insert_transformer,
|
||||
(uchar*) thd);
|
||||
tmp_having= tmp_having->transform(thd, &Item::expr_cache_insert_transformer,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
if (select_lex->expr_cache_may_be_used[SELECT_LIST] ||
|
||||
@ -2153,7 +2153,8 @@ bool JOIN::setup_subquery_caches()
|
||||
while ((item= li++))
|
||||
{
|
||||
Item *new_item=
|
||||
item->transform(&Item::expr_cache_insert_transformer, (uchar*) thd);
|
||||
item->transform(thd, &Item::expr_cache_insert_transformer,
|
||||
NULL);
|
||||
if (new_item != item)
|
||||
{
|
||||
thd->change_item_tree(li.ref(), new_item);
|
||||
@ -2162,8 +2163,8 @@ bool JOIN::setup_subquery_caches()
|
||||
for (ORDER *tmp_group= group_list; tmp_group ; tmp_group= tmp_group->next)
|
||||
{
|
||||
*tmp_group->item=
|
||||
(*tmp_group->item)->transform(&Item::expr_cache_insert_transformer,
|
||||
(uchar*) thd);
|
||||
(*tmp_group->item)->transform(thd, &Item::expr_cache_insert_transformer,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
if (select_lex->expr_cache_may_be_used[NO_MATTER])
|
||||
@ -2171,8 +2172,8 @@ bool JOIN::setup_subquery_caches()
|
||||
for (ORDER *ord= order; ord; ord= ord->next)
|
||||
{
|
||||
*ord->item=
|
||||
(*ord->item)->transform(&Item::expr_cache_insert_transformer,
|
||||
(uchar*) thd);
|
||||
(*ord->item)->transform(thd, &Item::expr_cache_insert_transformer,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
@ -2440,7 +2441,7 @@ void JOIN::exec_inner()
|
||||
if (procedure)
|
||||
{
|
||||
procedure_fields_list= fields_list;
|
||||
if (procedure->change_columns(procedure_fields_list) ||
|
||||
if (procedure->change_columns(thd, procedure_fields_list) ||
|
||||
result->prepare(procedure_fields_list, unit))
|
||||
{
|
||||
thd->set_examined_row_count(0);
|
||||
@ -2975,8 +2976,8 @@ void JOIN::exec_inner()
|
||||
else
|
||||
{
|
||||
if (!(curr_table->select->cond=
|
||||
new Item_cond_and(curr_table->select->cond,
|
||||
sort_table_cond)))
|
||||
new Item_cond_and(thd, curr_table->select->cond,
|
||||
sort_table_cond)))
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
if (curr_table->pre_idx_push_select_cond)
|
||||
@ -2984,7 +2985,7 @@ void JOIN::exec_inner()
|
||||
if (sort_table_cond->type() == Item::COND_ITEM)
|
||||
sort_table_cond= sort_table_cond->copy_andor_structure(thd);
|
||||
if (!(curr_table->pre_idx_push_select_cond=
|
||||
new Item_cond_and(curr_table->pre_idx_push_select_cond,
|
||||
new Item_cond_and(thd, curr_table->pre_idx_push_select_cond,
|
||||
sort_table_cond)))
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -3887,7 +3888,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
|
||||
if (join->cond_value == Item::COND_FALSE)
|
||||
{
|
||||
join->impossible_where= true;
|
||||
conds=new Item_int((longlong) 0,1);
|
||||
conds= new Item_int(join->thd, (longlong) 0, 1);
|
||||
}
|
||||
|
||||
join->cond_equal= NULL;
|
||||
@ -4837,7 +4838,7 @@ Item_func_null_predicate::add_key_fields(JOIN *join, KEY_FIELD **key_fields,
|
||||
/* column_name IS [NOT] NULL */
|
||||
if (is_local_field(args[0]) && !(used_tables() & OUTER_REF_TABLE_BIT))
|
||||
{
|
||||
Item *tmp= new Item_null;
|
||||
Item *tmp= new Item_null(join->thd);
|
||||
if (unlikely(!tmp)) // Should never be true
|
||||
return;
|
||||
add_key_equal_fields(join, key_fields, *and_level, this,
|
||||
@ -9155,7 +9156,7 @@ inline void add_cond_and_fix(THD *thd, Item **e1, Item *e2)
|
||||
if (!e2)
|
||||
return;
|
||||
Item *res;
|
||||
if ((res= new Item_cond_and(*e1, e2)))
|
||||
if ((res= new Item_cond_and(thd, *e1, e2)))
|
||||
{
|
||||
res->fix_fields(thd, 0);
|
||||
res->update_used_tables();
|
||||
@ -9256,7 +9257,7 @@ static void add_not_null_conds(JOIN *join)
|
||||
*/
|
||||
if (!referred_tab)
|
||||
continue;
|
||||
if (!(notnull= new Item_func_isnotnull(not_null_item)))
|
||||
if (!(notnull= new Item_func_isnotnull(join->thd, not_null_item)))
|
||||
DBUG_VOID_RETURN;
|
||||
/*
|
||||
We need to do full fix_fields() call here in order to have correct
|
||||
@ -9312,14 +9313,15 @@ static void add_not_null_conds(JOIN *join)
|
||||
*/
|
||||
|
||||
static COND*
|
||||
add_found_match_trig_cond(JOIN_TAB *tab, COND *cond, JOIN_TAB *root_tab)
|
||||
add_found_match_trig_cond(THD *thd, JOIN_TAB *tab, COND *cond,
|
||||
JOIN_TAB *root_tab)
|
||||
{
|
||||
COND *tmp;
|
||||
DBUG_ASSERT(cond != 0);
|
||||
if (tab == root_tab)
|
||||
return cond;
|
||||
if ((tmp= add_found_match_trig_cond(tab->first_upper, cond, root_tab)))
|
||||
tmp= new Item_func_trig_cond(tmp, &tab->found);
|
||||
if ((tmp= add_found_match_trig_cond(thd, tab->first_upper, cond, root_tab)))
|
||||
tmp= new Item_func_trig_cond(thd, tmp, &tab->found);
|
||||
if (tmp)
|
||||
{
|
||||
tmp->quick_fix_field();
|
||||
@ -9626,8 +9628,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
if (tab->bush_children)
|
||||
{
|
||||
// Reached the materialization tab
|
||||
tmp= make_cond_after_sjm(cond, cond, save_used_tables, used_tables,
|
||||
/*inside_or_clause=*/FALSE);
|
||||
tmp= make_cond_after_sjm(thd, cond, cond, save_used_tables,
|
||||
used_tables, /*inside_or_clause=*/FALSE);
|
||||
used_tables= save_used_tables | used_tables;
|
||||
save_used_tables= 0;
|
||||
}
|
||||
@ -9671,7 +9673,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
below to check if we should use 'quick' instead.
|
||||
*/
|
||||
DBUG_PRINT("info", ("Item_int"));
|
||||
tmp= new Item_int((longlong) 1,1); // Always true
|
||||
tmp= new Item_int(thd, (longlong) 1, 1); // Always true
|
||||
}
|
||||
|
||||
}
|
||||
@ -9699,7 +9701,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
a cond, so neutralize the hack above.
|
||||
*/
|
||||
COND *tmp_cond;
|
||||
if (!(tmp_cond= add_found_match_trig_cond(first_inner_tab, tmp, 0)))
|
||||
if (!(tmp_cond= add_found_match_trig_cond(thd, first_inner_tab, tmp,
|
||||
0)))
|
||||
DBUG_RETURN(1);
|
||||
sel->cond= tmp_cond;
|
||||
tab->set_select_cond(tmp_cond, __LINE__);
|
||||
@ -9784,7 +9787,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
{
|
||||
/* Join with outer join condition */
|
||||
COND *orig_cond=sel->cond;
|
||||
sel->cond= and_conds(sel->cond, *tab->on_expr_ref);
|
||||
sel->cond= and_conds(thd, sel->cond, *tab->on_expr_ref);
|
||||
|
||||
/*
|
||||
We can't call sel->cond->fix_fields,
|
||||
@ -9903,13 +9906,14 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
(table_map) 0, -1, FALSE, FALSE);
|
||||
if (!tmp_cond)
|
||||
continue;
|
||||
tmp_cond= new Item_func_trig_cond(tmp_cond, &cond_tab->not_null_compl);
|
||||
tmp_cond= new Item_func_trig_cond(thd, tmp_cond,
|
||||
&cond_tab->not_null_compl);
|
||||
if (!tmp_cond)
|
||||
DBUG_RETURN(1);
|
||||
tmp_cond->quick_fix_field();
|
||||
cond_tab->select_cond= !cond_tab->select_cond ? tmp_cond :
|
||||
new Item_cond_and(cond_tab->select_cond,
|
||||
tmp_cond);
|
||||
new Item_cond_and(thd, cond_tab->select_cond,
|
||||
tmp_cond);
|
||||
if (!cond_tab->select_cond)
|
||||
DBUG_RETURN(1);
|
||||
cond_tab->select_cond->quick_fix_field();
|
||||
@ -9999,7 +10003,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
First add the guards for match variables of
|
||||
all embedding outer join operations.
|
||||
*/
|
||||
if (!(tmp_cond= add_found_match_trig_cond(cond_tab->first_inner,
|
||||
if (!(tmp_cond= add_found_match_trig_cond(thd,
|
||||
cond_tab->first_inner,
|
||||
tmp_cond,
|
||||
first_inner_tab)))
|
||||
DBUG_RETURN(1);
|
||||
@ -10008,7 +10013,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
the null complemented row.
|
||||
*/
|
||||
DBUG_PRINT("info", ("Item_func_trig_cond"));
|
||||
tmp_cond= new Item_func_trig_cond(tmp_cond,
|
||||
tmp_cond= new Item_func_trig_cond(thd, tmp_cond,
|
||||
&first_inner_tab->
|
||||
not_null_compl);
|
||||
DBUG_PRINT("info", ("Item_func_trig_cond 0x%lx",
|
||||
@ -10019,7 +10024,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
DBUG_PRINT("info", ("Item_cond_and"));
|
||||
*sel_cond_ref= !(*sel_cond_ref) ?
|
||||
tmp_cond :
|
||||
new Item_cond_and(*sel_cond_ref, tmp_cond);
|
||||
new Item_cond_and(thd, *sel_cond_ref, tmp_cond);
|
||||
DBUG_PRINT("info", ("Item_cond_and 0x%lx",
|
||||
(ulong)(*sel_cond_ref)));
|
||||
if (!(*sel_cond_ref))
|
||||
@ -11007,7 +11012,7 @@ void JOIN_TAB::remove_redundant_bnl_scan_conds()
|
||||
{
|
||||
List_iterator<Item> pushed_cond_li(*((Item_cond*) select_cond)->argument_list());
|
||||
Item *pushed_item;
|
||||
Item_cond_and *reduced_select_cond= new Item_cond_and;
|
||||
Item_cond_and *reduced_select_cond= new Item_cond_and(join->thd);
|
||||
|
||||
if (is_cond_and(cache_select->cond))
|
||||
{
|
||||
@ -12639,7 +12644,7 @@ static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
|
||||
if (!item)
|
||||
{
|
||||
Item_func_eq *eq_item;
|
||||
if (!(eq_item= new (thd->mem_root) Item_func_eq(orig_left_item,
|
||||
if (!(eq_item= new (thd->mem_root) Item_func_eq(thd, orig_left_item,
|
||||
orig_right_item)) ||
|
||||
eq_item->set_cmp_func_and_arg_cmp_context())
|
||||
return FALSE;
|
||||
@ -12734,7 +12739,7 @@ static bool check_row_equality(THD *thd, Item *left_row, Item_row *right_row,
|
||||
if (!is_converted)
|
||||
{
|
||||
Item_func_eq *eq_item;
|
||||
if (!(eq_item= new Item_func_eq(left_item, right_item)) ||
|
||||
if (!(eq_item= new Item_func_eq(thd, left_item, right_item)) ||
|
||||
eq_item->set_cmp_func_and_arg_cmp_context())
|
||||
return FALSE;
|
||||
eq_item->quick_fix_field();
|
||||
@ -12901,7 +12906,7 @@ COND *Item_cond_and::build_equal_items(THD *thd,
|
||||
if (!cond_args->elements &&
|
||||
!cond_equal.current_level.elements &&
|
||||
!eq_list.elements)
|
||||
return new (thd->mem_root) Item_int((longlong) 1, 1);
|
||||
return new (thd->mem_root) Item_int(thd, (longlong) 1, 1);
|
||||
|
||||
List_iterator_fast<Item_equal> it(cond_equal.current_level);
|
||||
while ((item_equal= it++))
|
||||
@ -13008,7 +13013,7 @@ COND *Item_func_eq::build_equal_items(THD *thd,
|
||||
Item_equal *item_equal;
|
||||
int n= cond_equal.current_level.elements + eq_list.elements;
|
||||
if (n == 0)
|
||||
return new (thd->mem_root) Item_int((longlong) 1,1);
|
||||
return new (thd->mem_root) Item_int(thd, (longlong) 1, 1);
|
||||
else if (n == 1)
|
||||
{
|
||||
if ((item_equal= cond_equal.current_level.pop()))
|
||||
@ -13034,7 +13039,7 @@ COND *Item_func_eq::build_equal_items(THD *thd,
|
||||
Here a new AND level must be created. It can happen only
|
||||
when a row equality is processed as a standalone predicate.
|
||||
*/
|
||||
Item_cond_and *and_cond= new Item_cond_and(eq_list);
|
||||
Item_cond_and *and_cond= new Item_cond_and(thd, eq_list);
|
||||
and_cond->quick_fix_field();
|
||||
List<Item> *cond_args= and_cond->argument_list();
|
||||
List_iterator_fast<Item_equal> it(cond_equal.current_level);
|
||||
@ -13070,7 +13075,7 @@ COND *Item_func::build_equal_items(THD *thd, COND_EQUAL *inherited,
|
||||
an argument of a comparison predicate.
|
||||
*/
|
||||
uchar* is_subst_valid= (uchar *) Item::ANY_SUBST;
|
||||
COND *cond= compile(&Item::subst_argument_checker,
|
||||
COND *cond= compile(thd, &Item::subst_argument_checker,
|
||||
&is_subst_valid,
|
||||
&Item::equal_fields_propagator,
|
||||
(uchar *) inherited);
|
||||
@ -13387,13 +13392,13 @@ static TABLE_LIST* embedding_sjm(Item *item)
|
||||
- 0, otherwise.
|
||||
*/
|
||||
|
||||
Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
|
||||
Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
|
||||
Item_equal *item_equal)
|
||||
{
|
||||
List<Item> eq_list;
|
||||
Item_func_eq *eq_item= 0;
|
||||
if (((Item *) item_equal)->const_item() && !item_equal->val_int())
|
||||
return new Item_int((longlong) 0,1);
|
||||
return new Item_int(thd, (longlong) 0, 1);
|
||||
Item *item_const= item_equal->get_const();
|
||||
Item_equal_fields_iterator it(*item_equal);
|
||||
Item *head;
|
||||
@ -13458,7 +13463,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
|
||||
Upper item also has "field_item=const".
|
||||
Don't produce equality if const is equal to item_const.
|
||||
*/
|
||||
Item_func_eq *func= new Item_func_eq(item_const, upper_const);
|
||||
Item_func_eq *func= new Item_func_eq(thd, item_const, upper_const);
|
||||
func->set_cmp_func();
|
||||
func->quick_fix_field();
|
||||
if (func->val_int())
|
||||
@ -13507,7 +13512,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
|
||||
if (head_real_item->type() == Item::FIELD_ITEM)
|
||||
head_item= head_real_item;
|
||||
|
||||
eq_item= new Item_func_eq(field_item->real_item(), head_item);
|
||||
eq_item= new Item_func_eq(thd, field_item->real_item(), head_item);
|
||||
|
||||
if (!eq_item || eq_item->set_cmp_func())
|
||||
return 0;
|
||||
@ -13540,7 +13545,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
|
||||
switch (eq_list.elements)
|
||||
{
|
||||
case 0:
|
||||
res= cond ? cond : new Item_int((longlong) 1, 1);
|
||||
res= cond ? cond : new Item_int(thd, (longlong) 1, 1);
|
||||
break;
|
||||
case 1:
|
||||
if (!cond || cond->type() == Item::INT_ITEM)
|
||||
@ -13563,7 +13568,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
|
||||
}
|
||||
}
|
||||
if (!res)
|
||||
res= new Item_cond_and(eq_list);
|
||||
res= new Item_cond_and(thd, eq_list);
|
||||
if (res)
|
||||
{
|
||||
res->quick_fix_field();
|
||||
@ -13630,7 +13635,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
|
||||
The transformed condition, or NULL in case of error
|
||||
*/
|
||||
|
||||
static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
|
||||
static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
|
||||
COND *cond,
|
||||
COND_EQUAL *cond_equal,
|
||||
void *table_join_idx)
|
||||
@ -13660,7 +13665,7 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
|
||||
Item *item;
|
||||
while ((item= li++))
|
||||
{
|
||||
Item *new_item= substitute_for_best_equal_field(context_tab,
|
||||
Item *new_item= substitute_for_best_equal_field(thd, context_tab,
|
||||
item, cond_equal,
|
||||
table_join_idx);
|
||||
/*
|
||||
@ -13678,8 +13683,8 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
|
||||
bool false_eq_cond= FALSE;
|
||||
while ((item_equal= it++))
|
||||
{
|
||||
eq_cond= eliminate_item_equal(eq_cond, cond_equal->upper_levels,
|
||||
item_equal);
|
||||
eq_cond= eliminate_item_equal(thd, eq_cond, cond_equal->upper_levels,
|
||||
item_equal);
|
||||
if (!eq_cond)
|
||||
{
|
||||
eq_cond= 0;
|
||||
@ -13735,7 +13740,7 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
|
||||
cond_equal= item_equal->upper_levels;
|
||||
if (cond_equal && cond_equal->current_level.head() == item_equal)
|
||||
cond_equal= cond_equal->upper_levels;
|
||||
cond= eliminate_item_equal(0, cond_equal, item_equal);
|
||||
cond= eliminate_item_equal(thd, 0, cond_equal, item_equal);
|
||||
return cond ? cond : org_cond;
|
||||
}
|
||||
else
|
||||
@ -13746,7 +13751,7 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
|
||||
while((item_equal= it++))
|
||||
{
|
||||
REPLACE_EQUAL_FIELD_ARG arg= {item_equal, context_tab};
|
||||
cond= cond->transform(&Item::replace_equal_field, (uchar *) &arg);
|
||||
cond= cond->transform(thd, &Item::replace_equal_field, (uchar *) &arg);
|
||||
}
|
||||
cond_equal= cond_equal->upper_levels;
|
||||
}
|
||||
@ -13929,7 +13934,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
|
||||
if (can_change_cond_ref_to_const(func, right_item, left_item,
|
||||
field_value_owner, field, value))
|
||||
{
|
||||
Item *tmp=value->clone_item();
|
||||
Item *tmp=value->clone_item(thd);
|
||||
if (tmp)
|
||||
{
|
||||
tmp->collation.set(right_item->collation);
|
||||
@ -13958,7 +13963,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
|
||||
else if (can_change_cond_ref_to_const(func, left_item, right_item,
|
||||
field_value_owner, field, value))
|
||||
{
|
||||
Item *tmp= value->clone_item();
|
||||
Item *tmp= value->clone_item(thd);
|
||||
if (tmp)
|
||||
{
|
||||
tmp->collation.set(left_item->collation);
|
||||
@ -14251,7 +14256,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
|
||||
/* Add ON expression to the WHERE or upper-level ON condition. */
|
||||
if (conds)
|
||||
{
|
||||
conds= and_conds(conds, table->on_expr);
|
||||
conds= and_conds(join->thd, conds, table->on_expr);
|
||||
conds->top_level_item();
|
||||
/* conds is always a new item as both cond and on_expr existed */
|
||||
DBUG_ASSERT(!conds->fixed);
|
||||
@ -14899,7 +14904,7 @@ void propagate_new_equalities(THD *thd, Item *cond,
|
||||
else
|
||||
{
|
||||
uchar* is_subst_valid= (uchar *) Item::ANY_SUBST;
|
||||
cond= cond->compile(&Item::subst_argument_checker,
|
||||
cond= cond->compile(thd, &Item::subst_argument_checker,
|
||||
&is_subst_valid,
|
||||
&Item::equal_fields_propagator,
|
||||
(uchar *) inherited);
|
||||
@ -15339,8 +15344,8 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
|
||||
|
||||
*/
|
||||
|
||||
Item *item0= new(thd->mem_root) Item_int((longlong)0, 1);
|
||||
Item *eq_cond= new(thd->mem_root) Item_func_eq(args[0], item0);
|
||||
Item *item0= new(thd->mem_root) Item_int(thd, (longlong) 0, 1);
|
||||
Item *eq_cond= new(thd->mem_root) Item_func_eq(thd, args[0], item0);
|
||||
if (!eq_cond)
|
||||
return this;
|
||||
|
||||
@ -15348,7 +15353,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
|
||||
if (field->table->pos_in_table_list->is_inner_table_of_outer_join())
|
||||
{
|
||||
// outer join: transform "col IS NULL" to "col IS NULL or col=0"
|
||||
Item *or_cond= new(thd->mem_root) Item_cond_or(eq_cond, this);
|
||||
Item *or_cond= new(thd->mem_root) Item_cond_or(thd, eq_cond, this);
|
||||
if (!or_cond)
|
||||
return this;
|
||||
cond= or_cond;
|
||||
@ -15400,8 +15405,8 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
|
||||
query_cache_abort(&thd->query_cache_tls);
|
||||
#endif
|
||||
COND *new_cond, *cond= this;
|
||||
if ((new_cond= new Item_func_eq(args[0],
|
||||
new Item_int("last_insert_id()",
|
||||
if ((new_cond= new Item_func_eq(thd, args[0],
|
||||
new Item_int(thd, "last_insert_id()",
|
||||
thd->read_first_successful_insert_id_in_prev_stmt(),
|
||||
MY_INT64_NUM_DECIMAL_DIGITS))))
|
||||
{
|
||||
@ -16260,7 +16265,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
|
||||
string_total_length+= new_field->pack_length();
|
||||
}
|
||||
thd->mem_root= mem_root_save;
|
||||
arg= sum_item->set_arg(i, thd, new Item_field(new_field));
|
||||
arg= sum_item->set_arg(i, thd, new Item_field(thd, new_field));
|
||||
thd->mem_root= &table->mem_root;
|
||||
if (param->force_not_null_cols)
|
||||
{
|
||||
@ -19844,7 +19849,7 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond,
|
||||
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
|
||||
{
|
||||
/* Create new top level AND item */
|
||||
Item_cond_and *new_cond=new Item_cond_and;
|
||||
Item_cond_and *new_cond=new Item_cond_and(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0; // OOM /* purecov: inspected */
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
@ -19879,7 +19884,7 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond,
|
||||
}
|
||||
else
|
||||
{ // Or list
|
||||
Item_cond_or *new_cond=new Item_cond_or;
|
||||
Item_cond_or *new_cond=new Item_cond_or(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0; // OOM /* purecov: inspected */
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
@ -19956,7 +19961,7 @@ make_cond_for_table_from_pred(THD *thd, Item *root_cond, Item *cond,
|
||||
|
||||
*/
|
||||
static COND *
|
||||
make_cond_after_sjm(Item *root_cond, Item *cond, table_map tables,
|
||||
make_cond_after_sjm(THD *thd, Item *root_cond, Item *cond, table_map tables,
|
||||
table_map sjm_tables, bool inside_or_clause)
|
||||
{
|
||||
/*
|
||||
@ -19974,14 +19979,14 @@ make_cond_after_sjm(Item *root_cond, Item *cond, table_map tables,
|
||||
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
|
||||
{
|
||||
/* Create new top level AND item */
|
||||
Item_cond_and *new_cond=new Item_cond_and;
|
||||
Item_cond_and *new_cond= new Item_cond_and(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0; // OOM /* purecov: inspected */
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
Item *item;
|
||||
while ((item=li++))
|
||||
{
|
||||
Item *fix=make_cond_after_sjm(root_cond, item, tables, sjm_tables,
|
||||
Item *fix=make_cond_after_sjm(thd, root_cond, item, tables, sjm_tables,
|
||||
inside_or_clause);
|
||||
if (fix)
|
||||
new_cond->argument_list()->push_back(fix);
|
||||
@ -20005,14 +20010,14 @@ make_cond_after_sjm(Item *root_cond, Item *cond, table_map tables,
|
||||
}
|
||||
else
|
||||
{ // Or list
|
||||
Item_cond_or *new_cond=new Item_cond_or;
|
||||
Item_cond_or *new_cond= new Item_cond_or(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0; // OOM /* purecov: inspected */
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
Item *item;
|
||||
while ((item=li++))
|
||||
{
|
||||
Item *fix= make_cond_after_sjm(root_cond, item, tables, sjm_tables,
|
||||
Item *fix= make_cond_after_sjm(thd, root_cond, item, tables, sjm_tables,
|
||||
/*inside_or_clause= */TRUE);
|
||||
if (!fix)
|
||||
return (COND*) 0; // Always true
|
||||
@ -22453,7 +22458,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
||||
pos= item;
|
||||
if (item->field->flags & BLOB_FLAG)
|
||||
{
|
||||
if (!(pos= new Item_copy_string(pos)))
|
||||
if (!(pos= new Item_copy_string(thd, pos)))
|
||||
goto err;
|
||||
/*
|
||||
Item_copy_string::copy for function can call
|
||||
@ -22508,7 +22513,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
||||
on how the value is to be used: In some cases this may be an
|
||||
argument in a group function, like: IF(ISNULL(col),0,COUNT(*))
|
||||
*/
|
||||
if (!(pos=new Item_copy_string(pos)))
|
||||
if (!(pos=new Item_copy_string(thd, pos)))
|
||||
goto err;
|
||||
if (i < border) // HAVING, ORDER and GROUP BY
|
||||
{
|
||||
@ -22722,7 +22727,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
|
||||
*/
|
||||
Item_func_set_user_var* suv=
|
||||
new Item_func_set_user_var(thd, (Item_func_set_user_var*) item);
|
||||
Item_field *new_field= new Item_field(field);
|
||||
Item_field *new_field= new Item_field(thd, field);
|
||||
if (!suv || !new_field)
|
||||
DBUG_RETURN(true); // Fatal error
|
||||
/*
|
||||
@ -22743,9 +22748,9 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
|
||||
else if ((field= item->get_tmp_table_field()))
|
||||
{
|
||||
if (item->type() == Item::SUM_FUNC_ITEM && field->table->group)
|
||||
item_field= ((Item_sum*) item)->result_item(field);
|
||||
item_field= ((Item_sum*) item)->result_item(thd, field);
|
||||
else
|
||||
item_field= (Item*) new Item_field(field);
|
||||
item_field= (Item *) new Item_field(thd, field);
|
||||
if (!item_field)
|
||||
DBUG_RETURN(true); // Fatal error
|
||||
|
||||
@ -22985,7 +22990,7 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
|
||||
if (!join_tab->ref.key_parts)
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
Item_cond_and *cond=new Item_cond_and();
|
||||
Item_cond_and *cond= new Item_cond_and(thd);
|
||||
TABLE *table=join_tab->table;
|
||||
int error= 0;
|
||||
if (!cond)
|
||||
@ -22996,7 +23001,7 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
|
||||
Field *field=table->field[table->key_info[join_tab->ref.key].key_part[i].
|
||||
fieldnr-1];
|
||||
Item *value=join_tab->ref.items[i];
|
||||
cond->add(new Item_func_equal(new Item_field(field), value));
|
||||
cond->add(new Item_func_equal(thd, new Item_field(thd, field), value));
|
||||
}
|
||||
if (thd->is_fatal_error)
|
||||
DBUG_RETURN(TRUE);
|
||||
@ -23016,7 +23021,8 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
|
||||
join_tab->select->cond= cond;
|
||||
if (join_tab->select->pre_idx_push_select_cond)
|
||||
{
|
||||
Item *new_cond= and_conds(cond_copy, join_tab->select->pre_idx_push_select_cond);
|
||||
Item *new_cond= and_conds(thd, cond_copy,
|
||||
join_tab->select->pre_idx_push_select_cond);
|
||||
if (!new_cond->fixed && new_cond->fix_fields(thd, &new_cond))
|
||||
error= 1;
|
||||
join_tab->pre_idx_push_select_cond=
|
||||
@ -23112,8 +23118,8 @@ static bool change_group_ref(THD *thd, Item_func *expr, ORDER *group_list,
|
||||
if (item->eq(*group_tmp->item,0))
|
||||
{
|
||||
Item *new_item;
|
||||
if (!(new_item= new Item_ref(context, group_tmp->item, 0,
|
||||
item->name)))
|
||||
if (!(new_item= new Item_ref(thd, context, group_tmp->item, 0,
|
||||
item->name)))
|
||||
return 1; // fatal_error is set
|
||||
thd->change_item_tree(arg, new_item);
|
||||
arg_changed= TRUE;
|
||||
@ -23170,7 +23176,7 @@ bool JOIN::rollup_init()
|
||||
*/
|
||||
for (i= 0 ; i < send_group_parts ; i++)
|
||||
{
|
||||
rollup.null_items[i]= new (thd->mem_root) Item_null_result();
|
||||
rollup.null_items[i]= new (thd->mem_root) Item_null_result(thd);
|
||||
List<Item> *rollup_fields= &rollup.fields[i];
|
||||
rollup_fields->empty();
|
||||
rollup.ref_pointer_arrays[i]= ref_array;
|
||||
@ -23250,7 +23256,7 @@ bool JOIN::rollup_process_const_fields()
|
||||
{
|
||||
if (*group_tmp->item == item)
|
||||
{
|
||||
Item* new_item= new Item_func_rollup_const(item);
|
||||
Item* new_item= new Item_func_rollup_const(thd, item);
|
||||
if (!new_item)
|
||||
return 1;
|
||||
new_item->fix_fields(thd, (Item **) 0);
|
||||
@ -23375,7 +23381,7 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields,
|
||||
This is an element that is used by the GROUP BY and should be
|
||||
set to NULL in this level
|
||||
*/
|
||||
Item_null_result *null_item= new (thd->mem_root) Item_null_result();
|
||||
Item_null_result *null_item= new (thd->mem_root) Item_null_result(thd);
|
||||
if (!null_item)
|
||||
return 1;
|
||||
item->maybe_null= 1; // Value will be null sometimes
|
||||
@ -23528,11 +23534,12 @@ int print_explain_message_line(select_result_sink *result,
|
||||
ha_rows *rows,
|
||||
const char *message)
|
||||
{
|
||||
Item *item_null= new Item_null();
|
||||
THD *thd= result->thd;
|
||||
Item *item_null= new Item_null(thd);
|
||||
List<Item> item_list;
|
||||
|
||||
item_list.push_back(new Item_int((int32) select_number));
|
||||
item_list.push_back(new Item_string_sys(select_type));
|
||||
item_list.push_back(new Item_int(thd, (int32) select_number));
|
||||
item_list.push_back(new Item_string_sys(thd, select_type));
|
||||
/* `table` */
|
||||
item_list.push_back(item_null);
|
||||
|
||||
@ -23547,7 +23554,7 @@ int print_explain_message_line(select_result_sink *result,
|
||||
/* `rows` */
|
||||
if (rows)
|
||||
{
|
||||
item_list.push_back(new Item_int(*rows,
|
||||
item_list.push_back(new Item_int(thd, *rows,
|
||||
MY_INT64_NUM_DECIMAL_DIGITS));
|
||||
}
|
||||
else
|
||||
@ -23567,7 +23574,7 @@ int print_explain_message_line(select_result_sink *result,
|
||||
|
||||
/* `Extra` */
|
||||
if (message)
|
||||
item_list.push_back(new Item_string_sys(message));
|
||||
item_list.push_back(new Item_string_sys(thd, message));
|
||||
else
|
||||
item_list.push_back(item_null);
|
||||
|
||||
@ -25051,11 +25058,11 @@ void JOIN::cache_const_exprs()
|
||||
return;
|
||||
|
||||
if (conds)
|
||||
conds->compile(&Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
|
||||
conds->compile(thd, &Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
|
||||
&Item::cache_const_expr_transformer, (uchar *)&cache_flag);
|
||||
cache_flag= FALSE;
|
||||
if (having)
|
||||
having->compile(&Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
|
||||
having->compile(thd, &Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
|
||||
&Item::cache_const_expr_transformer, (uchar *)&cache_flag);
|
||||
|
||||
for (JOIN_TAB *tab= first_depth_first_tab(this); tab;
|
||||
@ -25064,7 +25071,7 @@ void JOIN::cache_const_exprs()
|
||||
if (*tab->on_expr_ref)
|
||||
{
|
||||
cache_flag= FALSE;
|
||||
(*tab->on_expr_ref)->compile(&Item::cache_const_expr_analyzer,
|
||||
(*tab->on_expr_ref)->compile(thd, &Item::cache_const_expr_analyzer,
|
||||
(uchar **)&analyzer_arg,
|
||||
&Item::cache_const_expr_transformer,
|
||||
(uchar *)&cache_flag);
|
||||
|
@ -1850,9 +1850,9 @@ int test_if_item_cache_changed(List<Cached_item> &list);
|
||||
int join_init_read_record(JOIN_TAB *tab);
|
||||
int join_read_record_no_init(JOIN_TAB *tab);
|
||||
void set_position(JOIN *join,uint idx,JOIN_TAB *table,KEYUSE *key);
|
||||
inline Item * and_items(Item* cond, Item *item)
|
||||
inline Item * and_items(THD *thd, Item* cond, Item *item)
|
||||
{
|
||||
return (cond? (new Item_cond_and(cond, item)) : item);
|
||||
return (cond ? (new Item_cond_and(thd, cond, item)) : item);
|
||||
}
|
||||
bool choose_plan(JOIN *join, table_map join_tables);
|
||||
void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab,
|
||||
|
108
sql/sql_show.cc
108
sql/sql_show.cc
@ -453,9 +453,9 @@ bool mysqld_show_authors(THD *thd)
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("mysqld_show_authors");
|
||||
|
||||
field_list.push_back(new Item_empty_string("Name",40));
|
||||
field_list.push_back(new Item_empty_string("Location",40));
|
||||
field_list.push_back(new Item_empty_string("Comment",512));
|
||||
field_list.push_back(new Item_empty_string(thd, "Name", 40));
|
||||
field_list.push_back(new Item_empty_string(thd, "Location", 40));
|
||||
field_list.push_back(new Item_empty_string(thd, "Comment", 512));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
@ -487,9 +487,9 @@ bool mysqld_show_contributors(THD *thd)
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("mysqld_show_contributors");
|
||||
|
||||
field_list.push_back(new Item_empty_string("Name",40));
|
||||
field_list.push_back(new Item_empty_string("Location",40));
|
||||
field_list.push_back(new Item_empty_string("Comment", 512));
|
||||
field_list.push_back(new Item_empty_string(thd, "Name", 40));
|
||||
field_list.push_back(new Item_empty_string(thd, "Location", 40));
|
||||
field_list.push_back(new Item_empty_string(thd, "Comment", 512));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
@ -564,9 +564,9 @@ bool mysqld_show_privileges(THD *thd)
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("mysqld_show_privileges");
|
||||
|
||||
field_list.push_back(new Item_empty_string("Privilege",10));
|
||||
field_list.push_back(new Item_empty_string("Context",15));
|
||||
field_list.push_back(new Item_empty_string("Comment",NAME_CHAR_LEN));
|
||||
field_list.push_back(new Item_empty_string(thd, "Privilege", 10));
|
||||
field_list.push_back(new Item_empty_string(thd, "Context", 15));
|
||||
field_list.push_back(new Item_empty_string(thd, "Comment", NAME_CHAR_LEN));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
@ -1144,19 +1144,19 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
||||
|
||||
if (table_list->view)
|
||||
{
|
||||
field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN));
|
||||
field_list.push_back(new Item_empty_string("Create View",
|
||||
field_list.push_back(new Item_empty_string(thd, "View", NAME_CHAR_LEN));
|
||||
field_list.push_back(new Item_empty_string(thd, "Create View",
|
||||
MY_MAX(buffer.length(),1024)));
|
||||
field_list.push_back(new Item_empty_string("character_set_client",
|
||||
field_list.push_back(new Item_empty_string(thd, "character_set_client",
|
||||
MY_CS_NAME_SIZE));
|
||||
field_list.push_back(new Item_empty_string("collation_connection",
|
||||
field_list.push_back(new Item_empty_string(thd, "collation_connection",
|
||||
MY_CS_NAME_SIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
field_list.push_back(new Item_empty_string("Table",NAME_CHAR_LEN));
|
||||
field_list.push_back(new Item_empty_string(thd, "Table", NAME_CHAR_LEN));
|
||||
// 1024 is for not to confuse old clients
|
||||
field_list.push_back(new Item_empty_string("Create Table",
|
||||
field_list.push_back(new Item_empty_string(thd, "Create Table",
|
||||
MY_MAX(buffer.length(),1024)));
|
||||
}
|
||||
|
||||
@ -1249,8 +1249,8 @@ bool mysqld_show_create_db(THD *thd, LEX_STRING *dbname,
|
||||
load_db_opt_by_name(thd, dbname->str, &create);
|
||||
}
|
||||
List<Item> field_list;
|
||||
field_list.push_back(new Item_empty_string("Database",NAME_CHAR_LEN));
|
||||
field_list.push_back(new Item_empty_string("Create Database",1024));
|
||||
field_list.push_back(new Item_empty_string(thd, "Database", NAME_CHAR_LEN));
|
||||
field_list.push_back(new Item_empty_string(thd, "Create Database", 1024));
|
||||
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
@ -1313,11 +1313,11 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
|
||||
!wild_case_compare(system_charset_info, field->field_name,wild))
|
||||
{
|
||||
if (table_list->view)
|
||||
field_list.push_back(new Item_ident_for_show(field,
|
||||
field_list.push_back(new Item_ident_for_show(thd, field,
|
||||
table_list->view_db.str,
|
||||
table_list->view_name.str));
|
||||
else
|
||||
field_list.push_back(new Item_field(field));
|
||||
field_list.push_back(new Item_field(thd, field));
|
||||
}
|
||||
}
|
||||
restore_record(table, s->default_values); // Get empty record
|
||||
@ -2343,22 +2343,26 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("mysqld_list_processes");
|
||||
|
||||
field_list.push_back(new Item_int("Id", 0, MY_INT32_NUM_DECIMAL_DIGITS));
|
||||
field_list.push_back(new Item_empty_string("User", USERNAME_CHAR_LENGTH));
|
||||
field_list.push_back(new Item_empty_string("Host",LIST_PROCESS_HOST_LEN));
|
||||
field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
|
||||
field_list.push_back(new Item_int(thd, "Id", 0, MY_INT32_NUM_DECIMAL_DIGITS));
|
||||
field_list.push_back(new Item_empty_string(thd, "User",
|
||||
USERNAME_CHAR_LENGTH));
|
||||
field_list.push_back(new Item_empty_string(thd, "Host",
|
||||
LIST_PROCESS_HOST_LEN));
|
||||
field_list.push_back(field=new Item_empty_string(thd, "db", NAME_CHAR_LEN));
|
||||
field->maybe_null=1;
|
||||
field_list.push_back(new Item_empty_string("Command",16));
|
||||
field_list.push_back(field= new Item_return_int("Time",7, MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_empty_string(thd, "Command", 16));
|
||||
field_list.push_back(field= new Item_return_int(thd, "Time", 7,
|
||||
MYSQL_TYPE_LONG));
|
||||
field->unsigned_flag= 0;
|
||||
field_list.push_back(field=new Item_empty_string("State",30));
|
||||
field_list.push_back(field=new Item_empty_string(thd, "State", 30));
|
||||
field->maybe_null=1;
|
||||
field_list.push_back(field=new Item_empty_string("Info",max_query_length));
|
||||
field_list.push_back(field=new Item_empty_string(thd, "Info",
|
||||
max_query_length));
|
||||
field->maybe_null=1;
|
||||
if (!thd->variables.old_mode &&
|
||||
!(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
|
||||
{
|
||||
field_list.push_back(field= new Item_float("Progress", 0.0, 3, 7));
|
||||
field_list.push_back(field= new Item_float(thd, "Progress", 0.0, 3, 7));
|
||||
field->maybe_null= 0;
|
||||
}
|
||||
if (protocol->send_result_set_metadata(&field_list,
|
||||
@ -3528,7 +3532,7 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
|
||||
}
|
||||
|
||||
|
||||
COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
|
||||
COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table)
|
||||
{
|
||||
if (!cond)
|
||||
return (COND*) 0;
|
||||
@ -3537,14 +3541,14 @@ COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
|
||||
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
|
||||
{
|
||||
/* Create new top level AND item */
|
||||
Item_cond_and *new_cond=new Item_cond_and;
|
||||
Item_cond_and *new_cond=new Item_cond_and(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0;
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
Item *item;
|
||||
while ((item=li++))
|
||||
{
|
||||
Item *fix= make_cond_for_info_schema(item, table);
|
||||
Item *fix= make_cond_for_info_schema(thd, item, table);
|
||||
if (fix)
|
||||
new_cond->argument_list()->push_back(fix);
|
||||
}
|
||||
@ -3560,14 +3564,14 @@ COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
|
||||
}
|
||||
else
|
||||
{ // Or list
|
||||
Item_cond_or *new_cond=new Item_cond_or;
|
||||
Item_cond_or *new_cond= new Item_cond_or(thd);
|
||||
if (!new_cond)
|
||||
return (COND*) 0;
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
Item *item;
|
||||
while ((item=li++))
|
||||
{
|
||||
Item *fix=make_cond_for_info_schema(item, table);
|
||||
Item *fix=make_cond_for_info_schema(thd, item, table);
|
||||
if (!fix)
|
||||
return (COND*) 0;
|
||||
new_cond->argument_list()->push_back(fix);
|
||||
@ -7058,7 +7062,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
schema_table_idx == SCH_GLOBAL_VARIABLES)
|
||||
scope= OPT_GLOBAL;
|
||||
|
||||
COND *partial_cond= make_cond_for_info_schema(cond, tables);
|
||||
COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
|
||||
|
||||
mysql_rwlock_rdlock(&LOCK_system_variables_hash);
|
||||
res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, scope),
|
||||
@ -7100,7 +7104,7 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
tmp1= &thd->status_var;
|
||||
}
|
||||
|
||||
COND *partial_cond= make_cond_for_info_schema(cond, tables);
|
||||
COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
|
||||
// Evaluate and cache const subqueries now, before the mutex.
|
||||
if (partial_cond)
|
||||
partial_cond->val_int();
|
||||
@ -7323,7 +7327,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
||||
case MYSQL_TYPE_SHORT:
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
case MYSQL_TYPE_INT24:
|
||||
if (!(item= new Item_return_int(fields_info->field_name,
|
||||
if (!(item= new Item_return_int(thd, fields_info->field_name,
|
||||
fields_info->field_length,
|
||||
fields_info->field_type,
|
||||
fields_info->value)))
|
||||
@ -7333,33 +7337,34 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
||||
item->unsigned_flag= (fields_info->field_flags & MY_I_S_UNSIGNED);
|
||||
break;
|
||||
case MYSQL_TYPE_DATE:
|
||||
if (!(item=new Item_return_date_time(fields_info->field_name,
|
||||
if (!(item=new Item_return_date_time(thd, fields_info->field_name,
|
||||
strlen(fields_info->field_name),
|
||||
fields_info->field_type)))
|
||||
DBUG_RETURN(0);
|
||||
break;
|
||||
case MYSQL_TYPE_TIME:
|
||||
if (!(item=new Item_return_date_time(fields_info->field_name,
|
||||
if (!(item=new Item_return_date_time(thd, fields_info->field_name,
|
||||
strlen(fields_info->field_name),
|
||||
fields_info->field_type)))
|
||||
DBUG_RETURN(0);
|
||||
break;
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
if (!(item=new Item_return_date_time(fields_info->field_name,
|
||||
if (!(item=new Item_return_date_time(thd, fields_info->field_name,
|
||||
strlen(fields_info->field_name),
|
||||
fields_info->field_type)))
|
||||
DBUG_RETURN(0);
|
||||
break;
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
if ((item= new Item_float(fields_info->field_name, 0.0, NOT_FIXED_DEC,
|
||||
fields_info->field_length)) == NULL)
|
||||
if ((item= new Item_float(thd, fields_info->field_name, 0.0,
|
||||
NOT_FIXED_DEC,
|
||||
fields_info->field_length)) == NULL)
|
||||
DBUG_RETURN(NULL);
|
||||
break;
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
case MYSQL_TYPE_NEWDECIMAL:
|
||||
if (!(item= new Item_decimal((longlong) fields_info->value, false)))
|
||||
if (!(item= new Item_decimal(thd, (longlong) fields_info->value, false)))
|
||||
{
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@ -7383,7 +7388,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
||||
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||
case MYSQL_TYPE_LONG_BLOB:
|
||||
case MYSQL_TYPE_BLOB:
|
||||
if (!(item= new Item_blob(fields_info->field_name,
|
||||
if (!(item= new Item_blob(thd, fields_info->field_name,
|
||||
fields_info->field_length)))
|
||||
{
|
||||
DBUG_RETURN(0);
|
||||
@ -7393,7 +7398,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
||||
/* Don't let unimplemented types pass through. Could be a grave error. */
|
||||
DBUG_ASSERT(fields_info->field_type == MYSQL_TYPE_STRING);
|
||||
|
||||
if (!(item= new Item_empty_string("", fields_info->field_length, cs)))
|
||||
if (!(item= new Item_empty_string(thd, "", fields_info->field_length, cs)))
|
||||
{
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@ -7815,7 +7820,7 @@ static bool optimize_for_get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond
|
||||
if (plan->has_db_lookup_value() && plan->has_table_lookup_value())
|
||||
plan->partial_cond= 0;
|
||||
else
|
||||
plan->partial_cond= make_cond_for_info_schema(cond, tables);
|
||||
plan->partial_cond= make_cond_for_info_schema(thd, cond, tables);
|
||||
|
||||
end:
|
||||
DBUG_RETURN(0);
|
||||
@ -9152,8 +9157,9 @@ static bool show_create_trigger_impl(THD *thd,
|
||||
|
||||
/* Send header. */
|
||||
|
||||
fields.push_back(new Item_empty_string("Trigger", NAME_LEN));
|
||||
fields.push_back(new Item_empty_string("sql_mode", trg_sql_mode_str.length));
|
||||
fields.push_back(new Item_empty_string(thd, "Trigger", NAME_LEN));
|
||||
fields.push_back(new Item_empty_string(thd, "sql_mode",
|
||||
trg_sql_mode_str.length));
|
||||
|
||||
{
|
||||
/*
|
||||
@ -9162,7 +9168,7 @@ static bool show_create_trigger_impl(THD *thd,
|
||||
*/
|
||||
|
||||
Item_empty_string *stmt_fld=
|
||||
new Item_empty_string("SQL Original Statement",
|
||||
new Item_empty_string(thd, "SQL Original Statement",
|
||||
MY_MAX(trg_sql_original_stmt.length, 1024));
|
||||
|
||||
stmt_fld->maybe_null= TRUE;
|
||||
@ -9170,13 +9176,13 @@ static bool show_create_trigger_impl(THD *thd,
|
||||
fields.push_back(stmt_fld);
|
||||
}
|
||||
|
||||
fields.push_back(new Item_empty_string("character_set_client",
|
||||
fields.push_back(new Item_empty_string(thd, "character_set_client",
|
||||
MY_CS_NAME_SIZE));
|
||||
|
||||
fields.push_back(new Item_empty_string("collation_connection",
|
||||
fields.push_back(new Item_empty_string(thd, "collation_connection",
|
||||
MY_CS_NAME_SIZE));
|
||||
|
||||
fields.push_back(new Item_empty_string("Database Collation",
|
||||
fields.push_back(new Item_empty_string(thd, "Database Collation",
|
||||
MY_CS_NAME_SIZE));
|
||||
|
||||
if (p->send_result_set_metadata(&fields, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
|
@ -112,7 +112,7 @@ void view_store_options(THD *thd, TABLE_LIST *table, String *buff);
|
||||
void init_fill_schema_files_row(TABLE* table);
|
||||
bool schema_table_store_record(THD *thd, TABLE *table);
|
||||
void initialize_information_schema_acl();
|
||||
COND *make_cond_for_info_schema(COND *cond, TABLE_LIST *table);
|
||||
COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table);
|
||||
|
||||
ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name);
|
||||
ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
|
||||
|
@ -3268,7 +3268,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
pointer in the parsed tree of a prepared statement or a
|
||||
stored procedure statement.
|
||||
*/
|
||||
sql_field->def= sql_field->def->safe_charset_converter(save_cs);
|
||||
sql_field->def= sql_field->def->safe_charset_converter(thd, save_cs);
|
||||
|
||||
if (sql_field->def == NULL)
|
||||
{
|
||||
@ -7414,7 +7414,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
This field was not dropped and not changed, add it to the list
|
||||
for the new table.
|
||||
*/
|
||||
def= new Create_field(field, field);
|
||||
def= new Create_field(thd, field, field);
|
||||
new_create_list.push_back(def);
|
||||
alter_it.rewind(); // Change default if ALTER
|
||||
Alter_column *alter;
|
||||
@ -9626,9 +9626,9 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
|
||||
*/
|
||||
DBUG_ASSERT(! thd->in_sub_stmt);
|
||||
|
||||
field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
|
||||
field_list.push_back(item = new Item_empty_string(thd, "Table", NAME_LEN*2));
|
||||
item->maybe_null= 1;
|
||||
field_list.push_back(item= new Item_int("Checksum",
|
||||
field_list.push_back(item= new Item_int(thd, "Checksum",
|
||||
(longlong) 1,
|
||||
MY_INT64_NUM_DECIMAL_DIGITS));
|
||||
item->maybe_null= 1;
|
||||
|
@ -1978,7 +1978,7 @@ loop_end:
|
||||
table to be updated was created by mysql 4.1. Deny this.
|
||||
*/
|
||||
field->can_alter_field_type= 0;
|
||||
Item_field *ifield= new Item_field((Field *) field);
|
||||
Item_field *ifield= new Item_field(join->thd, (Field *) field);
|
||||
if (!ifield)
|
||||
DBUG_RETURN(1);
|
||||
ifield->maybe_null= 0;
|
||||
|
459
sql/sql_yacc.yy
459
sql/sql_yacc.yy
File diff suppressed because it is too large
Load Diff
16
sql/table.cc
16
sql/table.cc
@ -4142,7 +4142,7 @@ bool TABLE::fill_item_list(List<Item> *item_list) const
|
||||
*/
|
||||
for (Field **ptr= field; *ptr; ptr++)
|
||||
{
|
||||
Item_field *item= new Item_field(*ptr);
|
||||
Item_field *item= new Item_field(in_use, *ptr);
|
||||
if (!item || item_list->push_back(item))
|
||||
return TRUE;
|
||||
}
|
||||
@ -4390,7 +4390,7 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds,
|
||||
this expression will not be moved to WHERE condition (i.e. will
|
||||
be clean correctly for PS/SP)
|
||||
*/
|
||||
tbl->on_expr= and_conds(tbl->on_expr,
|
||||
tbl->on_expr= and_conds(thd, tbl->on_expr,
|
||||
where->copy_andor_structure(thd));
|
||||
break;
|
||||
}
|
||||
@ -4400,7 +4400,7 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds,
|
||||
if (*conds && !(*conds)->fixed)
|
||||
res= (*conds)->fix_fields(thd, conds);
|
||||
if (!res)
|
||||
*conds= and_conds(*conds, where->copy_andor_structure(thd));
|
||||
*conds= and_conds(thd, *conds, where->copy_andor_structure(thd));
|
||||
if (*conds && !(*conds)->fixed && !res)
|
||||
res= (*conds)->fix_fields(thd, conds);
|
||||
}
|
||||
@ -4472,7 +4472,7 @@ merge_on_conds(THD *thd, TABLE_LIST *table, bool is_cascaded)
|
||||
{
|
||||
if (tbl->view && !is_cascaded)
|
||||
continue;
|
||||
cond= and_conds(cond, merge_on_conds(thd, tbl, is_cascaded));
|
||||
cond= and_conds(thd, cond, merge_on_conds(thd, tbl, is_cascaded));
|
||||
}
|
||||
DBUG_RETURN(cond);
|
||||
}
|
||||
@ -4532,10 +4532,10 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type)
|
||||
for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local)
|
||||
{
|
||||
if (tbl->check_option)
|
||||
check_option= and_conds(check_option, tbl->check_option);
|
||||
check_option= and_conds(thd, check_option, tbl->check_option);
|
||||
}
|
||||
}
|
||||
check_option= and_conds(check_option,
|
||||
check_option= and_conds(thd, check_option,
|
||||
merge_on_conds(thd, this, is_cascaded));
|
||||
|
||||
if (arena)
|
||||
@ -5354,7 +5354,7 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
|
||||
{
|
||||
DBUG_RETURN(field);
|
||||
}
|
||||
Item *item= new Item_direct_view_ref(&view->view->select_lex.context,
|
||||
Item *item= new Item_direct_view_ref(thd, &view->view->select_lex.context,
|
||||
field_ref, view->alias,
|
||||
name, view);
|
||||
/*
|
||||
@ -7328,7 +7328,7 @@ bool TABLE_LIST::change_refs_to_fields()
|
||||
DBUG_ASSERT(!field_it.end_of_fields());
|
||||
if (!materialized_items[idx])
|
||||
{
|
||||
materialized_items[idx]= new Item_field(table->field[idx]);
|
||||
materialized_items[idx]= new Item_field(thd, table->field[idx]);
|
||||
if (!materialized_items[idx])
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -855,9 +855,9 @@ bool sphinx_show_status ( THD * thd )
|
||||
}
|
||||
CSphTLS * pTls = (CSphTLS*) thd->ha_data[sphinx_hton.slot];
|
||||
|
||||
field_list.push_back ( new Item_empty_string ( "Type", 10 ) );
|
||||
field_list.push_back ( new Item_empty_string ( "Name", FN_REFLEN ) );
|
||||
field_list.push_back ( new Item_empty_string ( "Status", 10 ) );
|
||||
field_list.push_back ( new Item_empty_string ( thd, "Type", 10 ) );
|
||||
field_list.push_back ( new Item_empty_string ( thd, "Name", FN_REFLEN ) );
|
||||
field_list.push_back ( new Item_empty_string ( thd, "Status", 10 ) );
|
||||
if ( protocol->send_fields ( &field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF ) )
|
||||
SPH_RET(TRUE);
|
||||
|
||||
@ -2337,8 +2337,8 @@ int ha_sphinx::write_row ( byte * )
|
||||
{
|
||||
if ( (*ppField)->type()==MYSQL_TYPE_TIMESTAMP )
|
||||
{
|
||||
Item_field * pWrap = new Item_field ( *ppField ); // autofreed by query arena, I assume
|
||||
Item_func_unix_timestamp * pConv = new Item_func_unix_timestamp ( pWrap );
|
||||
Item_field * pWrap = new Item_field ( ha_thd(), *ppField ); // autofreed by query arena, I assume
|
||||
Item_func_unix_timestamp * pConv = new Item_func_unix_timestamp ( ha_thd(), pWrap );
|
||||
pConv->quick_fix_field();
|
||||
unsigned int uTs = (unsigned int) pConv->val_int();
|
||||
|
||||
|
@ -2390,7 +2390,7 @@ TABLE *spider_mk_sys_tmp_table(
|
||||
goto error_alloc_field;
|
||||
field->init(table);
|
||||
|
||||
if (!(i_field = new Item_field((Field *) field)))
|
||||
if (!(i_field = new Item_field(thd, (Field *) field)))
|
||||
goto error_alloc_item_field;
|
||||
|
||||
if (i_list.push_back(i_field))
|
||||
@ -2443,7 +2443,7 @@ TABLE *spider_mk_sys_tmp_table_for_result(
|
||||
goto error_alloc_field1;
|
||||
field1->init(table);
|
||||
|
||||
if (!(i_field1 = new Item_field((Field *) field1)))
|
||||
if (!(i_field1 = new Item_field(thd, (Field *) field1)))
|
||||
goto error_alloc_item_field1;
|
||||
|
||||
if (i_list.push_back(i_field1))
|
||||
@ -2454,7 +2454,7 @@ TABLE *spider_mk_sys_tmp_table_for_result(
|
||||
goto error_alloc_field2;
|
||||
field2->init(table);
|
||||
|
||||
if (!(i_field2 = new Item_field((Field *) field2)))
|
||||
if (!(i_field2 = new Item_field(thd, (Field *) field2)))
|
||||
goto error_alloc_item_field2;
|
||||
|
||||
if (i_list.push_back(i_field2))
|
||||
@ -2465,7 +2465,7 @@ TABLE *spider_mk_sys_tmp_table_for_result(
|
||||
goto error_alloc_field3;
|
||||
field3->init(table);
|
||||
|
||||
if (!(i_field3 = new Item_field((Field *) field3)))
|
||||
if (!(i_field3 = new Item_field(thd, (Field *) field3)))
|
||||
goto error_alloc_item_field3;
|
||||
|
||||
if (i_list.push_back(i_field3))
|
||||
|
Loading…
x
Reference in New Issue
Block a user