diff options
author | unknown <dlenev@mysql.com> | 2006-04-24 18:57:00 +0400 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2006-04-24 18:57:00 +0400 |
commit | dfbf652165def750409cc1e8519e1aacd7a17f8b (patch) | |
tree | c4f5fbeb5dad984a88a67118b45fc15d30e0b073 /sql/tztime.h | |
parent | fb62bcb0021b1ac7425e3ddfc41d6458e1f76aac (diff) | |
download | mariadb-git-dfbf652165def750409cc1e8519e1aacd7a17f8b.tar.gz |
Fix for bug#11081 "Using a CONVERT_TZ function in a stored function or
trigger fails".
In cases when CONVERT_TZ() function was used in trigger or stored function
(or in stored procedure which was called from trigger or stored function)
error about non existing '.' table was reported.
Statements that use CONVERT_TZ() function should have time zone related
tables in their table list. tz_init_table_list() function which is used
to produce part of table list containing those tables didn't set
TABLE_LIST::db_length/table_name_length members properly. As result time
zone tables needed for CONVERT_TZ() function were incorrectly handled by
prelocking algorithm and "Table '.' doesn't exist' error was emitted.
This fix changes tz_init_table_list() in such way that it properly inits
TABLE_LIST::table_name_length/db_length members and thus produces table list
which can be handled by prelocking algorithm correctly.
mysql-test/r/timezone2.result:
Added test for bug #11081 "Using a CONVERT_TZ function in a stored function
or trigger fails".
mysql-test/t/timezone2.test:
Added test for bug #11081 "Using a CONVERT_TZ function in a stored function
or trigger fails".
sql/tztime.cc:
Now tz_init_table_list() inits table_name_length and db_length members in
TABLE_LIST objects, so table lists produced with its help can be handled
by prelocking algorithm properly.
Also two clean-ups are included:
- Now we use MY_TZ_TABLES_COUNT instead of magical number 4 in places where
it is appropriate.
- TZ_NAMES_ENTRY structure was converted to Tz_names_entry class in order
to emphasize its non-POD nature.
sql/tztime.h:
Added MY_TZ_TABLES_COUNT constant to be used as number of time zone related
tables which are needed for dynamical loading of time zone descriptions.
Diffstat (limited to 'sql/tztime.h')
-rw-r--r-- | sql/tztime.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sql/tztime.h b/sql/tztime.h index 23460a8e739..c49b9fe4592 100644 --- a/sql/tztime.h +++ b/sql/tztime.h @@ -69,6 +69,15 @@ extern void my_tz_free(); extern TABLE_LIST fake_time_zone_tables_list; /* + Number of elements in table list produced by my_tz_get_table_list() + (this table list contains tables which are needed for dynamical loading + of time zone descriptions). Actually it is imlementation detail that + should not be used anywhere outside of tztime.h and tztime.cc. +*/ + +static const int MY_TZ_TABLES_COUNT= 4; + +/* Check if we have pointer to the begining of list of implicitly used time zone tables, set SELECT_ACL for them and fast-forward to its end. @@ -90,9 +99,9 @@ inline bool my_tz_check_n_skip_implicit_tables(TABLE_LIST **table, { if (*table == tz_tables) { - for (int i= 0; i < 4; i++) + for (int i= 0; i < MY_TZ_TABLES_COUNT; i++) (*table)[i].grant.privilege= SELECT_ACL; - (*table)+= 3; + (*table)+= MY_TZ_TABLES_COUNT - 1; return TRUE; } return FALSE; |