~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Brian Aker
  • Date: 2009-12-01 21:53:49 UTC
  • mto: (1235.1.4 push)
  • mto: This revision was merged to the branch mainline in revision 1236.
  • Revision ID: brian@gaz-20091201215349-veugbv3su39q6ard
More identifier work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
549
549
    0           OK
550
550
    != 0        Error
551
551
*/
552
 
 
553
 
bool quick_rm_table(Session& session, const char *db,
554
 
                    const char *table_name, bool is_tmp)
 
552
bool quick_rm_table(Session& session,
 
553
                    TableIdentifier &identifier)
555
554
{
556
 
  bool error= 0;
557
 
 
558
 
  TableIdentifier identifier(db, table_name, is_tmp ? INTERNAL_TMP_TABLE : NO_TMP_TABLE);
559
 
 
560
 
  return (plugin::StorageEngine::dropTable(session, identifier, false)
561
 
          || error);
 
555
  return (plugin::StorageEngine::dropTable(session, identifier, false));
562
556
}
563
557
 
564
558
/*
1550
1544
                                message::Table *table_proto,
1551
1545
                                AlterInfo *alter_info,
1552
1546
                                bool internal_tmp_table,
1553
 
                                uint32_t select_field_count, 
 
1547
                                uint32_t select_field_count,
1554
1548
                                bool is_if_not_exists)
1555
1549
{
1556
1550
  uint          db_options, key_count;
1558
1552
  Cursor        *cursor;
1559
1553
  bool          error= true;
1560
1554
  TableShare share;
1561
 
  bool lex_identified_temp_table= 
 
1555
  bool lex_identified_temp_table=
1562
1556
    (table_proto->type() == drizzled::message::Table::TEMPORARY);
1563
1557
 
1564
1558
  /* Check for duplicate fields and check type of table to create */
2398
2392
  }
2399
2393
  else if (err)
2400
2394
  {
2401
 
    (void) quick_rm_table(*session, db,
2402
 
                          table_name, false);
 
2395
    TableIdentifier identifier(db, table_name, NO_TMP_TABLE);
 
2396
    quick_rm_table(*session, identifier);
 
2397
 
2403
2398
    goto err;
2404
2399
  }
2405
2400
 
2503
2498
                                &Cursor::ha_check));
2504
2499
}
2505
2500
 
2506
 
/*
2507
 
  Recreates tables by calling drizzled::alter_table().
2508
 
 
2509
 
  SYNOPSIS
2510
 
    mysql_recreate_table()
2511
 
    session                     Thread Cursor
2512
 
    tables              Tables to recreate
2513
 
 
2514
 
 RETURN
2515
 
    Like drizzled::alter_table().
2516
 
*/
2517
 
bool mysql_recreate_table(Session *session, TableList *table_list)
2518
 
{
2519
 
  HA_CREATE_INFO create_info;
2520
 
  AlterInfo alter_info;
2521
 
  message::Table table_proto;
2522
 
 
2523
 
  assert(!table_list->next_global);
2524
 
  /*
2525
 
    table_list->table has been closed and freed. Do not reference
2526
 
    uninitialized data. open_tables() could fail.
2527
 
  */
2528
 
  table_list->table= NULL;
2529
 
 
2530
 
  memset(&create_info, 0, sizeof(create_info));
2531
 
  create_info.row_type=ROW_TYPE_NOT_USED;
2532
 
  create_info.default_table_charset=default_charset_info;
2533
 
  /* Force alter table to recreate table */
2534
 
  alter_info.flags.set(ALTER_CHANGE_COLUMN);
2535
 
  alter_info.flags.set(ALTER_RECREATE);
2536
 
  return(alter_table(session, NULL, NULL, &create_info, &table_proto,
2537
 
                     table_list, &alter_info, 0,
2538
 
                     (order_st *) 0, 0));
2539
 
}
2540
 
 
2541
2501
 
2542
2502
bool mysql_checksum_table(Session *session, TableList *tables,
2543
2503
                          HA_CHECK_OPT *)