summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/authors.h2
-rw-r--r--sql/datadict.cc37
-rw-r--r--sql/filesort.cc3
-rw-r--r--sql/ha_partition.cc2
-rw-r--r--sql/item.cc47
-rw-r--r--sql/item.h165
-rw-r--r--sql/item_cmpfunc.cc8
-rw-r--r--sql/item_cmpfunc.h184
-rw-r--r--sql/item_func.cc51
-rw-r--r--sql/item_func.h332
-rw-r--r--sql/item_geofunc.h146
-rw-r--r--sql/item_inetfunc.h32
-rw-r--r--sql/item_jsonfunc.h88
-rw-r--r--sql/item_row.cc8
-rw-r--r--sql/item_row.h6
-rw-r--r--sql/item_strfunc.h284
-rw-r--r--sql/item_subselect.h4
-rw-r--r--sql/item_sum.h76
-rw-r--r--sql/item_timefunc.h184
-rw-r--r--sql/item_vers.cc3
-rw-r--r--sql/item_vers.h12
-rw-r--r--sql/item_windowfunc.h54
-rw-r--r--sql/item_xmlfunc.cc68
-rw-r--r--sql/item_xmlfunc.h8
-rw-r--r--sql/log.cc2
-rw-r--r--sql/mysqld.cc1
-rw-r--r--sql/mysqld.h2
-rw-r--r--sql/opt_subselect.cc85
-rw-r--r--sql/procedure.h2
-rw-r--r--sql/sql_array.h2
-rw-r--r--sql/sql_base.cc3
-rw-r--r--sql/sql_class.h9
-rw-r--r--sql/sql_connect.cc4
-rw-r--r--sql/sql_db.cc3
-rw-r--r--sql/sql_delete.cc36
-rw-r--r--sql/sql_derived.cc4
-rw-r--r--sql/sql_explain.cc27
-rw-r--r--sql/sql_explain.h4
-rw-r--r--sql/sql_join_cache.cc32
-rw-r--r--sql/sql_join_cache.h6
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_lex.h3
-rw-r--r--sql/sql_select.cc296
-rw-r--r--sql/sql_select.h6
-rw-r--r--sql/sql_string.h6
-rw-r--r--sql/sql_table.cc18
-rw-r--r--sql/sql_tvc.cc8
-rw-r--r--sql/sql_tvc.h6
-rw-r--r--sql/sql_type.h1
-rw-r--r--sql/sql_union.cc8
-rw-r--r--sql/sql_update.cc11
-rw-r--r--sql/sql_window.cc4
-rw-r--r--sql/sql_window.h1
-rw-r--r--sql/sys_vars.cc39
-rw-r--r--sql/table.cc28
-rw-r--r--sql/table.h2
-rw-r--r--sql/vtmd.h4
57 files changed, 1353 insertions, 1116 deletions
diff --git a/sql/authors.h b/sql/authors.h
index 3a8f5497248..609b77059f4 100644
--- a/sql/authors.h
+++ b/sql/authors.h
@@ -75,6 +75,8 @@ struct show_table_authors_st show_table_authors[]= {
"Prepared statements (4.1), Cursors (5.0), GET_LOCK (10.0)" },
{ "Ian Gilfillan", "South Africa", "MariaDB documentation"},
{ "Federico Razolli", "Italy", "MariaDB documentation Italian translation"},
+ { "Vinchen", "Shenzhen, China", "Instant ADD Column for InnoDB, Spider engine optimization, from Tencent Game DBA Team" },
+ { "Willhan", "Shenzhen, China", "Big Column Compression, Spider engine optimization, from Tencent Game DBA Team" },
/* People working on MySQL code base (not NDB) */
{ "Guilhem Bichot", "Bordeaux, France", "Replication (since 4.0)" },
diff --git a/sql/datadict.cc b/sql/datadict.cc
index 4425f278e12..4e18fe06cb6 100644
--- a/sql/datadict.cc
+++ b/sql/datadict.cc
@@ -24,7 +24,7 @@ static int read_string(File file, uchar**to, size_t length)
{
DBUG_ENTER("read_string");
- my_free(*to);
+ /* This can't use MY_THREAD_SPECIFIC as it's used on server start */
if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) ||
mysql_file_read(file, *to, length, MYF(MY_NABP)))
{
@@ -51,7 +51,7 @@ static int read_string(File file, uchar**to, size_t length)
@param[out] is_sequence 1 if table is a SEQUENCE, 0 otherwise
- @retval TABLE_TYPE_UNKNOWN error
+ @retval TABLE_TYPE_UNKNOWN error - file can't be opened
@retval TABLE_TYPE_NORMAL table
@retval TABLE_TYPE_SEQUENCE sequence table
@retval TABLE_TYPE_VIEW view
@@ -72,33 +72,36 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
if ((file= mysql_file_open(key_file_frm, path, O_RDONLY | O_SHARE, MYF(0)))
< 0)
DBUG_RETURN(TABLE_TYPE_UNKNOWN);
- error= mysql_file_read(file, (uchar*) header, sizeof(header), MYF(MY_NABP));
- if (error)
+ /*
+ We return TABLE_TYPE_NORMAL if we can open the .frm file. This allows us
+ to drop a bad .frm file with DROP TABLE
+ */
+ type= TABLE_TYPE_NORMAL;
+
+ /*
+ Initialize engine name in case we are not able to find it out
+ The cast is safe, as engine_name->str points to a usable buffer.
+ */
+ if (engine_name)
+ {
+ engine_name->length= 0;
+ ((char*) (engine_name->str))[0]= 0;
+ }
+
+ if ((error= mysql_file_read(file, (uchar*) header, sizeof(header), MYF(MY_NABP))))
goto err;
+
if (!strncmp((char*) header, "TYPE=VIEW\n", 10))
{
type= TABLE_TYPE_VIEW;
goto err;
}
- /*
- We return TABLE_TYPE_NORMAL if we can read the .frm file. This allows us
- to drop a bad .frm file with DROP TABLE
- */
- type= TABLE_TYPE_NORMAL;
-
/* engine_name is 0 if we only want to know if table is view or not */
if (!engine_name)
goto err;
- /*
- Initialize engine name in case we are not able to find it out
- The cast is safe, as engine_name->str points to a usable buffer.
- */
- engine_name->length= 0;
- ((char*) (engine_name->str))[0]= 0;
-
if (!is_binary_frm_header(header))
goto err;
diff --git a/sql/filesort.cc b/sql/filesort.cc
index d2e167ce7bf..3c33f06d6cf 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -25,9 +25,6 @@
#include "mariadb.h"
#include "sql_priv.h"
#include "filesort.h"
-#ifdef HAVE_STDDEF_H
-#include <stddef.h> /* for macro offsetof */
-#endif
#include <m_ctype.h>
#include "sql_sort.h"
#include "probes_mysql.h"
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index bd5d854a129..8d019ba69f3 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -682,7 +682,7 @@ int ha_partition::create(const char *name, TABLE *table_arg,
handler **file, **abort_file;
DBUG_ENTER("ha_partition::create");
- DBUG_ASSERT(*fn_rext((char*)name) == '\0');
+ DBUG_ASSERT(!fn_frm_ext(name));
/* Not allowed to create temporary partitioned tables */
if (create_info && create_info->tmp_table())
diff --git a/sql/item.cc b/sql/item.cc
index 19b495ed50c..0a5886d2fcf 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -78,6 +78,12 @@ inline void set_max_sum_func_level(THD *thd, SELECT_LEX *select)
select->nest_level - 1);
}
+
+MEM_ROOT *get_thd_memroot(THD *thd)
+{
+ return thd->mem_root;
+}
+
/*****************************************************************************
** Item functions
*****************************************************************************/
@@ -1261,7 +1267,7 @@ Item *Item::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
if (!needs_charset_converter(tocs))
return this;
Item_func_conv_charset *conv= new (thd->mem_root) Item_func_conv_charset(thd, this, tocs, 1);
- return conv->safe ? conv : NULL;
+ return conv && conv->safe ? conv : NULL;
}
@@ -2700,15 +2706,15 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
0 if an error occured
*/
-Item* Item_func_or_sum::build_clone(THD *thd, MEM_ROOT *mem_root)
+Item* Item_func_or_sum::build_clone(THD *thd)
{
- Item_func_or_sum *copy= (Item_func_or_sum *) get_copy(thd, mem_root);
+ Item_func_or_sum *copy= (Item_func_or_sum *) get_copy(thd);
if (!copy)
return 0;
if (arg_count > 2)
{
copy->args=
- (Item**) alloc_root(mem_root, sizeof(Item*) * arg_count);
+ (Item**) alloc_root(thd->mem_root, sizeof(Item*) * arg_count);
if (!copy->args)
return 0;
}
@@ -2718,7 +2724,7 @@ Item* Item_func_or_sum::build_clone(THD *thd, MEM_ROOT *mem_root)
for (uint i= 0; i < arg_count; i++)
{
- Item *arg_clone= args[i]->build_clone(thd, mem_root);
+ Item *arg_clone= args[i]->build_clone(thd);
if (!arg_clone)
return 0;
copy->args[i]= arg_clone;
@@ -2743,19 +2749,13 @@ Item* Item_func_or_sum::build_clone(THD *thd, MEM_ROOT *mem_root)
0 if an error occured
*/
-Item* Item_ref::build_clone(THD *thd, MEM_ROOT *mem_root)
+Item* Item_ref::build_clone(THD *thd)
{
- Item_ref *copy= (Item_ref *) get_copy(thd, mem_root);
- if (!copy)
+ Item_ref *copy= (Item_ref *) get_copy(thd);
+ if (!copy ||
+ !(copy->ref= (Item**) alloc_root(thd->mem_root, sizeof(Item*))) ||
+ !(*copy->ref= (* ref)->build_clone(thd)))
return 0;
- copy->ref=
- (Item**) alloc_root(mem_root, sizeof(Item*));
- if (!copy->ref)
- return 0;
- Item *item_clone= (* ref)->build_clone(thd, mem_root);
- if (!item_clone)
- return 0;
- *copy->ref= item_clone;
return copy;
}
@@ -3237,6 +3237,11 @@ table_map Item_field::all_used_tables() const
return (get_depended_from() ? OUTER_REF_TABLE_BIT : field->table->map);
}
+
+/*
+ @Note thd->fatal_error can be set in case of OOM
+*/
+
void Item_field::fix_after_pullout(st_select_lex *new_parent, Item **ref,
bool merge)
{
@@ -3296,6 +3301,8 @@ void Item_field::fix_after_pullout(st_select_lex *new_parent, Item **ref,
}
Name_resolution_context *ctx= new Name_resolution_context();
+ if (!ctx)
+ return; // Fatal error set
if (context->select_lex == new_parent)
{
/*
@@ -7356,7 +7363,7 @@ Item *Item_field::derived_field_transformer_for_where(THD *thd, uchar *arg)
st_select_lex *sel= (st_select_lex *)arg;
Item *producing_item= find_producing_item(this, sel);
if (producing_item)
- return producing_item->build_clone(thd, thd->mem_root);
+ return producing_item->build_clone(thd);
return this;
}
@@ -7368,7 +7375,7 @@ Item *Item_direct_view_ref::derived_field_transformer_for_where(THD *thd,
st_select_lex *sel= (st_select_lex *)arg;
Item *producing_item= find_producing_item(this, sel);
DBUG_ASSERT (producing_item != NULL);
- return producing_item->build_clone(thd, thd->mem_root);
+ return producing_item->build_clone(thd);
}
return this;
}
@@ -7414,7 +7421,7 @@ Item *Item_field::derived_grouping_field_transformer_for_where(THD *thd,
st_select_lex *sel= (st_select_lex *)arg;
Grouping_tmp_field *gr_field= find_matching_grouping_field(this, sel);
if (gr_field)
- return gr_field->producing_item->build_clone(thd, thd->mem_root);
+ return gr_field->producing_item->build_clone(thd);
return this;
}
@@ -7427,7 +7434,7 @@ Item_direct_view_ref::derived_grouping_field_transformer_for_where(THD *thd,
return this;
st_select_lex *sel= (st_select_lex *)arg;
Grouping_tmp_field *gr_field= find_matching_grouping_field(this, sel);
- return gr_field->producing_item->build_clone(thd, thd->mem_root);
+ return gr_field->producing_item->build_clone(thd);
}
void Item_field::print(String *str, enum_query_type query_type)
diff --git a/sql/item.h b/sql/item.h
index 8861f86a13e..7e8c0c86ac0 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -128,8 +128,6 @@ enum precedence {
HIGHEST_PRECEDENCE
};
-typedef Bounds_checked_array<Item*> Ref_ptr_array;
-
bool mark_unsupported_function(const char *where, void *store, uint result);
/* convenience helper for mark_unsupported_function() above */
@@ -1222,7 +1220,7 @@ public:
virtual bool basic_const_item() const { return 0; }
/* cloning of constant items (0 if it is not const) */
virtual Item *clone_item(THD *thd) { return 0; }
- virtual Item* build_clone(THD *thd, MEM_ROOT *mem_root) { return get_copy(thd, mem_root); }
+ virtual Item* build_clone(THD *thd) { return get_copy(thd); }
virtual cond_result eq_cmp_result() const { return COND_OK; }
inline uint float_length(uint decimals_par) const
{ return decimals < FLOATING_POINT_DECIMALS ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;}
@@ -1692,7 +1690,7 @@ public:
virtual bool set_fields_as_dependent_processor(void *arg) { return 0; }
/*============== End of Item processor list ======================*/
- virtual Item *get_copy(THD *thd, MEM_ROOT *mem_root)=0;
+ virtual Item *get_copy(THD *thd)=0;
bool cache_const_expr_analyzer(uchar **arg);
Item* cache_const_expr_transformer(THD *thd, uchar *arg);
@@ -1968,11 +1966,14 @@ public:
}
};
+MEM_ROOT *get_thd_memroot(THD *thd);
+
template <class T>
-inline Item* get_item_copy (THD *thd, MEM_ROOT *mem_root, T* item)
+inline Item* get_item_copy (THD *thd, T* item)
{
- Item *copy= new (mem_root) T(*item);
- copy->register_in(thd);
+ Item *copy= new (get_thd_memroot(thd)) T(*item);
+ if (copy)
+ copy->register_in(thd);
return copy;
}
@@ -2403,7 +2404,7 @@ public:
bool append_for_log(THD *thd, String *str);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item *get_copy(THD *thd) { return 0; }
/*
Override the inherited create_field_for_create_select(),
@@ -2531,7 +2532,7 @@ public:
purposes.
*/
virtual void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item *get_copy(THD *thd) { return 0; }
private:
uint m_case_expr_id;
@@ -2601,8 +2602,8 @@ public:
{
return mark_unsupported_function("name_const()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_name_const>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_name_const>(thd, this); }
};
class Item_num: public Item_basic_constant
@@ -2738,8 +2739,8 @@ public:
const Type_handler *handler= field->type_handler();
return handler->type_handler_for_item_field();
}
- Item* get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_ident_for_show>(thd, mem_root, this); }
+ Item* get_copy(THD *thd)
+ { return get_item_copy<Item_ident_for_show>(thd, this); }
};
@@ -2929,8 +2930,8 @@ public:
bool cleanup_excluding_const_fields_processor(void *arg)
{ return field && const_item() ? 0 : cleanup_processor(arg); }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_field>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_field>(thd, this); }
bool is_outer_field() const
{
DBUG_ASSERT(fixed);
@@ -2958,8 +2959,8 @@ public:
:Item_field(thd, field),
Item_args()
{ }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_field_row>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_field_row>(thd, this); }
const Type_handler *type_handler() const { return &type_handler_row; }
uint cols() const { return arg_count; }
@@ -3054,8 +3055,8 @@ public:
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs);
bool check_partition_func_processor(void *int_arg) {return FALSE;}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_null>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_null>(thd, this); }
};
class Item_null_result :public Item_null
@@ -3329,7 +3330,7 @@ public:
bool append_for_log(THD *thd, String *str);
bool check_vcol_func_processor(void *int_arg) {return FALSE;}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item *get_copy(THD *thd) { return 0; }
private:
void invalid_default_param() const;
@@ -3399,8 +3400,8 @@ public:
{ return (uint) (max_length - MY_TEST(value < 0)); }
bool eq(const Item *item, bool binary_cmp) const
{ return int_eq(value, item); }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_int>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_int>(thd, this); }
};
@@ -3432,8 +3433,8 @@ public:
virtual void print(String *str, enum_query_type query_type);
Item *neg(THD *thd);
uint decimal_precision() const { return max_length; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_uint>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_uint>(thd, this); }
};
@@ -3479,8 +3480,8 @@ public:
uint decimal_precision() const { return decimal_value.precision(); }
bool eq(const Item *, bool binary_cmp) const;
void set_decimal_value(my_decimal *value_par);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_decimal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_decimal>(thd, this); }
};
@@ -3530,8 +3531,8 @@ public:
virtual void print(String *str, enum_query_type query_type);
bool eq(const Item *item, bool binary_cmp) const
{ return real_eq(value, item); }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_float>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_float>(thd, this); }
};
@@ -3721,8 +3722,8 @@ public:
return MYSQL_TYPE_STRING; // Not a temporal literal
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_string>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_string>(thd, this); }
};
@@ -3976,8 +3977,8 @@ public:
return &type_handler_longlong;
}
void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_hex_hybrid>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_hex_hybrid>(thd, this); }
};
@@ -4017,8 +4018,8 @@ public:
collation.collation);
}
void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_hex_string>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_hex_string>(thd, this); }
};
@@ -4105,8 +4106,8 @@ public:
void print(String *str, enum_query_type query_type);
Item *clone_item(THD *thd);
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_date_literal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_date_literal>(thd, this); }
};
@@ -4126,8 +4127,8 @@ public:
void print(String *str, enum_query_type query_type);
Item *clone_item(THD *thd);
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_time_literal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_time_literal>(thd, this); }
};
@@ -4149,8 +4150,8 @@ public:
void print(String *str, enum_query_type query_type);
Item *clone_item(THD *thd);
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_datetime_literal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_datetime_literal>(thd, this); }
};
@@ -4387,7 +4388,7 @@ public:
virtual void fix_length_and_dec()= 0;
bool const_item() const { return const_item_cache; }
table_map used_tables() const { return used_tables_cache; }
- Item* build_clone(THD *thd, MEM_ROOT *mem_root);
+ Item* build_clone(THD *thd);
};
@@ -4570,7 +4571,7 @@ public:
return (*ref)->is_outer_field();
}
- Item* build_clone(THD *thd, MEM_ROOT *mem_root);
+ Item* build_clone(THD *thd);
/**
Checks if the item tree that ref points to contains a subquery.
@@ -4579,8 +4580,8 @@ public:
{
return (*ref)->has_subquery();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_ref>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_ref>(thd, this); }
bool excl_dep_on_table(table_map tab_map)
{
table_map used= used_tables();
@@ -4654,8 +4655,8 @@ public:
bool is_null();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
virtual Ref_Type ref_type() { return DIRECT_REF; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_direct_ref>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_direct_ref>(thd, this); }
};
@@ -4818,9 +4819,9 @@ public:
{
return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_wrapper>(thd, mem_root, this); }
- Item *build_clone(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_wrapper>(thd, this); }
+ Item *build_clone(THD *thd) { return 0; }
};
@@ -4988,8 +4989,8 @@ public:
item_equal= NULL;
Item_direct_ref::cleanup();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_direct_view_ref>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_direct_view_ref>(thd, this); }
};
@@ -5082,8 +5083,8 @@ public:
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
virtual void print(String *str, enum_query_type query_type);
table_map used_tables() const;
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_ref_null_helper>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_ref_null_helper>(thd, this); }
};
/*
@@ -5246,8 +5247,8 @@ public:
longlong val_int();
void copy();
int save_in_field(Field *field, bool no_conversions);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_copy_string>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_copy_string>(thd, this); }
};
@@ -5270,8 +5271,8 @@ public:
return null_value ? 0 : cached_value;
}
virtual void copy();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_copy_int>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_copy_int>(thd, this); }
};
@@ -5288,8 +5289,8 @@ public:
{
return null_value ? 0.0 : (double) (ulonglong) cached_value;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_copy_uint>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_copy_uint>(thd, this); }
};
@@ -5316,8 +5317,8 @@ public:
cached_value= item->val_real();
null_value= item->null_value;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_copy_float>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_copy_float>(thd, this); }
};
@@ -5337,8 +5338,8 @@ public:
double val_real();
longlong val_int();
void copy();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_copy_decimal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_copy_decimal>(thd, this); }
};
@@ -5832,8 +5833,8 @@ public:
bool cache_value();
int save_in_field(Field *field, bool no_conversions);
Item *convert_to_basic_const_item(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_int>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_int>(thd, this); }
};
@@ -5868,8 +5869,8 @@ public:
Item_cache_time(THD *thd)
:Item_cache_temporal(thd, &type_handler_time2) { }
bool cache_value();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_time>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_time>(thd, this); }
};
@@ -5878,8 +5879,8 @@ class Item_cache_datetime: public Item_cache_temporal
public:
Item_cache_datetime(THD *thd)
:Item_cache_temporal(thd, &type_handler_datetime2) { }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_datetime>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_datetime>(thd, this); }
};
@@ -5888,8 +5889,8 @@ class Item_cache_date: public Item_cache_temporal
public:
Item_cache_date(THD *thd)
:Item_cache_temporal(thd, &type_handler_newdate) { }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_date>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_date>(thd, this); }
};
@@ -5906,8 +5907,8 @@ public:
my_decimal *val_decimal(my_decimal *);
bool cache_value();
Item *convert_to_basic_const_item(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_real>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_real>(thd, this); }
};
@@ -5924,8 +5925,8 @@ public:
my_decimal *val_decimal(my_decimal *);
bool cache_value();
Item *convert_to_basic_const_item(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_decimal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_decimal>(thd, this); }
};
@@ -5952,8 +5953,8 @@ public:
int save_in_field(Field *field, bool no_conversions);
bool cache_value();
Item *convert_to_basic_const_item(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_str>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_str>(thd, this); }
};
@@ -5977,8 +5978,8 @@ public:
*/
return Item::safe_charset_converter(thd, tocs);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_str_for_nullif>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_str_for_nullif>(thd, this); }
};
@@ -6048,8 +6049,8 @@ public:
}
bool cache_value();
virtual void set_null();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cache_row>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cache_row>(thd, this); }
};
@@ -6142,7 +6143,7 @@ public:
{
Type_geometry_attributes::set_geometry_type(type);
}
- Item* get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item* get_copy(THD *thd) { return 0; }
private:
uint m_flags;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index ae06f0a089c..4360e629388 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -4940,20 +4940,20 @@ void Item_cond::neg_arguments(THD *thd)
0 if an error occured
*/
-Item *Item_cond::build_clone(THD *thd, MEM_ROOT *mem_root)
+Item *Item_cond::build_clone(THD *thd)
{
List_iterator_fast<Item> li(list);
Item *item;
- Item_cond *copy= (Item_cond *) get_copy(thd, mem_root);
+ Item_cond *copy= (Item_cond *) get_copy(thd);
if (!copy)
return 0;
copy->list.empty();
while ((item= li++))
{
- Item *arg_clone= item->build_clone(thd, mem_root);
+ Item *arg_clone= item->build_clone(thd);
if (!arg_clone)
return 0;
- if (copy->list.push_back(arg_clone, mem_root))
+ if (copy->list.push_back(arg_clone, thd->mem_root))
return 0;
}
return copy;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 7bab02db263..0a3339e7ffe 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -268,8 +268,8 @@ public:
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"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_istrue>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_istrue>(thd, this); }
};
@@ -284,8 +284,8 @@ public:
Item_func_truth(thd, a, true, false) {}
~Item_func_isnottrue() {}
virtual const char* func_name() const { return "isnottrue"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_isnottrue>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_isnottrue>(thd, this); }
};
@@ -299,8 +299,8 @@ public:
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"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_isfalse>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_isfalse>(thd, this); }
};
@@ -315,8 +315,8 @@ public:
Item_func_truth(thd, a, false, false) {}
~Item_func_isnotfalse() {}
virtual const char* func_name() const { return "isnotfalse"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_isnotfalse>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_isnotfalse>(thd, this); }
};
@@ -378,8 +378,8 @@ public:
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool invisible_mode();
void reset_cache() { cache= NULL; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_in_optimizer>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_in_optimizer>(thd, this); }
};
@@ -539,10 +539,10 @@ public:
return add_key_fields_optimize_op(join, key_fields, and_level,
usable_tables, sargables, false);
}
- Item *build_clone(THD *thd, MEM_ROOT *mem_root)
+ Item *build_clone(THD *thd)
{
Item_bool_rowready_func2 *clone=
- (Item_bool_rowready_func2 *) Item_func::build_clone(thd, mem_root);
+ (Item_bool_rowready_func2 *) Item_func::build_clone(thd);
if (clone)
{
clone->cmp.comparators= 0;
@@ -573,8 +573,8 @@ public:
Item_args::propagate_equal_fields(thd, Context_boolean(), cond);
return this;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_xor>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_xor>(thd, this); }
};
class Item_func_not :public Item_bool_func
@@ -592,8 +592,8 @@ public:
Item *neg_transformer(THD *thd);
bool fix_fields(THD *, Item **);
virtual void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_not>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_not>(thd, this); }
};
class Item_maxmin_subselect;
@@ -641,8 +641,8 @@ public:
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_trig_cond>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_trig_cond>(thd, this); }
};
class Item_func_not_all :public Item_func_not
@@ -679,8 +679,8 @@ public:
longlong val_int();
const char *func_name() const { return "<nop>"; }
Item *neg_transformer(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_nop_all>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_nop_all>(thd, this); }
};
@@ -720,8 +720,8 @@ public:
uint in_equality_no;
virtual uint exists2in_reserved_items() { return 1; };
friend class Arg_comparator;
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_eq>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_eq>(thd, this); }
};
class Item_func_equal :public Item_bool_rowready_func2
@@ -744,8 +744,8 @@ public:
return add_key_fields_optimize_op(join, key_fields, and_level,
usable_tables, sargables, true);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_equal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_equal>(thd, this); }
};
@@ -760,8 +760,8 @@ public:
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return ">="; }
Item *negated_item(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_ge>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_ge>(thd, this); }
};
@@ -776,8 +776,8 @@ public:
cond_result eq_cmp_result() const { return COND_FALSE; }
const char *func_name() const { return ">"; }
Item *negated_item(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_gt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_gt>(thd, this); }
};
@@ -792,8 +792,8 @@ public:
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "<="; }
Item *negated_item(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_le>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_le>(thd, this); }
};
@@ -808,8 +808,8 @@ public:
cond_result eq_cmp_result() const { return COND_FALSE; }
const char *func_name() const { return "<"; }
Item *negated_item(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_lt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_lt>(thd, this); }
};
@@ -833,8 +833,8 @@ public:
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);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_ne>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_ne>(thd, this); }
};
@@ -923,8 +923,8 @@ public:
cond);
return this;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_between>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_between>(thd, this); }
longlong val_int_cmp_string();
longlong val_int_cmp_temporal();
@@ -951,8 +951,8 @@ public:
agg_arg_charsets_for_comparison(cmp_collation, args, 2);
fix_char_length(2); // returns "1" or "0" or "-1"
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_strcmp>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_strcmp>(thd, this); }
};
@@ -985,8 +985,8 @@ public:
str->append(func_name());
print_args(str, 0, query_type);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_interval>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_interval>(thd, this); }
};
@@ -1009,8 +1009,8 @@ public:
}
const char *func_name() const { return "coalesce"; }
table_map not_null_tables() const { return 0; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_coalesce>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_coalesce>(thd, this); }
};
@@ -1082,8 +1082,8 @@ public:
const char *func_name() const { return "ifnull"; }
table_map not_null_tables() const { return 0; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_ifnull>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_ifnull>(thd, this); }
};
@@ -1145,8 +1145,8 @@ public:
const char *func_name() const { return "if"; }
bool eval_not_null_tables(void *opt_arg);
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_if>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_if>(thd, this); }
private:
void cache_type_info(Item *source);
};
@@ -1166,8 +1166,8 @@ public:
{
fix_length_and_dec2_eliminate_null(args + 1);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_nvl2>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_nvl2>(thd, this); }
};
@@ -1253,8 +1253,8 @@ public:
cond, &args[2]);
return this;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_nullif>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_nullif>(thd, this); }
Item *derived_field_transformer_for_having(THD *thd, uchar *arg)
{ reset_first_arg_if_needed(); return this; }
Item *derived_field_transformer_for_where(THD *thd, uchar *arg)
@@ -2114,9 +2114,9 @@ public:
enum precedence precedence() const { return BETWEEN_PRECEDENCE; }
CHARSET_INFO *compare_collation() const { return cmp_collation.collation; }
bool need_parentheses_in_default() { return true; }
- Item *build_clone(THD *thd, MEM_ROOT *mem_root)
+ Item *build_clone(THD *thd)
{
- Item_func_case *clone= (Item_func_case *) Item_func::build_clone(thd, mem_root);
+ Item_func_case *clone= (Item_func_case *) Item_func::build_clone(thd);
if (clone)
clone->arg_buffer= 0;
return clone;
@@ -2151,8 +2151,8 @@ public:
return this;
}
Item *find_item();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_case_searched>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_case_searched>(thd, this); }
};
@@ -2197,17 +2197,17 @@ public:
void fix_length_and_dec();
Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond);
Item *find_item();
- Item *build_clone(THD *thd, MEM_ROOT *mem_root)
+ Item *build_clone(THD *thd)
{
Item_func_case_simple *clone= (Item_func_case_simple *)
- Item_func_case::build_clone(thd, mem_root);
+ Item_func_case::build_clone(thd);
uint ncases= when_count();
if (clone && clone->Predicant_to_list_comparator::init_clone(thd, ncases))
return NULL;
return clone;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_case_simple>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_case_simple>(thd, this); }
};
@@ -2222,8 +2222,8 @@ public:
{ Item_func::print(str, query_type); }
void fix_length_and_dec();
Item *find_item();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_decode_oracle>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_decode_oracle>(thd, this); }
};
@@ -2384,11 +2384,11 @@ public:
bool eval_not_null_tables(void *opt_arg);
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool count_sargable_conds(void *arg);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_in>(thd, mem_root, this); }
- Item *build_clone(THD *thd, MEM_ROOT *mem_root)
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_in>(thd, this); }
+ Item *build_clone(THD *thd)
{
- Item_func_in *clone= (Item_func_in *) Item_func::build_clone(thd, mem_root);
+ Item_func_in *clone= (Item_func_in *) Item_func::build_clone(thd);
if (clone)
{
clone->array= 0;
@@ -2516,8 +2516,8 @@ public:
bool top_level);
table_map not_null_tables() const { return 0; }
Item *neg_transformer(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_isnull>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_isnull>(thd, this); }
};
/* Functions used by HAVING for rewriting IN subquery */
@@ -2564,8 +2564,8 @@ public:
Item *neg_transformer(THD *thd);
void print(String *str, enum_query_type query_type);
void top_level_item() { abort_on_null=1; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_isnotnull>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_isnotnull>(thd, this); }
};
@@ -2706,8 +2706,8 @@ public:
bool find_selective_predicates_list_processor(void *arg);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_like>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_like>(thd, this); }
};
@@ -2818,11 +2818,11 @@ public:
void fix_length_and_dec();
const char *func_name() const { return "regexp"; }
enum precedence precedence() const { return CMP_PRECEDENCE; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_regex>(thd, mem_root, this); }
- Item *build_clone(THD *thd, MEM_ROOT *mem_root)
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_regex>(thd, this); }
+ Item *build_clone(THD *thd)
{
- Item_func_regex *clone= (Item_func_regex*) Item_bool_func::build_clone(thd, mem_root);
+ Item_func_regex *clone= (Item_func_regex*) Item_bool_func::build_clone(thd);
if (clone)
clone->re.reset();
return clone;
@@ -2867,8 +2867,8 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp_instr"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_regexp_instr>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_regexp_instr>(thd, this); }
};
@@ -2945,7 +2945,7 @@ public:
Item *compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t);
bool eval_not_null_tables(void *opt_arg);
- Item *build_clone(THD *thd, MEM_ROOT *mem_root);
+ Item *build_clone(THD *thd);
};
template <template<class> class LI, class T> class Item_equal_iterator;
@@ -3119,7 +3119,7 @@ public:
void set_context_field(Item_field *ctx_field) { context_field= ctx_field; }
void set_link_equal_fields(bool flag) { link_equal_fields= flag; }
- Item* get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item* get_copy(THD *thd) { return 0; }
/*
This does not comply with the specification of the virtual method,
but Item_equal items are processed distinguishly anyway
@@ -3273,8 +3273,8 @@ public:
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);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cond_and>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cond_and>(thd, this); }
};
inline bool is_cond_and(Item *item)
@@ -3300,8 +3300,8 @@ public:
table_map not_null_tables() const { return and_tables_cache; }
Item *copy_andor_structure(THD *thd);
Item *neg_transformer(THD *thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_cond_or>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_cond_or>(thd, this); }
};
class Item_func_dyncol_check :public Item_bool_func
@@ -3311,8 +3311,8 @@ public:
longlong val_int();
const char *func_name() const { return "column_check"; }
bool need_parentheses_in_default() { return false; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_dyncol_check>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dyncol_check>(thd, this); }
};
class Item_func_dyncol_exists :public Item_bool_func
@@ -3323,8 +3323,8 @@ public:
longlong val_int();
const char *func_name() const { return "column_exists"; }
bool need_parentheses_in_default() { return false; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_dyncol_exists>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dyncol_exists>(thd, this); }
};
@@ -3352,8 +3352,8 @@ public:
:Item_func_cursor_bool_attr(thd, name, offset) { }
const char *func_name() const { return "%ISOPEN"; }
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_cursor_isopen>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_cursor_isopen>(thd, this); }
};
@@ -3364,8 +3364,8 @@ public:
:Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; }
const char *func_name() const { return "%FOUND"; }
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_cursor_found>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_cursor_found>(thd, this); }
};
@@ -3376,8 +3376,8 @@ public:
:Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; }
const char *func_name() const { return "%NOTFOUND"; }
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_cursor_notfound>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_cursor_notfound>(thd, this); }
};
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 0d32fdf1824..659ec29e452 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3253,17 +3253,15 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
func->used_tables_and_const_cache_join(item);
f_args.arg_type[i]=item->result_type();
}
- //TODO: why all following memory is not allocated with 1 thd->alloc() call?
- if (!(buffers=new String[arg_count]) ||
- !(f_args.args= (char**) thd->alloc(arg_count * sizeof(char *))) ||
- !(f_args.lengths= (ulong*) thd->alloc(arg_count * sizeof(long))) ||
- !(f_args.maybe_null= (char*) thd->alloc(arg_count * sizeof(char))) ||
- !(num_buffer= (char*) thd->alloc(arg_count *
- ALIGN_SIZE(sizeof(double)))) ||
- !(f_args.attributes= (const char**) thd->alloc(arg_count *
- sizeof(char *))) ||
- !(f_args.attribute_lengths= (ulong*) thd->alloc(arg_count *
- sizeof(long))))
+ if (!(buffers=new (thd->mem_root) String[arg_count]) ||
+ !multi_alloc_root(thd->mem_root,
+ &f_args.args, arg_count * sizeof(char *),
+ &f_args.lengths, arg_count * sizeof(long),
+ &f_args.maybe_null, arg_count * sizeof(char),
+ &num_buffer, arg_count * sizeof(double),
+ &f_args.attributes, arg_count * sizeof(char *),
+ &f_args.attribute_lengths, arg_count * sizeof(long),
+ NullS))
{
free_udf(u_d);
DBUG_RETURN(TRUE);
@@ -3275,6 +3273,8 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
initid.const_item=func->const_item_cache;
initid.decimals=func->decimals;
initid.ptr=0;
+ for (uint i1= 0 ; i1 < arg_count ; i1++)
+ buffers[i1].set_thread_specific();
if (u_d->func_init)
{
@@ -5299,8 +5299,8 @@ get_var_with_binlog(THD *thd, enum_sql_command sql_command,
Item_func_set_user_var(thd, name,
new (thd->mem_root) Item_null(thd))),
thd->mem_root);
- /* Create the variable */
- if (sql_set_variables(thd, &tmp_var_list, false))
+ /* Create the variable if the above allocations succeeded */
+ if (thd->is_fatal_error || sql_set_variables(thd, &tmp_var_list, false))
{
thd->lex= sav_lex;
goto err;
@@ -5837,20 +5837,25 @@ void Item_func_get_system_var::cleanup()
cached_strval.free();
}
+/**
+ @retval
+ 0 ok
+ 1 OOM error
+*/
-void Item_func_match::init_search(THD *thd, bool no_order)
+bool Item_func_match::init_search(THD *thd, bool no_order)
{
DBUG_ENTER("Item_func_match::init_search");
if (!table->file->get_table()) // the handler isn't opened yet
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
/* Check if init_search() has been called before */
if (ft_handler)
{
if (join_key)
table->file->ft_handler= ft_handler;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
if (key == NO_SUCH_KEY)
@@ -5862,6 +5867,8 @@ void Item_func_match::init_search(THD *thd, bool no_order)
for (uint i= 1; i < arg_count; i++)
fields.push_back(args[i]);
concat_ws= new (thd->mem_root) Item_func_concat_ws(thd, fields);
+ if (thd->is_fatal_error)
+ DBUG_RETURN(1); // OOM
/*
Above function used only to get value and do not need fix_fields for it:
Item_string - basic constant
@@ -5874,10 +5881,11 @@ void Item_func_match::init_search(THD *thd, bool no_order)
if (master)
{
join_key= master->join_key= join_key | master->join_key;
- master->init_search(thd, no_order);
+ if (master->init_search(thd, no_order))
+ DBUG_RETURN(1);
ft_handler= master->ft_handler;
join_key= master->join_key;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
String *ft_tmp= 0;
@@ -5892,8 +5900,9 @@ void Item_func_match::init_search(THD *thd, bool no_order)
if (ft_tmp->charset() != cmp_collation.collation)
{
uint dummy_errors;
- search_value.copy(ft_tmp->ptr(), ft_tmp->length(), ft_tmp->charset(),
- cmp_collation.collation, &dummy_errors);
+ if (search_value.copy(ft_tmp->ptr(), ft_tmp->length(), ft_tmp->charset(),
+ cmp_collation.collation, &dummy_errors))
+ DBUG_RETURN(1);
ft_tmp= &search_value;
}
@@ -5908,7 +5917,7 @@ void Item_func_match::init_search(THD *thd, bool no_order)
if (join_key)
table->file->ft_handler=ft_handler;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
diff --git a/sql/item_func.h b/sql/item_func.h
index ddf830395e5..c4a87b4f699 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -822,8 +822,8 @@ public:
{
return Cursor_ref::print_func(str, func_name());
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_cursor_rowcount>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_cursor_rowcount>(thd, this); }
};
@@ -842,8 +842,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_connection_id>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_connection_id>(thd, this); }
};
@@ -899,8 +899,8 @@ public:
virtual void print(String *str, enum_query_type query_type);
uint decimal_precision() const { return args[0]->decimal_precision(); }
bool need_parentheses_in_default() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_signed>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_signed>(thd, this); }
};
@@ -930,8 +930,8 @@ public:
}
uint decimal_precision() const { return max_length; }
virtual void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_unsigned>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_unsigned>(thd, this); }
};
@@ -960,8 +960,8 @@ public:
const char *func_name() const { return "decimal_typecast"; }
virtual void print(String *str, enum_query_type query_type);
bool need_parentheses_in_default() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_decimal_typecast>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_decimal_typecast>(thd, this); }
};
@@ -983,8 +983,8 @@ public:
const char *func_name() const { return "double_typecast"; }
virtual void print(String *str, enum_query_type query_type);
bool need_parentheses_in_default() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_double_typecast>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_double_typecast>(thd, this); }
};
@@ -1010,8 +1010,8 @@ public:
longlong int_op();
double real_op();
my_decimal *decimal_op(my_decimal *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_plus>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_plus>(thd, this); }
};
class Item_func_minus :public Item_func_additive_op
@@ -1041,8 +1041,8 @@ public:
Item_func_additive_op::fix_length_and_dec_int();
fix_unsigned_flag();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_minus>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_minus>(thd, this); }
};
@@ -1060,8 +1060,8 @@ public:
void fix_length_and_dec();
bool check_partition_func_processor(void *int_arg) {return FALSE;}
bool check_vcol_func_processor(void *arg) { return FALSE;}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_mul>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_mul>(thd, this); }
};
@@ -1079,8 +1079,8 @@ public:
void fix_length_and_dec_double();
void fix_length_and_dec_int();
void result_precision();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_div>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_div>(thd, this); }
};
@@ -1103,8 +1103,8 @@ public:
bool check_partition_func_processor(void *int_arg) {return FALSE;}
bool check_vcol_func_processor(void *arg) { return FALSE;}
bool need_parentheses_in_default() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_int_div>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_int_div>(thd, this); }
};
@@ -1138,8 +1138,8 @@ public:
}
bool check_partition_func_processor(void *int_arg) {return FALSE;}
bool check_vcol_func_processor(void *arg) { return FALSE;}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_mod>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_mod>(thd, this); }
};
@@ -1164,8 +1164,8 @@ public:
void fix_length_and_dec();
uint decimal_precision() const { return args[0]->decimal_precision(); }
bool need_parentheses_in_default() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_neg>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_neg>(thd, this); }
};
@@ -1181,8 +1181,8 @@ public:
void fix_length_and_dec_double();
void fix_length_and_dec_decimal();
void fix_length_and_dec();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_abs>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_abs>(thd, this); }
};
// A class to handle logarithmic and trigonometric functions
@@ -1207,8 +1207,8 @@ public:
Item_func_exp(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "exp"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_exp>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_exp>(thd, this); }
};
@@ -1218,8 +1218,8 @@ public:
Item_func_ln(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "ln"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_ln>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_ln>(thd, this); }
};
@@ -1230,8 +1230,8 @@ public:
Item_func_log(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {}
double val_real();
const char *func_name() const { return "log"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_log>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_log>(thd, this); }
};
@@ -1241,8 +1241,8 @@ public:
Item_func_log2(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "log2"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_log2>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_log2>(thd, this); }
};
@@ -1252,8 +1252,8 @@ public:
Item_func_log10(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "log10"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_log10>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_log10>(thd, this); }
};
@@ -1263,8 +1263,8 @@ public:
Item_func_sqrt(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "sqrt"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sqrt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sqrt>(thd, this); }
};
@@ -1274,8 +1274,8 @@ public:
Item_func_pow(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {}
double val_real();
const char *func_name() const { return "pow"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_pow>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_pow>(thd, this); }
};
@@ -1285,8 +1285,8 @@ public:
Item_func_acos(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "acos"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_acos>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_acos>(thd, this); }
};
class Item_func_asin :public Item_dec_func
@@ -1295,8 +1295,8 @@ public:
Item_func_asin(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "asin"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_asin>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_asin>(thd, this); }
};
class Item_func_atan :public Item_dec_func
@@ -1306,8 +1306,8 @@ public:
Item_func_atan(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {}
double val_real();
const char *func_name() const { return "atan"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_atan>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_atan>(thd, this); }
};
class Item_func_cos :public Item_dec_func
@@ -1316,8 +1316,8 @@ public:
Item_func_cos(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "cos"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_cos>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_cos>(thd, this); }
};
class Item_func_sin :public Item_dec_func
@@ -1326,8 +1326,8 @@ public:
Item_func_sin(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "sin"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sin>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sin>(thd, this); }
};
class Item_func_tan :public Item_dec_func
@@ -1336,8 +1336,8 @@ public:
Item_func_tan(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "tan"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_tan>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_tan>(thd, this); }
};
class Item_func_cot :public Item_dec_func
@@ -1346,8 +1346,8 @@ public:
Item_func_cot(THD *thd, Item *a): Item_dec_func(thd, a) {}
double val_real();
const char *func_name() const { return "cot"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_cot>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_cot>(thd, this); }
};
@@ -1369,8 +1369,8 @@ public:
longlong int_op();
double real_op();
my_decimal *decimal_op(my_decimal *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_ceiling>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_ceiling>(thd, this); }
};
@@ -1382,8 +1382,8 @@ public:
longlong int_op();
double real_op();
my_decimal *decimal_op(my_decimal *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_floor>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_floor>(thd, this); }
};
/* This handles round and truncate */
@@ -1407,8 +1407,8 @@ public:
{
args[0]->type_handler()->Item_func_round_fix_length_and_dec(this);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_round>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_round>(thd, this); }
};
@@ -1432,8 +1432,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_rand>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_rand>(thd, this); }
private:
void seed_random (Item * val);
};
@@ -1449,8 +1449,8 @@ public:
uint decimal_precision() const { return 1; }
void fix_length_and_dec() { fix_char_length(2); }
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sign>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sign>(thd, this); }
};
@@ -1468,8 +1468,8 @@ public:
const char *func_name() const { return name; }
void fix_length_and_dec()
{ decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_units>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_units>(thd, this); }
};
@@ -1563,8 +1563,8 @@ class Item_func_min :public Item_func_min_max
public:
Item_func_min(THD *thd, List<Item> &list): Item_func_min_max(thd, list, 1) {}
const char *func_name() const { return "least"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_min>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_min>(thd, this); }
};
class Item_func_max :public Item_func_min_max
@@ -1572,8 +1572,8 @@ class Item_func_max :public Item_func_min_max
public:
Item_func_max(THD *thd, List<Item> &list): Item_func_min_max(thd, list, -1) {}
const char *func_name() const { return "greatest"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_max>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_max>(thd, this); }
};
@@ -1604,8 +1604,8 @@ public:
/* The item could be a NULL constant. */
null_value= args[0]->is_null();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_rollup_const>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_rollup_const>(thd, this); }
};
@@ -1626,8 +1626,8 @@ public:
Item_func_octet_length(THD *thd, Item *a): Item_long_func_length(thd, a) {}
longlong val_int();
const char *func_name() const { return "octet_length"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_octet_length>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_octet_length>(thd, this); }
};
class Item_func_bit_length :public Item_longlong_func
@@ -1641,8 +1641,8 @@ public:
}
longlong val_int();
const char *func_name() const { return "bit_length"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_bit_length>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_bit_length>(thd, this); }
};
class Item_func_char_length :public Item_long_func_length
@@ -1652,8 +1652,8 @@ public:
Item_func_char_length(THD *thd, Item *a): Item_long_func_length(thd, a) {}
longlong val_int();
const char *func_name() const { return "char_length"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_char_length>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_char_length>(thd, this); }
};
class Item_func_coercibility :public Item_long_func
@@ -1673,8 +1673,8 @@ public:
Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
{ return this; }
bool const_item() const { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_coercibility>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_coercibility>(thd, this); }
};
@@ -1706,8 +1706,8 @@ public:
agg_arg_charsets_for_comparison(cmp_collation, args, 2);
}
virtual void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_locate>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_locate>(thd, this); }
};
@@ -1721,8 +1721,8 @@ public:
longlong val_int();
const char *func_name() const { return "field"; }
void fix_length_and_dec();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_field>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_field>(thd, this); }
};
@@ -1736,8 +1736,8 @@ public:
longlong val_int();
const char *func_name() const { return "ascii"; }
void fix_length_and_dec() { max_length=3; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_ascii>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_ascii>(thd, this); }
};
class Item_func_ord :public Item_long_func
@@ -1750,8 +1750,8 @@ public:
void fix_length_and_dec() { fix_char_length(7); }
longlong val_int();
const char *func_name() const { return "ord"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_ord>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_ord>(thd, this); }
};
class Item_func_find_in_set :public Item_long_func
@@ -1768,8 +1768,8 @@ public:
longlong val_int();
const char *func_name() const { return "find_in_set"; }
void fix_length_and_dec();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_find_in_set>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_find_in_set>(thd, this); }
};
/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
@@ -1797,8 +1797,8 @@ public:
longlong val_int();
const char *func_name() const { return "|"; }
enum precedence precedence() const { return BITOR_PRECEDENCE; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_bit_or>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_bit_or>(thd, this); }
};
class Item_func_bit_and :public Item_func_bit
@@ -1808,8 +1808,8 @@ public:
longlong val_int();
const char *func_name() const { return "&"; }
enum precedence precedence() const { return BITAND_PRECEDENCE; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_bit_and>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_bit_and>(thd, this); }
};
class Item_func_bit_count :public Item_long_func
@@ -1821,8 +1821,8 @@ public:
longlong val_int();
const char *func_name() const { return "bit_count"; }
void fix_length_and_dec() { max_length=2; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_bit_count>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_bit_count>(thd, this); }
};
class Item_func_shift_left :public Item_func_bit
@@ -1832,8 +1832,8 @@ public:
longlong val_int();
const char *func_name() const { return "<<"; }
enum precedence precedence() const { return SHIFT_PRECEDENCE; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_shift_left>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_shift_left>(thd, this); }
};
class Item_func_shift_right :public Item_func_bit
@@ -1843,8 +1843,8 @@ public:
longlong val_int();
const char *func_name() const { return ">>"; }
enum precedence precedence() const { return SHIFT_PRECEDENCE; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_shift_right>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_shift_right>(thd, this); }
};
class Item_func_bit_neg :public Item_func_bit
@@ -1859,8 +1859,8 @@ public:
str->append(func_name());
args[0]->print_parenthesised(str, query_type, precedence());
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_bit_neg>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_bit_neg>(thd, this); }
};
@@ -1884,8 +1884,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_last_insert_id>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_last_insert_id>(thd, this); }
};
@@ -1908,8 +1908,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_benchmark>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_benchmark>(thd, this); }
};
@@ -1935,8 +1935,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sleep>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sleep>(thd, this); }
};
@@ -2063,8 +2063,8 @@ class Item_func_udf_float :public Item_udf_func
String *val_str(String *str);
const Type_handler *type_handler() const { return &type_handler_double; }
void fix_length_and_dec() { fix_num_length_and_dec(); }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_udf_float>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_udf_float>(thd, this); }
};
@@ -2081,8 +2081,8 @@ public:
String *val_str(String *str);
const Type_handler *type_handler() const { return &type_handler_longlong; }
void fix_length_and_dec() { decimals= 0; max_length= 21; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_udf_int>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_udf_int>(thd, this); }
};
@@ -2099,8 +2099,8 @@ public:
String *val_str(String *str);
const Type_handler *type_handler() const { return &type_handler_newdecimal; }
void fix_length_and_dec() { fix_num_length_and_dec(); }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_udf_decimal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_udf_decimal>(thd, this); }
};
@@ -2138,8 +2138,8 @@ public:
}
const Type_handler *type_handler() const { return string_type_handler(); }
void fix_length_and_dec();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_udf_str>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_udf_str>(thd, this); }
};
#else /* Dummy functions to get sql_yacc.cc compiled */
@@ -2221,8 +2221,8 @@ class Item_func_get_lock :public Item_long_func
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_get_lock>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_get_lock>(thd, this); }
};
class Item_func_release_lock :public Item_long_func
@@ -2245,8 +2245,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_release_lock>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_release_lock>(thd, this); }
};
/* replication functions */
@@ -2276,8 +2276,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_master_pos_wait>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_master_pos_wait>(thd, this); }
};
@@ -2301,8 +2301,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_master_gtid_wait>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_master_gtid_wait>(thd, this); }
};
@@ -2409,8 +2409,8 @@ public:
bool register_field_in_bitmap(void *arg);
bool set_entry(THD *thd, bool create_if_not_exists);
void cleanup();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_set_user_var>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_set_user_var>(thd, this); }
};
@@ -2437,8 +2437,8 @@ public:
table_map used_tables() const
{ return const_item() ? 0 : RAND_TABLE_BIT; }
bool eq(const Item *item, bool binary_cmp) const;
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_get_user_var>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_get_user_var>(thd, this); }
private:
bool set_value(THD *thd, sp_rcontext *ctx, Item **it);
@@ -2482,8 +2482,8 @@ public:
void set_null_value(CHARSET_INFO* cs);
void set_value(const char *str, uint length, CHARSET_INFO* cs);
const Type_handler *type_handler() const { return &type_handler_double; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_user_var_as_out_param>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_user_var_as_out_param>(thd, this); }
};
@@ -2537,8 +2537,8 @@ public:
void cleanup();
bool check_vcol_func_processor(void *arg);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_get_system_var>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_get_system_var>(thd, this); }
};
@@ -2587,14 +2587,14 @@ public:
virtual void print(String *str, enum_query_type query_type);
bool fix_index();
- void init_search(THD *thd, bool no_order);
+ bool init_search(THD *thd, bool no_order);
bool check_vcol_func_processor(void *arg)
{
return mark_unsupported_function("match ... against()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_match>(thd, mem_root, this); }
- Item *build_clone(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_match>(thd, this); }
+ Item *build_clone(THD *thd) { return 0; }
private:
/**
Check whether storage engine for given table,
@@ -2639,8 +2639,8 @@ public:
longlong val_int();
const char *func_name() const { return "^"; }
enum precedence precedence() const { return BITXOR_PRECEDENCE; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_bit_xor>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_bit_xor>(thd, this); }
};
class Item_func_is_free_lock :public Item_long_func
@@ -2657,8 +2657,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_is_free_lock>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_is_free_lock>(thd, this); }
};
class Item_func_is_used_lock :public Item_long_func
@@ -2675,8 +2675,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_is_used_lock>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_is_used_lock>(thd, this); }
};
@@ -2724,8 +2724,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_row_count>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_row_count>(thd, this); }
};
@@ -2867,11 +2867,11 @@ public:
{
return TRUE;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sp>(thd, mem_root, this); }
- Item *build_clone(THD *thd, MEM_ROOT *mem_root)
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sp>(thd, this); }
+ Item *build_clone(THD *thd)
{
- Item_func_sp *clone= (Item_func_sp *) Item_func::build_clone(thd, mem_root);
+ Item_func_sp *clone= (Item_func_sp *) Item_func::build_clone(thd);
if (clone)
clone->sp_result_field= NULL;
return clone;
@@ -2895,8 +2895,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_found_rows>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_found_rows>(thd, this); }
};
@@ -2914,8 +2914,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_oracle_sql_rowcount>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_oracle_sql_rowcount>(thd, this); }
};
@@ -2938,8 +2938,8 @@ public:
maybe_null= null_value= false;
max_length= 11;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sqlcode>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sqlcode>(thd, this); }
};
@@ -2958,8 +2958,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_uuid_short>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_uuid_short>(thd, this); }
};
@@ -2988,8 +2988,8 @@ public:
Item_func::update_used_tables();
maybe_null= last_value->maybe_null;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_last_value>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_last_value>(thd, this); }
};
@@ -3011,8 +3011,8 @@ public:
maybe_null= 1; /* In case of errors */
}
bool const_item() const { return 0; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_nextval>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_nextval>(thd, this); }
void print(String *str, enum_query_type query_type);
bool check_vcol_func_processor(void *arg)
{
@@ -3031,8 +3031,8 @@ public:
Item_func_nextval(thd, table) {}
longlong val_int();
const char *func_name() const { return "lastval"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_lastval>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_lastval>(thd, this); }
};
@@ -3052,8 +3052,8 @@ public:
longlong val_int();
const char *func_name() const { return "setval"; }
void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_setval>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_setval>(thd, this); }
};
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index d332d067c37..8101433abb5 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -202,8 +202,8 @@ public:
Item_geometry_func(thd, a, srid) {}
const char *func_name() const { return "st_geometryfromtext"; }
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_geometry_from_text>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_geometry_from_text>(thd, this); }
};
class Item_func_geometry_from_wkb: public Item_geometry_func
@@ -219,8 +219,8 @@ public:
Item_geometry_func(thd, a, srid) {}
const char *func_name() const { return "st_geometryfromwkb"; }
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_geometry_from_wkb>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_geometry_from_wkb>(thd, this); }
};
@@ -241,8 +241,8 @@ public:
Item_geometry_func(thd, js, opt, srid) {}
const char *func_name() const { return "st_geomfromgeojson"; }
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_geometry_from_json>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_geometry_from_json>(thd, this); }
};
@@ -254,8 +254,8 @@ public:
const char *func_name() const { return "st_astext"; }
String *val_str_ascii(String *);
void fix_length_and_dec();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_as_wkt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_as_wkt>(thd, this); }
};
class Item_func_as_wkb: public Item_binary_func_args_geometry
@@ -273,8 +273,8 @@ public:
max_length= (uint32) UINT_MAX32;
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_as_wkb>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_as_wkb>(thd, this); }
};
@@ -296,8 +296,8 @@ public:
const char *func_name() const { return "st_asgeojson"; }
void fix_length_and_dec();
String *val_str_ascii(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_as_geojson>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_as_geojson>(thd, this); }
};
@@ -314,8 +314,8 @@ public:
fix_length_and_charset(20, default_charset());
maybe_null= 1;
};
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_geometry_type>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_geometry_type>(thd, this); }
};
@@ -349,8 +349,8 @@ public:
{}
const char *func_name() const { return "st_convexhull"; }
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_convexhull>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_convexhull>(thd, this); }
};
@@ -362,8 +362,8 @@ public:
const char *func_name() const { return "st_centroid"; }
String *val_str(String *);
Field::geometry_type get_geometry_type() const;
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_centroid>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_centroid>(thd, this); }
};
class Item_func_envelope: public Item_geometry_func_args_geometry
@@ -374,8 +374,8 @@ public:
const char *func_name() const { return "st_envelope"; }
String *val_str(String *);
Field::geometry_type get_geometry_type() const;
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_envelope>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_envelope>(thd, this); }
};
@@ -408,8 +408,8 @@ public:
:Item_geometry_func_args_geometry(thd, a) {}
const char *func_name() const { return "st_boundary"; }
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_boundary>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_boundary>(thd, this); }
};
@@ -424,8 +424,8 @@ public:
const char *func_name() const { return "point"; }
String *val_str(String *);
Field::geometry_type get_geometry_type() const;
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_point>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_point>(thd, this); }
};
class Item_func_spatial_decomp: public Item_geometry_func_args_geometry
@@ -450,8 +450,8 @@ public:
}
}
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_spatial_decomp>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_spatial_decomp>(thd, this); }
};
class Item_func_spatial_decomp_n: public Item_geometry_func_args_geometry
@@ -483,8 +483,8 @@ public:
}
}
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_spatial_decomp_n>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_spatial_decomp_n>(thd, this); }
};
class Item_func_spatial_collection: public Item_geometry_func
@@ -521,8 +521,8 @@ public:
}
const char *func_name() const { return "geometrycollection"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_spatial_collection>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_spatial_collection>(thd, this); }
};
@@ -571,7 +571,7 @@ public:
usable_tables, sargables, false);
}
bool need_parentheses_in_default() { return false; }
- Item *build_clone(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item *build_clone(THD *thd) { return 0; }
};
@@ -583,8 +583,8 @@ public:
{ }
longlong val_int();
const char *func_name() const;
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_spatial_mbr_rel>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_spatial_mbr_rel>(thd, this); }
};
@@ -599,8 +599,8 @@ public:
{ }
longlong val_int();
const char *func_name() const;
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_spatial_precise_rel>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_spatial_precise_rel>(thd, this); }
};
@@ -622,8 +622,8 @@ public:
longlong val_int();
const char *func_name() const { return "st_relate"; }
bool need_parentheses_in_default() { return false; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_spatial_relate>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_spatial_relate>(thd, this); }
};
@@ -658,8 +658,8 @@ public:
{
Item_func::print(str, query_type);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_spatial_operation>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_spatial_operation>(thd, this); }
};
@@ -715,8 +715,8 @@ public:
:Item_geometry_func_args_geometry(thd, obj, distance) {}
const char *func_name() const { return "st_buffer"; }
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_buffer>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_buffer>(thd, this); }
};
@@ -729,8 +729,8 @@ public:
const char *func_name() const { return "st_isempty"; }
void fix_length_and_dec() { maybe_null= 1; }
bool need_parentheses_in_default() { return false; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_isempty>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_isempty>(thd, this); }
};
class Item_func_issimple: public Item_long_func_args_geometry
@@ -746,8 +746,8 @@ public:
const char *func_name() const { return "st_issimple"; }
void fix_length_and_dec() { decimals=0; max_length=2; }
uint decimal_precision() const { return 1; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_issimple>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_issimple>(thd, this); }
};
class Item_func_isclosed: public Item_long_func_args_geometry
@@ -759,8 +759,8 @@ public:
const char *func_name() const { return "st_isclosed"; }
void fix_length_and_dec() { decimals=0; max_length=2; }
uint decimal_precision() const { return 1; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_isclosed>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_isclosed>(thd, this); }
};
class Item_func_isring: public Item_func_issimple
@@ -769,8 +769,8 @@ public:
Item_func_isring(THD *thd, Item *a): Item_func_issimple(thd, a) {}
longlong val_int();
const char *func_name() const { return "st_isring"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_isring>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_isring>(thd, this); }
};
class Item_func_dimension: public Item_long_func_args_geometry
@@ -781,8 +781,8 @@ public:
longlong val_int();
const char *func_name() const { return "st_dimension"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_dimension>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dimension>(thd, this); }
};
@@ -797,8 +797,8 @@ public:
Item_real_func::fix_length_and_dec();
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_x>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_x>(thd, this); }
};
@@ -813,8 +813,8 @@ public:
Item_real_func::fix_length_and_dec();
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_y>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_y>(thd, this); }
};
@@ -826,8 +826,8 @@ public:
longlong val_int();
const char *func_name() const { return "st_numgeometries"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_numgeometries>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_numgeometries>(thd, this); }
};
@@ -839,8 +839,8 @@ public:
longlong val_int();
const char *func_name() const { return "st_numinteriorrings"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_numinteriorring>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_numinteriorring>(thd, this); }
};
@@ -852,8 +852,8 @@ public:
longlong val_int();
const char *func_name() const { return "st_numpoints"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_numpoints>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_numpoints>(thd, this); }
};
@@ -868,8 +868,8 @@ public:
Item_real_func::fix_length_and_dec();
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_area>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_area>(thd, this); }
};
@@ -886,8 +886,8 @@ public:
Item_real_func::fix_length_and_dec();
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_glength>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_glength>(thd, this); }
};
@@ -899,8 +899,8 @@ public:
longlong val_int();
const char *func_name() const { return "srid"; }
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_srid>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_srid>(thd, this); }
};
@@ -916,8 +916,8 @@ public:
:Item_real_func_args_geometry_geometry(thd, a, b) {}
double val_real();
const char *func_name() const { return "st_distance"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_distance>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_distance>(thd, this); }
};
@@ -933,8 +933,8 @@ public:
const char *func_name() const { return "st_pointonsurface"; }
String *val_str(String *);
Field::geometry_type get_geometry_type() const;
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_pointonsurface>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_pointonsurface>(thd, this); }
};
@@ -951,8 +951,8 @@ class Item_func_gis_debug: public Item_long_func
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_gis_debug>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_gis_debug>(thd, this); }
};
#endif
diff --git a/sql/item_inetfunc.h b/sql/item_inetfunc.h
index bd0a95b5270..d934cef43dd 100644
--- a/sql/item_inetfunc.h
+++ b/sql/item_inetfunc.h
@@ -39,8 +39,8 @@ public:
maybe_null= 1;
unsigned_flag= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_inet_aton>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_inet_aton>(thd, this); }
};
@@ -61,8 +61,8 @@ public:
fix_length_and_charset(3 * 8 + 7, default_charset());
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_inet_ntoa>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_inet_ntoa>(thd, this); }
};
@@ -130,8 +130,8 @@ public:
fix_length_and_charset(16, &my_charset_bin);
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_inet6_aton>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_inet6_aton>(thd, this); }
protected:
virtual bool calc_value(const String *arg, String *buffer);
@@ -164,8 +164,8 @@ public:
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_inet6_ntoa>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_inet6_ntoa>(thd, this); }
protected:
virtual bool calc_value(const String *arg, String *buffer);
@@ -186,8 +186,8 @@ public:
public:
virtual const char *func_name() const
{ return "is_ipv4"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_is_ipv4>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_is_ipv4>(thd, this); }
protected:
virtual bool calc_value(const String *arg);
@@ -208,8 +208,8 @@ public:
public:
virtual const char *func_name() const
{ return "is_ipv6"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_is_ipv6>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_is_ipv6>(thd, this); }
protected:
virtual bool calc_value(const String *arg);
@@ -230,8 +230,8 @@ public:
public:
virtual const char *func_name() const
{ return "is_ipv4_compat"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_is_ipv4_compat>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_is_ipv4_compat>(thd, this); }
protected:
virtual bool calc_value(const String *arg);
@@ -252,8 +252,8 @@ public:
public:
virtual const char *func_name() const
{ return "is_ipv4_mapped"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_is_ipv4_mapped>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_is_ipv4_mapped>(thd, this); }
protected:
virtual bool calc_value(const String *arg);
diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h
index 77e7588be25..354de69eee4 100644
--- a/sql/item_jsonfunc.h
+++ b/sql/item_jsonfunc.h
@@ -54,8 +54,8 @@ public:
Item_bool_func::fix_length_and_dec();
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_valid>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_valid>(thd, this); }
};
@@ -70,8 +70,8 @@ public:
Item_bool_func(thd, js, i_path) {}
const char *func_name() const { return "json_exists"; }
void fix_length_and_dec();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_exists>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_exists>(thd, this); }
longlong val_int();
};
@@ -89,8 +89,8 @@ public:
void fix_length_and_dec();
String *val_str(String *);
virtual bool check_and_get_value(json_engine_t *je, String *res, int *error);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_value>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_value>(thd, this); }
};
@@ -102,8 +102,8 @@ public:
bool is_json_type() { return true; }
const char *func_name() const { return "json_query"; }
bool check_and_get_value(json_engine_t *je, String *res, int *error);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_query>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_query>(thd, this); }
};
@@ -117,8 +117,8 @@ public:
const char *func_name() const { return "json_quote"; }
void fix_length_and_dec();
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_quote>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_quote>(thd, this); }
};
@@ -132,8 +132,8 @@ public:
const char *func_name() const { return "json_unquote"; }
void fix_length_and_dec();
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_unquote>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_unquote>(thd, this); }
};
@@ -168,8 +168,8 @@ public:
longlong val_int();
double val_real();
uint get_n_paths() const { return arg_count - 1; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_extract>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_extract>(thd, this); }
};
@@ -187,8 +187,8 @@ public:
const char *func_name() const { return "json_contains"; }
void fix_length_and_dec();
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_contains>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_contains>(thd, this); }
};
@@ -210,8 +210,8 @@ public:
void fix_length_and_dec();
void cleanup();
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_contains_path>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_contains_path>(thd, this); }
};
@@ -229,8 +229,8 @@ public:
bool is_json_type() { return true; }
void fix_length_and_dec();
const char *func_name() const { return "json_array"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_array>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_array>(thd, this); }
};
@@ -246,8 +246,8 @@ public:
String *val_str(String *);
uint get_n_paths() const { return arg_count/2; }
const char *func_name() const { return "json_array_append"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_array_append>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_array_append>(thd, this); }
};
@@ -258,8 +258,8 @@ public:
Item_func_json_array_append(thd, list) {}
String *val_str(String *);
const char *func_name() const { return "json_array_insert"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_array_insert>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_array_insert>(thd, this); }
};
@@ -273,8 +273,8 @@ public:
String *val_str(String *);
bool is_json_type() { return true; }
const char *func_name() const { return "json_object"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_object>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_object>(thd, this); }
};
@@ -288,8 +288,8 @@ public:
String *val_str(String *);
bool is_json_type() { return true; }
const char *func_name() const { return "json_merge"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_merge>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_merge>(thd, this); }
};
@@ -311,8 +311,8 @@ public:
const char *func_name() const { return "json_length"; }
void fix_length_and_dec();
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_length>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_length>(thd, this); }
};
@@ -327,8 +327,8 @@ public:
const char *func_name() const { return "json_depth"; }
void fix_length_and_dec() { max_length= 10; }
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_depth>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_depth>(thd, this); }
};
@@ -341,8 +341,8 @@ public:
const char *func_name() const { return "json_type"; }
void fix_length_and_dec();
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_type>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_type>(thd, this); }
};
@@ -364,8 +364,8 @@ public:
return mode_insert ?
(mode_replace ? "json_set" : "json_insert") : "json_update";
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_insert>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_insert>(thd, this); }
};
@@ -380,8 +380,8 @@ public:
String *val_str(String *);
uint get_n_paths() const { return arg_count - 1; }
const char *func_name() const { return "json_remove"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_remove>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_remove>(thd, this); }
};
@@ -397,8 +397,8 @@ public:
const char *func_name() const { return "json_keys"; }
void fix_length_and_dec();
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_keys>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_keys>(thd, this); }
};
@@ -422,8 +422,8 @@ public:
void fix_length_and_dec();
String *val_str(String *);
uint get_n_paths() const { return arg_count > 4 ? arg_count - 4 : 0; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_search>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_search>(thd, this); }
};
@@ -451,8 +451,8 @@ public:
String *val_str(String *str);
String *val_json(String *str);
bool is_json_type() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_json_format>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_json_format>(thd, this); }
};
diff --git a/sql/item_row.cc b/sql/item_row.cc
index 9c029b16292..eae88cd2e6e 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -163,15 +163,15 @@ void Item_row::bring_value()
}
-Item* Item_row::build_clone(THD *thd, MEM_ROOT *mem_root)
+Item* Item_row::build_clone(THD *thd)
{
- Item_row *copy= (Item_row *) get_copy(thd, mem_root);
+ Item_row *copy= (Item_row *) get_copy(thd);
if (!copy)
return 0;
- copy->args= (Item**) alloc_root(mem_root, sizeof(Item*) * arg_count);
+ copy->args= (Item**) alloc_root(thd->mem_root, sizeof(Item*) * arg_count);
for (uint i= 0; i < arg_count; i++)
{
- Item *arg_clone= args[i]->build_clone(thd, mem_root);
+ Item *arg_clone= args[i]->build_clone(thd);
if (!arg_clone)
return 0;
copy->args[i]= arg_clone;
diff --git a/sql/item_row.h b/sql/item_row.h
index a6fdd2b212c..a66ae7fb5dc 100644
--- a/sql/item_row.h
+++ b/sql/item_row.h
@@ -128,9 +128,9 @@ public:
}
bool check_vcol_func_processor(void *arg) {return FALSE; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_row>(thd, mem_root, this); }
- Item *build_clone(THD *thd, MEM_ROOT *mem_root);
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_row>(thd, this); }
+ Item *build_clone(THD *thd);
};
#endif /* ITEM_ROW_INCLUDED */
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index fbcf69d00ce..5b5826b4637 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -147,8 +147,8 @@ public:
fix_length_and_charset(32, default_charset());
}
const char *func_name() const { return "md5"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_md5>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_md5>(thd, this); }
};
@@ -159,8 +159,8 @@ public:
String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "sha"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sha>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sha>(thd, this); }
};
class Item_func_sha2 :public Item_str_ascii_checksum_func
@@ -171,8 +171,8 @@ public:
String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "sha2"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sha2>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sha2>(thd, this); }
};
class Item_func_to_base64 :public Item_str_ascii_checksum_func
@@ -184,8 +184,8 @@ public:
String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "to_base64"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_to_base64>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_to_base64>(thd, this); }
};
class Item_func_from_base64 :public Item_str_binary_checksum_func
@@ -197,8 +197,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "from_base64"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_from_base64>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_from_base64>(thd, this); }
};
#include <my_crypt.h>
@@ -223,8 +223,8 @@ public:
Item_aes_crypt(thd, a, b) {}
void fix_length_and_dec();
const char *func_name() const { return "aes_encrypt"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_aes_encrypt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_aes_encrypt>(thd, this); }
};
class Item_func_aes_decrypt :public Item_aes_crypt
@@ -234,8 +234,8 @@ public:
Item_aes_crypt(thd, a, b) {}
void fix_length_and_dec();
const char *func_name() const { return "aes_decrypt"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_aes_decrypt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_aes_decrypt>(thd, this); }
};
@@ -281,8 +281,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "concat"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_concat>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_concat>(thd, this); }
};
@@ -301,9 +301,9 @@ public:
{ }
String *val_str(String *);
const char *func_name() const { return "concat_operator_oracle"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ Item *get_copy(THD *thd)
{
- return get_item_copy<Item_func_concat_operator_oracle>(thd, mem_root, this);
+ return get_item_copy<Item_func_concat_operator_oracle>(thd, this);
}
};
@@ -321,8 +321,8 @@ public:
maybe_null= 1;
}
const char *func_name() const { return "decode_histogram"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_decode_histogram>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_decode_histogram>(thd, this); }
};
class Item_func_concat_ws :public Item_str_func
@@ -334,8 +334,8 @@ public:
void fix_length_and_dec();
const char *func_name() const { return "concat_ws"; }
table_map not_null_tables() const { return 0; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_concat_ws>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_concat_ws>(thd, this); }
};
class Item_func_reverse :public Item_str_func
@@ -346,8 +346,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "reverse"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_reverse>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_reverse>(thd, this); }
};
@@ -361,8 +361,8 @@ public:
void fix_length_and_dec();
String *val_str_internal(String *str, String *empty_string_for_null);
const char *func_name() const { return "replace"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_replace>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_replace>(thd, this); }
};
@@ -374,8 +374,8 @@ public:
Item_func_replace(thd, org, find, replace) {}
String *val_str(String *to) { return val_str_internal(to, &tmp_emtpystr); };
const char *func_name() const { return "replace_oracle"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_replace_oracle>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_replace_oracle>(thd, this); }
};
@@ -400,7 +400,7 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp_replace"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0;}
+ Item *get_copy(THD *thd) { return 0;}
};
@@ -422,7 +422,7 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp_substr"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item *get_copy(THD *thd) { return 0; }
};
@@ -436,8 +436,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "insert"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_insert>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_insert>(thd, this); }
};
@@ -459,8 +459,8 @@ public:
Item_func_lcase(THD *thd, Item *item): Item_str_conv(thd, item) {}
const char *func_name() const { return "lcase"; }
void fix_length_and_dec();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_lcase>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_lcase>(thd, this); }
};
class Item_func_ucase :public Item_str_conv
@@ -469,8 +469,8 @@ public:
Item_func_ucase(THD *thd, Item *item): Item_str_conv(thd, item) {}
const char *func_name() const { return "ucase"; }
void fix_length_and_dec();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_ucase>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_ucase>(thd, this); }
};
@@ -482,8 +482,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "left"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_left>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_left>(thd, this); }
};
@@ -495,8 +495,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "right"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_right>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_right>(thd, this); }
};
@@ -512,8 +512,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "substr"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_substr>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_substr>(thd, this); }
};
class Item_func_substr_oracle :public Item_func_substr
@@ -527,8 +527,8 @@ public:
Item_func_substr_oracle(THD *thd, Item *a, Item *b, Item *c):
Item_func_substr(thd, a, b, c) {}
const char *func_name() const { return "substr_oracle"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_substr_oracle>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_substr_oracle>(thd, this); }
};
class Item_func_substr_index :public Item_str_func
@@ -540,8 +540,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "substring_index"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_substr_index>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_substr_index>(thd, this); }
};
@@ -574,8 +574,8 @@ public:
const char *func_name() const { return "trim"; }
void print(String *str, enum_query_type query_type);
virtual const char *mode_name() const { return "both"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_trim>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_trim>(thd, this); }
};
@@ -587,8 +587,8 @@ public:
String *val_str(String *);
const char *func_name() const { return "ltrim"; }
const char *mode_name() const { return "leading"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_ltrim>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_ltrim>(thd, this); }
};
@@ -600,8 +600,8 @@ public:
String *val_str(String *);
const char *func_name() const { return "rtrim"; }
const char *mode_name() const { return "trailing"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_rtrim>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_rtrim>(thd, this); }
};
@@ -639,8 +639,8 @@ public:
"password" : "old_password"); }
static char *alloc(THD *thd, const char *password, size_t pass_len,
enum PW_Alg al);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_password>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_password>(thd, this); }
};
@@ -661,8 +661,8 @@ public:
max_length = args[0]->max_length + 9;
}
const char *func_name() const { return "des_encrypt"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_des_encrypt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_des_encrypt>(thd, this); }
};
class Item_func_des_decrypt :public Item_str_binary_checksum_func
@@ -683,8 +683,8 @@ public:
max_length-= 9U;
}
const char *func_name() const { return "des_decrypt"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_des_decrypt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_des_decrypt>(thd, this); }
};
@@ -719,8 +719,8 @@ public:
{
return FALSE;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_encrypt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_encrypt>(thd, this); }
};
#include "sql_crypt.h"
@@ -739,8 +739,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "encode"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_encode>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_encode>(thd, this); }
protected:
virtual void crypto_transform(String *);
private:
@@ -754,8 +754,8 @@ class Item_func_decode :public Item_func_encode
public:
Item_func_decode(THD *thd, Item *a, Item *seed_arg): Item_func_encode(thd, a, seed_arg) {}
const char *func_name() const { return "decode"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_decode>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_decode>(thd, this); }
protected:
void crypto_transform(String *);
};
@@ -794,8 +794,8 @@ public:
}
const char *func_name() const { return "database"; }
const char *fully_qualified_func_name() const { return "database()"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_database>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_database>(thd, this); }
};
@@ -815,8 +815,8 @@ public:
max_length= 512 * system_charset_info->mbmaxlen;
null_value= maybe_null= false;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sqlerrm>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sqlerrm>(thd, this); }
};
@@ -847,8 +847,8 @@ public:
{
return save_str_value_in_field(field, &str_value);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_user>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_user>(thd, this); }
};
@@ -897,8 +897,8 @@ public:
return mark_unsupported_function(fully_qualified_func_name(), arg,
VCOL_SESSION_FUNC);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_current_role>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_current_role>(thd, this); }
};
@@ -910,8 +910,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "soundex"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_soundex>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_soundex>(thd, this); }
};
@@ -924,8 +924,8 @@ public:
String *val_str(String *str);
void fix_length_and_dec();
const char *func_name() const { return "elt"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_elt>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_elt>(thd, this); }
};
@@ -938,8 +938,8 @@ public:
String *val_str(String *str);
void fix_length_and_dec();
const char *func_name() const { return "make_set"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_make_set>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_make_set>(thd, this); }
};
@@ -955,8 +955,8 @@ public:
String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "format"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_format>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_format>(thd, this); }
};
@@ -978,8 +978,8 @@ public:
max_length= arg_count * 4;
}
const char *func_name() const { return "char"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_char>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_char>(thd, this); }
};
class Item_func_chr :public Item_func_char
@@ -993,8 +993,8 @@ public:
max_length= 4;
}
const char *func_name() const { return "chr"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_chr>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_chr>(thd, this); }
};
class Item_func_repeat :public Item_str_func
@@ -1006,8 +1006,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "repeat"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_repeat>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_repeat>(thd, this); }
};
@@ -1018,8 +1018,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "space"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_space>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_space>(thd, this); }
};
@@ -1035,8 +1035,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_binlog_gtid_pos>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_binlog_gtid_pos>(thd, this); }
};
@@ -1062,8 +1062,8 @@ public:
Item_func_pad(thd, arg1, arg2) {}
String *val_str(String *);
const char *func_name() const { return "rpad"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_rpad>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_rpad>(thd, this); }
};
@@ -1076,8 +1076,8 @@ public:
Item_func_pad(thd, arg1, arg2) {}
String *val_str(String *);
const char *func_name() const { return "lpad"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_lpad>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_lpad>(thd, this); }
};
@@ -1094,8 +1094,8 @@ public:
max_length=64;
maybe_null= 1;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_conv>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_conv>(thd, this); }
};
@@ -1129,8 +1129,8 @@ public:
fix_char_length(args[0]->max_length * 2);
m_arg0_type_handler= args[0]->type_handler();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_hex>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_hex>(thd, this); }
};
class Item_func_unhex :public Item_str_func
@@ -1150,8 +1150,8 @@ public:
decimals=0;
max_length=(1+args[0]->max_length)/2;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_unhex>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_unhex>(thd, this); }
};
@@ -1182,8 +1182,8 @@ public:
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"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_like_range_min>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_like_range_min>(thd, this); }
};
@@ -1193,8 +1193,8 @@ public:
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"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_like_range_max>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_like_range_max>(thd, this); }
};
#endif
@@ -1220,8 +1220,8 @@ public:
void print(String *str, enum_query_type query_type);
const char *func_name() const { return "cast_as_binary"; }
bool need_parentheses_in_default() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_binary>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_binary>(thd, this); }
};
@@ -1242,8 +1242,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_load_file>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_load_file>(thd, this); }
};
@@ -1259,8 +1259,8 @@ class Item_func_export_set: public Item_str_func
String *val_str(String *str);
void fix_length_and_dec();
const char *func_name() const { return "export_set"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_export_set>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_export_set>(thd, this); }
};
@@ -1278,8 +1278,8 @@ public:
2 * collation.collation->mbmaxlen;
max_length= (uint32) MY_MIN(max_result_length, MAX_BLOB_WIDTH);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_quote>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_quote>(thd, this); }
};
class Item_func_conv_charset :public Item_str_func
@@ -1362,8 +1362,8 @@ public:
void fix_length_and_dec();
const char *func_name() const { return "convert"; }
void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_conv_charset>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_conv_charset>(thd, this); }
};
class Item_func_set_collation :public Item_str_func
@@ -1384,8 +1384,8 @@ public:
return args[0]->field_for_view_update();
}
bool need_parentheses_in_default() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_set_collation>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_set_collation>(thd, this); }
};
@@ -1413,8 +1413,8 @@ public:
:Item_func_expr_str_metadata(thd, a) { }
String *val_str(String *);
const char *func_name() const { return "charset"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_charset>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_charset>(thd, this); }
};
@@ -1425,8 +1425,8 @@ public:
:Item_func_expr_str_metadata(thd, a) {}
String *val_str(String *);
const char *func_name() const { return "collation"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_collation>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_collation>(thd, this); }
};
@@ -1460,8 +1460,8 @@ public:
Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
{ return this; }
void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_weight_string>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_weight_string>(thd, this); }
};
class Item_func_crc32 :public Item_long_func
@@ -1475,8 +1475,8 @@ public:
const char *func_name() const { return "crc32"; }
void fix_length_and_dec() { max_length=10; }
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_crc32>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_crc32>(thd, this); }
};
class Item_func_uncompressed_length : public Item_long_func_length
@@ -1488,8 +1488,8 @@ public:
const char *func_name() const{return "uncompressed_length";}
void fix_length_and_dec() { max_length=10; maybe_null= true; }
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_uncompressed_length>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_uncompressed_length>(thd, this); }
};
#ifdef HAVE_COMPRESS
@@ -1507,8 +1507,8 @@ public:
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
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_compress>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_compress>(thd, this); }
};
class Item_func_uncompress: public Item_str_binary_checksum_func
@@ -1520,8 +1520,8 @@ public:
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
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_uncompress>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_uncompress>(thd, this); }
};
@@ -1541,8 +1541,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_uuid>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_uuid>(thd, this); }
};
@@ -1564,8 +1564,8 @@ public:
String *val_str(String *);
void print(String *str, enum_query_type query_type);
enum Functype functype() const { return DYNCOL_FUNC; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_dyncol_create>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dyncol_create>(thd, this); }
};
@@ -1578,8 +1578,8 @@ public:
const char *func_name() const{ return "column_add"; }
String *val_str(String *);
void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_dyncol_add>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dyncol_add>(thd, this); }
};
class Item_func_dyncol_json: public Item_str_func
@@ -1595,8 +1595,8 @@ public:
collation.set(&my_charset_bin);
decimals= 0;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_dyncol_json>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dyncol_json>(thd, this); }
};
/*
@@ -1637,8 +1637,8 @@ public:
bool get_dyn_value(THD *thd, DYNAMIC_COLUMN_VALUE *val, String *tmp);
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_dyncol_get>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_dyncol_get>(thd, this); }
};
@@ -1649,8 +1649,8 @@ public:
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 *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_dyncol_list>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dyncol_list>(thd, this); }
};
#endif /* ITEM_STRFUNC_INCLUDED */
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 9e548e94ac1..e48b45fb11e 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -263,8 +263,8 @@ public:
void register_as_with_rec_ref(With_element *with_elem);
void init_expr_cache_tracker(THD *thd);
- Item* build_clone(THD *thd, MEM_ROOT *mem_root) { return 0; }
- Item* get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item* build_clone(THD *thd) { return 0; }
+ Item* get_copy(THD *thd) { return 0; }
bool wrap_tvc_in_derived_table(THD *thd, st_select_lex *tvc_sl);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index e91728a1aa1..9822f9e5430 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -792,8 +792,8 @@ public:
}
Item *copy_or_same(THD* thd);
void remove();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_sum>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_sum>(thd, this); }
bool supports_removal() const
{
@@ -856,8 +856,8 @@ class Item_sum_count :public Item_sum_int
return has_with_distinct() ? "count(distinct " : "count(";
}
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_count>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_count>(thd, this); }
bool supports_removal() const
{
@@ -912,8 +912,8 @@ public:
count= 0;
Item_sum_sum::cleanup();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_avg>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_avg>(thd, this); }
bool supports_removal() const
{
@@ -978,8 +978,8 @@ public:
count= 0;
Item_sum_num::cleanup();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_variance>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_variance>(thd, this); }
};
/*
@@ -999,8 +999,8 @@ class Item_sum_std :public Item_sum_variance
Item *result_item(THD *thd, Field *field);
const char *func_name() const { return "std("; }
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_std>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_std>(thd, this); }
};
// This class is a string or number function depending on num_func
@@ -1069,8 +1069,8 @@ public:
bool add();
const char *func_name() const { return "min("; }
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_min>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_min>(thd, this); }
};
@@ -1084,8 +1084,8 @@ public:
bool add();
const char *func_name() const { return "max("; }
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_max>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_max>(thd, this); }
};
@@ -1165,8 +1165,8 @@ public:
bool add();
const char *func_name() const { return "bit_or("; }
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_or>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_or>(thd, this); }
private:
void set_bits_from_counters();
@@ -1182,8 +1182,8 @@ public:
bool add();
const char *func_name() const { return "bit_and("; }
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_and>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_and>(thd, this); }
private:
void set_bits_from_counters();
@@ -1197,8 +1197,8 @@ public:
bool add();
const char *func_name() const { return "bit_xor("; }
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_xor>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_xor>(thd, this); }
private:
void set_bits_from_counters();
@@ -1255,8 +1255,8 @@ public:
my_decimal *val_decimal(my_decimal *dec) { return val_decimal_from_real(dec); }
String *val_str(String *str) { return val_string_from_real(str); }
double val_real();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_avg_field_double>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_avg_field_double>(thd, this); }
};
@@ -1275,8 +1275,8 @@ public:
longlong val_int() { return val_int_from_decimal(); }
String *val_str(String *str) { return val_string_from_decimal(str); }
my_decimal *val_decimal(my_decimal *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_avg_field_decimal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_avg_field_decimal>(thd, this); }
};
@@ -1296,8 +1296,8 @@ public:
{ return val_decimal_from_real(dec_buf); }
bool is_null() { update_null_value(); return null_value; }
const Type_handler *type_handler() const { return &type_handler_double; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_variance_field>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_variance_field>(thd, this); }
};
@@ -1309,8 +1309,8 @@ public:
{ }
enum Type type() const { return FIELD_STD_ITEM; }
double val_real();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_std_field>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_std_field>(thd, this); }
};
@@ -1396,8 +1396,8 @@ class Item_sum_udf_float :public Item_udf_sum
const Type_handler *type_handler() const { return &type_handler_double; }
void fix_length_and_dec() { fix_num_length_and_dec(); }
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_udf_float>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_udf_float>(thd, this); }
};
@@ -1418,8 +1418,8 @@ public:
const Type_handler *type_handler() const { return &type_handler_longlong; }
void fix_length_and_dec() { decimals=0; max_length=21; }
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_udf_int>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_udf_int>(thd, this); }
};
@@ -1459,8 +1459,8 @@ public:
const Type_handler *type_handler() const { return string_type_handler(); }
void fix_length_and_dec();
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_udf_str>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_udf_str>(thd, this); }
};
@@ -1480,8 +1480,8 @@ public:
const Type_handler *type_handler() const { return &type_handler_newdecimal; }
void fix_length_and_dec() { fix_num_length_and_dec(); }
Item *copy_or_same(THD* thd);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_udf_decimal>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_udf_decimal>(thd, this); }
};
#else /* Dummy functions to get sql_yacc.cc compiled */
@@ -1668,8 +1668,8 @@ public:
virtual void print(String *str, enum_query_type query_type);
virtual bool change_context_processor(void *cntx)
{ context= (Name_resolution_context *)cntx; return FALSE; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_group_concat>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_group_concat>(thd, this); }
};
#endif /* ITEM_SUM_INCLUDED */
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index fc6d297d9ce..ed02d5174bd 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -66,8 +66,8 @@ public:
{
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_period_add>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_period_add>(thd, this); }
};
@@ -84,8 +84,8 @@ public:
decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_period_diff>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_period_diff>(thd, this); }
};
@@ -109,8 +109,8 @@ public:
{
return !has_date_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_to_days>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_to_days>(thd, this); }
};
@@ -137,8 +137,8 @@ public:
{
return !has_date_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_to_seconds>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_to_seconds>(thd, this); }
};
@@ -160,8 +160,8 @@ public:
{
return !has_date_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_dayofmonth>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dayofmonth>(thd, this); }
};
@@ -195,8 +195,8 @@ public:
{
return !has_date_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_month>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_month>(thd, this); }
};
@@ -217,8 +217,8 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_monthname>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_monthname>(thd, this); }
};
@@ -240,8 +240,8 @@ public:
{
return !has_date_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_dayofyear>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dayofyear>(thd, this); }
};
@@ -263,8 +263,8 @@ public:
{
return !has_time_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_hour>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_hour>(thd, this); }
};
@@ -286,8 +286,8 @@ public:
{
return !has_time_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_minute>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_minute>(thd, this); }
};
@@ -309,8 +309,8 @@ public:
{
return !has_date_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_quarter>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_quarter>(thd, this); }
};
@@ -332,8 +332,8 @@ public:
{
return !has_time_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_second>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_second>(thd, this); }
};
@@ -365,8 +365,8 @@ public:
{
return arg_count == 2;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_week>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_week>(thd, this); }
};
class Item_func_yearweek :public Item_long_func
@@ -393,8 +393,8 @@ public:
{
return !has_date_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_yearweek>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_yearweek>(thd, this); }
};
@@ -418,8 +418,8 @@ public:
{
return !has_date_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_year>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_year>(thd, this); }
};
@@ -454,8 +454,8 @@ public:
{
return !has_date_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_weekday>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_weekday>(thd, this); }
};
class Item_func_dayname :public Item_func_weekday
@@ -533,8 +533,8 @@ public:
}
longlong int_op();
my_decimal *decimal_op(my_decimal* buf);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_unix_timestamp>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_unix_timestamp>(thd, this); }
};
@@ -556,8 +556,8 @@ public:
}
longlong int_op();
my_decimal *decimal_op(my_decimal* buf);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_time_to_sec>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_time_to_sec>(thd, this); }
};
@@ -684,8 +684,8 @@ public:
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(THD *thd, MYSQL_TIME *now_time);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_curtime_local>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_curtime_local>(thd, this); }
};
@@ -695,8 +695,8 @@ public:
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(THD *thd, MYSQL_TIME *now_time);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_curtime_utc>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_curtime_utc>(thd, this); }
};
@@ -723,8 +723,8 @@ public:
Item_func_curdate_local(THD *thd): Item_func_curdate(thd) {}
const char *func_name() const { return "curdate"; }
void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_curdate_local>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_curdate_local>(thd, this); }
};
@@ -734,8 +734,8 @@ public:
Item_func_curdate_utc(THD *thd): Item_func_curdate(thd) {}
const char *func_name() const { return "utc_date"; }
void store_now_in_TIME(THD* thd, MYSQL_TIME *now_time);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_curdate_utc>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_curdate_utc>(thd, this); }
};
@@ -771,8 +771,8 @@ public:
int save_in_field(Field *field, bool no_conversions);
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time);
virtual enum Functype functype() const { return NOW_FUNC; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_now_local>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_now_local>(thd, this); }
};
@@ -788,8 +788,8 @@ public:
return mark_unsupported_function(func_name(), "()", arg,
VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_now_utc>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_now_utc>(thd, this); }
};
@@ -812,8 +812,8 @@ public:
VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC);
}
virtual enum Functype functype() const { return SYSDATE_FUNC; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sysdate_local>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sysdate_local>(thd, this); }
};
@@ -831,8 +831,8 @@ public:
{
return has_date_args() || has_time_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_from_days>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_from_days>(thd, this); }
};
@@ -859,8 +859,8 @@ public:
return false;
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_date_format>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_date_format>(thd, this); }
};
class Item_func_time_format: public Item_func_date_format
@@ -870,8 +870,8 @@ public:
Item_func_date_format(thd, a, b) { is_time_format= true; }
const char *func_name() const { return "time_format"; }
bool check_vcol_func_processor(void *arg) { return false; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_time_format>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_time_format>(thd, this); }
};
@@ -885,8 +885,8 @@ class Item_func_from_unixtime :public Item_datetimefunc
const char *func_name() const { return "from_unixtime"; }
void fix_length_and_dec();
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_from_unixtime>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_from_unixtime>(thd, this); }
};
@@ -930,8 +930,8 @@ class Item_func_convert_tz :public Item_datetimefunc
}
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
void cleanup();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_convert_tz>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_convert_tz>(thd, this); }
};
@@ -948,8 +948,8 @@ public:
maybe_null= true;
}
const char *func_name() const { return "sec_to_time"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_sec_to_time>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_sec_to_time>(thd, this); }
};
@@ -969,8 +969,8 @@ public:
void print(String *str, enum_query_type query_type);
enum precedence precedence() const { return ADDINTERVAL_PRECEDENCE; }
bool need_parentheses_in_default() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_date_add_interval>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_date_add_interval>(thd, this); }
};
@@ -1077,8 +1077,8 @@ class Item_extract :public Item_int_func
}
return true;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_extract>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_extract>(thd, this); }
};
@@ -1110,8 +1110,8 @@ public:
}
void print(String *str, enum_query_type query_type);
bool need_parentheses_in_default() { return true; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_char_typecast>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_char_typecast>(thd, this); }
};
@@ -1135,8 +1135,8 @@ public:
{
args[0]->type_handler()->Item_date_typecast_fix_length_and_dec(this);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_date_typecast>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_date_typecast>(thd, this); }
};
@@ -1153,8 +1153,8 @@ public:
{
args[0]->type_handler()->Item_time_typecast_fix_length_and_dec(this);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_time_typecast>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_time_typecast>(thd, this); }
};
@@ -1171,8 +1171,8 @@ public:
{
args[0]->type_handler()->Item_datetime_typecast_fix_length_and_dec(this);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_datetime_typecast>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_datetime_typecast>(thd, this); }
};
@@ -1185,8 +1185,8 @@ public:
Item_datefunc(thd, a, b) {}
const char *func_name() const { return "makedate"; }
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_makedate>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_makedate>(thd, this); }
};
@@ -1203,8 +1203,8 @@ public:
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
void print(String *str, enum_query_type query_type);
const char *func_name() const { return "add_time"; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_add_time>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_add_time>(thd, this); }
};
class Item_func_timediff :public Item_timefunc
@@ -1221,8 +1221,8 @@ public:
maybe_null= true;
}
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_timediff>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_timediff>(thd, this); }
};
class Item_func_maketime :public Item_timefunc
@@ -1243,8 +1243,8 @@ public:
}
const char *func_name() const { return "maketime"; }
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_maketime>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_maketime>(thd, this); }
};
@@ -1266,8 +1266,8 @@ public:
{
return !has_time_args();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_microsecond>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_microsecond>(thd, this); }
};
@@ -1287,8 +1287,8 @@ public:
maybe_null=1;
}
virtual void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_timestamp_diff>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_timestamp_diff>(thd, this); }
};
@@ -1313,8 +1313,8 @@ public:
fix_length_and_charset(17, default_charset());
}
virtual void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_get_format>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_get_format>(thd, this); }
};
@@ -1333,8 +1333,8 @@ public:
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
const char *func_name() const { return "str_to_date"; }
void fix_length_and_dec();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_str_to_date>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_str_to_date>(thd, this); }
};
@@ -1346,8 +1346,8 @@ public:
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);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_last_day>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_last_day>(thd, this); }
};
#endif /* ITEM_TIMEFUNC_INCLUDED */
diff --git a/sql/item_vers.cc b/sql/item_vers.cc
index bae515a6ede..8aa1321e396 100644
--- a/sql/item_vers.cc
+++ b/sql/item_vers.cc
@@ -19,6 +19,9 @@
System Versioning items
*/
+#include "mariadb.h"
+#include "sql_priv.h"
+
#include "sql_class.h"
#include "tztime.h"
#include "item.h"
diff --git a/sql/item_vers.h b/sql/item_vers.h
index a61899a924d..39ed4ecda1f 100644
--- a/sql/item_vers.h
+++ b/sql/item_vers.h
@@ -36,8 +36,8 @@ public:
return "vtq_commit_ts";
}
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_vtq_ts>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_vtq_ts>(thd, this); }
void fix_length_and_dec() { fix_attributes_datetime(decimals); }
};
@@ -76,8 +76,8 @@ public:
}
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_vtq_id>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_vtq_id>(thd, this); }
};
class Item_func_vtq_trx_sees : public Item_bool_func
@@ -92,8 +92,8 @@ public:
return "vtq_trx_sees";
}
longlong val_int();
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_vtq_trx_sees>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_vtq_trx_sees>(thd, this); }
};
class Item_func_vtq_trx_sees_eq :
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h
index 849c298f5aa..0a0a02c86b1 100644
--- a/sql/item_windowfunc.h
+++ b/sql/item_windowfunc.h
@@ -146,8 +146,8 @@ public:
return "row_number";
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_row_number>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_row_number>(thd, this); }
};
@@ -221,8 +221,8 @@ public:
}
Item_sum_int::cleanup();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_rank>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_rank>(thd, this); }
};
@@ -291,8 +291,8 @@ class Item_sum_dense_rank: public Item_sum_int
}
Item_sum_int::cleanup();
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_dense_rank>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_dense_rank>(thd, this); }
};
class Item_sum_hybrid_simple : public Item_sum,
@@ -354,8 +354,8 @@ class Item_sum_first_value : public Item_sum_hybrid_simple
return "first_value";
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_first_value>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_first_value>(thd, this); }
};
/*
@@ -380,8 +380,8 @@ class Item_sum_last_value : public Item_sum_hybrid_simple
return "last_value";
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_last_value>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_last_value>(thd, this); }
};
class Item_sum_nth_value : public Item_sum_hybrid_simple
@@ -400,8 +400,8 @@ class Item_sum_nth_value : public Item_sum_hybrid_simple
return "nth_value";
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_nth_value>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_nth_value>(thd, this); }
};
class Item_sum_lead : public Item_sum_hybrid_simple
@@ -420,8 +420,8 @@ class Item_sum_lead : public Item_sum_hybrid_simple
return "lead";
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_lead>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_lead>(thd, this); }
};
class Item_sum_lag : public Item_sum_hybrid_simple
@@ -440,8 +440,8 @@ class Item_sum_lag : public Item_sum_hybrid_simple
return "lag";
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_lag>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_lag>(thd, this); }
};
/*
@@ -532,8 +532,8 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count
}
void setup_window_func(THD *thd, Window_spec *window_spec);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_percent_rank>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_percent_rank>(thd, this); }
private:
longlong cur_rank; // Current rank of the current row.
@@ -619,8 +619,8 @@ class Item_sum_cume_dist: public Item_sum_window_with_row_count
// requires.
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_cume_dist>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_cume_dist>(thd, this); }
ulonglong get_row_number()
{
@@ -694,8 +694,8 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
const Type_handler *type_handler() const { return &type_handler_longlong; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_ntile>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_ntile>(thd, this); }
private:
longlong get_num_quantiles() { return args[0]->val_int(); }
@@ -825,8 +825,8 @@ public:
// requires.
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_percentile_disc>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_percentile_disc>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec);
void setup_hybrid(THD *thd, Item *item);
bool fix_fields(THD *thd, Item **ref);
@@ -955,8 +955,8 @@ public:
// requires.
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_sum_percentile_cont>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_percentile_cont>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec);
void setup_hybrid(THD *thd, Item *item);
bool fix_fields(THD *thd, Item **ref);
@@ -1281,7 +1281,7 @@ public:
void print(String *str, enum_query_type query_type);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item *get_copy(THD *thd) { return 0; }
};
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index b08d43f041c..83a25b7865c 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -247,8 +247,8 @@ public:
Item_nodeset_func(thd, pxml) {}
const char *func_name() const { return "xpath_rootelement"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_rootelement>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_rootelement>(thd, this); }
};
@@ -260,8 +260,8 @@ public:
Item_nodeset_func(thd, a, b, pxml) {}
const char *func_name() const { return "xpath_union"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_union>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_union>(thd, this); }
};
@@ -294,8 +294,8 @@ public:
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_selfbyname"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_selfbyname>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_selfbyname>(thd, this); }
};
@@ -308,8 +308,8 @@ public:
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_childbyname"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_childbyname>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_childbyname>(thd, this); }
};
@@ -324,8 +324,8 @@ public:
need_self(need_self_arg) {}
const char *func_name() const { return "xpath_descendantbyname"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_descendantbyname>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_descendantbyname>(thd, this); }
};
@@ -340,8 +340,8 @@ public:
need_self(need_self_arg) {}
const char *func_name() const { return "xpath_ancestorbyname"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_ancestorbyname>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_ancestorbyname>(thd, this); }
};
@@ -354,8 +354,8 @@ public:
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_parentbyname"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_parentbyname>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_parentbyname>(thd, this); }
};
@@ -368,8 +368,8 @@ public:
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_attributebyname"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_attributebyname>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_attributebyname>(thd, this); }
};
@@ -385,8 +385,8 @@ public:
Item_nodeset_func(thd, a, b, pxml) {}
const char *func_name() const { return "xpath_predicate"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_predicate>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_predicate>(thd, this); }
};
@@ -398,8 +398,8 @@ public:
Item_nodeset_func(thd, a, b, pxml) { }
const char *func_name() const { return "xpath_elementbyindex"; }
String *val_nodeset(String *nodeset);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_func_elementbyindex>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_func_elementbyindex>(thd, this); }
};
@@ -426,8 +426,8 @@ public:
}
return args[0]->val_real() ? 1 : 0;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_xpath_cast_bool>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_xpath_cast_bool>(thd, this); }
};
@@ -440,8 +440,8 @@ public:
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(); }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_xpath_cast_number>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_xpath_cast_number>(thd, this); }
};
@@ -457,8 +457,8 @@ public:
String *val_nodeset(String *res)
{ return string_cache; }
void fix_length_and_dec() { max_length= MAX_BLOB_WIDTH; }
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_context_cache>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_context_cache>(thd, this); }
};
@@ -478,8 +478,8 @@ public:
return ((MY_XPATH_FLT*)flt->ptr())->pos + 1;
return 0;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_xpath_position>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_xpath_position>(thd, this); }
};
@@ -501,8 +501,8 @@ public:
return predicate_supplied_context_size;
return res->length() / sizeof(MY_XPATH_FLT);
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_xpath_count>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_xpath_count>(thd, this); }
};
@@ -546,8 +546,8 @@ public:
}
return sum;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_xpath_sum>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_xpath_sum>(thd, this); }
};
@@ -624,8 +624,8 @@ public:
}
return 0;
}
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_nodeset_to_const_comparator>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_nodeset_to_const_comparator>(thd, this); }
};
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index 3c071b897e2..425b2b8ec1c 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -96,8 +96,8 @@ public:
Item_xml_str_func(thd, a, b) {}
const char *func_name() const { return "extractvalue"; }
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_xml_extractvalue>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_xml_extractvalue>(thd, this); }
};
@@ -112,8 +112,8 @@ public:
Item_xml_str_func(thd, a, b, c) {}
const char *func_name() const { return "updatexml"; }
String *val_str(String *);
- Item *get_copy(THD *thd, MEM_ROOT *mem_root)
- { return get_item_copy<Item_func_xml_update>(thd, mem_root, this); }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_xml_update>(thd, this); }
};
#endif /* ITEM_XMLFUNC_INCLUDED */
diff --git a/sql/log.cc b/sql/log.cc
index 09bd23be2bf..be8b24da8df 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2391,7 +2391,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name, const char **errmsg)
*errmsg = "Could not open log file";
goto err;
}
- if (init_io_cache(log, file, IO_SIZE*2, READ_CACHE, 0, 0,
+ if (init_io_cache(log, file, binlog_file_cache_size, READ_CACHE, 0, 0,
MYF(MY_WME|MY_DONT_CHECK_FILESIZE)))
{
sql_print_error("Failed to create a cache on log (file '%s')",
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index a6b4ee3aaee..e77184999dc 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -508,6 +508,7 @@ ulong slave_ddl_exec_mode_options= SLAVE_EXEC_MODE_IDEMPOTENT;
ulonglong slave_type_conversions_options;
ulong thread_cache_size=0;
ulonglong binlog_cache_size=0;
+ulonglong binlog_file_cache_size=0;
ulonglong max_binlog_cache_size=0;
ulong slave_max_allowed_packet= 0;
ulonglong binlog_stmt_cache_size=0;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index f4c00cc4b4f..0e42788acad 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -251,7 +251,7 @@ extern volatile ulong cached_thread_count;
extern ulong what_to_log,flush_time;
extern ulong max_prepared_stmt_count, prepared_stmt_count;
extern ulong open_files_limit;
-extern ulonglong binlog_cache_size, binlog_stmt_cache_size;
+extern ulonglong binlog_cache_size, binlog_stmt_cache_size, binlog_file_cache_size;
extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
extern ulong max_binlog_size;
extern ulong slave_max_allowed_packet;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index b6378685268..72da68816ad 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -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(THD *thd, Item **tree);
+static bool 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);
@@ -1750,9 +1750,9 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
*/
Item_row *row= new (thd->mem_root) Item_row(thd, subq_lex->pre_fix);
/* fix fields on subquery was call so they should be the same */
- DBUG_ASSERT(subq_pred->left_expr->cols() == row->cols());
if (!row)
DBUG_RETURN(TRUE);
+ DBUG_ASSERT(subq_pred->left_expr->cols() == row->cols());
nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr);
Item_func_eq *item_eq=
new (thd->mem_root) Item_func_eq(thd, subq_pred->left_expr_orig, row);
@@ -1839,7 +1839,8 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
}
parent_lex->have_merged_subqueries= TRUE;
- DBUG_RETURN(FALSE);
+ /* Fatal error may have been set to by fix_after_pullout() */
+ DBUG_RETURN(thd->is_fatal_error);
}
@@ -1880,6 +1881,7 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
bool optimization_delayed= TRUE;
TABLE_LIST *jtbm;
char *tbl_alias;
+ THD *thd= parent_join->thd;
DBUG_ENTER("convert_subq_to_jtbm");
subq_pred->set_strategy(SUBS_MATERIALIZATION);
@@ -1887,8 +1889,8 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
*remove_item= TRUE;
- if (!(tbl_alias= (char*)parent_join->thd->calloc(SUBQERY_TEMPTABLE_NAME_MAX_LEN)) ||
- !(jtbm= alloc_join_nest(parent_join->thd))) //todo: this is not a join nest!
+ if (!(tbl_alias= (char*)thd->calloc(SUBQERY_TEMPTABLE_NAME_MAX_LEN)) ||
+ !(jtbm= alloc_join_nest(thd))) //todo: this is not a join nest!
{
DBUG_RETURN(TRUE);
}
@@ -1900,13 +1902,13 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
/* Nests do not participate in those 'chains', so: */
/* jtbm->next_leaf= jtbm->next_local= jtbm->next_global == NULL*/
- emb_join_list->push_back(jtbm, parent_join->thd->mem_root);
+ emb_join_list->push_back(jtbm, thd->mem_root);
/*
Inject the jtbm table into TABLE_LIST::next_leaf list, so that
make_join_statistics() and co. can find it.
*/
- parent_lex->leaf_tables.push_back(jtbm, parent_join->thd->mem_root);
+ parent_lex->leaf_tables.push_back(jtbm, thd->mem_root);
if (subq_pred->unit->first_select()->options & OPTION_SCHEMA_TABLE)
parent_lex->options |= OPTION_SCHEMA_TABLE;
@@ -1931,7 +1933,7 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
subq_pred->unit->first_select()->select_number);
jtbm->alias= tbl_alias;
parent_join->table_count++;
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(thd->is_fatal_error);
}
subselect_hash_sj_engine *hash_sj_engine=
((subselect_hash_sj_engine*)subq_pred->engine);
@@ -1954,27 +1956,10 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
jtbm->alias= tbl_alias;
parent_lex->have_merged_subqueries= TRUE;
-#if 0
- /* Inject sj_on_expr into the parent's WHERE or ON */
- if (emb_tbl_nest)
- {
- DBUG_ASSERT(0);
- /*emb_tbl_nest->on_expr= and_items(emb_tbl_nest->on_expr,
- sj_nest->sj_on_expr);
- emb_tbl_nest->on_expr->fix_fields(parent_join->thd, &emb_tbl_nest->on_expr);
- */
- }
- else
- {
- /* Inject into the WHERE */
- parent_join->conds= and_items(parent_join->conds, conds);
- parent_join->conds->fix_fields(parent_join->thd, &parent_join->conds);
- parent_join->select_lex->where= parent_join->conds;
- }
-#endif
+
/* Don't unlink the child subselect, as the subquery will be used. */
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(thd->is_fatal_error);
}
@@ -1989,6 +1974,9 @@ static TABLE_LIST *alloc_join_nest(THD *thd)
return tbl;
}
+/*
+ @Note thd->is_fatal_error can be set in case of OOM
+*/
void fix_list_after_tbl_changes(SELECT_LEX *new_parent, List<TABLE_LIST> *tlist)
{
@@ -3718,6 +3706,11 @@ bool setup_sj_materialization_part1(JOIN_TAB *sjm_tab)
DBUG_RETURN(FALSE);
}
+/**
+ @retval
+ FALSE ok
+ TRUE error
+*/
bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab)
{
@@ -3730,8 +3723,6 @@ bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab)
SJ_MATERIALIZATION_INFO *sjm= emb_sj_nest->sj_mat_info;
THD *thd= tab->join->thd;
uint i;
- //List<Item> &item_list= emb_sj_nest->sj_subq_pred->unit->first_select()->item_list;
- //List_iterator<Item> it(item_list);
if (!sjm->is_sj_scan)
{
@@ -3781,6 +3772,8 @@ bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab)
null_count ? cur_ref_buff : 0,
cur_key_part->length, tab_ref->items[i],
FALSE);
+ if (!*ref_key)
+ DBUG_RETURN(TRUE);
cur_ref_buff+= cur_key_part->store_length;
}
*ref_key= NULL; /* End marker. */
@@ -3806,9 +3799,9 @@ bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab)
*/
for (i= 0; i < sjm->tables; i++)
{
- remove_sj_conds(thd, &tab[i].select_cond);
- if (tab[i].select)
- remove_sj_conds(thd, &tab[i].select->cond);
+ if (remove_sj_conds(thd, &tab[i].select_cond) ||
+ (tab[i].select && remove_sj_conds(thd, &tab[i].select->cond)))
+ DBUG_RETURN(TRUE);
}
if (!(sjm->in_equality= create_subq_in_equalities(thd, sjm,
emb_sj_nest->sj_subq_pred)))
@@ -3845,7 +3838,9 @@ bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab)
temptable record, we copy its columns to their corresponding columns
in the record buffers for the source tables.
*/
- sjm->copy_field= new Copy_field[sjm->sjm_table_cols.elements];
+ if (!(sjm->copy_field= new Copy_field[sjm->sjm_table_cols.elements]))
+ DBUG_RETURN(TRUE);
+
//it.rewind();
Ref_ptr_array p_items= emb_sj_nest->sj_subq_pred->unit->first_select()->ref_pointer_array;
for (uint i=0; i < sjm->sjm_table_cols.elements; i++)
@@ -3972,16 +3967,20 @@ static Item *create_subq_in_equalities(THD *thd, SJ_MATERIALIZATION_INFO *sjm,
}
+/**
+ @retval
+ 0 ok
+ 1 error
+*/
-
-static void remove_sj_conds(THD *thd, Item **tree)
+static bool remove_sj_conds(THD *thd, Item **tree)
{
if (*tree)
{
if (is_cond_sj_in_equality(*tree))
{
*tree= NULL;
- return;
+ return 0;
}
else if ((*tree)->type() == Item::COND_ITEM)
{
@@ -3990,12 +3989,19 @@ static void remove_sj_conds(THD *thd, Item **tree)
while ((item= li++))
{
if (is_cond_sj_in_equality(item))
- li.replace(new (thd->mem_root) Item_int(thd, 1));
+ {
+ Item_int *tmp= new (thd->mem_root) Item_int(thd, 1);
+ if (!tmp)
+ return 1;
+ li.replace(tmp);
+ }
}
}
}
+ return 0;
}
+
/* Check if given Item was injected by semi-join equality */
static bool is_cond_sj_in_equality(Item *item)
{
@@ -4183,7 +4189,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
share->db_plugin= ha_lock_engine(0, heap_hton);
table->file= get_new_handler(share, &table->mem_root,
share->db_type());
- DBUG_ASSERT(uniq_tuple_length_arg <= table->file->max_key_length());
+ DBUG_ASSERT(!table->file || uniq_tuple_length_arg <= table->file->max_key_length());
}
if (!table->file)
goto err;
@@ -5302,6 +5308,9 @@ TABLE *create_dummy_tmp_table(THD *thd)
sjm_table_param.field_count= 1;
List<Item> sjm_table_cols;
Item *column_item= new (thd->mem_root) Item_int(thd, 1);
+ if (!column_item)
+ DBUG_RETURN(NULL);
+
sjm_table_cols.push_back(column_item, thd->mem_root);
if (!(table= create_tmp_table(thd, &sjm_table_param,
sjm_table_cols, (ORDER*) 0,
diff --git a/sql/procedure.h b/sql/procedure.h
index a1c9b95f20b..fdbfab7f17c 100644
--- a/sql/procedure.h
+++ b/sql/procedure.h
@@ -59,7 +59,7 @@ public:
DBUG_ASSERT(0); // impossible
return mark_unsupported_function("proc", arg, VCOL_IMPOSSIBLE);
}
- Item* get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
+ Item* get_copy(THD *thd) { return 0; }
};
class Item_proc_real :public Item_proc
diff --git a/sql/sql_array.h b/sql/sql_array.h
index bbaa653b177..341ea9a651b 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -258,4 +258,6 @@ public:
}
};
+typedef Bounds_checked_array<Item*> Ref_ptr_array;
+
#endif /* SQL_ARRAY_INCLUDED */
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 99971a53a3c..b83e597a36d 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -8555,7 +8555,8 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order)
Item_func_match *ifm;
while ((ifm=li++))
- ifm->init_search(thd, no_order);
+ if (ifm->init_search(thd, no_order))
+ return 1;
}
return 0;
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 688b135d875..1217bcc20d7 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2082,11 +2082,6 @@ typedef struct
extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
-class THD;
-#ifndef DBUG_OFF
-void dbug_serve_apcs(THD *thd, int n_calls);
-#endif
-
/**
@class THD
For each client connection we create a separate thread with THD serving as
@@ -6363,6 +6358,10 @@ public:
};
+#ifndef DBUG_OFF
+void dbug_serve_apcs(THD *thd, int n_calls);
+#endif
+
class ScopedStatementReplication
{
public:
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index a100f38c02c..e428d969db0 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -45,6 +45,7 @@ HASH global_index_stats;
extern mysql_mutex_t LOCK_global_user_client_stats;
extern mysql_mutex_t LOCK_global_table_stats;
extern mysql_mutex_t LOCK_global_index_stats;
+extern vio_keepalive_opts opt_vio_keepalive;
/*
Get structure for logging connection data for the current user
@@ -1064,7 +1065,8 @@ static int check_connection(THD *thd)
bzero((char*) &net->vio->remote, sizeof(net->vio->remote));
}
vio_keepalive(net->vio, TRUE);
-
+ vio_set_keepalive_options(net->vio, &opt_vio_keepalive);
+
if (thd->packet.alloc(thd->variables.net_buffer_length))
{
/*
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index d41e9acfdc8..f568db51b9c 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -1725,8 +1725,7 @@ bool mysql_upgrade_db(THD *thd, LEX_CSTRING *old_db)
DBUG_PRINT("info",("Examining: %s", file->name));
/* skiping non-FRM files */
- if (my_strcasecmp(files_charset_info,
- (extension= fn_rext(file->name)), reg_ext))
+ if (!(extension= (char*) fn_frm_ext(file->name)))
continue;
/* A frm file found, add the table info rename list */
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 23928af22cc..aec30da1894 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -61,6 +61,8 @@ Explain_delete* Delete_plan::save_explain_delete_data(MEM_ROOT *mem_root, THD *t
Explain_query *query= thd->lex->explain;
Explain_delete *explain=
new (mem_root) Explain_delete(mem_root, thd->lex->analyze_stmt);
+ if (!explain)
+ return 0;
if (deleting_all_rows)
{
@@ -71,8 +73,9 @@ Explain_delete* Delete_plan::save_explain_delete_data(MEM_ROOT *mem_root, THD *t
else
{
explain->deleting_all_rows= false;
- Update_plan::save_explain_data_intern(mem_root, explain,
- thd->lex->analyze_stmt);
+ if (Update_plan::save_explain_data_intern(mem_root, explain,
+ thd->lex->analyze_stmt))
+ return 0;
}
query->add_upd_del_plan(explain);
@@ -86,13 +89,16 @@ Update_plan::save_explain_update_data(MEM_ROOT *mem_root, THD *thd)
Explain_query *query= thd->lex->explain;
Explain_update* explain=
new (mem_root) Explain_update(mem_root, thd->lex->analyze_stmt);
- save_explain_data_intern(mem_root, explain, thd->lex->analyze_stmt);
+ if (!explain)
+ return 0;
+ if (save_explain_data_intern(mem_root, explain, thd->lex->analyze_stmt))
+ return 0;
query->add_upd_del_plan(explain);
return explain;
}
-void Update_plan::save_explain_data_intern(MEM_ROOT *mem_root,
+bool Update_plan::save_explain_data_intern(MEM_ROOT *mem_root,
Explain_update *explain,
bool is_analyze)
{
@@ -105,13 +111,13 @@ void Update_plan::save_explain_data_intern(MEM_ROOT *mem_root,
if (impossible_where)
{
explain->impossible_where= true;
- return;
+ return 0;
}
if (no_partitions)
{
explain->no_partitions= true;
- return;
+ return 0;
}
if (is_analyze)
@@ -162,7 +168,8 @@ void Update_plan::save_explain_data_intern(MEM_ROOT *mem_root,
explain->where_cond= select? select->cond: NULL;
if (using_filesort)
- explain->filesort_tracker= new (mem_root) Filesort_tracker(is_analyze);
+ if (!(explain->filesort_tracker= new (mem_root) Filesort_tracker(is_analyze)))
+ return 1;
explain->using_io_buffer= using_io_buffer;
append_possible_keys(mem_root, explain->possible_keys, table,
@@ -211,6 +218,7 @@ void Update_plan::save_explain_data_intern(MEM_ROOT *mem_root,
if (!(unit->item && unit->item->eliminated))
explain->add_child(unit->first_select()->select_number);
}
+ return 0;
}
@@ -428,7 +436,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
query_type= THD::STMT_QUERY_TYPE;
error= -1;
deleted= maybe_deleted;
- query_plan.save_explain_delete_data(thd->mem_root, thd);
+ if (!query_plan.save_explain_delete_data(thd->mem_root, thd))
+ error= 1;
goto cleanup;
}
if (error != HA_ERR_WRONG_COMMAND)
@@ -546,7 +555,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (thd->lex->describe)
goto produce_explain_and_leave;
- explain= query_plan.save_explain_delete_data(thd->mem_root, thd);
+ if (!(explain= query_plan.save_explain_delete_data(thd->mem_root, thd)))
+ goto got_error;
ANALYZE_START_TRACKING(&explain->command_tracker);
DBUG_EXECUTE_IF("show_explain_probe_delete_exec_start",
@@ -598,7 +608,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (error)
goto got_error;
- init_ftfuncs(thd, select_lex, 1);
+ if (init_ftfuncs(thd, select_lex, 1))
+ goto got_error;
if (table->prepare_triggers_for_delete_stmt_or_event())
{
@@ -812,7 +823,8 @@ produce_explain_and_leave:
We come here for various "degenerate" query plans: impossible WHERE,
no-partitions-used, impossible-range, etc.
*/
- query_plan.save_explain_delete_data(thd->mem_root, thd);
+ if (!(query_plan.save_explain_delete_data(thd->mem_root, thd)))
+ goto got_error;
send_nothing_and_leave:
/*
@@ -1112,7 +1124,7 @@ multi_delete::initialize_tables(JOIN *join)
MEM_STRIP_BUF_SIZE);
}
init_ftfuncs(thd, thd->lex->current_select, 1);
- DBUG_RETURN(thd->is_fatal_error != 0);
+ DBUG_RETURN(thd->is_fatal_error);
}
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index d87128f5c00..af3add1a5b2 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -1382,7 +1382,7 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
continue;
extracted_cond_copy= !sl->next_select() ?
extracted_cond :
- extracted_cond->build_clone(thd, thd->mem_root);
+ extracted_cond->build_clone(thd);
if (!extracted_cond_copy)
continue;
@@ -1412,7 +1412,7 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
*/
extracted_cond_copy= !sl->next_select() ?
extracted_cond :
- extracted_cond->build_clone(thd, thd->mem_root);
+ extracted_cond->build_clone(thd);
if (!extracted_cond_copy)
continue;
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 05df9a21572..660d68427d1 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -1143,33 +1143,37 @@ void Explain_table_access::fill_key_len_str(String *key_len_str) const
}
-void Explain_index_use::set(MEM_ROOT *mem_root, KEY *key, uint key_len_arg)
+bool Explain_index_use::set(MEM_ROOT *mem_root, KEY *key, uint key_len_arg)
{
- set_pseudo_key(mem_root, key->name.str);
+ if (set_pseudo_key(mem_root, key->name.str))
+ return 1;
+
key_len= key_len_arg;
uint len= 0;
for (uint i= 0; i < key->usable_key_parts; i++)
{
- key_parts_list.append_str(mem_root,
- key->key_part[i].field->field_name.str);
+ if (!key_parts_list.append_str(mem_root,
+ key->key_part[i].field->field_name.str))
+ return 1;
len += key->key_part[i].store_length;
if (len >= key_len_arg)
break;
}
+ return 0;
}
-void Explain_index_use::set_pseudo_key(MEM_ROOT *root, const char* key_name_arg)
+bool Explain_index_use::set_pseudo_key(MEM_ROOT *root, const char* key_name_arg)
{
if (key_name_arg)
{
- size_t name_len= strlen(key_name_arg);
- if ((key_name= (char*)alloc_root(root, name_len+1)))
- memcpy(key_name, key_name_arg, name_len+1);
+ if (!(key_name= strdup_root(root, key_name_arg)))
+ return 1;
}
else
key_name= NULL;
key_len= ~(uint) 0;
+ return 0;
}
@@ -2450,8 +2454,11 @@ int Explain_range_checked_fer::append_possible_keys_stat(MEM_ROOT *alloc,
for (j= 0; j < table->s->keys; j++)
{
if (possible_keys.is_set(j))
- keys_stat_names[j]= key_set.append_str(alloc,
- table->key_info[j].name.str);
+ {
+ if (!(keys_stat_names[j]= key_set.append_str(alloc,
+ table->key_info[j].name.str)))
+ return 1;
+ }
else
keys_stat_names[j]= NULL;
}
diff --git a/sql/sql_explain.h b/sql/sql_explain.h
index 154769fe289..895c059f1b0 100644
--- a/sql/sql_explain.h
+++ b/sql/sql_explain.h
@@ -589,8 +589,8 @@ public:
key_name= NULL;
key_len= (uint)-1;
}
- void set(MEM_ROOT *root, KEY *key_name, uint key_len_arg);
- void set_pseudo_key(MEM_ROOT *root, const char *key_name);
+ bool set(MEM_ROOT *root, KEY *key_name, uint key_len_arg);
+ bool set_pseudo_key(MEM_ROOT *root, const char *key_name);
inline const char *get_key_name() const { return key_name; }
inline uint get_key_len() const { return key_len; }
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 2f1a81cc2ec..6df92f13585 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -2571,10 +2571,11 @@ finish:
BNLH, BKA or BKAH) to the data structure
RETURN VALUE
- none
+ 0 ok
+ 1 error
*/
-void JOIN_CACHE::save_explain_data(EXPLAIN_BKA_TYPE *explain)
+bool JOIN_CACHE::save_explain_data(EXPLAIN_BKA_TYPE *explain)
{
explain->incremental= MY_TEST(prev_cache);
@@ -2596,6 +2597,7 @@ void JOIN_CACHE::save_explain_data(EXPLAIN_BKA_TYPE *explain)
default:
DBUG_ASSERT(0);
}
+ return 0;
}
/**
@@ -2608,7 +2610,7 @@ THD *JOIN_CACHE::thd()
}
-static void add_mrr_explain_info(String *str, uint mrr_mode, handler *file)
+static bool add_mrr_explain_info(String *str, uint mrr_mode, handler *file)
{
char mrr_str_buf[128]={0};
int len;
@@ -2617,22 +2619,30 @@ static void add_mrr_explain_info(String *str, uint mrr_mode, handler *file)
if (len > 0)
{
if (str->length())
- str->append(STRING_WITH_LEN("; "));
- str->append(mrr_str_buf, len);
+ {
+ if (str->append(STRING_WITH_LEN("; ")))
+ return 1;
+ }
+ if (str->append(mrr_str_buf, len))
+ return 1;
}
+ return 0;
}
-void JOIN_CACHE_BKA::save_explain_data(EXPLAIN_BKA_TYPE *explain)
+
+bool JOIN_CACHE_BKA::save_explain_data(EXPLAIN_BKA_TYPE *explain)
{
- JOIN_CACHE::save_explain_data(explain);
- add_mrr_explain_info(&explain->mrr_type, mrr_mode, join_tab->table->file);
+ if (JOIN_CACHE::save_explain_data(explain))
+ return 1;
+ return add_mrr_explain_info(&explain->mrr_type, mrr_mode, join_tab->table->file);
}
-void JOIN_CACHE_BKAH::save_explain_data(EXPLAIN_BKA_TYPE *explain)
+bool JOIN_CACHE_BKAH::save_explain_data(EXPLAIN_BKA_TYPE *explain)
{
- JOIN_CACHE::save_explain_data(explain);
- add_mrr_explain_info(&explain->mrr_type, mrr_mode, join_tab->table->file);
+ if (JOIN_CACHE::save_explain_data(explain))
+ return 1;
+ return add_mrr_explain_info(&explain->mrr_type, mrr_mode, join_tab->table->file);
}
diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h
index 4ae843ebfc2..f6894c6727d 100644
--- a/sql/sql_join_cache.h
+++ b/sql/sql_join_cache.h
@@ -662,7 +662,7 @@ public:
enum_nested_loop_state join_records(bool skip_last);
/* Add a comment on the join algorithm employed by the join cache */
- virtual void save_explain_data(EXPLAIN_BKA_TYPE *explain);
+ virtual bool save_explain_data(EXPLAIN_BKA_TYPE *explain);
THD *thd();
@@ -1340,7 +1340,7 @@ public:
/* Check index condition of the joined table for a record from BKA cache */
bool skip_index_tuple(range_id_t range_info);
- void save_explain_data(EXPLAIN_BKA_TYPE *explain);
+ bool save_explain_data(EXPLAIN_BKA_TYPE *explain);
};
@@ -1431,5 +1431,5 @@ public:
/* Check index condition of the joined table for a record from BKAH cache */
bool skip_index_tuple(range_id_t range_info);
- void save_explain_data(EXPLAIN_BKA_TYPE *explain);
+ bool save_explain_data(EXPLAIN_BKA_TYPE *explain);
};
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index d93f42cd464..a510ed14f1f 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -7208,7 +7208,7 @@ Item *st_select_lex::build_cond_for_grouping_fields(THD *thd, Item *cond,
if (no_top_clones)
return cond;
cond->clear_extraction_flag();
- return cond->build_clone(thd, thd->mem_root);
+ return cond->build_clone(thd);
}
if (cond->type() == Item::COND_ITEM)
{
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 6e10bc4df94..c15d050eb4d 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -31,6 +31,7 @@
#include "sql_trigger.h"
#include "sp.h" // enum stored_procedure_type
#include "sql_tvc.h"
+#include "item.h"
/* YACC and LEX Definitions */
@@ -2607,7 +2608,7 @@ public:
Explain_update* save_explain_update_data(MEM_ROOT *mem_root, THD *thd);
protected:
- void save_explain_data_intern(MEM_ROOT *mem_root, Explain_update *eu, bool is_analyze);
+ bool save_explain_data_intern(MEM_ROOT *mem_root, Explain_update *eu, bool is_analyze);
public:
virtual ~Update_plan() {}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 72de82dc5d1..838649a6398 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016 Oracle and/or its affiliates.
- Copyright (c) 2009, 2016 MariaDB
+ Copyright (c) 2009, 2016, 2017 MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1028,7 +1028,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
union_part= unit_arg->is_unit_op();
if (select_lex->handle_derived(thd->lex, DT_PREPARE))
- DBUG_RETURN(1);
+ DBUG_RETURN(-1);
thd->lex->current_select->context_analysis_place= NO_MATTER;
thd->lex->current_select->is_item_list_lookup= 1;
@@ -1267,6 +1267,8 @@ JOIN::prepare(TABLE_LIST *tables_init,
(*ord->item)->field_type() == MYSQL_TYPE_BIT)
{
Item_field *field= new (thd->mem_root) Item_field(thd, *(Item_field**)ord->item);
+ if (!field)
+ DBUG_RETURN(-1);
int el= all_fields.elements;
ref_ptrs[el]= field;
all_fields.push_front(field, thd->mem_root);
@@ -1439,14 +1441,16 @@ err:
DBUG_RETURN(res); /* purecov: inspected */
}
-void JOIN::build_explain()
+
+bool JOIN::build_explain()
{
create_explain_query_if_not_exists(thd->lex, thd->mem_root);
have_query_plan= QEP_AVAILABLE;
- save_explain_data(thd->lex->explain, false /* can overwrite */,
- need_tmp,
- !skip_sort_order && !no_order && (order || group_list),
- select_distinct);
+ if (save_explain_data(thd->lex->explain, false /* can overwrite */,
+ need_tmp,
+ !skip_sort_order && !no_order && (order || group_list),
+ select_distinct))
+ return 1;
uint select_nr= select_lex->select_number;
JOIN_TAB *curr_tab= join_tab + exec_join_tab_cnt();
for (uint i= 0; i < aggr_tables; i++, curr_tab++)
@@ -1464,8 +1468,10 @@ void JOIN::build_explain()
get_using_temporary_read_tracker();
}
}
+ return 0;
}
+
int JOIN::optimize()
{
int res= 0;
@@ -1485,7 +1491,7 @@ int JOIN::optimize()
init_state == JOIN::OPTIMIZATION_PHASE_1_DONE)
{
if (!res && have_query_plan != QEP_DELETED)
- build_explain();
+ res= build_explain();
optimization_state= JOIN::OPTIMIZATION_DONE;
}
return res;
@@ -2079,6 +2085,9 @@ int JOIN::optimize_stage2()
{
ref_item= substitute_for_best_equal_field(thd, tab, ref_item,
equals, map2table);
+ if (thd->is_fatal_error)
+ DBUG_RETURN(1);
+
if (first_inner)
{
equals= first_inner->cond_equal;
@@ -2391,7 +2400,8 @@ int JOIN::optimize_stage2()
/* Perform FULLTEXT search before all regular searches */
if (!(select_options & SELECT_DESCRIBE))
- init_ftfuncs(thd, select_lex, MY_TEST(order));
+ if (init_ftfuncs(thd, select_lex, MY_TEST(order)))
+ DBUG_RETURN(1);
/*
It's necessary to check const part of HAVING cond as
@@ -2778,7 +2788,8 @@ bool JOIN::make_aggr_tables_info()
if (gbh)
{
- pushdown_query= new (thd->mem_root) Pushdown_query(select_lex, gbh);
+ if (!(pushdown_query= new (thd->mem_root) Pushdown_query(select_lex, gbh)))
+ DBUG_RETURN(1);
/*
We must store rows in the tmp table if we need to do an ORDER BY
or DISTINCT and the storage handler can't handle it.
@@ -2795,7 +2806,8 @@ bool JOIN::make_aggr_tables_info()
curr_tab->ref.key= -1;
curr_tab->join= this;
- curr_tab->tmp_table_param= new TMP_TABLE_PARAM(tmp_table_param);
+ if (!(curr_tab->tmp_table_param= new TMP_TABLE_PARAM(tmp_table_param)))
+ DBUG_RETURN(1);
TABLE* table= create_tmp_table(thd, curr_tab->tmp_table_param,
all_fields,
NULL, query.distinct,
@@ -2805,7 +2817,8 @@ bool JOIN::make_aggr_tables_info()
if (!table)
DBUG_RETURN(1);
- curr_tab->aggr= new (thd->mem_root) AGGR_OP(curr_tab);
+ if (!(curr_tab->aggr= new (thd->mem_root) AGGR_OP(curr_tab)))
+ DBUG_RETURN(1);
curr_tab->aggr->set_write_func(::end_send);
curr_tab->table= table;
/*
@@ -3245,7 +3258,8 @@ bool JOIN::make_aggr_tables_info()
curr_tab= join_tab + exec_join_tab_cnt() + aggr_tables - 1;
if (select_lex->window_funcs.elements)
{
- curr_tab->window_funcs_step= new Window_funcs_computation;
+ if (!(curr_tab->window_funcs_step= new Window_funcs_computation))
+ DBUG_RETURN(true);
if (curr_tab->window_funcs_step->setup(thd, &select_lex->window_funcs,
curr_tab))
DBUG_RETURN(true);
@@ -3287,7 +3301,8 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
!select_lex->with_sum_func) ?
select_limit : HA_POS_ERROR;
- tab->tmp_table_param= new TMP_TABLE_PARAM(tmp_table_param);
+ if (!(tab->tmp_table_param= new TMP_TABLE_PARAM(tmp_table_param)))
+ DBUG_RETURN(true);
tab->tmp_table_param->skip_create_table= true;
TABLE* table= create_tmp_table(thd, tab->tmp_table_param, *table_fields,
table_group, distinct,
@@ -3301,8 +3316,7 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
DBUG_ASSERT(tab > tab->join->join_tab || !top_join_tab_count || !tables_list);
if (tab > join_tab)
(tab - 1)->next_select= sub_select_postjoin_aggr;
- tab->aggr= new (thd->mem_root) AGGR_OP(tab);
- if (!tab->aggr)
+ if (!(tab->aggr= new (thd->mem_root) AGGR_OP(tab)))
goto err;
tab->table= table;
table->reginfo.join_tab= tab;
@@ -3452,33 +3466,42 @@ bool JOIN::setup_subquery_caches()
select_lex->expr_cache_may_be_used[IN_ON] ||
select_lex->expr_cache_may_be_used[NO_MATTER])
{
- if (conds)
- conds= conds->transform(thd, &Item::expr_cache_insert_transformer,
- NULL);
JOIN_TAB *tab;
+ if (conds &&
+ !(conds= conds->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL)))
+ DBUG_RETURN(TRUE);
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(thd, &Item::expr_cache_insert_transformer,
- NULL);
+ if (tab->select_cond &&
+ !(tab->select_cond=
+ tab->select_cond->transform(thd,
+ &Item::expr_cache_insert_transformer,
+ NULL)))
+ DBUG_RETURN(TRUE);
if (tab->cache_select && tab->cache_select->cond)
- tab->cache_select->cond=
- tab->cache_select->
- cond->transform(thd, &Item::expr_cache_insert_transformer,
- NULL);
-
+ if (!(tab->cache_select->cond=
+ tab->cache_select->
+ cond->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL)))
+ DBUG_RETURN(TRUE);
}
- if (having)
- having= having->transform(thd, &Item::expr_cache_insert_transformer,
- NULL);
+ if (having &&
+ !(having= having->transform(thd,
+ &Item::expr_cache_insert_transformer,
+ NULL)))
+ DBUG_RETURN(TRUE);
+
if (tmp_having)
{
DBUG_ASSERT(having == NULL);
- tmp_having= tmp_having->transform(thd, &Item::expr_cache_insert_transformer,
- NULL);
+ if (!(tmp_having=
+ tmp_having->transform(thd,
+ &Item::expr_cache_insert_transformer,
+ NULL)))
+ DBUG_RETURN(TRUE);
}
}
if (select_lex->expr_cache_may_be_used[SELECT_LIST] ||
@@ -3489,9 +3512,11 @@ bool JOIN::setup_subquery_caches()
Item *item;
while ((item= li++))
{
- Item *new_item=
- item->transform(thd, &Item::expr_cache_insert_transformer,
- NULL);
+ Item *new_item;
+ if (!(new_item=
+ item->transform(thd, &Item::expr_cache_insert_transformer,
+ NULL)))
+ DBUG_RETURN(TRUE);
if (new_item != item)
{
thd->change_item_tree(li.ref(), new_item);
@@ -3499,18 +3524,22 @@ 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(thd, &Item::expr_cache_insert_transformer,
- NULL);
+ if (!(*tmp_group->item=
+ (*tmp_group->item)->transform(thd,
+ &Item::expr_cache_insert_transformer,
+ NULL)))
+ DBUG_RETURN(TRUE);
}
}
if (select_lex->expr_cache_may_be_used[NO_MATTER])
{
for (ORDER *ord= order; ord; ord= ord->next)
{
- *ord->item=
- (*ord->item)->transform(thd, &Item::expr_cache_insert_transformer,
- NULL);
+ if (!(*ord->item=
+ (*ord->item)->transform(thd,
+ &Item::expr_cache_insert_transformer,
+ NULL)))
+ DBUG_RETURN(TRUE);
}
}
DBUG_RETURN(FALSE);
@@ -3635,7 +3664,8 @@ JOIN::reinit()
}
if (!(select_options & SELECT_DESCRIBE))
- init_ftfuncs(thd, select_lex, MY_TEST(order));
+ if (init_ftfuncs(thd, select_lex, MY_TEST(order)))
+ DBUG_RETURN(1);
DBUG_RETURN(0);
}
@@ -3677,7 +3707,14 @@ err:
}
-void JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
+/**
+ @retval
+ 0 ok
+ 1 error
+*/
+
+
+bool JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
bool need_tmp_table, bool need_order,
bool distinct)
{
@@ -3696,9 +3733,8 @@ void JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
/* It's a degenerate join */
message= zero_result_cause ? zero_result_cause : "No tables used";
}
- save_explain_data_intern(thd->lex->explain, need_tmp_table, need_order,
- distinct, message);
- return;
+ return save_explain_data_intern(thd->lex->explain, need_tmp_table, need_order,
+ distinct, message);
}
/*
@@ -3718,11 +3754,13 @@ void JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
{
if (join_tab[i].filesort)
{
- join_tab[i].filesort->tracker=
- new Filesort_tracker(thd->lex->analyze_stmt);
+ if (!(join_tab[i].filesort->tracker=
+ new Filesort_tracker(thd->lex->analyze_stmt)))
+ return 1;
}
}
}
+ return 0;
}
@@ -9415,16 +9453,16 @@ Item *JOIN_TAB::get_splitting_cond_for_grouping_derived(THD *thd)
for (ORDER *ord= sel->join->partition_list; ord;
ord= ord->next, fld= li++)
{
- Item *left_item= (*ord->item)->build_clone(thd, thd->mem_root);
+ Item *left_item= (*ord->item)->build_clone(thd);
uint i= 0;
for (KEY_PART_INFO *key_part= start; key_part < end; key_part++, i++)
{
if (key_part->fieldnr == fld->field_index + 1)
break;
}
- Item *right_item= ref.items[i]->build_clone(thd, thd->mem_root);
+ Item *right_item= ref.items[i]->build_clone(thd);
Item_func_eq *eq_item= 0;
- right_item= right_item->build_clone(thd, thd->mem_root);
+ right_item= right_item->build_clone(thd);
if (left_item && right_item)
{
right_item->walk(&Item::set_fields_as_dependent_processor,
@@ -12610,7 +12648,8 @@ bool JOIN_TAB::preread_init()
/* init ftfuns for just initialized derived table */
if (table->fulltext_searched)
- init_ftfuncs(join->thd, join->select_lex, MY_TEST(join->order));
+ if (init_ftfuncs(join->thd, join->select_lex, MY_TEST(join->order)))
+ return TRUE;
return FALSE;
}
@@ -14791,7 +14830,7 @@ static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
This works OK with PS/SP re-execution as changes are made to
the arguments of AND/OR items only
*/
- if (new_item != item)
+ if (new_item && new_item != item)
li.replace(new_item);
}
@@ -14870,7 +14909,9 @@ static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
while((item_equal= it++))
{
REPLACE_EQUAL_FIELD_ARG arg= {item_equal, context_tab};
- cond= cond->transform(thd, &Item::replace_equal_field, (uchar *) &arg);
+ if (!(cond= cond->transform(thd, &Item::replace_equal_field,
+ (uchar *) &arg)))
+ return 0;
}
cond_equal= cond_equal->upper_levels;
}
@@ -15027,6 +15068,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
{
cond->marker=1;
COND_CMP *tmp2;
+ /* Will work, even if malloc would fail */
if ((tmp2= new (thd->mem_root) COND_CMP(and_father, func)))
save_list->push_back(tmp2);
}
@@ -15059,6 +15101,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
thd->change_item_tree(args + 1, value);
cond->marker=1;
COND_CMP *tmp2;
+ /* Will work, even if malloc would fail */
if ((tmp2=new (thd->mem_root) COND_CMP(and_father, func)))
save_list->push_back(tmp2);
}
@@ -16490,6 +16533,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
query_cache_abort(thd, &thd->query_cache_tls);
#endif
COND *new_cond, *cond= this;
+ /* If this fails, we will catch it later before executing query */
if ((new_cond= new (thd->mem_root) Item_func_eq(thd, args[0],
new (thd->mem_root) Item_int(thd, "last_insert_id()",
thd->read_first_successful_insert_id_in_prev_stmt(),
@@ -17334,7 +17378,8 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
Item *arg= sum_item->get_arg(i);
if (!arg->const_item())
{
- Field *new_field=
+ Item *tmp_item;
+ Field *new_field=
create_tmp_field(thd, table, arg, arg->type(), &copy_func,
tmp_from_field, &default_field[fieldnr],
group != 0,not_all_columns,
@@ -17359,7 +17404,10 @@ 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 (thd->mem_root) Item_temptable_field(thd, new_field));
+ if (!(tmp_item= new (thd->mem_root)
+ Item_temptable_field(thd, new_field)))
+ goto err;
+ arg= sum_item->set_arg(i, thd, tmp_item);
thd->mem_root= &table->mem_root;
if (param->force_not_null_cols)
{
@@ -23275,6 +23323,10 @@ setup_new_fields(THD *thd, List<Item> &fields,
Try to use the fields in the order given by 'order' to allow one to
optimize away 'order by'.
+
+ @retval
+ 0 OOM error if thd->is_fatal_error is set. Otherwise group was eliminated
+ # Pointer to new group
*/
ORDER *
@@ -23337,6 +23389,8 @@ create_distinct_group(THD *thd, Ref_ptr_array ref_pointer_array,
BIT type and will be returned [el]client.
*/
Item_field *new_item= new (thd->mem_root) Item_field(thd, (Item_field*)item);
+ if (!new_item)
+ return 0;
int el= all_fields.elements;
orig_ref_pointer_array[el]= new_item;
all_fields.push_front(new_item, thd->mem_root);
@@ -24018,7 +24072,10 @@ change_to_use_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array,
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
item_field= item;
else if (item->type() == Item::FIELD_ITEM)
- item_field= item->get_tmp_table_item(thd);
+ {
+ if (!(item_field= item->get_tmp_table_item(thd)))
+ DBUG_RETURN(true);
+ }
else if (item->type() == Item::FUNC_ITEM &&
((Item_func*)item)->functype() == Item_func::SUSERVAR_FUNC)
{
@@ -24126,8 +24183,13 @@ change_refs_to_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array,
if (item->type() == Item::SUM_FUNC_ITEM && item->const_item())
new_item= item;
else
- new_item= item->get_tmp_table_item(thd);
- res_all_fields.push_back(new_item, thd->mem_root);
+ {
+ if (!(new_item= item->get_tmp_table_item(thd)))
+ return 1;
+ }
+
+ if (res_all_fields.push_back(new_item, thd->mem_root))
+ return 1;
ref_pointer_array[((i < border)? all_fields.elements-i-1 : i-border)]=
new_item;
}
@@ -24493,7 +24555,9 @@ bool JOIN::rollup_init()
*/
for (i= 0 ; i < send_group_parts ; i++)
{
- rollup.null_items[i]= new (thd->mem_root) Item_null_result(thd);
+ if (!(rollup.null_items[i]= new (thd->mem_root) Item_null_result(thd)))
+ return true;
+
List<Item> *rollup_fields= &rollup.fields[i];
rollup_fields->empty();
rollup.ref_pointer_arrays[i]= Ref_ptr_array(ref_array, all_fields.elements);
@@ -24837,8 +24901,12 @@ void JOIN::clear()
}
-/*
+/**
Print an EXPLAIN line with all NULLs and given message in the 'Extra' column
+
+ @retval
+ 0 ok
+ 1 OOM error or error from send_data()
*/
int print_explain_message_line(select_result_sink *result,
@@ -24897,7 +24965,7 @@ int print_explain_message_line(select_result_sink *result,
else
item_list.push_back(item_null, mem_root);
- if (result->send_data(item_list))
+ if (thd->is_fatal_error || result->send_data(item_list))
return 1;
return 0;
}
@@ -24931,13 +24999,14 @@ int append_possible_keys(MEM_ROOT *alloc, String_list &list, TABLE *table,
for (j=0 ; j < table->s->keys ; j++)
{
if (possible_keys.is_set(j))
- list.append_str(alloc, table->key_info[j].name.str);
+ if (!(list.append_str(alloc, table->key_info[j].name.str)))
+ return 1;
}
return 0;
}
-void JOIN_TAB::save_explain_data(Explain_table_access *eta,
+bool JOIN_TAB::save_explain_data(Explain_table_access *eta,
table_map prefix_tables,
bool distinct_arg, JOIN_TAB *first_top_tab)
{
@@ -24966,9 +25035,11 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta,
if (filesort)
{
- eta->pre_join_sort= new Explain_aggr_filesort(thd->mem_root,
- thd->lex->analyze_stmt,
- filesort);
+ if (!(eta->pre_join_sort=
+ new Explain_aggr_filesort(thd->mem_root,
+ thd->lex->analyze_stmt,
+ filesort)))
+ return 1;
}
tracker= &eta->tracker;
@@ -25065,7 +25136,8 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta,
// psergey-todo: why does this use thd MEM_ROOT??? Doesn't this
// break ANALYZE ? thd->mem_root will be freed, and after that we will
// attempt to print the query plan?
- append_possible_keys(thd->mem_root, eta->possible_keys, table, keys);
+ if (append_possible_keys(thd->mem_root, eta->possible_keys, table, keys))
+ return 1;
// psergey-todo: ^ check for error return code
/* Build "key", "key_len", and "ref" */
@@ -25086,7 +25158,8 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta,
*/
if (tab_select && tab_select->quick && tab_type != JT_CONST)
{
- eta->quick_info= tab_select->quick->get_explain(thd->mem_root);
+ if (!(eta->quick_info= tab_select->quick->get_explain(thd->mem_root)))
+ return 1;
}
if (key_info) /* 'index' or 'ref' access */
@@ -25099,10 +25172,14 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta,
for (uint kp= 0; kp < ref.key_parts; kp++)
{
if ((key_part_map(1) << kp) & ref.const_ref_part_map)
- eta->ref_list.append_str(thd->mem_root, "const");
+ {
+ if (!(eta->ref_list.append_str(thd->mem_root, "const")))
+ return 1;
+ }
else
{
- eta->ref_list.append_str(thd->mem_root, (*key_ref)->name());
+ if (!(eta->ref_list.append_str(thd->mem_root, (*key_ref)->name())))
+ return 1;
key_ref++;
}
}
@@ -25359,7 +25436,8 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta,
if (cache)
{
eta->push_extra(ET_USING_JOIN_BUFFER);
- cache->save_explain_data(&eta->bka_type);
+ if (cache->save_explain_data(&eta->bka_type))
+ return 1;
}
}
@@ -25372,15 +25450,21 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta,
/* The same for non-merged semi-joins */
eta->non_merged_sjm_number = get_non_merged_semijoin_select();
+
+ return 0;
}
/*
Walk through join->aggr_tables and save aggregation/grouping query plan into
an Explain_select object
+
+ @retval
+ 0 ok
+ 1 error
*/
-void save_agg_explain_data(JOIN *join, Explain_select *xpl_sel)
+bool save_agg_explain_data(JOIN *join, Explain_select *xpl_sel)
{
JOIN_TAB *join_tab=join->join_tab + join->exec_join_tab_cnt();
Explain_aggr_node *prev_node;
@@ -25392,7 +25476,8 @@ void save_agg_explain_data(JOIN *join, Explain_select *xpl_sel)
{
// Each aggregate means a temp.table
prev_node= node;
- node= new Explain_aggr_tmp_table;
+ if (!(node= new Explain_aggr_tmp_table))
+ return 1;
node->child= prev_node;
if (join_tab->window_funcs_step)
@@ -25400,19 +25485,20 @@ void save_agg_explain_data(JOIN *join, Explain_select *xpl_sel)
Explain_aggr_node *new_node=
join_tab->window_funcs_step->save_explain_plan(thd->mem_root,
is_analyze);
- if (new_node)
- {
- prev_node=node;
- node= new_node;
- node->child= prev_node;
- }
+ if (!new_node)
+ return 1;
+
+ prev_node=node;
+ node= new_node;
+ node->child= prev_node;
}
/* The below matches execution in join_init_read_record() */
if (join_tab->distinct)
{
prev_node= node;
- node= new Explain_aggr_remove_dups;
+ if (!(node= new Explain_aggr_remove_dups))
+ return 1;
node->child= prev_node;
}
@@ -25420,20 +25506,27 @@ void save_agg_explain_data(JOIN *join, Explain_select *xpl_sel)
{
Explain_aggr_filesort *eaf =
new Explain_aggr_filesort(thd->mem_root, is_analyze, join_tab->filesort);
+ if (!eaf)
+ return 1;
prev_node= node;
node= eaf;
node->child= prev_node;
}
}
xpl_sel->aggr_tree= node;
+ return 0;
}
-/*
+/**
Save Query Plan Footprint
@note
Currently, this function may be called multiple times
+
+ @retval
+ 0 ok
+ 1 error
*/
int JOIN::save_explain_data_intern(Explain_query *output,
@@ -25442,7 +25535,6 @@ int JOIN::save_explain_data_intern(Explain_query *output,
const char *message)
{
JOIN *join= this; /* Legacy: this code used to be a non-member function */
- int cur_error= 0;
DBUG_ENTER("JOIN::save_explain_data_intern");
DBUG_PRINT("info", ("Select %p, type %s, message %s",
join->select_lex, join->select_lex->type,
@@ -25460,8 +25552,11 @@ int JOIN::save_explain_data_intern(Explain_query *output,
if (message)
{
- explain= new (output->mem_root) Explain_select(output->mem_root,
- thd->lex->analyze_stmt);
+ if (!(explain= new (output->mem_root)
+ Explain_select(output->mem_root,
+ thd->lex->analyze_stmt)))
+ DBUG_RETURN(1);
+
join->select_lex->set_explain_type(true);
explain->select_id= join->select_lex->select_number;
@@ -25474,13 +25569,17 @@ int JOIN::save_explain_data_intern(Explain_query *output,
if (select_lex->master_unit()->derived)
explain->connection_type= Explain_node::EXPLAIN_NODE_DERIVED;
- save_agg_explain_data(this, explain);
+ if (save_agg_explain_data(this, explain))
+ DBUG_RETURN(1);
+
output->add_node(explain);
}
else if (pushdown_query)
{
- explain= new (output->mem_root) Explain_select(output->mem_root,
- thd->lex->analyze_stmt);
+ if (!(explain= new (output->mem_root)
+ Explain_select(output->mem_root,
+ thd->lex->analyze_stmt)))
+ DBUG_RETURN(1);
select_lex->set_explain_type(true);
explain->select_id= select_lex->select_number;
@@ -25500,6 +25599,9 @@ int JOIN::save_explain_data_intern(Explain_query *output,
explain= xpl_sel=
new (output->mem_root) Explain_select(output->mem_root,
thd->lex->analyze_stmt);
+ if (!explain)
+ DBUG_RETURN(1);
+
table_map used_tables=0;
join->select_lex->set_explain_type(true);
@@ -25509,7 +25611,8 @@ int JOIN::save_explain_data_intern(Explain_query *output,
if (select_lex->master_unit()->derived)
xpl_sel->connection_type= Explain_node::EXPLAIN_NODE_DERIVED;
- save_agg_explain_data(this, xpl_sel);
+ if (save_agg_explain_data(this, xpl_sel))
+ DBUG_RETURN(1);
xpl_sel->exec_const_cond= exec_const_cond;
xpl_sel->outer_ref_cond= outer_ref_cond;
@@ -25541,6 +25644,8 @@ int JOIN::save_explain_data_intern(Explain_query *output,
Explain_table_access *eta= (new (output->mem_root)
Explain_table_access(output->mem_root));
+ if (!eta)
+ DBUG_RETURN(1);
if (tab->bush_root_tab != prev_bush_root_tab)
{
if (tab->bush_root_tab)
@@ -25548,7 +25653,9 @@ int JOIN::save_explain_data_intern(Explain_query *output,
/*
We've entered an SJ-Materialization nest. Create an object for it.
*/
- cur_parent= new (output->mem_root) Explain_basic_join(output->mem_root);
+ if (!(cur_parent=
+ new (output->mem_root) Explain_basic_join(output->mem_root)))
+ DBUG_RETURN(1);
JOIN_TAB *first_child= tab->bush_root_tab->bush_children->start;
cur_parent->select_id=
@@ -25568,7 +25675,8 @@ int JOIN::save_explain_data_intern(Explain_query *output,
prev_bush_root_tab= tab->bush_root_tab;
cur_parent->add_table(eta, output);
- tab->save_explain_data(eta, used_tables, distinct_arg, first_top_tab);
+ if (tab->save_explain_data(eta, used_tables, distinct_arg, first_top_tab))
+ DBUG_RETURN(1);
if (saved_join_tab)
tab= saved_join_tab;
@@ -25600,10 +25708,10 @@ int JOIN::save_explain_data_intern(Explain_query *output,
}
}
- if (!cur_error && select_lex->is_top_level_node())
+ if (select_lex->is_top_level_node())
output->query_plan_ready();
- DBUG_RETURN(cur_error);
+ DBUG_RETURN(0);
}
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 4902f99e4ec..0c8c3c1a40c 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -608,7 +608,7 @@ typedef struct st_join_table {
void remove_redundant_bnl_scan_conds();
- void save_explain_data(Explain_table_access *eta, table_map prefix_tables,
+ bool save_explain_data(Explain_table_access *eta, table_map prefix_tables,
bool distinct, struct st_join_table *first_top_tab);
bool use_order() const; ///< Use ordering provided by chosen index?
@@ -1526,7 +1526,7 @@ public:
int optimize();
int optimize_inner();
int optimize_stage2();
- void build_explain();
+ bool build_explain();
int reinit();
int init_execution();
void exec();
@@ -1667,7 +1667,7 @@ public:
{
return (unit->item && unit->item->is_in_predicate());
}
- void save_explain_data(Explain_query *output, bool can_overwrite,
+ bool save_explain_data(Explain_query *output, bool can_overwrite,
bool need_tmp_table, bool need_order, bool distinct);
int save_explain_data_intern(Explain_query *output, bool need_tmp_table,
bool need_order, bool distinct,
diff --git a/sql/sql_string.h b/sql/sql_string.h
index c88c58b1b40..41d31dc33c2 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -181,6 +181,8 @@ public:
}
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
{ return (void*) alloc_root(mem_root, (uint) size); }
+ static void *operator new[](size_t size, MEM_ROOT *mem_root) throw ()
+ { return alloc_root(mem_root, size); }
static void operator delete(void *ptr_arg, size_t size)
{
(void) ptr_arg;
@@ -189,6 +191,10 @@ public:
}
static void operator delete(void *, MEM_ROOT *)
{ /* never called */ }
+ static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
+ static void operator delete[](void *ptr, MEM_ROOT *mem_root)
+ { /* never called */ }
+
~String() { free(); }
/* Mark variable thread specific it it's not allocated already */
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 640aa6e29bb..9b4a56e9d9c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -441,6 +441,13 @@ uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length)
}
+static bool check_if_frm_exists(char *path, const char *db, const char *table)
+{
+ fn_format(path, table, db, reg_ext, MYF(0));
+ return !access(path, F_OK);
+}
+
+
/*
Translate a table name to a file name (WL #1324).
@@ -531,13 +538,18 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db,
DBUG_PRINT("enter", ("db: '%s' table_name: '%s' ext: '%s' flags: %x",
db, table_name, ext, flags));
+ (void) tablename_to_filename(db, dbbuff, sizeof(dbbuff));
+
+ /* Check if this is a temporary table name. Allow it if a corresponding .frm file exists */
+ if (is_prefix(table_name, tmp_file_prefix) && strlen(table_name) < NAME_CHAR_LEN &&
+ check_if_frm_exists(tbbuff, dbbuff, table_name))
+ flags|= FN_IS_TMP;
+
if (flags & FN_IS_TMP) // FN_FROM_IS_TMP | FN_TO_IS_TMP
strmake(tbbuff, table_name, sizeof(tbbuff)-1);
else
(void) tablename_to_filename(table_name, tbbuff, sizeof(tbbuff));
- (void) tablename_to_filename(db, dbbuff, sizeof(dbbuff));
-
char *end = buff + bufflen;
/* Don't add FN_ROOTDIR if mysql_data_home already includes it */
char *pos = strnmov(buff, mysql_data_home, bufflen);
@@ -9964,7 +9976,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
if (mysql_trans_prepare_alter_copy_data(thd))
DBUG_RETURN(-1);
- if (!(copy= new Copy_field[to->s->fields]))
+ if (!(copy= new (thd->mem_root) Copy_field[to->s->fields]))
DBUG_RETURN(-1); /* purecov: inspected */
/* We need external lock before we can disable/enable keys */
diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc
index 7b4a9596afd..56a6ae58a77 100644
--- a/sql/sql_tvc.cc
+++ b/sql/sql_tvc.cc
@@ -283,6 +283,9 @@ int table_value_constr::save_explain_data_intern(THD *thd,
explain= new (output->mem_root) Explain_select(output->mem_root,
thd->lex->analyze_stmt);
+ if (!explain)
+ DBUG_RETURN(1);
+
select_lex->set_explain_type(true);
explain->select_id= select_lex->select_number;
@@ -309,7 +312,7 @@ int table_value_constr::save_explain_data_intern(THD *thd,
Optimization of TVC
*/
-void table_value_constr::optimize(THD *thd)
+bool table_value_constr::optimize(THD *thd)
{
create_explain_query_if_not_exists(thd->lex, thd->mem_root);
have_query_plan= QEP_AVAILABLE;
@@ -320,8 +323,9 @@ void table_value_constr::optimize(THD *thd)
thd->lex->explain && // for "SET" command in SPs.
(!thd->lex->explain->get_select(select_lex->select_number)))
{
- save_explain_data_intern(thd, thd->lex->explain);
+ return save_explain_data_intern(thd, thd->lex->explain);
}
+ return 0;
}
diff --git a/sql/sql_tvc.h b/sql/sql_tvc.h
index b4fca78262b..420311cccb2 100644
--- a/sql/sql_tvc.h
+++ b/sql/sql_tvc.h
@@ -16,14 +16,14 @@
#ifndef SQL_TVC_INCLUDED
#define SQL_TVC_INCLUDED
#include "sql_type.h"
-#include "item.h"
typedef List<Item> List_item;
class select_result;
-
class Explain_select;
class Explain_query;
class Item_func_in;
+class st_select_lex_unit;
+typedef class st_select_lex SELECT_LEX;
/**
@class table_value_constr
@@ -57,7 +57,7 @@ public:
int save_explain_data_intern(THD *thd_arg,
Explain_query *output);
- void optimize(THD *thd_arg);
+ bool optimize(THD *thd_arg);
bool exec(SELECT_LEX *sl);
void print(THD *thd_arg, String *str, enum_query_type query_type);
diff --git a/sql/sql_type.h b/sql/sql_type.h
index f9a4ae2a96b..3c52c70289a 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -73,7 +73,6 @@ struct Schema_specification_st;
struct TABLE;
struct SORT_FIELD_ATTR;
-
/*
Flags for collation aggregation modes, used in TDCollation::agg():
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index d1551cb5e96..ecc2a54bdd8 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -1282,7 +1282,11 @@ bool st_select_lex_unit::optimize()
sl->tvc->select_options=
(select_limit_cnt == HA_POS_ERROR || sl->braces) ?
sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union;
- sl->tvc->optimize(thd);
+ if (sl->tvc->optimize(thd))
+ {
+ thd->lex->current_select= lex_select_save;
+ DBUG_RETURN(TRUE);
+ }
continue;
}
thd->lex->current_select= sl;
@@ -1397,7 +1401,7 @@ bool st_select_lex_unit::exec()
sl->tvc->select_options=
(select_limit_cnt == HA_POS_ERROR || sl->braces) ?
sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union;
- sl->tvc->optimize(thd);
+ saved_error= sl->tvc->optimize(thd);
}
else
{
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index e6a906a43c1..cec410a0e62 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -474,7 +474,8 @@ int mysql_update(THD *thd,
goto err;
}
}
- init_ftfuncs(thd, select_lex, 1);
+ if (init_ftfuncs(thd, select_lex, 1))
+ goto err;
table->mark_columns_needed_for_update();
@@ -545,7 +546,8 @@ int mysql_update(THD *thd,
*/
if (thd->lex->describe)
goto produce_explain_and_leave;
- explain= query_plan.save_explain_update_data(query_plan.mem_root, thd);
+ if (!(explain= query_plan.save_explain_update_data(query_plan.mem_root, thd)))
+ goto err;
ANALYZE_START_TRACKING(&explain->command_tracker);
@@ -1103,7 +1105,8 @@ produce_explain_and_leave:
We come here for various "degenerate" query plans: impossible WHERE,
no-partitions-used, impossible-range, etc.
*/
- query_plan.save_explain_update_data(query_plan.mem_root, thd);
+ if (!query_plan.save_explain_update_data(query_plan.mem_root, thd))
+ goto err;
emit_explain_and_leave:
int err2= thd->lex->explain->send_explain(thd);
@@ -1836,7 +1839,7 @@ int multi_update::prepare(List<Item> &not_used_values,
switch_to_nullable_trigger_fields(*values_for_table[i], table);
}
}
- copy_field= new Copy_field[max_fields];
+ copy_field= new (thd->mem_root) Copy_field[max_fields];
DBUG_RETURN(thd->is_fatal_error != 0);
}
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 4bcdca3ca11..bf393ab1c4d 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -3093,10 +3093,14 @@ Window_funcs_computation::save_explain_plan(MEM_ROOT *mem_root,
Explain_aggr_window_funcs *xpl= new Explain_aggr_window_funcs;
List_iterator<Window_funcs_sort> it(win_func_sorts);
Window_funcs_sort *srt;
+ if (!xpl)
+ return 0;
while ((srt = it++))
{
Explain_aggr_filesort *eaf=
new Explain_aggr_filesort(mem_root, is_analyze, srt->filesort);
+ if (!eaf)
+ return 0;
xpl->sorts.push_back(eaf, mem_root);
}
return xpl;
diff --git a/sql/sql_window.h b/sql/sql_window.h
index 4cb9c1362f5..392f89e8f03 100644
--- a/sql/sql_window.h
+++ b/sql/sql_window.h
@@ -17,7 +17,6 @@
#ifndef SQL_WINDOW_INCLUDED
#define SQL_WINDOW_INCLUDED
-#include "item.h"
#include "filesort.h"
#include "records.h"
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index feabd738224..fd5409ab26d 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -437,6 +437,13 @@ static Sys_var_ulonglong Sys_binlog_cache_size(
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, SIZE_T_MAX), DEFAULT(32768), BLOCK_SIZE(IO_SIZE));
+static Sys_var_ulonglong Sys_binlog_file_cache_size(
+ "binlog_file_cache_size",
+ "The size of file cache for the binary log",
+ GLOBAL_VAR(binlog_file_cache_size),
+ CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(IO_SIZE*2, SIZE_T_MAX), DEFAULT(IO_SIZE*4), BLOCK_SIZE(IO_SIZE));
+
static Sys_var_ulonglong Sys_binlog_stmt_cache_size(
"binlog_stmt_cache_size", "The size of the statement cache for "
"updates to non-transactional engines for the binary log. "
@@ -5345,6 +5352,38 @@ static Sys_var_ulong Sys_host_cache_size(
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
ON_UPDATE(fix_host_cache_size));
+vio_keepalive_opts opt_vio_keepalive;
+
+static Sys_var_int Sys_keepalive_time(
+ "tcp_keepalive_time",
+ "Timeout, in milliseconds, with no activity until the first TCP keep-alive packet is sent."
+ "If set to 0, system dependent default is used.",
+ AUTO_SET GLOBAL_VAR(opt_vio_keepalive.idle),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, INT_MAX32/1000),
+ DEFAULT(0),
+ BLOCK_SIZE(1),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL));
+
+static Sys_var_int Sys_keepalive_interval(
+ "tcp_keepalive_interval",
+ "The interval, in seconds, between when successive keep-alive packets are sent if no acknowledgement is received."
+ "If set to 0, system dependent default is used.",
+ AUTO_SET GLOBAL_VAR(opt_vio_keepalive.interval),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, INT_MAX32/1000),
+ DEFAULT(0),
+ BLOCK_SIZE(1),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL));
+
+static Sys_var_int Sys_keepalive_probes(
+ "tcp_keepalive_probes",
+ "The number of unacknowledged probes to send before considering the connection dead and notifying the application layer."
+ "If set to 0, system dependent default is used.",
+ AUTO_SET GLOBAL_VAR(opt_vio_keepalive.probes),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, INT_MAX32/1000),
+ DEFAULT(0),
+ BLOCK_SIZE(1),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL));
+
static Sys_var_charptr Sys_ignore_db_dirs(
"ignore_db_dirs",
"Specifies a directory to add to the ignore list when collecting "
diff --git a/sql/table.cc b/sql/table.cc
index 32b0d954e9f..f5a031a1cda 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -219,31 +219,26 @@ static uchar *get_field_name(Field **buff, size_t *length,
Returns pointer to '.frm' extension of the file name.
SYNOPSIS
- fn_rext()
+ fn_frm_ext()
name file name
DESCRIPTION
Checks file name part starting with the rightmost '.' character,
and returns it if it is equal to '.frm'.
- TODO
- It is a good idea to get rid of this function modifying the code
- to garantee that the functions presently calling fn_rext() always
- get arguments in the same format: either with '.frm' or without '.frm'.
-
RETURN VALUES
- Pointer to the '.frm' extension. If there is no extension,
- or extension is not '.frm', pointer at the end of file name.
+ Pointer to the '.frm' extension or NULL if not a .frm file
*/
-char *fn_rext(char *name)
+const char *fn_frm_ext(const char *name)
{
- char *res= strrchr(name, '.');
+ const char *res= strrchr(name, '.');
if (res && !strcmp(res, reg_ext))
return res;
- return name + strlen(name);
+ return 0;
}
+
TABLE_CATEGORY get_table_category(const LEX_CSTRING *db,
const LEX_CSTRING *name)
{
@@ -6421,11 +6416,6 @@ void TABLE::mark_columns_needed_for_delete()
need_signal= true;
}
}
- if (check_constraints)
- {
- mark_check_constraint_columns_for_read();
- need_signal= true;
- }
if (need_signal)
file->column_bitmaps_signal();
@@ -8439,8 +8429,8 @@ Item* TABLE_LIST::build_pushable_cond_for_table(THD *thd, Item *cond)
if (!(item->used_tables() == tab_map))
continue;
Item_func_eq *eq= 0;
- Item *left_item_clone= left_item->build_clone(thd, thd->mem_root);
- Item *right_item_clone= item->build_clone(thd, thd->mem_root);
+ Item *left_item_clone= left_item->build_clone(thd);
+ Item *right_item_clone= item->build_clone(thd);
if (left_item_clone && right_item_clone)
{
left_item_clone->set_item_equal(NULL);
@@ -8470,7 +8460,7 @@ Item* TABLE_LIST::build_pushable_cond_for_table(THD *thd, Item *cond)
return new_cond;
}
else if (cond->get_extraction_flag() != NO_EXTRACTION_FL)
- return cond->build_clone(thd, thd->mem_root);
+ return cond->build_clone(thd);
return 0;
}
diff --git a/sql/table.h b/sql/table.h
index 3469ec4b0b4..33278b51a64 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2884,7 +2884,7 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
void append_unescaped(String *res, const char *pos, uint length);
void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
-char *fn_rext(char *name);
+const char *fn_frm_ext(const char *name);
/* Check that the integer is in the internal */
static inline int set_zone(int nr,int min_zone,int max_zone)
diff --git a/sql/vtmd.h b/sql/vtmd.h
index 6c0a4be6bd7..d77ed117248 100644
--- a/sql/vtmd.h
+++ b/sql/vtmd.h
@@ -2,6 +2,10 @@
#define VTMD_INCLUDED
#include <mysqld_error.h>
+
+#include "mariadb.h"
+#include "sql_priv.h"
+
#include "my_sys.h"
#include "table.h"
#include "unireg.h"