summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authordlenev@mysql.com <>2004-10-22 20:21:55 +0400
committerdlenev@mysql.com <>2004-10-22 20:21:55 +0400
commit0ea8f291863fd0f1be0dcc54d36b804e406d6d99 (patch)
tree0459ec01ddcf960a4e2477c51fc9a29dec5ae137 /sql
parentaf7ecf4c785af1533eac814952c04ccf3d7f2968 (diff)
parente6a44b719a75b812008c2d8c795c41259a7887a2 (diff)
downloadmariadb-git-0ea8f291863fd0f1be0dcc54d36b804e406d6d99.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-tzfix
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc5
-rw-r--r--sql/tztime.cc4
-rw-r--r--sql/tztime.h29
3 files changed, 37 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 8279e32c8de..8ee27cdc21f 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3730,7 +3730,10 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
TABLE_LIST *org_tables=tables;
for (; tables ; tables=tables->next)
{
- if (tables->derived || (tables->table && (int)tables->table->tmp_table))
+ if (tables->derived ||
+ (tables->table && (int)tables->table->tmp_table) ||
+ my_tz_check_n_skip_implicit_tables(&tables,
+ thd->lex->time_zone_tables_used))
continue;
if ((thd->master_access & want_access) == (want_access & ~EXTRA_ACL) &&
thd->db)
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 08e6fc7026e..c2143b0d5dd 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1434,6 +1434,10 @@ tz_init_table_list(TABLE_LIST *tz_tabs)
This function creates list of TABLE_LIST objects allocated in thd's
memroot, which can be used for opening of time zone tables.
+ NOTE
+ my_tz_check_n_skip_implicit_tables() function depends on fact that
+ elements of list created are allocated as TABLE_LIST[4] array.
+
RETURN VALUES
Returns pointer to first TABLE_LIST object, (could be 0 if time zone
tables don't exist) and &fake_time_zone_tables_list in case of error.
diff --git a/sql/tztime.h b/sql/tztime.h
index aabec260ec7..9f969639bd0 100644
--- a/sql/tztime.h
+++ b/sql/tztime.h
@@ -64,6 +64,35 @@ extern Time_zone * my_tz_find(const String *name, TABLE_LIST *tz_tables);
extern my_bool my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap);
extern void my_tz_free();
+
+/*
+ Check if we have pointer to the beggining of list of implictly used
+ time zone tables and fast-forward to its end.
+
+ SYNOPSIS
+ my_tz_check_n_skip_implicit_tables()
+ table - (in/out) pointer to element of table list to check
+ tz_tables - list of implicitly used time zone tables received
+ from my_tz_get_table_list() function.
+
+ NOTE
+ This function relies on my_tz_get_table_list() implementation.
+
+ RETURN VALUE
+ TRUE - if table points to the beggining of tz_tables list
+ FALSE - otherwise.
+*/
+inline bool my_tz_check_n_skip_implicit_tables(TABLE_LIST **table,
+ TABLE_LIST *tz_tables)
+{
+ if (*table == tz_tables)
+ {
+ (*table)+= 3;
+ return TRUE;
+ }
+ return FALSE;
+}
+
/*
Maximum length of time zone name that we support
(Time zone name is char(64) in db)