~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/sql_rename.cc

Removed dead variable, sorted authors file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
/*
17
17
  Atomic rename of table;  RENAME TABLE t1 to t2, tmp to t1 [,...]
18
18
*/
19
 
#include <drizzled/server_includes.h>
20
 
#include <drizzled/drizzled_error_messages.h>
21
 
 
22
 
static TableList *rename_tables(THD *thd, TableList *table_list,
 
19
 
 
20
#include "mysql_priv.h"
 
21
 
 
22
static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list,
23
23
                                 bool skip_error);
24
24
 
25
 
static TableList *reverse_table_list(TableList *table_list);
 
25
static TABLE_LIST *reverse_table_list(TABLE_LIST *table_list);
26
26
 
27
27
/*
28
28
  Every second entry in the table_list is the original name and every
29
29
  second entry is the new name.
30
30
*/
31
31
 
32
 
bool mysql_rename_tables(THD *thd, TableList *table_list, bool silent)
 
32
bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
33
33
{
34
34
  bool error= 1;
35
 
  TableList *ren_table= 0;
 
35
  TABLE_LIST *ren_table= 0;
36
36
 
37
37
  /*
38
38
    Avoid problems with a rename on a table that we have locked or
61
61
  if ((ren_table=rename_tables(thd,table_list,0)))
62
62
  {
63
63
    /* Rename didn't succeed;  rename back the tables in reverse order */
64
 
    TableList *table;
 
64
    TABLE_LIST *table;
65
65
 
66
66
    /* Reverse the table list */
67
67
    table_list= reverse_table_list(table_list);
96
96
  }
97
97
 
98
98
  pthread_mutex_lock(&LOCK_open);
99
 
  unlock_table_names(thd, table_list, (TableList*) 0);
 
99
  unlock_table_names(thd, table_list, (TABLE_LIST*) 0);
100
100
  pthread_mutex_unlock(&LOCK_open);
101
101
 
102
102
err:
115
115
  RETURN
116
116
    pointer to new (reversed) list
117
117
*/
118
 
static TableList *reverse_table_list(TableList *table_list)
 
118
static TABLE_LIST *reverse_table_list(TABLE_LIST *table_list)
119
119
{
120
 
  TableList *prev= 0;
 
120
  TABLE_LIST *prev= 0;
121
121
 
122
122
  while (table_list)
123
123
  {
124
 
    TableList *next= table_list->next_local;
 
124
    TABLE_LIST *next= table_list->next_local;
125
125
    table_list->next_local= prev;
126
126
    prev= table_list;
127
127
    table_list= next;
151
151
*/
152
152
 
153
153
bool
154
 
do_rename(THD *thd, TableList *ren_table, char *new_db, char *new_table_name,
 
154
do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
155
155
          char *new_table_alias, bool skip_error)
156
156
{
157
157
  int rc= 1;
214
214
    true      rename failed
215
215
*/
216
216
 
217
 
static TableList *
218
 
rename_tables(THD *thd, TableList *table_list, bool skip_error)
 
217
static TABLE_LIST *
 
218
rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
219
219
{
220
 
  TableList *ren_table, *new_table;
 
220
  TABLE_LIST *ren_table, *new_table;
221
221
 
222
222
  for (ren_table= table_list; ren_table; ren_table= new_table->next_local)
223
223
  {