summaryrefslogtreecommitdiff
path: root/sql/sql_truncate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_truncate.cc')
-rw-r--r--sql/sql_truncate.cc34
1 files changed, 15 insertions, 19 deletions
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index bd3f1fdc111..2ddb4bc042c 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -48,7 +48,7 @@ static bool fk_info_append_fields(THD *thd, String *str,
while ((field= it++))
{
- res|= append_identifier(thd, str, field->str, field->length);
+ res|= append_identifier(thd, str, field);
res|= str->append(", ");
}
@@ -80,22 +80,17 @@ static const char *fk_info_str(THD *thd, FOREIGN_KEY_INFO *fk_info)
`db`.`tbl`, CONSTRAINT `id` FOREIGN KEY (`fk`) REFERENCES `db`.`tbl` (`fk`)
*/
- res|= append_identifier(thd, &str, fk_info->foreign_db->str,
- fk_info->foreign_db->length);
+ res|= append_identifier(thd, &str, fk_info->foreign_db);
res|= str.append(".");
- res|= append_identifier(thd, &str, fk_info->foreign_table->str,
- fk_info->foreign_table->length);
+ res|= append_identifier(thd, &str, fk_info->foreign_table);
res|= str.append(", CONSTRAINT ");
- res|= append_identifier(thd, &str, fk_info->foreign_id->str,
- fk_info->foreign_id->length);
+ res|= append_identifier(thd, &str, fk_info->foreign_id);
res|= str.append(" FOREIGN KEY (");
res|= fk_info_append_fields(thd, &str, &fk_info->foreign_fields);
res|= str.append(") REFERENCES ");
- res|= append_identifier(thd, &str, fk_info->referenced_db->str,
- fk_info->referenced_db->length);
+ res|= append_identifier(thd, &str, fk_info->referenced_db);
res|= str.append(".");
- res|= append_identifier(thd, &str, fk_info->referenced_table->str,
- fk_info->referenced_table->length);
+ res|= append_identifier(thd, &str, fk_info->referenced_table);
res|= str.append(" (");
res|= fk_info_append_fields(thd, &str, &fk_info->referenced_fields);
res|= str.append(')');
@@ -303,8 +298,8 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref,
*/
if (thd->locked_tables_mode)
{
- if (!(table= find_table_for_mdl_upgrade(thd, table_ref->db,
- table_ref->table_name, FALSE)))
+ if (!(table= find_table_for_mdl_upgrade(thd, table_ref->db.str,
+ table_ref->table_name.str, FALSE)))
DBUG_RETURN(TRUE);
*hton_can_recreate= ha_check_storage_engine_flag(table->s->db_type(),
@@ -322,11 +317,12 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref,
thd->variables.lock_wait_timeout, 0))
DBUG_RETURN(TRUE);
- if (!ha_table_exists(thd, table_ref->db, table_ref->table_name,
+ if (!ha_table_exists(thd, &table_ref->db, &table_ref->table_name,
&hton, &is_sequence) ||
hton == view_pseudo_hton)
{
- my_error(ER_NO_SUCH_TABLE, MYF(0), table_ref->db, table_ref->table_name);
+ my_error(ER_NO_SUCH_TABLE, MYF(0), table_ref->db.str,
+ table_ref->table_name.str);
DBUG_RETURN(TRUE);
}
@@ -364,8 +360,8 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref,
else
{
/* Table is already locked exclusively. Remove cached instances. */
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table_ref->db,
- table_ref->table_name, FALSE);
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table_ref->db.str,
+ table_ref->table_name.str, FALSE);
}
DBUG_RETURN(FALSE);
@@ -418,7 +414,7 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
bool hton_can_recreate;
if (WSREP(thd) &&
- wsrep_to_isolation_begin(thd, table_ref->db, table_ref->table_name, 0))
+ wsrep_to_isolation_begin(thd, table_ref->db.str, table_ref->table_name.str, 0))
DBUG_RETURN(TRUE);
if (lock_table(thd, table_ref, &hton_can_recreate))
DBUG_RETURN(TRUE);
@@ -429,7 +425,7 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
The storage engine can truncate the table by creating an
empty table with the same structure.
*/
- error= dd_recreate_table(thd, table_ref->db, table_ref->table_name);
+ error= dd_recreate_table(thd, table_ref->db.str, table_ref->table_name.str);
if (thd->locked_tables_mode && thd->locked_tables_list.reopen_tables(thd))
thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);