~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/db.cc

  • Committer: Stewart Smith
  • Date: 2010-07-13 01:12:39 UTC
  • mto: (1638.10.46)
  • mto: This revision was merged to the branch mainline in revision 1701.
  • Revision ID: stewart@flamingspork.com-20100713011239-nwgjq3r0oxtaax0w
use the ENUM in the table proto instead of duplicating it for Foreign key options and match option. A move in the direction of just having foreign keys in the proto

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
namespace drizzled
54
54
{
55
55
 
56
 
static long mysql_rm_known_files(Session *session,
 
56
static long drop_tables_via_filenames(Session *session,
57
57
                                 SchemaIdentifier &schema_identifier,
58
58
                                 plugin::TableNameList &dropped_tables);
59
59
static void mysql_change_db_impl(Session *session);
272
272
 
273
273
 
274
274
    error= -1;
275
 
    deleted= mysql_rm_known_files(session, schema_identifier, dropped_tables);
 
275
    deleted= drop_tables_via_filenames(session, schema_identifier, dropped_tables);
276
276
    if (deleted >= 0)
277
277
    {
278
278
      error= 0;
399
399
 
400
400
    table_type= table->db_type;
401
401
 
 
402
    TableIdentifier identifier(db, table->table_name);
 
403
 
402
404
    {
403
405
      Table *locked_table;
404
406
      abort_locked_tables(session, db, table->table_name);
405
 
      remove_table_from_cache(session, db, table->table_name,
 
407
      remove_table_from_cache(session, identifier,
406
408
                              RTFC_WAIT_OTHER_THREAD_FLAG |
407
409
                              RTFC_CHECK_KILLED_FLAG);
408
410
      /*
418
420
        goto err_with_placeholders;
419
421
      }
420
422
    }
421
 
 
422
 
    TableIdentifier identifier(db, table->table_name);
423
423
    identifier.getPath();
424
424
 
425
425
    if (table_type == NULL && not plugin::StorageEngine::doesTableExist(*session, identifier))
488
488
  session MUST be set when calling this function!
489
489
*/
490
490
 
491
 
static long mysql_rm_known_files(Session *session,
492
 
                                 SchemaIdentifier &schema_identifier,
493
 
                                 plugin::TableNameList &dropped_tables)
 
491
static long drop_tables_via_filenames(Session *session,
 
492
                                      SchemaIdentifier &schema_identifier,
 
493
                                      plugin::TableNameList &dropped_tables)
494
494
{
495
495
  long deleted= 0;
496
496
  TableList *tot_list= NULL, **tot_list_next;
516
516
 
517
517
    table_list->db= (char*) (table_list+1);
518
518
    table_list->table_name= strcpy(table_list->db, schema_identifier.getSchemaName().c_str()) + db_len + 1;
519
 
    filename_to_tablename((*it).c_str(), table_list->table_name,
520
 
                          (*it).size() + 1);
 
519
    TableIdentifier::filename_to_tablename((*it).c_str(), table_list->table_name, (*it).size() + 1);
521
520
    table_list->alias= table_list->table_name;  // If lower_case_table_names=2
522
521
    table_list->internal_tmp_table= (strncmp((*it).c_str(),
523
522
                                             TMP_FILE_PREFIX,
617
616
    return true;
618
617
  }
619
618
 
620
 
  if (not check_db_name(schema_identifier))
 
619
  if (not check_db_name(session, schema_identifier))
621
620
  {
622
621
    my_error(ER_WRONG_DB_NAME, MYF(0), schema_identifier.getSQLPath().c_str());
623
622