transactd 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/common/tdclc_32_3_2.dll +0 -0
- data/bin/common/{tdclc_64_3_1.dll → tdclc_64_3_2.dll} +0 -0
- data/build/swig/ruby/ruby.swg +3 -0
- data/build/swig/ruby/tdclrb_wrap.cpp +2413 -126
- data/build/swig/tdcl.i +120 -9
- data/build/tdclc/tdclc.cbproj +4 -1
- data/build/tdclc/tdclc.rc +4 -4
- data/build/tdclcpp/tdclcpp.rc +4 -4
- data/build/tdclcpp/tdclcpp_bc.cbproj +8 -1
- data/build/tdclrb/tdclrb.rc +4 -4
- data/source/bzs/db/engine/mysql/database.cpp +138 -130
- data/source/bzs/db/engine/mysql/database.h +43 -48
- data/source/bzs/db/engine/mysql/dbManager.cpp +81 -96
- data/source/bzs/db/engine/mysql/dbManager.h +13 -22
- data/source/bzs/db/engine/mysql/mysqlInternal.h +157 -291
- data/source/bzs/db/engine/mysql/mysqlProtocol.cpp +425 -0
- data/source/bzs/db/engine/mysql/mysqlProtocol.h +72 -0
- data/source/bzs/db/engine/mysql/mysqlThd.cpp +8 -6
- data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +7 -3
- data/source/bzs/db/protocol/hs/hsCommandExecuter.h +1 -0
- data/source/bzs/db/protocol/tdap/client/client.h +22 -8
- data/source/bzs/db/protocol/tdap/client/connMgr.cpp +225 -21
- data/source/bzs/db/protocol/tdap/client/connMgr.h +42 -16
- data/source/bzs/db/protocol/tdap/client/database.cpp +58 -15
- data/source/bzs/db/protocol/tdap/client/database.h +3 -3
- data/source/bzs/db/protocol/tdap/client/dbDef.cpp +93 -85
- data/source/bzs/db/protocol/tdap/client/dbDef.h +1 -2
- data/source/bzs/db/protocol/tdap/client/dllmain.cpp +9 -5
- data/source/bzs/db/protocol/tdap/client/filter.h +2 -2
- data/source/bzs/db/protocol/tdap/client/groupComp.h +2 -2
- data/source/bzs/db/protocol/tdap/client/memRecord.cpp +1 -1
- data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +71 -12
- data/source/bzs/db/protocol/tdap/client/nsDatabase.h +7 -1
- data/source/bzs/db/protocol/tdap/client/nsTable.cpp +35 -2
- data/source/bzs/db/protocol/tdap/client/nsTable.h +1 -0
- data/source/bzs/db/protocol/tdap/client/recordset.cpp +5 -1
- data/source/bzs/db/protocol/tdap/client/recordset.h +15 -0
- data/source/bzs/db/protocol/tdap/client/recordsetImple.h +21 -16
- data/source/bzs/db/protocol/tdap/client/serializer.cpp +32 -11
- data/source/bzs/db/protocol/tdap/client/serializer.h +4 -1
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +3 -2
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.h +3 -0
- data/source/bzs/db/protocol/tdap/client/table.cpp +18 -14
- data/source/bzs/db/protocol/tdap/client/trdboostapi.h +8 -3
- data/source/bzs/db/protocol/tdap/mysql/characterset.cpp +1 -0
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +83 -43
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +3 -1
- data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +7 -7
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +247 -137
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +9 -9
- data/source/bzs/db/protocol/tdap/tdapSchema.cpp +1 -4
- data/source/bzs/db/protocol/tdap/tdapSchema.h +3 -7
- data/source/bzs/db/protocol/tdap/tdapcapi.h +23 -3
- data/source/bzs/db/protocol/tdap/uri.h +40 -0
- data/source/bzs/db/transactd/appModule.cpp +14 -5
- data/source/bzs/db/transactd/appModule.h +10 -1
- data/source/bzs/db/transactd/connManager.cpp +93 -48
- data/source/bzs/db/transactd/connManager.h +10 -7
- data/source/bzs/db/transactd/connectionRecord.h +114 -19
- data/source/bzs/env/tstring.h +2 -0
- data/source/bzs/example/changeSchema.cpp +1 -1
- data/source/bzs/example/changeSchema_c.cpp +1 -1
- data/source/bzs/example/insertRecords.cpp +2 -1
- data/source/bzs/example/insertRecords_c.cpp +2 -1
- data/source/bzs/example/queryData.cpp +5 -2
- data/source/bzs/netsvc/server/IAppModule.h +6 -0
- data/source/bzs/test/tdclatl/test_v3.js +75 -0
- data/source/bzs/test/tdclphp/transactd_v3_Test.php +104 -7
- data/source/bzs/test/tdclrb/transactd_v3_spec.rb +84 -0
- data/source/bzs/test/trdclengn/testField.h +66 -6
- data/source/bzs/test/trdclengn/test_tdclcpp_v3.cpp +10 -1
- data/source/bzs/test/trdclengn/test_trdclengn.cpp +85 -0
- data/source/bzs/test/trdclengn/testbase.h +1 -1
- data/source/global/tdclatl/BinlogPos.cpp +64 -0
- data/source/global/tdclatl/BinlogPos.h +84 -0
- data/source/global/tdclatl/ConnMgr.cpp +285 -0
- data/source/global/tdclatl/ConnMgr.h +83 -0
- data/source/global/tdclatl/ConnRecord.cpp +123 -0
- data/source/global/tdclatl/ConnRecord.h +69 -0
- data/source/global/tdclatl/ConnRecords.cpp +57 -0
- data/source/global/tdclatl/ConnRecords.h +55 -0
- data/source/global/tdclatl/Database.cpp +36 -0
- data/source/global/tdclatl/Database.h +4 -0
- data/source/global/tdclatl/Table.cpp +14 -1
- data/source/global/tdclatl/Table.h +1 -0
- data/source/global/tdclatl/resource.h +0 -0
- data/source/global/tdclatl/tdclatl.idl +148 -4
- metadata +14 -4
- data/bin/common/tdclc_32_3_1.dll +0 -0
|
@@ -105,10 +105,11 @@ struct dbdimple
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
dbdef::dbdef(nsdatabase* pbe, short
|
|
108
|
+
dbdef::dbdef(nsdatabase* pbe, short defType) : nstable(pbe)
|
|
109
109
|
{
|
|
110
110
|
m_dimpl = new dbdimple();
|
|
111
|
-
m_dimpl->deftype =
|
|
111
|
+
m_dimpl->deftype = defType;
|
|
112
|
+
m_dimpl->noWriteMode = (m_dimpl->deftype == TYPE_SCHEMA_BDF_NOPRELOAD);
|
|
112
113
|
m_keybuflen = 128;
|
|
113
114
|
m_keybuf = &m_dimpl->keybuf[0];
|
|
114
115
|
setShared();
|
|
@@ -120,11 +121,6 @@ dbdef::~dbdef()
|
|
|
120
121
|
m_dimpl = NULL;
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
void dbdef::setDefType(short defType)
|
|
124
|
-
{
|
|
125
|
-
m_dimpl->deftype = defType;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
124
|
short dbdef::tableCount() const
|
|
129
125
|
{
|
|
130
126
|
return m_dimpl->tableCount;
|
|
@@ -236,10 +232,10 @@ bool dbdef::testTablePtr(tabledef* td)
|
|
|
236
232
|
return true;
|
|
237
233
|
}
|
|
238
234
|
|
|
239
|
-
short dbdef::validateTableDef(short
|
|
235
|
+
short dbdef::validateTableDef(short tableIndex)
|
|
240
236
|
{
|
|
241
237
|
m_stat = STATUS_SUCCESS;
|
|
242
|
-
tabledef* td = tableDefs(
|
|
238
|
+
tabledef* td = tableDefs(tableIndex);
|
|
243
239
|
if (!testTablePtr(td)) return m_stat;
|
|
244
240
|
|
|
245
241
|
td->optionFlags.bitA = false; // reset valiable type
|
|
@@ -247,7 +243,7 @@ short dbdef::validateTableDef(short TableIndex)
|
|
|
247
243
|
for (short i = 0; i < td->fieldCount; ++i)
|
|
248
244
|
{
|
|
249
245
|
const fielddef& fd = td->fieldDefs[i];
|
|
250
|
-
short ret = fieldNumByName(
|
|
246
|
+
short ret = fieldNumByName(tableIndex, fd.name());
|
|
251
247
|
if ((ret != -1) && (ret != i))
|
|
252
248
|
{
|
|
253
249
|
m_stat = STATUS_DUPLICATE_FIELDNAME;
|
|
@@ -344,7 +340,7 @@ short dbdef::validateTableDef(short TableIndex)
|
|
|
344
340
|
// Chack duplicate table name.
|
|
345
341
|
for (short i = 1; i < m_dimpl->tableCount; i++)
|
|
346
342
|
{
|
|
347
|
-
if ((tableDefs(i)) && (i !=
|
|
343
|
+
if ((tableDefs(i)) && (i != tableIndex))
|
|
348
344
|
{
|
|
349
345
|
m_stat = 0;
|
|
350
346
|
if (strcmp(tableDefs(i)->tableNameA(), td->tableNameA()) == 0)
|
|
@@ -359,21 +355,22 @@ short dbdef::validateTableDef(short TableIndex)
|
|
|
359
355
|
return m_stat;
|
|
360
356
|
}
|
|
361
357
|
|
|
362
|
-
void dbdef::updateTableDef(short
|
|
358
|
+
void dbdef::updateTableDef(short tableIndex, bool forPsqlDdf)
|
|
363
359
|
{
|
|
364
|
-
if ((m_stat = validateTableDef(
|
|
360
|
+
if ((m_stat = validateTableDef(tableIndex)) != 0)
|
|
365
361
|
return;
|
|
366
362
|
|
|
367
|
-
tabledef* td = tableDefs(
|
|
363
|
+
tabledef* td = tableDefs(tableIndex);
|
|
368
364
|
if (!testTablePtr(td)) return;
|
|
369
365
|
|
|
370
366
|
if (m_dimpl->noWriteMode)
|
|
371
367
|
{
|
|
372
|
-
|
|
368
|
+
if (m_dimpl->deftype != TYPE_SCHEMA_BDF_NOPRELOAD)
|
|
369
|
+
m_stat = STATUS_ACCESS_DENIED;
|
|
373
370
|
return;
|
|
374
371
|
}
|
|
375
372
|
if (m_dimpl->deftype == TYPE_SCHEMA_DDF)
|
|
376
|
-
saveDDF(
|
|
373
|
+
saveDDF(tableIndex, 3, forPsqlDdf);
|
|
377
374
|
else
|
|
378
375
|
{
|
|
379
376
|
moveById(td->id);
|
|
@@ -389,21 +386,21 @@ void dbdef::updateTableDef(short TableIndex, bool forPsqlDdf)
|
|
|
389
386
|
m_pdata = m_dimpl->bdf;
|
|
390
387
|
m_buflen = m_dimpl->bdfLen;
|
|
391
388
|
if (m_stat == STATUS_SUCCESS)
|
|
392
|
-
setDefaultImage(
|
|
389
|
+
setDefaultImage(tableIndex, NULL, 0);
|
|
393
390
|
}
|
|
394
391
|
}
|
|
395
392
|
}
|
|
396
393
|
|
|
397
|
-
void dbdef::deleteTable(short
|
|
394
|
+
void dbdef::deleteTable(short tableIndex)
|
|
398
395
|
{
|
|
399
|
-
tabledef* td = tableDefs(
|
|
396
|
+
tabledef* td = tableDefs(tableIndex);
|
|
400
397
|
if (!testTablePtr(td)) return;
|
|
401
398
|
|
|
402
399
|
m_stat = STATUS_SUCCESS;
|
|
403
400
|
if (m_dimpl->noWriteMode == false)
|
|
404
401
|
{
|
|
405
402
|
if (m_dimpl->deftype == TYPE_SCHEMA_DDF)
|
|
406
|
-
saveDDF(
|
|
403
|
+
saveDDF(tableIndex, 4);
|
|
407
404
|
else
|
|
408
405
|
{
|
|
409
406
|
moveById(td->id);
|
|
@@ -419,18 +416,18 @@ void dbdef::deleteTable(short TableIndex)
|
|
|
419
416
|
}
|
|
420
417
|
if (m_stat == STATUS_SUCCESS)
|
|
421
418
|
{
|
|
422
|
-
setDefaultImage(
|
|
419
|
+
setDefaultImage(tableIndex, NULL, 0);
|
|
423
420
|
free(td);
|
|
424
|
-
m_dimpl->tableDefs[
|
|
421
|
+
m_dimpl->tableDefs[tableIndex] = NULL;
|
|
425
422
|
}
|
|
426
423
|
}
|
|
427
424
|
|
|
428
|
-
void dbdef::renumberFieldNum(short
|
|
425
|
+
void dbdef::renumberFieldNum(short tableIndex, short Index, short op)
|
|
429
426
|
{
|
|
430
427
|
int i, j;
|
|
431
428
|
keydef* KeyDef;
|
|
432
429
|
|
|
433
|
-
tabledef* td = tableDefs(
|
|
430
|
+
tabledef* td = tableDefs(tableIndex);
|
|
434
431
|
if (!testTablePtr(td)) return;
|
|
435
432
|
|
|
436
433
|
for (i = 0; i < td->keyCount; i++)
|
|
@@ -454,11 +451,11 @@ void dbdef::renumberFieldNum(short TableIndex, short Index, short op)
|
|
|
454
451
|
}
|
|
455
452
|
}
|
|
456
453
|
|
|
457
|
-
bool dbdef::isUsedField(short
|
|
454
|
+
bool dbdef::isUsedField(short tableIndex, short deleteIndex)
|
|
458
455
|
{
|
|
459
456
|
int i, j;
|
|
460
457
|
keydef* KeyDef;
|
|
461
|
-
tabledef* td = tableDefs(
|
|
458
|
+
tabledef* td = tableDefs(tableIndex);
|
|
462
459
|
if (!testTablePtr(td)) return false;
|
|
463
460
|
|
|
464
461
|
for (i = 0; i < td->keyCount; i++)
|
|
@@ -466,60 +463,60 @@ bool dbdef::isUsedField(short TableIndex, short DeleteIndex)
|
|
|
466
463
|
KeyDef = &(td->keyDefs[i]);
|
|
467
464
|
for (j = 0; j < KeyDef->segmentCount; j++)
|
|
468
465
|
{
|
|
469
|
-
if (KeyDef->segments[j].fieldNum ==
|
|
466
|
+
if (KeyDef->segments[j].fieldNum == deleteIndex)
|
|
470
467
|
return true;
|
|
471
468
|
}
|
|
472
469
|
}
|
|
473
470
|
return false;
|
|
474
471
|
}
|
|
475
472
|
|
|
476
|
-
void dbdef::deleteField(short
|
|
473
|
+
void dbdef::deleteField(short tableIndex, short deleteIndex)
|
|
477
474
|
{
|
|
478
475
|
m_stat = STATUS_SUCCESS;
|
|
479
|
-
if (isUsedField(
|
|
476
|
+
if (isUsedField(tableIndex, deleteIndex) == true)
|
|
480
477
|
{
|
|
481
478
|
m_stat = STATUS_USE_KEYFIELD;
|
|
482
479
|
return;
|
|
483
480
|
}
|
|
484
|
-
renumberFieldNum(
|
|
485
|
-
tabledef* td = tableDefs(
|
|
486
|
-
if ((
|
|
481
|
+
renumberFieldNum(tableIndex, deleteIndex, 4);
|
|
482
|
+
tabledef* td = tableDefs(tableIndex);
|
|
483
|
+
if ((deleteIndex == td->fieldCount - 1) && (td->keyCount == 0))
|
|
487
484
|
{
|
|
488
485
|
}
|
|
489
486
|
else
|
|
490
487
|
{
|
|
491
|
-
memmove(&td->fieldDefs[
|
|
488
|
+
memmove(&td->fieldDefs[deleteIndex], &td->fieldDefs[deleteIndex + 1],
|
|
492
489
|
td->size() + (char*)td -
|
|
493
|
-
(char*)&(td->fieldDefs[
|
|
490
|
+
(char*)&(td->fieldDefs[deleteIndex + 1]));
|
|
494
491
|
}
|
|
495
492
|
td->fieldCount--;
|
|
496
493
|
td->setKeydefsPtr();
|
|
497
|
-
updateTableDef(
|
|
494
|
+
updateTableDef(tableIndex);
|
|
498
495
|
}
|
|
499
496
|
|
|
500
|
-
void dbdef::deleteKey(short
|
|
497
|
+
void dbdef::deleteKey(short tableIndex, short deleteIndex)
|
|
501
498
|
{
|
|
502
499
|
m_stat = STATUS_SUCCESS;
|
|
503
|
-
tabledef* td = tableDefs(
|
|
500
|
+
tabledef* td = tableDefs(tableIndex);
|
|
504
501
|
if (!testTablePtr(td)) return ;
|
|
505
|
-
if (
|
|
502
|
+
if (deleteIndex != td->keyCount - 1)
|
|
506
503
|
{
|
|
507
|
-
memmove(&td->keyDefs[
|
|
504
|
+
memmove(&td->keyDefs[deleteIndex], &td->keyDefs[deleteIndex + 1],
|
|
508
505
|
td->size() + (char*)td -
|
|
509
|
-
(char*)&(td->keyDefs[
|
|
506
|
+
(char*)&(td->keyDefs[deleteIndex + 1]));
|
|
510
507
|
}
|
|
511
508
|
td->keyCount--;
|
|
512
|
-
if ((td->primaryKeyNum ==
|
|
509
|
+
if ((td->primaryKeyNum == deleteIndex) ||
|
|
513
510
|
(td->primaryKeyNum > td->keyCount - 1))
|
|
514
511
|
td->primaryKeyNum = -1;
|
|
515
|
-
if ((td->parentKeyNum ==
|
|
512
|
+
if ((td->parentKeyNum == deleteIndex) ||
|
|
516
513
|
(td->parentKeyNum > td->keyCount - 1))
|
|
517
514
|
td->parentKeyNum = -1;
|
|
518
|
-
if ((td->replicaKeyNum ==
|
|
515
|
+
if ((td->replicaKeyNum == deleteIndex) ||
|
|
519
516
|
(td->replicaKeyNum > td->keyCount - 1))
|
|
520
517
|
td->replicaKeyNum = -1;
|
|
521
518
|
|
|
522
|
-
updateTableDef(
|
|
519
|
+
updateTableDef(tableIndex);
|
|
523
520
|
}
|
|
524
521
|
|
|
525
522
|
void dbdef::insertTable(tabledef* td)
|
|
@@ -557,6 +554,7 @@ void dbdef::insertTable(tabledef* td)
|
|
|
557
554
|
if ((td->ddfid == 0) && (m_dimpl->deftype == TYPE_SCHEMA_DDF))
|
|
558
555
|
td->ddfid = getDDFNewTableIndex();
|
|
559
556
|
memcpy(m_dimpl->tableDefs[td->id], td, sizeof(tabledef));
|
|
557
|
+
m_dimpl->tableDefs[td->id]->defaultImage = NULL;
|
|
560
558
|
if (m_dimpl->noWriteMode)
|
|
561
559
|
{
|
|
562
560
|
if (m_dimpl->tableCount < td->id)
|
|
@@ -589,10 +587,12 @@ void dbdef::insertTable(tabledef* td)
|
|
|
589
587
|
}
|
|
590
588
|
}
|
|
591
589
|
|
|
592
|
-
bool dbdef::resizeAt(short
|
|
590
|
+
bool dbdef::resizeAt(short tableIndex, bool key)
|
|
593
591
|
{
|
|
594
|
-
tabledef*
|
|
595
|
-
if (!
|
|
592
|
+
tabledef* td = m_dimpl->tableDefs[tableIndex];
|
|
593
|
+
if (!testTablePtr(td)) return false;
|
|
594
|
+
|
|
595
|
+
if (!key && td->m_inUse != 0) return false;
|
|
596
596
|
|
|
597
597
|
uint_td addsize;
|
|
598
598
|
|
|
@@ -601,64 +601,64 @@ bool dbdef::resizeAt(short TableIndex, bool key)
|
|
|
601
601
|
else
|
|
602
602
|
addsize = sizeof(fielddef);
|
|
603
603
|
|
|
604
|
-
uint_td size =
|
|
605
|
-
|
|
604
|
+
uint_td size = td->size() + addsize;
|
|
605
|
+
|
|
606
606
|
void* p = malloc(size);
|
|
607
607
|
if (p)
|
|
608
608
|
{
|
|
609
|
-
memcpy(p,
|
|
610
|
-
free(
|
|
611
|
-
m_dimpl->tableDefs[
|
|
609
|
+
memcpy(p, td, td->size());
|
|
610
|
+
free(td);
|
|
611
|
+
m_dimpl->tableDefs[tableIndex] = td = (tabledef*)p;
|
|
612
612
|
// init for memcpy
|
|
613
|
-
|
|
614
|
-
|
|
613
|
+
td->setFielddefsPtr();
|
|
614
|
+
td->setKeydefsPtr();
|
|
615
615
|
return true;
|
|
616
616
|
}
|
|
617
617
|
m_stat = STATUS_CANT_ALLOC_MEMORY;
|
|
618
618
|
return false;
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
-
keydef* dbdef::insertKey(short
|
|
621
|
+
keydef* dbdef::insertKey(short tableIndex, short insertIndex)
|
|
622
622
|
{
|
|
623
|
-
if (resizeAt(
|
|
623
|
+
if (resizeAt(tableIndex, true) == false)
|
|
624
624
|
return NULL;
|
|
625
625
|
|
|
626
|
-
tabledef* td = m_dimpl->tableDefs[
|
|
627
|
-
if (
|
|
626
|
+
tabledef* td = m_dimpl->tableDefs[tableIndex];
|
|
627
|
+
if (insertIndex < tableDefs(tableIndex)->keyCount)
|
|
628
628
|
{
|
|
629
|
-
memmove(&td->keyDefs[
|
|
630
|
-
&td->keyDefs[
|
|
631
|
-
td->size() + (char*)td - (char*)&(td->keyDefs[
|
|
629
|
+
memmove(&td->keyDefs[insertIndex + 1],
|
|
630
|
+
&td->keyDefs[insertIndex],
|
|
631
|
+
td->size() + (char*)td - (char*)&(td->keyDefs[insertIndex]));
|
|
632
632
|
}
|
|
633
633
|
td->keyCount++;
|
|
634
|
-
memset(&(td->keyDefs[
|
|
634
|
+
memset(&(td->keyDefs[insertIndex]), 0, sizeof(keydef));
|
|
635
635
|
|
|
636
636
|
if ((!m_dimpl->noWriteMode) && (m_dimpl->deftype != TYPE_SCHEMA_DDF))
|
|
637
|
-
updateTableDef(
|
|
637
|
+
updateTableDef(tableIndex);
|
|
638
638
|
else
|
|
639
639
|
td->calcReclordlen();
|
|
640
|
-
return &(td->keyDefs[
|
|
640
|
+
return &(td->keyDefs[insertIndex]);
|
|
641
641
|
}
|
|
642
642
|
|
|
643
|
-
fielddef* dbdef::insertField(short
|
|
643
|
+
fielddef* dbdef::insertField(short tableIndex, short insertIndex)
|
|
644
644
|
{
|
|
645
|
-
if (resizeAt(
|
|
645
|
+
if (resizeAt(tableIndex, false) == false)
|
|
646
646
|
return NULL;
|
|
647
647
|
|
|
648
|
-
tabledef* td = tableDefs(
|
|
649
|
-
if ((
|
|
648
|
+
tabledef* td = tableDefs(tableIndex);
|
|
649
|
+
if ((insertIndex < td->fieldCount) || (td->keyCount > 0))
|
|
650
650
|
{
|
|
651
651
|
|
|
652
|
-
memmove(&(td->fieldDefs[
|
|
653
|
-
&(td->fieldDefs[
|
|
652
|
+
memmove(&(td->fieldDefs[insertIndex + 1]),
|
|
653
|
+
&(td->fieldDefs[insertIndex]),
|
|
654
654
|
td->size() + (char*)td -
|
|
655
|
-
(char*)&(td->fieldDefs[
|
|
655
|
+
(char*)&(td->fieldDefs[insertIndex]));
|
|
656
656
|
}
|
|
657
657
|
td->fieldCount++;
|
|
658
658
|
td->setKeydefsPtr();
|
|
659
|
-
renumberFieldNum(
|
|
660
|
-
memset(&(td->fieldDefs[
|
|
661
|
-
fielddef* fd = &(td->fieldDefs[
|
|
659
|
+
renumberFieldNum(tableIndex, insertIndex, 2);
|
|
660
|
+
memset(&(td->fieldDefs[insertIndex]), 0, sizeof(fielddef));
|
|
661
|
+
fielddef* fd = &(td->fieldDefs[insertIndex]);
|
|
662
662
|
fd->setCharsetIndex(td->charsetIndex);
|
|
663
663
|
fd->setSchemaCodePage(td->schemaCodePage);
|
|
664
664
|
fd->setPadCharSettings(false, true);
|
|
@@ -809,6 +809,7 @@ tabledef* dbdef::tableDefs(int index)
|
|
|
809
809
|
|
|
810
810
|
void dbdef::doOpen(const _TCHAR* uri, char_td mode, const _TCHAR* onerName)
|
|
811
811
|
{
|
|
812
|
+
assert((m_dimpl->deftype != TYPE_SCHEMA_BDF_NOPRELOAD));
|
|
812
813
|
m_dimpl->noWriteMode = true;
|
|
813
814
|
|
|
814
815
|
if (m_dimpl->deftype == TYPE_SCHEMA_DDF)
|
|
@@ -988,9 +989,9 @@ void dbdef::renumberTable(short OldIndex, short NewIndex)
|
|
|
988
989
|
}
|
|
989
990
|
}
|
|
990
991
|
|
|
991
|
-
short dbdef::fieldNumByViewNum(short
|
|
992
|
+
short dbdef::fieldNumByViewNum(short tableIndex, short index)
|
|
992
993
|
{
|
|
993
|
-
tabledef* td = tableDefs(
|
|
994
|
+
tabledef* td = tableDefs(tableIndex);
|
|
994
995
|
if (td)
|
|
995
996
|
{
|
|
996
997
|
for (short i = 0; i < td->fieldCount; i++)
|
|
@@ -1003,9 +1004,9 @@ short dbdef::fieldNumByViewNum(short TableIndex, short index)
|
|
|
1003
1004
|
return -1;
|
|
1004
1005
|
}
|
|
1005
1006
|
|
|
1006
|
-
short dbdef::findKeynumByFieldNum(short
|
|
1007
|
+
short dbdef::findKeynumByFieldNum(short tableIndex, short index)
|
|
1007
1008
|
{
|
|
1008
|
-
tabledef* td = tableDefs(
|
|
1009
|
+
tabledef* td = tableDefs(tableIndex);
|
|
1009
1010
|
if (td)
|
|
1010
1011
|
return td->findKeynumByFieldNum(index);
|
|
1011
1012
|
return -1;
|
|
@@ -1027,9 +1028,9 @@ short dbdef::tableNumByName(const _TCHAR* tableName)
|
|
|
1027
1028
|
return -1;
|
|
1028
1029
|
}
|
|
1029
1030
|
|
|
1030
|
-
short dbdef::fieldNumByName(short
|
|
1031
|
+
short dbdef::fieldNumByName(short tableIndex, const _TCHAR* name)
|
|
1031
1032
|
{
|
|
1032
|
-
tabledef* td = tableDefs(
|
|
1033
|
+
tabledef* td = tableDefs(tableIndex);
|
|
1033
1034
|
if (td)
|
|
1034
1035
|
return td->fieldNumByName(name);
|
|
1035
1036
|
return -1;
|
|
@@ -1316,11 +1317,11 @@ void dbdef::createDDF(const _TCHAR* fullpath)
|
|
|
1316
1317
|
id->release();
|
|
1317
1318
|
}
|
|
1318
1319
|
|
|
1319
|
-
void dbdef::saveDDF(short
|
|
1320
|
+
void dbdef::saveDDF(short tableIndex, short opration, bool forPsqlDdf)
|
|
1320
1321
|
{
|
|
1321
1322
|
ushort_td chOpen = 0;
|
|
1322
1323
|
short Mode = 0;
|
|
1323
|
-
ushort_td tbid =
|
|
1324
|
+
ushort_td tbid = tableIndex;
|
|
1324
1325
|
ushort_td fdid;
|
|
1325
1326
|
ushort_td keyid;
|
|
1326
1327
|
ushort_td segid;
|
|
@@ -1789,11 +1790,18 @@ void dbdef::reopen(char_td mode)
|
|
|
1789
1790
|
|
|
1790
1791
|
void dbdef::synchronizeSeverSchema(short tableIndex)
|
|
1791
1792
|
{
|
|
1792
|
-
if (
|
|
1793
|
+
if (isUseTransactd() == false)
|
|
1794
|
+
{
|
|
1795
|
+
m_stat = STATUS_NOSUPPORT_OP;
|
|
1796
|
+
return ;
|
|
1797
|
+
}
|
|
1793
1798
|
|
|
1794
1799
|
tabledef* tdold = tableDefs(tableIndex);
|
|
1795
|
-
if (!tdold)
|
|
1796
|
-
|
|
1800
|
+
if (!tdold)
|
|
1801
|
+
{
|
|
1802
|
+
m_stat = STATUS_INVALID_TABLE_IDX;
|
|
1803
|
+
return;
|
|
1804
|
+
}
|
|
1797
1805
|
void* tmp = m_keybuf;
|
|
1798
1806
|
|
|
1799
1807
|
_TCHAR dummyUrl[MAX_PATH] = _T("tdap://srv/db?dbfile=");
|
|
@@ -77,7 +77,6 @@ class DLLLIB dbdef : private nstable
|
|
|
77
77
|
dbdef(nsdatabase* pbe, short defType);
|
|
78
78
|
void create(const _TCHAR* uri);
|
|
79
79
|
void autoMakeSchema(bool noUseNullkey);
|
|
80
|
-
void setDefType(short defType);
|
|
81
80
|
bool testTablePtr(tabledef* td);
|
|
82
81
|
tabledef* initReadAfter(short tableIndex, const tabledef* data, uint_td datalen);
|
|
83
82
|
void* getBufferPtr(uint_td& size);
|
|
@@ -97,7 +96,7 @@ public:
|
|
|
97
96
|
int version() const;
|
|
98
97
|
|
|
99
98
|
inline short_td stat() const { return m_stat; }
|
|
100
|
-
short validateTableDef(short
|
|
99
|
+
short validateTableDef(short tableIndex);
|
|
101
100
|
void updateTableDef(short tableIndex, bool forPsqlDdf = true);
|
|
102
101
|
fielddef* insertField(short tableIndex, short insertIndex);
|
|
103
102
|
void deleteField(short tableIndex, short deleteIndex);
|
|
@@ -368,8 +368,9 @@ extern "C" PACKAGE_OSX short_td __STDCALL
|
|
|
368
368
|
client_t->reconnect();
|
|
369
369
|
else
|
|
370
370
|
client_t->cmdConnect();
|
|
371
|
-
if (client_t->req().keyNum ==
|
|
372
|
-
|
|
371
|
+
if ((client_t->req().keyNum == LG_SUBOP_ASSOCIATE) ||
|
|
372
|
+
(client_t->req().keyNum == LG_SUBOP_DISCONNECT_EX))
|
|
373
|
+
return STATUS_SUCCESS;
|
|
373
374
|
break;
|
|
374
375
|
}
|
|
375
376
|
case TD_RECONNECT:
|
|
@@ -378,8 +379,7 @@ extern "C" PACKAGE_OSX short_td __STDCALL
|
|
|
378
379
|
break;
|
|
379
380
|
}
|
|
380
381
|
case TD_STASTISTICS:
|
|
381
|
-
client_t->req().paramMask =
|
|
382
|
-
P_MASK_DATALEN | P_MASK_KEYBUF | P_MASK_KEYNUM;
|
|
382
|
+
client_t->req().paramMask = P_MASK_DATALEN | P_MASK_KEYBUF | P_MASK_KEYNUM;
|
|
383
383
|
break;
|
|
384
384
|
case TD_RESET_CLIENT:
|
|
385
385
|
case TD_GETDIRECTORY:
|
|
@@ -396,7 +396,11 @@ extern "C" PACKAGE_OSX short_td __STDCALL
|
|
|
396
396
|
break;
|
|
397
397
|
case TD_GET_SCHEMA:
|
|
398
398
|
if (client_t->isSupportFunction(TD_GET_SCHEMA))
|
|
399
|
-
|
|
399
|
+
{
|
|
400
|
+
client_t->req().paramMask = P_MASK_DATALEN | P_MASK_KEYNUM | P_MASK_KEYBUF;
|
|
401
|
+
if (keyNum == SC_SUBOP_BY_SQL)
|
|
402
|
+
client_t->req().paramMask |= P_MASK_POSBLK;
|
|
403
|
+
}
|
|
400
404
|
else
|
|
401
405
|
return STATUS_NOSUPPORT_OP;
|
|
402
406
|
break;
|
|
@@ -765,7 +765,7 @@ class filter
|
|
|
765
765
|
const keyValuePtr& v = keyValues[i + j];
|
|
766
766
|
fielddef& fd = fds[kd->segments[j].fieldNum];
|
|
767
767
|
has_null |= (v.ptr == NULL);
|
|
768
|
-
to = fd.keyCopy(to, (uchar_td*)v.ptr, v.len, (v.ptr == NULL));
|
|
768
|
+
to = fd.keyCopy(to, (uchar_td*)v.ptr, v.len, (v.ptr == NULL), m_isTransactd);
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
771
|
if (!l.setParam(dataBuf, (ushort_td)(to - dataBuf), has_null))
|
|
@@ -1156,7 +1156,7 @@ public:
|
|
|
1156
1156
|
for (int j = 0; j < keySize; ++j)
|
|
1157
1157
|
{
|
|
1158
1158
|
fielddef& fd = fds[kd->segments[j].fieldNum];
|
|
1159
|
-
to = fd.keyCopy(to, (uchar_td*)ptr[j], len[j], (ptr[j]==NULL));
|
|
1159
|
+
to = fd.keyCopy(to, (uchar_td*)ptr[j], len[j], (ptr[j]==NULL), m_isTransactd);
|
|
1160
1160
|
has_null |= (ptr[j] == NULL);
|
|
1161
1161
|
}
|
|
1162
1162
|
if (!l.setParam(m_buftmp, (ushort_td)(to - m_buftmp), has_null))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_GROUPCOMP_H
|
|
2
2
|
#define BZS_DB_PROTOCOL_TDAP_CLIENT_GROUPCOMP_H
|
|
3
3
|
/*=================================================================
|
|
4
|
-
Copyright (C) 2014 BizStation Corp All rights reserved.
|
|
4
|
+
Copyright (C) 2014-2016 BizStation Corp All rights reserved.
|
|
5
5
|
|
|
6
6
|
This program is free software; you can redistribute it and/or
|
|
7
7
|
modify it under the terms of the GNU General Public License
|
|
@@ -62,7 +62,7 @@ int binary_search(int key, const Container& a, int left, int right, FUNC func,
|
|
|
62
62
|
inline int compByKey(const fieldsBase& l, const fieldsBase& r, const int& s)
|
|
63
63
|
{
|
|
64
64
|
assert((s < (int)l.size()) && (s < (int)r.size()));
|
|
65
|
-
return l.getFieldNoCheck(s).comp(r.getFieldNoCheck(s),
|
|
65
|
+
return l.getFieldNoCheck(s).comp(r.getFieldNoCheck(s), CMPLOGICAL_VAR_COMP_ALL);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
template <class Container> class grouping_comp
|
|
@@ -58,7 +58,7 @@ void autoMemory::setParams(unsigned char* p, size_t s, short* endIndex, bool own
|
|
|
58
58
|
if (p)
|
|
59
59
|
memcpy(ptr, p, size);
|
|
60
60
|
else
|
|
61
|
-
memset(ptr, 0, size);
|
|
61
|
+
memset(ptr, 0, size + 1);
|
|
62
62
|
endFieldIndex = new short;
|
|
63
63
|
if (endIndex != NULL)
|
|
64
64
|
*endFieldIndex = *endIndex;
|