diff options
author | dlenev@brandersnatch.localdomain <> | 2004-08-10 12:42:31 +0400 |
---|---|---|
committer | dlenev@brandersnatch.localdomain <> | 2004-08-10 12:42:31 +0400 |
commit | f49d4f5350299e31ec4176210e2d457795fb5ed8 (patch) | |
tree | 4016d026abe9ef6a9eb602093cce08af13970126 /sql/item_timefunc.h | |
parent | bcbbfc3bb84b490d0f16d555c5e21b96dc105c23 (diff) | |
download | mariadb-git-f49d4f5350299e31ec4176210e2d457795fb5ed8.tar.gz |
Fix for bug #4508 "CONVERT_TZ() function with new time zone as param crashes server".
Instead of trying to open time zone tables during calculation of CONVERT_TZ() function
or setting of @@time_zone variable we should open and lock them with the rest of
statement's table (so we should add them to global table list) and after that use such
pre-opened tables for loading info about time zones.
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r-- | sql/item_timefunc.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index a7ff2924786..2254fc830c9 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -531,9 +531,22 @@ class Item_func_from_unixtime :public Item_date_func */ class Time_zone; +/* + This class represents CONVERT_TZ() function. + The important fact about this function that it is handled in special way. + When such function is met in expression time_zone system tables are added + to global list of tables to open, so later those already opened and locked + tables can be used during this function calculation for loading time zone + descriptions. +*/ class Item_func_convert_tz :public Item_date_func { - THD *thd; + /* Cached pointer to list of pre-opened time zone tables. */ + TABLE_LIST *tz_tables; + /* + If time zone parameters are constants we are caching objects that + represent them. + */ Time_zone *from_tz, *to_tz; public: Item_func_convert_tz(Item *a, Item *b, Item *c): @@ -542,6 +555,7 @@ class Item_func_convert_tz :public Item_date_func double val() { return (double) val_int(); } String *val_str(String *str); const char *func_name() const { return "convert_tz"; } + bool fix_fields(THD *, struct st_table_list *, Item **); void fix_length_and_dec(); bool get_date(TIME *res, uint fuzzy_date); }; |