Commit d145dda9 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-25292 Table_name class for (db, table_name, alias)

TABLE_SHARE, TABLE_LIST inherit Table_name

rename_table_and_triggers(), rename_check_preconditions() use
Table_name instead TABLE_LIST.

TODO:
  - Table_ident should inherit Table_name too;
  - Use TABLE_SHARE::alias instead of TABLE::alias.
parent 32d88fae
...@@ -257,7 +257,7 @@ struct rename_param ...@@ -257,7 +257,7 @@ struct rename_param
static int static int
rename_check_preconditions(THD *thd, rename_param *param, rename_check_preconditions(THD *thd, rename_param *param,
TABLE_LIST *ren_table, Table_name *ren_table,
const LEX_CSTRING *new_db, const LEX_CSTRING *new_db,
const LEX_CSTRING *new_table_name, const LEX_CSTRING *new_table_name,
const LEX_CSTRING *new_table_alias, const LEX_CSTRING *new_table_alias,
...@@ -333,7 +333,7 @@ rename_check_preconditions(THD *thd, rename_param *param, ...@@ -333,7 +333,7 @@ rename_check_preconditions(THD *thd, rename_param *param,
static bool static bool
rename_table_and_triggers(THD *thd, rename_param *param, rename_table_and_triggers(THD *thd, rename_param *param,
DDL_LOG_STATE *ddl_log_state, DDL_LOG_STATE *ddl_log_state,
TABLE_LIST *ren_table, const LEX_CSTRING *new_db, Table_name *ren_table, const LEX_CSTRING *new_db,
bool skip_error, bool *force_if_exists) bool skip_error, bool *force_if_exists)
{ {
int rc= 1; int rc= 1;
......
...@@ -705,12 +705,21 @@ class TABLE_STATISTICS_CB ...@@ -705,12 +705,21 @@ class TABLE_STATISTICS_CB
void abort_stats_load() { stats_state.abort_load(); } void abort_stats_load() { stats_state.abort_load(); }
}; };
struct Table_name
{
LEX_CSTRING db;
LEX_CSTRING table_name;
LEX_CSTRING alias;
};
/** /**
This structure is shared between different table objects. There is one This structure is shared between different table objects. There is one
instance of table share per one table in the database. instance of table share per one table in the database.
*/ */
struct TABLE_SHARE struct TABLE_SHARE: public Table_name
{ {
TABLE_SHARE() {} /* Remove gcc warning */ TABLE_SHARE() {} /* Remove gcc warning */
...@@ -760,8 +769,6 @@ struct TABLE_SHARE ...@@ -760,8 +769,6 @@ struct TABLE_SHARE
To ensure this one can use set_table_cache() methods. To ensure this one can use set_table_cache() methods.
*/ */
LEX_CSTRING table_cache_key; LEX_CSTRING table_cache_key;
LEX_CSTRING db; /* Pointer to db */
LEX_CSTRING table_name; /* Table name (for open) */
LEX_CSTRING path; /* Path to .frm file (from datadir) */ LEX_CSTRING path; /* Path to .frm file (from datadir) */
LEX_CSTRING normalized_path; /* unpack_filename(path) */ LEX_CSTRING normalized_path; /* unpack_filename(path) */
LEX_CSTRING connect_string; LEX_CSTRING connect_string;
...@@ -2192,7 +2199,8 @@ struct TABLE_CHAIN ...@@ -2192,7 +2199,8 @@ struct TABLE_CHAIN
void set_end_pos(TABLE_LIST **pos) { end_pos= pos; } void set_end_pos(TABLE_LIST **pos) { end_pos= pos; }
}; };
struct TABLE_LIST
struct TABLE_LIST: public Table_name
{ {
TABLE_LIST() {} /* Remove gcc warning */ TABLE_LIST() {} /* Remove gcc warning */
...@@ -2279,10 +2287,7 @@ struct TABLE_LIST ...@@ -2279,10 +2287,7 @@ struct TABLE_LIST
TABLE_LIST *next_local; TABLE_LIST *next_local;
/* link in a global list of all queries tables */ /* link in a global list of all queries tables */
TABLE_LIST *next_global, **prev_global; TABLE_LIST *next_global, **prev_global;
LEX_CSTRING db;
LEX_CSTRING table_name;
LEX_CSTRING schema_table_name; LEX_CSTRING schema_table_name;
LEX_CSTRING alias;
const char *option; /* Used by cache index */ const char *option; /* Used by cache index */
Item *on_expr; /* Used with outer join */ Item *on_expr; /* Used with outer join */
Name_resolution_context *on_context; /* For ON expressions */ Name_resolution_context *on_context; /* For ON expressions */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment