summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorJacob Mathew <jacob.mathew@mariadb.com>2017-02-10 13:41:34 -0800
committerJacob Mathew <jacob.mathew@mariadb.com>2017-02-10 13:41:34 -0800
commitcd53525d7c97a7c2b69873fbbd28982844e3cae3 (patch)
tree9ad5f74b8f4998a793b9d22d3b0d3aea224fbfa6 /sql/item.cc
parent070a8754c44e29572d1fafbfece251ace23ba41d (diff)
downloadmariadb-git-MDEV_10355.tar.gz
Changes to fix CREATE TABLE bug MDEV_10355.MDEV_10355MDEV-10355
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 369b2df2675..dd2c4fd75a5 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -9478,7 +9478,7 @@ Item *Item_cache_int::convert_to_basic_const_item(THD *thd)
Item_cache_temporal::Item_cache_temporal(THD *thd,
enum_field_types field_type_arg):
- Item_cache_int(thd, field_type_arg)
+ Item_cache_int(thd, field_type_arg), cached_temporal_item_name(NULL)
{
if (mysql_type_to_time_type(Item_cache_temporal::field_type()) ==
MYSQL_TIMESTAMP_ERROR)
@@ -9614,11 +9614,29 @@ int Item_cache_temporal::save_in_field(Field *field, bool no_conversions)
void Item_cache_temporal::store_packed(longlong val_arg, Item *example_arg)
{
- /* An explicit values is given, save it. */
+ /* An explicit value is given, save it. */
store(example_arg);
value_cached= true;
value= val_arg;
null_value= false;
+
+ switch (example_arg->type())
+ {
+ case FUNC_ITEM:
+ {
+ // Instead of "cache", use the actual function name,
+ // which is more meaningful to the end user
+ const char *func_name = ( ( Item_func* ) example_arg )->func_name();
+ char *ptr = ( char* ) current_thd->alloc( strlen( func_name ) + 3 );
+
+ if ( ptr )
+ {
+ strxmov( ptr, func_name, "()", NullS );
+ }
+
+ cached_temporal_item_name = ptr;
+ }
+ }
}