~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/systab_variable_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:
60
60
 
61
61
DT_FIELD_INFO pbms_variable_info[]=
62
62
{
63
 
        {"Id",                  NULL,   NULL, MYSQL_TYPE_LONG,          NULL,                                                   NOT_NULL_FLAG,  "The variable ID"},
 
63
        {"Id",                  NOVAL,  NULL, MYSQL_TYPE_LONG,          NULL,                                                   NOT_NULL_FLAG,  "The variable ID"},
64
64
        {"Name",                32,             NULL, MYSQL_TYPE_VARCHAR,       &UTF8_CHARSET,  NOT_NULL_FLAG,  "PBMS variable name"},
65
65
        {"Value",       1024,   NULL, MYSQL_TYPE_VARCHAR,       &UTF8_CHARSET,  0,      "PBMS variable value."},
66
66
        {"Description", 124,    NULL, MYSQL_TYPE_VARCHAR,       &UTF8_CHARSET,  NOT_NULL_FLAG,  "PBMS variable description."},
67
 
        {NULL,NULL, NULL, MYSQL_TYPE_STRING,NULL, 0, NULL}
 
67
        {NULL,NOVAL, NULL, MYSQL_TYPE_STRING,NULL, 0, NULL}
68
68
};
69
69
 
70
70
DT_KEY_INFO pbms_variable_keys[]=
327
327
        return_(path);
328
328
}
329
329
 
 
330
class LoadTableCleanUp : public CSRefObject {
 
331
        bool do_cleanup;
 
332
        CSThread *myself;
 
333
        
 
334
        uint32_t ref_id;
 
335
 
 
336
        public:
 
337
        
 
338
        LoadTableCleanUp(): CSRefObject(),
 
339
                do_cleanup(false), myself(NULL){}
 
340
                
 
341
        ~LoadTableCleanUp() 
 
342
        {
 
343
                if (do_cleanup) {
 
344
                        CSL.log(myself, CSLog::Protocol, "\nRestore failed!\n");
 
345
                        CSL.flush();
 
346
                        myself->logException();
 
347
                }
 
348
        }
 
349
        
 
350
        void setCleanUp(CSThread *self)
 
351
        {
 
352
                myself = self;
 
353
                do_cleanup = true;
 
354
        }
 
355
        
 
356
        void cancelCleanUp()
 
357
        {
 
358
                do_cleanup = false;
 
359
        }
 
360
        
 
361
};
 
362
 
330
363
void MSVariableTable::loadTable(MSDatabase *db)
331
364
{
332
365
        CSPath  *path;
392
425
                CSL.log(self, CSLog::Protocol, db->myDatabaseName->getCString());
393
426
                CSL.log(self, CSLog::Protocol, " ...");
394
427
                CSL.flush();
395
 
                try_(a) {
396
 
                        db->myBlobCloud->cl_restoreDB();
397
 
                }
398
 
                catch_(a) {
399
 
                        CSL.log(self, CSLog::Protocol, "\nRestore failed!\n");
400
 
                        CSL.flush();
401
 
                        self->logException();
402
 
                        throw_();
403
 
                }
404
 
                cont_(a);
 
428
                LoadTableCleanUp *cleanup;
 
429
                
 
430
                new_(cleanup, LoadTableCleanUp());
 
431
                push_(cleanup);
 
432
                cleanup->setCleanUp(self);
 
433
                
 
434
                db->myBlobCloud->cl_restoreDB();
 
435
                
 
436
                cleanup->cancelCleanUp();
 
437
                release_(cleanup);
 
438
 
405
439
                CSL.log(self, CSLog::Protocol, "\nRestore done.\n");
406
440
                CSL.flush();
407
441
                set_BackupNo(RETAIN(db), "0");
509
543
        save_write_set = table->write_set;
510
544
        table->write_set = NULL;
511
545
 
 
546
#ifdef DRIZZLED
512
547
        memset(buf, 0xFF, table->getNullBytes());
 
548
#else
 
549
        memset(buf, 0xFF, table->s->null_bytes);
 
550
#endif
513
551
        for (Field **field=GET_TABLE_FIELDS(table) ; *field ; field++) {
514
552
                curr_field = *field;
515
553
                save = curr_field->ptr;
516
554
#if MYSQL_VERSION_ID < 50114
517
555
                curr_field->ptr = (byte *) buf + curr_field->offset();
518
556
#else
 
557
#ifdef DRIZZLED
519
558
                curr_field->ptr = (byte *) buf + curr_field->offset(curr_field->getTable()->getInsertRecord());
 
559
#else
 
560
                curr_field->ptr = (byte *) buf + curr_field->offset(curr_field->table->record[0]);
 
561
#endif
520
562
#endif
521
563
                switch (curr_field->field_name[0]) {
522
564
                        case 'I':