~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

This patch does not change any algorithms or code paths, 
it just moves the transaction-related methods in the
drizzled/ha_commands.cc file into a file named
drizzled/transaction_services.cc and creates a singleton
Service class called TransactionServices containing all
the previous ha_xxx methods related specifically to the
XA distributed transaction processing model.

This is a quick stopgap patch in the move towards separating
out the XA Resource Manager API from the Storage Engine API.

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)
1280
1283
 
1281
1284
    This needs to be done before external_lock
1282
1285
  */
1283
 
  error= ha_enable_transaction(session, false);
 
1286
  TransactionServices &transaction_services= TransactionServices::singleton();
 
1287
  error= transaction_services.ha_enable_transaction(session, false);
1284
1288
  if (error)
1285
1289
    return -1;
1286
1290
 
1414
1418
  }
1415
1419
  to->cursor->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
1416
1420
 
1417
 
  if (ha_enable_transaction(session, true))
 
1421
  if (transaction_services.ha_enable_transaction(session, true))
1418
1422
  {
1419
1423
    error= 1;
1420
1424
    goto err;
1424
1428
    Ensure that the new table is saved properly to disk so that we
1425
1429
    can do a rename
1426
1430
  */
1427
 
  if (ha_autocommit_or_rollback(session, 0))
 
1431
  if (transaction_services.ha_autocommit_or_rollback(session, false))
1428
1432
    error=1;
1429
1433
  if (! session->endActiveTransaction())
1430
1434
    error=1;