diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-04-09 15:49:48 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-04-09 15:49:48 +0200 |
commit | 9594107fb8ce4c691c0cbb5891eef5add6ee105f (patch) | |
tree | cffc621b0ba6adfae9b88195ee31915b9d48c815 /sql/datadict.cc | |
parent | 5f69c8a59480569eb275169630f91763fceacc0f (diff) | |
download | mariadb-git-9594107fb8ce4c691c0cbb5891eef5add6ee105f.tar.gz |
cleanups
Diffstat (limited to 'sql/datadict.cc')
-rw-r--r-- | sql/datadict.cc | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/sql/datadict.cc b/sql/datadict.cc index c228784d578..15419c4f577 100644 --- a/sql/datadict.cc +++ b/sql/datadict.cc @@ -158,26 +158,35 @@ bool dd_check_storage_engine_flag(THD *thd, @param thd Thread context. @param db Name of the database to which the table belongs to. @param name Table name. + @param path For temporary tables only - path to table files. + Otherwise NULL (the path is calculated from db and table names). @retval FALSE Success. @retval TRUE Error. */ -bool dd_recreate_table(THD *thd, const char *db, const char *table_name) +bool dd_recreate_table(THD *thd, const char *db, const char *table_name, + const char *path) { bool error= TRUE; HA_CREATE_INFO create_info; - char path[FN_REFLEN + 1]; + char path_buf[FN_REFLEN + 1]; DBUG_ENTER("dd_recreate_table"); - /* There should be a exclusive metadata lock on the table. */ - DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name, - MDL_EXCLUSIVE)); - memset(&create_info, 0, sizeof(create_info)); - /* Create a path to the table, but without a extension. */ - build_table_filename(path, sizeof(path) - 1, db, table_name, "", 0); + if (path) + create_info.options|= HA_LEX_CREATE_TMP_TABLE; + else + { + build_table_filename(path_buf, sizeof(path_buf) - 1, + db, table_name, "", 0); + path= path_buf; + + /* There should be a exclusive metadata lock on the table. */ + DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name, + MDL_EXCLUSIVE)); + } /* Attempt to reconstruct the table. */ error= ha_create_table(thd, path, db, table_name, &create_info); |