@@ -208,10 +208,10 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent,
208208
209209
210210static bool
211- do_rename_temporary (THD *thd, TABLE_LIST *ren_table, TABLE_LIST *new_table)
211+ rename_temporary_table (THD *thd, TABLE_LIST *ren_table, TABLE_LIST *new_table)
212212{
213213 LEX_CSTRING *new_alias;
214- DBUG_ENTER (" do_rename_temporary " );
214+ DBUG_ENTER (" rename_temporary_table " );
215215
216216 new_alias= (lower_case_table_names == 2 ) ? &new_table->alias :
217217 &new_table->table_name ;
@@ -228,7 +228,7 @@ do_rename_temporary(THD *thd, TABLE_LIST *ren_table, TABLE_LIST *new_table)
228228
229229
230230/* *
231- Parameters for do_rename
231+ Parameters for rename_table_and_triggers()
232232*/
233233
234234struct rename_param
@@ -240,8 +240,6 @@ struct rename_param
240240
241241
242242/* *
243- check_rename()
244-
245243 Check pre-conditions for rename
246244 - From table should exists
247245 - To table should not exists.
@@ -258,14 +256,14 @@ struct rename_param
258256*/
259257
260258static int
261- check_rename (THD *thd, rename_param *param,
262- TABLE_LIST *ren_table,
263- const LEX_CSTRING *new_db,
264- const LEX_CSTRING *new_table_name,
265- const LEX_CSTRING *new_table_alias,
266- bool if_exists)
259+ rename_check_preconditions (THD *thd, rename_param *param,
260+ TABLE_LIST *ren_table,
261+ const LEX_CSTRING *new_db,
262+ const LEX_CSTRING *new_table_name,
263+ const LEX_CSTRING *new_table_alias,
264+ bool if_exists)
267265{
268- DBUG_ENTER (" check_rename " );
266+ DBUG_ENTER (" rename_check_preconditions " );
269267 DBUG_PRINT (" enter" , (" if_exists: %d" , (int ) if_exists));
270268
271269
@@ -316,7 +314,6 @@ check_rename(THD *thd, rename_param *param,
316314 Rename a single table or a view
317315
318316 SYNPOSIS
319- do_rename()
320317 thd Thread handle
321318 ren_table A table/view to be renamed
322319 new_db The database to which the table to be moved to
@@ -334,15 +331,16 @@ check_rename(THD *thd, rename_param *param,
334331*/
335332
336333static bool
337- do_rename (THD *thd, rename_param *param, DDL_LOG_STATE *ddl_log_state,
338- TABLE_LIST *ren_table, const LEX_CSTRING *new_db,
339- bool skip_error, bool *force_if_exists)
334+ rename_table_and_triggers (THD *thd, rename_param *param,
335+ DDL_LOG_STATE *ddl_log_state,
336+ TABLE_LIST *ren_table, const LEX_CSTRING *new_db,
337+ bool skip_error, bool *force_if_exists)
340338{
341339 int rc= 1 ;
342340 handlerton *hton;
343341 LEX_CSTRING *old_alias, *new_alias;
344342 TRIGGER_RENAME_PARAM rename_param;
345- DBUG_ENTER (" do_rename " );
343+ DBUG_ENTER (" rename_table_and_triggers " );
346344 DBUG_PRINT (" enter" , (" skip_error: %d" , (int ) skip_error));
347345
348346 old_alias= ¶m->old_alias ;
@@ -515,24 +513,25 @@ rename_tables(THD *thd, TABLE_LIST *table_list, DDL_LOG_STATE *ddl_log_state,
515513 pair->from = ren_table;
516514 pair->to = new_table;
517515
518- if (do_rename_temporary (thd, ren_table, new_table))
516+ if (rename_temporary_table (thd, ren_table, new_table))
519517 goto revert_rename;
520518 }
521519 else
522520 {
523521 int error;
524522 rename_param param;
525- error= check_rename (thd, ¶m, ren_table, &new_table->db ,
526- &new_table->table_name ,
527- &new_table->alias , (skip_error || if_exists));
523+ error= rename_check_preconditions (thd, ¶m, ren_table,
524+ &new_table->db , &new_table->table_name ,
525+ &new_table->alias ,
526+ (skip_error || if_exists));
528527 if (error < 0 )
529528 continue ; // Ignore rename (if exists)
530529 if (error > 0 )
531530 goto revert_rename;
532531
533- if (do_rename (thd, ¶m, ddl_log_state,
534- ren_table, &new_table->db ,
535- skip_error, force_if_exists))
532+ if (rename_table_and_triggers (thd, ¶m, ddl_log_state,
533+ ren_table, &new_table->db ,
534+ skip_error, force_if_exists))
536535 goto revert_rename;
537536 }
538537 }
@@ -542,7 +541,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, DDL_LOG_STATE *ddl_log_state,
542541 /* Revert temporary tables. Normal tables are reverted in the caller */
543542 List_iterator_fast<TABLE_PAIR> it (tmp_tables);
544543 while (TABLE_PAIR *pair= it++)
545- do_rename_temporary (thd, pair->to , pair->from );
544+ rename_temporary_table (thd, pair->to , pair->from );
546545
547546 DBUG_RETURN (1 );
548547}
0 commit comments