diff options
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/sql/item.h b/sql/item.h index d5f0dfec033..863265a73f7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2,7 +2,7 @@ #define SQL_ITEM_INCLUDED /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2015, MariaDB + Copyright (c) 2009, 2016, 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 @@ -430,7 +430,7 @@ public: RETURN FALSE if parameter value has been set, - TRUE if error has occured. + TRUE if error has occurred. */ virtual bool set_value(THD *thd, sp_rcontext *ctx, Item **it)= 0; @@ -663,9 +663,7 @@ protected: Field *tmp_table_field_from_field_type(TABLE *table, bool fixed_length, bool set_blob_packlength); - Field *create_tmp_field(bool group, TABLE *table, - uint convert_blob_length, - uint convert_int_length); + Field *create_tmp_field(bool group, TABLE *table, uint convert_int_length); public: /* @@ -1665,16 +1663,13 @@ public: // used in row subselects to get value of elements virtual void bring_value() {} - virtual Field *create_tmp_field(bool group, TABLE *table, - uint convert_blob_length) + virtual Field *create_tmp_field(bool group, TABLE *table) { /* Values with MY_INT32_NUM_DECIMAL_DIGITS digits may or may not fit into Field_long : make them Field_longlong. */ - return create_tmp_field(false, table, - convert_blob_length, - MY_INT32_NUM_DECIMAL_DIGITS - 2); + return create_tmp_field(false, table, MY_INT32_NUM_DECIMAL_DIGITS - 2); } virtual Item_field *field_for_view_update() { return 0; } @@ -2743,7 +2738,7 @@ public: /* If value for parameter was not set we treat it as non-const - so noone will use parameters value in fix_fields still + so no one will use parameters value in fix_fields still parameter is constant during execution. */ virtual table_map used_tables() const @@ -3688,6 +3683,11 @@ public: used_tables_cache|= item->used_tables(); const_item_cache&= item->const_item(); } + void used_tables_and_const_cache_update_and_join(Item *item) + { + item->update_used_tables(); + used_tables_and_const_cache_join(item); + } /* Call update_used_tables() for all "argc" items in the array "argv" and join with the current cache. @@ -3697,10 +3697,7 @@ public: void used_tables_and_const_cache_update_and_join(uint argc, Item **argv) { for (uint i=0 ; i < argc ; i++) - { - argv[i]->update_used_tables(); - used_tables_and_const_cache_join(argv[i]); - } + used_tables_and_const_cache_update_and_join(argv[i]); } /* Call update_used_tables() for all items in the list @@ -3713,10 +3710,7 @@ public: List_iterator_fast<Item> li(list); Item *item; while ((item=li++)) - { - item->update_used_tables(); - used_tables_and_const_cache_join(item); - } + used_tables_and_const_cache_update_and_join(item); } }; @@ -5161,6 +5155,12 @@ public: return (this->*processor)(arg); } virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); + void split_sum_func2_example(THD *thd, Ref_ptr_array ref_pointer_array, + List<Item> &fields, uint flags) + { + example->split_sum_func2(thd, ref_pointer_array, fields, &example, flags); + } + Item *get_example() const { return example; } }; @@ -5265,6 +5265,30 @@ public: bool cache_value(); }; + +class Item_cache_str_for_nullif: public Item_cache_str +{ +public: + Item_cache_str_for_nullif(THD *thd, const Item *item) + :Item_cache_str(thd, item) + { } + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) + { + /** + Item_cache_str::safe_charset_converter() returns a new Item_cache + with Item_func_conv_charset installed on "example". The original + Item_cache is not referenced (neither directly nor recursively) + from the result of Item_cache_str::safe_charset_converter(). + + For NULLIF() purposes we need a different behavior: + we need a new instance of Item_func_conv_charset, + with the original Item_cache referenced in args[0]. See MDEV-9181. + */ + return Item::safe_charset_converter(thd, tocs); + } +}; + + class Item_cache_row: public Item_cache { Item_cache **values; |