1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

cleanup: change dd_frm_type() to return the engine name, not legacy_db_type

this simplifies the code and avoids unnecessary conversions back and forth.
and it works even if the engine is not installed.
This commit is contained in:
Sergei Golubchik
2017-03-02 20:59:29 +01:00
parent 1c8d2121ab
commit 8eb66bc382
4 changed files with 41 additions and 35 deletions

View File

@ -5025,14 +5025,16 @@ bool ha_table_exists(THD *thd, const char *db, const char *table_name,
bool exists= true;
if (hton)
{
enum legacy_db_type db_type;
if (dd_frm_type(thd, path, &db_type) != FRMTYPE_VIEW)
char engine_buf[NAME_CHAR_LEN + 1];
LEX_STRING engine= { engine_buf, 0 };
if (dd_frm_type(thd, path, &engine) != FRMTYPE_VIEW)
{
handlerton *ht= ha_resolve_by_legacy_type(thd, db_type);
if ((*hton= ht))
plugin_ref p= plugin_lock_by_name(thd, &engine, MYSQL_STORAGE_ENGINE_PLUGIN);
*hton= p ? plugin_hton(p) : NULL;
if (*hton)
// verify that the table really exists
exists= discover_existence(thd,
plugin_int_to_ref(hton2plugin[ht->slot]), &args);
exists= discover_existence(thd, p, &args);
}
else
*hton= view_pseudo_hton;