~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

Merge Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#include "drizzled/internal/my_sys.h"
44
44
#include "drizzled/internal/iocache.h"
45
45
 
 
46
#include "drizzled/transaction_services.h"
 
47
 
46
48
extern pid_t current_pid;
47
49
 
48
50
using namespace std;
544
546
    ALTER Table
545
547
  */
546
548
 
 
549
  TransactionServices &transaction_services= TransactionServices::singleton();
547
550
  session->set_proc_info("discard_or_import_tablespace");
548
551
 
549
552
  discard= test(tablespace_op == DISCARD_TABLESPACE);
567
570
    goto err;
568
571
 
569
572
  /* The ALTER Table is always in its own transaction */
570
 
  error = ha_autocommit_or_rollback(session, 0);
 
573
  error= transaction_services.ha_autocommit_or_rollback(session, false);
571
574
  if (! session->endActiveTransaction())
572
575
    error=1;
573
576
  if (error)
575
578
  write_bin_log(session, session->query, session->query_length);
576
579
 
577
580
err:
578
 
  ha_autocommit_or_rollback(session, error);
 
581
  (void) transaction_services.ha_autocommit_or_rollback(session, error);
579
582
  session->tablespace_op=false;
580
583
 
581
584
  if (error == 0)
1260
1263
                         enum enum_enable_or_disable keys_onoff,
1261
1264
                         bool error_if_not_empty)
1262
1265
{
1263
 
  int error;
 
1266
  int error= 0;
1264
1267
  CopyField *copy,*copy_end;
1265
1268
  ulong found_count,delete_count;
1266
1269
  Session *session= current_session;
1280
1283
 
1281
1284
    This needs to be done before external_lock
1282
1285
  */
1283
 
  error= ha_enable_transaction(session, false);
1284
 
  if (error)
1285
 
    return -1;
 
1286
  TransactionServices &transaction_services= TransactionServices::singleton();
1286
1287
 
1287
1288
  if (!(copy= new CopyField[to->s->fields]))
1288
1289
    return -1;
1414
1415
  }
1415
1416
  to->cursor->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
1416
1417
 
1417
 
  if (ha_enable_transaction(session, true))
1418
 
  {
1419
 
    error= 1;
1420
 
    goto err;
1421
 
  }
1422
 
 
1423
1418
  /*
1424
1419
    Ensure that the new table is saved properly to disk so that we
1425
1420
    can do a rename
1426
1421
  */
1427
 
  if (ha_autocommit_or_rollback(session, 0))
 
1422
  if (transaction_services.ha_autocommit_or_rollback(session, false))
1428
1423
    error=1;
1429
1424
  if (! session->endActiveTransaction())
1430
1425
    error=1;