summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc30
1 files changed, 19 insertions, 11 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 0d652a431cb..80563b9cc83 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1656,6 +1656,7 @@ void Item_func_convert_tz::fix_length_and_dec()
collation.set(&my_charset_bin);
decimals= 0;
max_length= MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+ maybe_null= 1;
}
@@ -1668,12 +1669,6 @@ Item_func_convert_tz::fix_fields(THD *thd_arg, TABLE_LIST *tables_arg, Item **re
tz_tables= thd_arg->lex->time_zone_tables_used;
- if (args[1]->const_item())
- from_tz= my_tz_find(args[1]->val_str(&str), tz_tables);
-
- if (args[2]->const_item())
- to_tz= my_tz_find(args[2]->val_str(&str), tz_tables);
-
return 0;
}
@@ -1713,13 +1708,19 @@ bool Item_func_convert_tz::get_date(TIME *ltime,
my_time_t my_time_tmp;
bool not_used;
String str;
-
- if (!args[1]->const_item())
+
+ if (!from_tz_cached)
+ {
from_tz= my_tz_find(args[1]->val_str(&str), tz_tables);
-
- if (!args[2]->const_item())
+ from_tz_cached= args[1]->const_item();
+ }
+
+ if (!to_tz_cached)
+ {
to_tz= my_tz_find(args[2]->val_str(&str), tz_tables);
-
+ to_tz_cached= args[2]->const_item();
+ }
+
if (from_tz==0 || to_tz==0 || get_arg0_date(ltime, 0))
{
null_value= 1;
@@ -1741,6 +1742,13 @@ bool Item_func_convert_tz::get_date(TIME *ltime,
}
+void Item_func_convert_tz::cleanup()
+{
+ from_tz_cached= to_tz_cached= 0;
+ Item_date_func::cleanup();
+}
+
+
void Item_date_add_interval::fix_length_and_dec()
{
enum_field_types arg0_field_type;