summaryrefslogtreecommitdiff
path: root/sql/sql_base.h
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-08-12 14:17:51 +0200
committerSergei Golubchik <sergii@pisem.net>2013-08-12 14:17:51 +0200
commiteafb11c821dedf5fb5509875b4fb553417ef1ea5 (patch)
tree5263e3bcc243c88a8dc89bd3c471496a6d7b353b /sql/sql_base.h
parent055e9cb49c18460efcb0bba83f5e4da63ede0cdc (diff)
downloadmariadb-git-eafb11c821dedf5fb5509875b4fb553417ef1ea5.tar.gz
MDEV-4786 merge 10.0-monty -> 10.0
use get_table_def_key() instead of create_table_def_key() where appropriate
Diffstat (limited to 'sql/sql_base.h')
-rw-r--r--sql/sql_base.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/sql_base.h b/sql/sql_base.h
index cff7432d00f..9bfc55ebc64 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -136,6 +136,17 @@ static inline TABLE_SHARE *get_table_share(THD *thd, const char *db,
return get_table_share(thd, db, table_name, key, key_length, flags);
}
+// convenience helper: call get_table_share() reusing the MDL cache key.
+// NOTE: lifetime of the returned TABLE_SHARE is limited by the
+// lifetime of the TABLE_LIST object!!!
+static inline TABLE_SHARE *get_table_share_shortlived(THD *thd, TABLE_LIST *tl,
+ uint flags)
+{
+ const char *key;
+ uint key_length= get_table_def_key(tl, &key);
+ return get_table_share(thd, tl->db, tl->table_name, key, key_length, flags);
+}
+
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
uint lock_flags);
@@ -365,9 +376,8 @@ static inline bool tdc_open_view(THD *thd, TABLE_LIST *table_list,
const char *alias, MEM_ROOT *mem_root,
uint flags)
{
- char key[MAX_DBKEY_LENGTH];
- uint key_length;
- key_length= create_table_def_key(key, table_list->db, table_list->table_name);
+ const char *key;
+ uint key_length= get_table_def_key(table_list, &key);
return tdc_open_view(thd, table_list, alias, key, key_length, mem_root, flags);
}