~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

  • Committer: Stewart Smith
  • Date: 2011-02-28 02:07:11 UTC
  • mto: (2241.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2242.
  • Revision ID: stewart@flamingspork.com-20110228020711-bc1s0tsvbg4ynfwy
switch DISCARD/IMPORT TABLESPACE to only use the alter table protobuf message

Show diffs side-by-side

added added

removed removed

Lines of Context:
703
703
 
704
704
/* table_list should contain just one table */
705
705
static int discard_or_import_tablespace(Session *session,
706
 
                                              TableList *table_list,
707
 
                                              enum tablespace_op_type tablespace_op)
 
706
                                        TableList *table_list,
 
707
                                        bool discard)
708
708
{
709
709
  Table *table;
710
 
  bool discard;
711
710
 
712
711
  /*
713
712
    Note that DISCARD/IMPORT TABLESPACE always is the only operation in an
716
715
  TransactionServices &transaction_services= TransactionServices::singleton();
717
716
  session->set_proc_info("discard_or_import_tablespace");
718
717
 
719
 
  discard= test(tablespace_op == DISCARD_TABLESPACE);
720
 
 
721
718
 /*
722
719
   We set this flag so that ha_innobase::open and ::external_lock() do
723
720
   not complain when we lock the table
1380
1377
{
1381
1378
  bool error;
1382
1379
  Table *table;
 
1380
  message::AlterTable *alter_table_message= session->getLex()->alter_table();
1383
1381
 
1384
 
  if (alter_info->tablespace_op != NO_TABLESPACE_OP)
 
1382
  if (alter_table_message->operations_size()
 
1383
      && (alter_table_message->operations(0).operation()
 
1384
          == message::AlterTable::AlterTableOperation::DISCARD_TABLESPACE
 
1385
          || alter_table_message->operations(0).operation()
 
1386
          == message::AlterTable::AlterTableOperation::IMPORT_TABLESPACE))
1385
1387
  {
1386
 
    message::AlterTable *alter= session->getLex()->alter_table();
1387
 
 
1388
 
    if (alter_info->tablespace_op == DISCARD_TABLESPACE)
1389
 
    {
1390
 
      assert(alter->operations(0).operation() == message::AlterTable::AlterTableOperation::DISCARD_TABLESPACE);
1391
 
    }
1392
 
    else if (alter_info->tablespace_op == IMPORT_TABLESPACE)
1393
 
    {
1394
 
      assert(alter->operations(0).operation() == message::AlterTable::AlterTableOperation::IMPORT_TABLESPACE);
1395
 
    }
1396
 
 
 
1388
    bool discard= (alter_table_message->operations(0).operation() ==
 
1389
                   message::AlterTable::AlterTableOperation::DISCARD_TABLESPACE);
1397
1390
    /* DISCARD/IMPORT TABLESPACE is always alone in an ALTER Table */
1398
 
    return discard_or_import_tablespace(session, table_list, alter_info->tablespace_op);
 
1391
    return discard_or_import_tablespace(session, table_list, discard);
1399
1392
  }
1400
1393
 
1401
1394
  session->set_proc_info("init");