diff options
author | Monty <monty@mariadb.org> | 2018-01-07 18:03:44 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-01-30 21:33:55 +0200 |
commit | a7e352b54ddfaf91c92951d605cb02a4ffd2676b (patch) | |
tree | dc76f140342938ed2a0fe0e005100402762d5308 /sql/sql_admin.cc | |
parent | 921c5e931452301a09c84c53ffe35b81e6a1c71a (diff) | |
download | mariadb-git-a7e352b54ddfaf91c92951d605cb02a4ffd2676b.tar.gz |
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 "")
Diffstat (limited to 'sql/sql_admin.cc')
-rw-r--r-- | sql/sql_admin.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 4ed8234aa64..6c56e4c1010 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -77,7 +77,7 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table, { Protocol *protocol= thd->protocol; protocol->prepare_for_resend(); - protocol->store(table->alias, system_charset_info); + protocol->store(table->alias.str, table->alias.length, system_charset_info); protocol->store((char*) operator_name, system_charset_info); protocol->store(STRING_WITH_LEN("error"), system_charset_info); protocol->store(errmsg, system_charset_info); @@ -123,7 +123,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, */ table_list->mdl_request.init(MDL_key::TABLE, - table_list->db, table_list->table_name, + table_list->db.str, table_list->table_name.str, MDL_EXCLUSIVE, MDL_TRANSACTION); if (lock_table_names(thd, table_list, table_list->next_global, @@ -135,7 +135,8 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, if (share == NULL) DBUG_RETURN(0); // Can't open frm file - if (open_table_from_share(thd, share, "", 0, 0, 0, &tmp_table, FALSE)) + if (open_table_from_share(thd, share, &empty_clex_str, 0, 0, 0, + &tmp_table, FALSE)) { tdc_release_share(share); DBUG_RETURN(0); // Out of memory @@ -218,7 +219,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, "Failed renaming data file"); goto end; } - if (dd_recreate_table(thd, table_list->db, table_list->table_name)) + if (dd_recreate_table(thd, table_list->db.str, table_list->table_name.str)) { error= send_check_errmsg(thd, table_list, "repair", "Failed generating table from .frm file"); @@ -492,13 +493,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, for (table= tables; table; table= table->next_local) { char table_name[SAFE_NAME_LEN*2+2]; - const char *db= table->db; + const char *db= table->db.str; bool fatal_error=0; bool open_error; bool collect_eis= FALSE; - DBUG_PRINT("admin", ("table: '%s'.'%s'", table->db, table->table_name)); - strxmov(table_name, db, ".", table->table_name, NullS); + DBUG_PRINT("admin", ("table: '%s'.'%s'", db, table->table_name.str)); + strxmov(table_name, db, ".", table->table_name.str, NullS); thd->open_options|= extra_open_options; table->lock_type= lock_type; /* @@ -547,7 +548,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, close_thread_tables(thd); table->table= NULL; thd->mdl_context.release_transactional_locks(); - table->mdl_request.init(MDL_key::TABLE, table->db, table->table_name, + table->mdl_request.init(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED_NO_READ_WRITE, MDL_TRANSACTION); } @@ -818,7 +819,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, close_thread_tables(thd); table->table= NULL; thd->mdl_context.release_transactional_locks(); - table->mdl_request.init(MDL_key::TABLE, table->db, table->table_name, + table->mdl_request.init(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED_NO_READ_WRITE, MDL_TRANSACTION); table->mdl_request.set_type(MDL_SHARED_READ); @@ -1118,11 +1119,11 @@ send_result_message: if (what_to_upgrade) length= my_snprintf(buf, sizeof(buf), ER_THD(thd, ER_TABLE_NEEDS_UPGRADE), - what_to_upgrade, table->table_name); + what_to_upgrade, table->table_name.str); else length= my_snprintf(buf, sizeof(buf), ER_THD(thd, ER_TABLE_NEEDS_REBUILD), - table->table_name); + table->table_name.str); protocol->store(buf, length, system_charset_info); fatal_error=1; break; @@ -1154,7 +1155,7 @@ send_result_message: else if (open_for_modify || fatal_error) { tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, - table->db, table->table_name, FALSE); + table->db.str, table->table_name.str, FALSE); /* May be something modified. Consequently, we have to invalidate the query cache. |