mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Changed database, tablename and alias to be LEX_CSTRING
This was done in, among other things: - thd->db and thd->db_length - TABLE_LIST tablename, db, alias and schema_name - Audit plugin database name - lex->db - All db and table names in Alter_table_ctx - st_select_lex db Other things: - Changed a lot of functions to take const LEX_CSTRING* as argument for db, table_name and alias. See init_one_table() as an example. - Changed some function arguments from LEX_CSTRING to const LEX_CSTRING - Changed some lists from LEX_STRING to LEX_CSTRING - threads_mysql.result changed because process list_db wasn't always correctly updated - New append_identifier() function that takes LEX_CSTRING* as arguments - Added new element tmp_buff to Alter_table_ctx to separate temp name handling from temporary space - Ensure we store the length after my_casedn_str() of table/db names - Removed not used version of rename_table_in_stat_tables() - Changed Natural_join_column::table_name and db_name() to never return NULL (used for print) - thd->get_db() now returns db as a printable string (thd->db.str or "")
This commit is contained in:
@ -174,7 +174,7 @@ mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases)
|
||||
DBUG_ENTER("mysql_handle_single_derived");
|
||||
DBUG_PRINT("enter", ("phases: 0x%x allowed: 0x%x alias: '%s'",
|
||||
phases, allowed_phases,
|
||||
(derived->alias ? derived->alias : "<NULL>")));
|
||||
(derived->alias.str ? derived->alias.str : "<NULL>")));
|
||||
if (!lex->derived_tables)
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
@ -365,7 +365,7 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
Query_arena *arena, backup;
|
||||
DBUG_ENTER("mysql_derived_merge");
|
||||
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
|
||||
(derived->alias ? derived->alias : "<NULL>"),
|
||||
(derived->alias.str ? derived->alias.str : "<NULL>"),
|
||||
derived->get_unit()));
|
||||
|
||||
if (derived->merged)
|
||||
@ -514,7 +514,7 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
{
|
||||
DBUG_ENTER("mysql_derived_merge_for_insert");
|
||||
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
|
||||
(derived->alias ? derived->alias : "<NULL>"),
|
||||
(derived->alias.str ? derived->alias.str : "<NULL>"),
|
||||
derived->get_unit()));
|
||||
DBUG_PRINT("info", ("merged_for_insert: %d is_materialized_derived: %d "
|
||||
"is_multitable: %d single_table_updatable: %d "
|
||||
@ -572,7 +572,7 @@ bool mysql_derived_init(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
SELECT_LEX_UNIT *unit= derived->get_unit();
|
||||
DBUG_ENTER("mysql_derived_init");
|
||||
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
|
||||
(derived->alias ? derived->alias : "<NULL>"),
|
||||
(derived->alias.str ? derived->alias.str : "<NULL>"),
|
||||
derived->get_unit()));
|
||||
|
||||
// Skip already prepared views/DT
|
||||
@ -647,11 +647,10 @@ bool mysql_derived_init(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
{
|
||||
SELECT_LEX_UNIT *unit= derived->get_unit();
|
||||
DBUG_ENTER("mysql_derived_prepare");
|
||||
bool res= FALSE;
|
||||
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
|
||||
(derived->alias ? derived->alias : "<NULL>"),
|
||||
unit));
|
||||
DBUG_ENTER("mysql_derived_prepare");
|
||||
DBUG_PRINT("enter", ("unit: %p table_list: %p alias: '%s'",
|
||||
unit, derived, derived->alias.str));
|
||||
|
||||
if (!unit)
|
||||
DBUG_RETURN(FALSE);
|
||||
@ -692,7 +691,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
(first_select->options |
|
||||
thd->variables.option_bits |
|
||||
TMP_TABLE_ALL_COLUMNS),
|
||||
derived->alias, FALSE, FALSE, FALSE, 0);
|
||||
&derived->alias, FALSE, FALSE, FALSE, 0);
|
||||
thd->create_tmp_table_for_derived= FALSE;
|
||||
|
||||
if (!res && !derived->table)
|
||||
@ -785,7 +784,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
(first_select->options |
|
||||
thd->variables.option_bits |
|
||||
TMP_TABLE_ALL_COLUMNS),
|
||||
derived->alias,
|
||||
&derived->alias,
|
||||
FALSE, FALSE, FALSE,
|
||||
0))
|
||||
{
|
||||
@ -810,8 +809,8 @@ exit:
|
||||
thd->get_stmt_da()->sql_errno() == ER_SP_DOES_NOT_EXIST))
|
||||
{
|
||||
thd->clear_error();
|
||||
my_error(ER_VIEW_INVALID, MYF(0), derived->db,
|
||||
derived->table_name);
|
||||
my_error(ER_VIEW_INVALID, MYF(0), derived->db.str,
|
||||
derived->table_name.str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -881,11 +880,10 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
SELECT_LEX_UNIT *unit= derived->get_unit();
|
||||
SELECT_LEX *first_select= unit->first_select();
|
||||
SELECT_LEX *save_current_select= lex->current_select;
|
||||
|
||||
bool res= FALSE;
|
||||
DBUG_ENTER("mysql_derived_optimize");
|
||||
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
|
||||
(derived->alias ? derived->alias : "<NULL>"),
|
||||
(derived->alias.str ? derived->alias.str : "<NULL>"),
|
||||
derived->get_unit()));
|
||||
|
||||
lex->current_select= first_select;
|
||||
@ -966,7 +964,7 @@ bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
{
|
||||
DBUG_ENTER("mysql_derived_create");
|
||||
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
|
||||
(derived->alias ? derived->alias : "<NULL>"),
|
||||
(derived->alias.str ? derived->alias.str : "<NULL>"),
|
||||
derived->get_unit()));
|
||||
TABLE *table= derived->table;
|
||||
SELECT_LEX_UNIT *unit= derived->get_unit();
|
||||
@ -1067,7 +1065,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
bool res= FALSE;
|
||||
DBUG_ENTER("mysql_derived_fill");
|
||||
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
|
||||
(derived->alias ? derived->alias : "<NULL>"),
|
||||
(derived->alias.str ? derived->alias.str : "<NULL>"),
|
||||
derived->get_unit()));
|
||||
|
||||
if (unit->executed && !unit->uncacheable && !unit->describe &&
|
||||
@ -1189,7 +1187,7 @@ bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived)
|
||||
{
|
||||
DBUG_ENTER("mysql_derived_reinit");
|
||||
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
|
||||
(derived->alias ? derived->alias : "<NULL>"),
|
||||
(derived->alias.str ? derived->alias.str : "<NULL>"),
|
||||
derived->get_unit()));
|
||||
st_select_lex_unit *unit= derived->get_unit();
|
||||
|
||||
|
Reference in New Issue
Block a user