summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-10-10 22:19:53 +0400
committerAlexander Barkov <bar@mariadb.com>2019-10-10 22:19:53 +0400
commit5e17b1f7cbfc256850ed139a0a4898040e16ff60 (patch)
tree23a2ca0da556bccef315b71a42ba419bdcfd2f08 /sql/item.h
parentf5833a4e4507454a4f70510c97e6e75a709c5722 (diff)
downloadmariadb-git-5e17b1f7cbfc256850ed139a0a4898040e16ff60.tar.gz
A small cleanup for MDEV-16309 Split ::create_tmp_field() into virtual methods in Item
These two methods: - Item_result_field::create_tmp_field_ex() - Item_func_user_var::create_tmp_field_ex() had duplicate code, except that they used a different type handler. Adding a protected method Item_result_field::create_tmp_field_ex_from_handler() with a "const Type_handler*" parameter, and reusing it from the two mentioned methods.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/item.h b/sql/item.h
index 022a14585c3..880d4ec0d27 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3169,6 +3169,11 @@ class st_select_lex;
class Item_result_field :public Item_fixed_hybrid /* Item with result field */
{
+protected:
+ Field *create_tmp_field_ex_from_handler(MEM_ROOT *root, TABLE *table,
+ Tmp_field_src *src,
+ const Tmp_field_param *param,
+ const Type_handler *h);
public:
Field *result_field; /* Save result here */
Item_result_field(THD *thd): Item_fixed_hybrid(thd), result_field(0) {}
@@ -3179,7 +3184,12 @@ public:
~Item_result_field() {} /* Required with gcc 2.95 */
Field *get_tmp_table_field() { return result_field; }
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
- const Tmp_field_param *param);
+ const Tmp_field_param *param)
+ {
+ DBUG_ASSERT(fixed);
+ const Type_handler *h= type_handler()->type_handler_for_tmp_table(this);
+ return create_tmp_field_ex_from_handler(root, table, src, param, h);
+ }
void get_tmp_field_src(Tmp_field_src *src, const Tmp_field_param *param);
/*
This implementation of used_tables() used by Item_avg_field and