~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/handler/ha_innodb.cc

  • Committer: Brian Aker
  • Date: 2010-02-04 15:58:21 UTC
  • mfrom: (1280.1.9 build)
  • Revision ID: brian@gaz-20100204155821-bi4txluiivy043sb
Rollup of Brian, Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
#include "drizzled/plugin/info_schema_table.h"
86
86
#include "drizzled/memory/multi_malloc.h"
87
87
#include "drizzled/pthread_globals.h"
 
88
#include "drizzled/named_savepoint.h"
 
89
 
 
90
#include <drizzled/transaction_services.h>
88
91
 
89
92
/** @file ha_innodb.cc */
90
93
 
128
131
#include <string>
129
132
 
130
133
using namespace std;
131
 
 
 
134
using namespace drizzled;
132
135
 
133
136
#ifndef DRIZZLE_SERVER
134
137
/* This is needed because of Bug #3596.  Let us hope that pthread_mutex_t
257
260
                                     HTON_PRIMARY_KEY_IN_READ_INDEX |
258
261
                                     HTON_PARTIAL_COLUMN_READ |
259
262
                                     HTON_TABLE_SCAN_ON_INDEX |
260
 
                                     HTON_HAS_DOES_TRANSACTIONS, sizeof(trx_named_savept_t))
 
263
                                     HTON_HAS_DOES_TRANSACTIONS)
261
264
  {
262
265
    table_definition_ext= drizzled::plugin::DEFAULT_DEFINITION_FILE_EXT;
263
266
    addAlias("INNOBASE");
272
275
                        whose resources should be free'd */
273
276
 
274
277
  virtual int savepoint_set_hook(Session* session,
275
 
                                 void *savepoint);
 
278
                                 drizzled::NamedSavepoint &savepoint);
276
279
  virtual int savepoint_rollback_hook(Session* session,
277
 
                                      void *savepoint);
 
280
                                     drizzled::NamedSavepoint &savepoint);
278
281
  virtual int savepoint_release_hook(Session* session,
279
 
                                     void *savepoint);
 
282
                                     drizzled::NamedSavepoint &savepoint);
280
283
  virtual int commit(Session* session, bool all);
281
284
  virtual int rollback(Session* session, bool all);
282
285
 
1445
1448
{
1446
1449
        assert(engine == innodb_engine_ptr);
1447
1450
        /* Register the statement */
1448
 
        trans_register_ha(session, FALSE, engine);
 
1451
  TransactionServices &transaction_services= TransactionServices::singleton();
 
1452
        transaction_services.trans_register_ha(session, FALSE, engine);
1449
1453
}
1450
1454
 
1451
1455
/*********************************************************************//**
1470
1474
        if (session_test_options(session, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
1471
1475
 
1472
1476
                /* No autocommit mode, register for a transaction */
1473
 
                trans_register_ha(session, TRUE, engine);
 
1477
    TransactionServices &transaction_services= TransactionServices::singleton();
 
1478
    transaction_services.trans_register_ha(session, TRUE, engine);
1474
1479
        }
1475
1480
}
1476
1481
 
2337
2342
/*===========================*/
2338
2343
        Session*        session,                /*!< in: handle to the MySQL thread of the user
2339
2344
                                whose transaction should be rolled back */
2340
 
        void*   savepoint)      /*!< in: savepoint data */
 
2345
        drizzled::NamedSavepoint &named_savepoint)      /*!< in: savepoint data */
2341
2346
{
2342
2347
        ib_int64_t      mysql_binlog_cache_pos;
2343
2348
        int             error = 0;
2344
2349
        trx_t*          trx;
2345
 
        char            sp_name[64];
2346
2350
 
2347
2351
        assert(this == innodb_engine_ptr);
2348
2352
 
2355
2359
        innobase_release_stat_resources(trx);
2356
2360
 
2357
2361
        /* TODO: use provided savepoint data area to store savepoint data */
2358
 
 
2359
 
        int64_t2str((ulint)savepoint, sp_name, 36);
2360
 
 
2361
 
        error = (int) trx_rollback_to_savepoint_for_mysql(trx, sp_name,
 
2362
        error = (int) trx_rollback_to_savepoint_for_mysql(trx, named_savepoint.getName().c_str(),
2362
2363
                                                &mysql_binlog_cache_pos);
2363
2364
        return(convert_error_code_to_mysql(error, 0, NULL));
2364
2365
}
2372
2373
/*=======================*/
2373
2374
        Session*        session,                /*!< in: handle to the MySQL thread of the user
2374
2375
                                whose transaction should be rolled back */
2375
 
        void*   savepoint)      /*!< in: savepoint data */
 
2376
        drizzled::NamedSavepoint &named_savepoint)      /*!< in: savepoint data */
2376
2377
{
2377
2378
        int             error = 0;
2378
2379
        trx_t*          trx;
2379
 
        char            sp_name[64];
2380
2380
 
2381
2381
        assert(this == innodb_engine_ptr);
2382
2382
 
2383
2383
        trx = check_trx_exists(session);
2384
2384
 
2385
2385
        /* TODO: use provided savepoint data area to store savepoint data */
2386
 
 
2387
 
        int64_t2str((ulint)savepoint, sp_name, 36);
2388
 
 
2389
 
        error = (int) trx_release_savepoint_for_mysql(trx, sp_name);
 
2386
        error = (int) trx_release_savepoint_for_mysql(trx, named_savepoint.getName().c_str());
2390
2387
 
2391
2388
        return(convert_error_code_to_mysql(error, 0, NULL));
2392
2389
}
2398
2395
InnobaseEngine::savepoint_set_hook(
2399
2396
/*===============*/
2400
2397
        Session*        session,/*!< in: handle to the MySQL thread */
2401
 
        void*   savepoint)      /*!< in: savepoint data */
 
2398
        drizzled::NamedSavepoint &named_savepoint)      /*!< in: savepoint data */
2402
2399
{
2403
2400
        int     error = 0;
2404
2401
        trx_t*  trx;
2423
2420
        assert(trx->active_trans);
2424
2421
 
2425
2422
        /* TODO: use provided savepoint data area to store savepoint data */
2426
 
        char sp_name[64];
2427
 
        int64_t2str((ulint)savepoint,sp_name,36);
2428
 
 
2429
 
        error = (int) trx_savepoint_for_mysql(trx, sp_name, (ib_int64_t)0);
 
2423
        error = (int) trx_savepoint_for_mysql(trx, named_savepoint.getName().c_str(), (ib_int64_t)0);
2430
2424
 
2431
2425
        return(convert_error_code_to_mysql(error, 0, NULL));
2432
2426
}