diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-02-28 18:42:49 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-02-28 18:42:49 +0100 |
commit | 8161c6772d144d6a4f08fc924ff6e6e403d1371d (patch) | |
tree | 3f1fe5f8048a163da4eadf0f86c1fd2a3007955d /sql/sql_base.h | |
parent | 154aac8eb002f5d167153e09f1d13570989521e0 (diff) | |
parent | 31c06437c970d4d0f4ec0301acac9c56e0ed29b5 (diff) | |
download | mariadb-git-8161c6772d144d6a4f08fc924ff6e6e403d1371d.tar.gz |
merge with mysql-5.5.30 minus few incorrect or not applicable changesets
Diffstat (limited to 'sql/sql_base.h')
-rw-r--r-- | sql/sql_base.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/sql/sql_base.h b/sql/sql_base.h index 45d41777fea..21a2ff322f0 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -81,6 +81,31 @@ uint cached_table_definitions(void); uint create_table_def_key(THD *thd, char *key, const TABLE_LIST *table_list, bool tmp_table); + +/** + Create a table cache key for non-temporary table. + + @param key Buffer for key (must be at least NAME_LEN*2+2 bytes). + @param db Database name. + @param table_name Table name. + + @return Length of key. + + @sa create_table_def_key(thd, char *, table_list, bool) +*/ + +inline uint +create_table_def_key(char *key, const char *db, const char *table_name) +{ + /* + In theory caller should ensure that both db and table_name are + not longer than NAME_LEN bytes. In practice we play safe to avoid + buffer overruns. + */ + return (uint)(strmake(strmake(key, db, NAME_LEN) + 1, table_name, + NAME_LEN) - key + 1); +} + TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, uint key_length, uint db_flags, int *error, my_hash_value_type hash_value); @@ -158,7 +183,7 @@ thr_lock_type read_lock_type_for_table(THD *thd, TABLE_LIST *table_list); my_bool mysql_rm_tmp_tables(void); -bool rm_temporary_table(handlerton *base, char *path); +bool rm_temporary_table(handlerton *base, const char *path); void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, const MDL_savepoint &start_of_statement_svp); TABLE_LIST *find_table_in_list(TABLE_LIST *table, |