~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/rename.cc

  • Committer: Stewart Smith
  • Date: 2008-12-18 23:54:47 UTC
  • mto: This revision was merged to the branch mainline in revision 719.
  • Revision ID: stewart@flamingspork.com-20081218235447-qf6dofgd6guwefo2
fix RENAME TABLE

(problem was missing hton to mysql_rename_table)

If engine implements table_exists_in_engine we get the hton from there.

Else, we reintroduce the mysql_frm_type hackery (temporarily, it *will* go away again with FRM removal).

also fix rename test: no views, plus current FLUSH LOCKS bug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
{
160
160
  int rc= 1;
161
161
  const char *new_alias, *old_alias;
162
 
  /* TODO: What should this really be set to - it doesn't
163
 
     get set anywhere before it's used? */
164
 
  enum legacy_db_type table_type=DB_TYPE_UNKNOWN;
165
162
 
166
163
  if (lower_case_table_names == 2)
167
164
  {
174
171
    new_alias= new_table_name;
175
172
  }
176
173
 
 
174
  handlerton *hton= NULL;
 
175
 
 
176
  if(ha_table_exists_in_engine(session, ren_table->db, old_alias, &hton)
 
177
     != HA_ERR_TABLE_EXIST)
 
178
  {
 
179
    my_error(ER_NO_SUCH_TABLE, MYF(0), ren_table->db, old_alias);
 
180
    return(1);
 
181
  }
 
182
 
177
183
  if (ha_table_exists_in_engine(session, new_db, new_alias)
178
184
      !=HA_ERR_NO_SUCH_TABLE)
179
185
  {
181
187
    return(1);                  // This can't be skipped
182
188
  }
183
189
 
184
 
  rc= mysql_rename_table(ha_resolve_by_legacy_type(session, table_type),
185
 
                               ren_table->db, old_alias,
186
 
                               new_db, new_alias, 0);
 
190
  rc= mysql_rename_table(hton,
 
191
                         ren_table->db, old_alias,
 
192
                         new_db, new_alias, 0);
187
193
  if (rc && !skip_error)
188
194
    return(1);
189
195