diff options
author | unknown <dlenev@mysql.com> | 2005-01-28 10:22:50 +0300 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2005-01-28 10:22:50 +0300 |
commit | 8cac2c0562ec5460368be91602b329ddce653d0d (patch) | |
tree | 654d19586759f3b5343d53fba8af67eb8e5ce42f /sql/item_timefunc.cc | |
parent | a6bfe13c6f4fc2e0c2bebea8a295a445aa5765e8 (diff) | |
parent | bf89dc063a6576cb08f2da29c8f505846965590b (diff) | |
download | mariadb-git-8cac2c0562ec5460368be91602b329ddce653d0d.tar.gz |
Manual merge of fixes for bugs #7899 "CREATE TABLE .. SELECT .. and
CONVERT_TZ() function does not work well together" and bug #7705
"CONVERT_TZ() crashes with subquery/WHERE on index column" in 5.0
tree.
mysql-test/r/timezone2.result:
Auto merged
mysql-test/t/timezone2.test:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/set_var.h:
Auto merged
sql/set_var.cc:
Manual merge.
sql/sql_lex.cc:
Ignoring changes in st_lex::unlink_first_table()/link_first_table_back()
made in 4.1 since they are not applicable to 5.0.
sql/tztime.cc:
Manual merge.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 5a069aee554..3d1feee1f8c 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1662,6 +1662,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; } @@ -1674,12 +1675,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 FALSE; } @@ -1719,13 +1714,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, TIME_NO_ZERO_DATE)) { null_value= 1; @@ -1747,6 +1748,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; |