~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/transaction_ms.cc

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2010-10-18 21:21:20 UTC
  • mto: This revision was merged to the branch mainline in revision 1871.
  • Revision ID: barry.leslie@primebase.com-20101018212120-dqukgtkwhb1imt1o
Merged changes from lp:pbms. These changes should remove any danger
of longjmp() clobbering local variables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 */
29
29
 
30
30
#include "cslib/CSConfig.h"
 
31
 
31
32
#include <inttypes.h>
32
 
#include <string>
33
33
 
34
34
#include "defs_ms.h"
 
35
 
 
36
#include "cslib/CSGlobal.h"
 
37
#include "cslib/CSStrUtil.h"
 
38
#include "cslib/CSLog.h"
 
39
 
35
40
#include "mysql_ms.h"
36
41
#include "open_table_ms.h"
37
42
#include "trans_log_ms.h"
38
43
#include "transaction_ms.h"
39
44
#include "pbmsdaemon_ms.h"
40
45
 
41
 
#include "cslib/CSGlobal.h"
42
 
#include "cslib/CSStrUtil.h"
43
 
#include "cslib/CSLog.h"
44
 
 
45
 
 
46
46
/*
47
47
 * The pbms_ functions are utility functions supplied by ha_pbms.cc
48
48
 */
179
179
 
180
180
void MSTransactionThread::dereference(MSTransPtr rec, MS_TxnState state)
181
181
{
182
 
        MSOpenTable             *otab;
183
182
        enter_();
184
183
        
185
184
        try_(a) {
 
185
                MSOpenTable             *otab;
186
186
                otab = MSTableList::getOpenTableByID(rec->tr_db_id, rec->tr_tab_id);
187
187
                frompool_(otab);
188
188
                otab->freeReference(rec->tr_blob_id, rec->tr_blob_ref_id);
199
199
 
200
200
void MSTransactionThread::commitReference(MSTransPtr rec, MS_TxnState state)
201
201
{
202
 
        MSOpenTable             *otab;
203
202
        enter_();
204
203
        
205
204
        try_(a) {
 
205
                MSOpenTable             *otab;
206
206
                otab = MSTableList::getOpenTableByID(rec->tr_db_id, rec->tr_tab_id);
207
207
                frompool_(otab);
208
208
                otab->commitReference(rec->tr_blob_id, rec->tr_blob_ref_id);
237
237
 
238
238
bool MSTransactionThread::doWork()
239
239
{
240
 
        MSTransRec rec = {0,0,0,0,0,0,0};
241
 
        MS_TxnState state;
242
240
        enter_();
243
241
        
244
242
        try_(a) {
 
243
                MSTransRec rec = {0,0,0,0,0,0,0};
 
244
                MS_TxnState state;
245
245
                while (!myMustQuit) {
246
246
                        // This will sleep while waiting for the next 
247
247
                        // completed transaction.
412
412
        exit_();
413
413
}
414
414
 
415
 
class MSTransactionCheckPoint: public CSCString
 
415
class MSTransactionCheckPoint: public CSString
416
416
{
417
417
        public:
418
 
        MSTransactionCheckPoint(const char *name, uint32_t stmtCount ):CSCString()
 
418
        MSTransactionCheckPoint(const char *name, uint32_t stmtCount ):CSString(name)
419
419
        {
420
 
                myCString = cs_strdup(name);
421
 
                myStrLen = strlen(name);
422
 
 
423
420
                position = stmtCount;
424
421
        }
425
422
        
444
441
void MSTransactionManager::releaseSavepoint(const char *savePoint)
445
442
{
446
443
        MSTransactionCheckPoint *checkPoint;
447
 
        CSCString *name;
 
444
        CSString *name;
448
445
        enter_();
449
446
        
450
 
        name = CSCString::newString(savePoint);
 
447
        name = CSString::newString(savePoint);
451
448
        push_(name);
452
449
 
453
450
        checkPoint = (MSTransactionCheckPoint*) self->mySavePoints.find(name);
462
459
void MSTransactionManager::rollbackTo(const char *savePoint)
463
460
{
464
461
        MSTransactionCheckPoint *checkPoint;
465
 
        CSCString *name;
 
462
        CSString *name;
466
463
        enter_();
467
464
        
468
 
        name = CSCString::newString(savePoint);
 
465
        name = CSString::newString(savePoint);
469
466
        push_(name);
470
467
 
471
468
        checkPoint = (MSTransactionCheckPoint*) self->mySavePoints.find(name);