diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-04-09 15:50:30 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-04-09 15:50:30 +0200 |
commit | cdc01e29d3a9f6d98aaa482363af81003485e256 (patch) | |
tree | 20c8ce171e2666e720ac5977561997038fe3c2f2 /sql/datadict.cc | |
parent | 15c936e4b3d151346c027bd4b51b44c826b095b6 (diff) | |
download | mariadb-git-cdc01e29d3a9f6d98aaa482363af81003485e256.tar.gz |
remove dd_frm_type(), dd_frm_storage_engine(), dd_check_storage_engine_flag()
from everywhere - now RENAME, SHOW FULL TABLES, and TRUNCATE work with discovery.
improve error messages in truncate
Diffstat (limited to 'sql/datadict.cc')
-rw-r--r-- | sql/datadict.cc | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/sql/datadict.cc b/sql/datadict.cc index 15419c4f577..55ffd8eaee3 100644 --- a/sql/datadict.cc +++ b/sql/datadict.cc @@ -70,88 +70,6 @@ frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt) } -/** - Given a table name, check type of .frm and legacy table type. - - @param[in] thd The current session. - @param[in] db Table schema. - @param[in] table_name Table database. - @param[out] table_type handlerton of the table if FRMTYPE_TABLE, - otherwise undefined. - - @return FALSE if FRMTYPE_TABLE and storage engine found. TRUE otherwise. -*/ - -bool dd_frm_storage_engine(THD *thd, const char *db, const char *table_name, - handlerton **table_type) -{ - char path[FN_REFLEN + 1]; - enum legacy_db_type db_type; - LEX_STRING db_name = {(char *) db, strlen(db)}; - - /* There should be at least some lock on the table. */ - DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, - table_name, MDL_SHARED)); - - if (check_db_name(&db_name)) - { - my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str); - return TRUE; - } - - if (check_table_name(table_name, strlen(table_name), FALSE)) - { - my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name); - return TRUE; - } - - (void) build_table_filename(path, sizeof(path) - 1, db, - table_name, reg_ext, 0); - - dd_frm_type(thd, path, &db_type); - - /* Type is unknown if the object is not found or is not a table. */ - if (db_type == DB_TYPE_UNKNOWN || - !(*table_type= ha_resolve_by_legacy_type(thd, db_type))) - { - my_error(ER_NO_SUCH_TABLE, MYF(0), db, table_name); - return TRUE; - } - - return FALSE; -} - - -/** - Given a table name, check if the storage engine for the - table referred by this name supports an option 'flag'. - Return an error if the table does not exist or is not a - base table. - - @pre Any metadata lock on the table. - - @param[in] thd The current session. - @param[in] db Table schema. - @param[in] table_name Table database. - @param[in] flag The option to check. - @param[out] yes_no The result. Undefined if error. -*/ - -bool dd_check_storage_engine_flag(THD *thd, - const char *db, const char *table_name, - uint32 flag, bool *yes_no) -{ - handlerton *table_type; - - if (dd_frm_storage_engine(thd, db, table_name, &table_type)) - return TRUE; - - *yes_no= ha_check_storage_engine_flag(table_type, flag); - - return FALSE; -} - - /* Regenerate a metadata locked table. |