transactd 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/BUILD_UNIX-JA +6 -6
  3. data/README +20 -18
  4. data/README-JA +19 -17
  5. data/RELEASE_NOTE +144 -0
  6. data/RELEASE_NOTE-JA +153 -0
  7. data/bin/common/tdclc_32_2_3.dll +0 -0
  8. data/bin/common/tdclc_64_2_3.dll +0 -0
  9. data/build/common/get_ruby_path.cmake +1 -1
  10. data/build/swig/ruby/ruby.swg +10 -9
  11. data/build/swig/ruby/tdclrb_wrap.cpp +1416 -561
  12. data/build/swig/tdcl.i +30 -3
  13. data/build/tdclc/tdclc.cbproj +1 -1
  14. data/build/tdclc/tdclc.rc +4 -4
  15. data/build/tdclcpp/BUILDNUMBER.txt +1 -0
  16. data/build/tdclcpp/tdclcpp.rc +4 -4
  17. data/build/tdclcpp/tdclcpp_bc.cbproj +1 -1
  18. data/build/tdclrb/BUILDNUMBER.txt +1 -0
  19. data/build/tdclrb/tdclrb.rc +4 -4
  20. data/source/bzs/db/engine/mysql/database.cpp +85 -41
  21. data/source/bzs/db/engine/mysql/database.h +35 -5
  22. data/source/bzs/db/engine/mysql/mysqlInternal.h +189 -37
  23. data/source/bzs/db/engine/mysql/mysqlThd.cpp +21 -21
  24. data/source/bzs/db/protocol/tdap/client/activeTable.cpp +11 -0
  25. data/source/bzs/db/protocol/tdap/client/activeTable.h +1 -1
  26. data/source/bzs/db/protocol/tdap/client/activeTableImple.h +11 -4
  27. data/source/bzs/db/protocol/tdap/client/client.h +30 -1
  28. data/source/bzs/db/protocol/tdap/client/dbDef.cpp +2 -1
  29. data/source/bzs/db/protocol/tdap/client/dllmain.cpp +35 -5
  30. data/source/bzs/db/protocol/tdap/client/field.cpp +100 -51
  31. data/source/bzs/db/protocol/tdap/client/field.h +7 -7
  32. data/source/bzs/db/protocol/tdap/client/filter.h +20 -6
  33. data/source/bzs/db/protocol/tdap/client/groupQuery.cpp +337 -58
  34. data/source/bzs/db/protocol/tdap/client/groupQuery.h +56 -13
  35. data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +83 -5
  36. data/source/bzs/db/protocol/tdap/client/nsDatabase.h +4 -1
  37. data/source/bzs/db/protocol/tdap/client/nsTable.cpp +2 -2
  38. data/source/bzs/db/protocol/tdap/client/nsTable.h +2 -1
  39. data/source/bzs/db/protocol/tdap/client/pooledDatabaseManager.h +20 -6
  40. data/source/bzs/db/protocol/tdap/client/recordset.cpp +7 -0
  41. data/source/bzs/db/protocol/tdap/client/recordsetImple.h +8 -4
  42. data/source/bzs/db/protocol/tdap/client/request.h +11 -1
  43. data/source/bzs/db/protocol/tdap/client/serializer.cpp +40 -2
  44. data/source/bzs/db/protocol/tdap/client/serializer.h +4 -2
  45. data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +1 -0
  46. data/source/bzs/db/protocol/tdap/client/stringConverter.h +4 -4
  47. data/source/bzs/db/protocol/tdap/client/table.cpp +124 -71
  48. data/source/bzs/db/protocol/tdap/client/table.h +8 -7
  49. data/source/bzs/db/protocol/tdap/client/trdormapi.h +33 -1
  50. data/source/bzs/db/protocol/tdap/fieldComp.h +1 -1
  51. data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +3 -1
  52. data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +20 -4
  53. data/source/bzs/db/protocol/tdap/mysql/request.h +14 -0
  54. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +132 -69
  55. data/source/bzs/db/protocol/tdap/tdapRequest.h +18 -4
  56. data/source/bzs/db/protocol/tdap/tdapSchema.cpp +32 -22
  57. data/source/bzs/db/protocol/tdap/tdapSchema.h +69 -4
  58. data/source/bzs/db/protocol/tdap/tdapcapi.h +13 -5
  59. data/source/bzs/db/protocol/tdap/uri.h +4 -4
  60. data/source/bzs/db/transactd/transactd.cpp +6 -5
  61. data/source/bzs/env/crosscompile.cpp +17 -0
  62. data/source/bzs/env/crosscompile.h +4 -1
  63. data/source/bzs/env/mbcswchrLinux.cpp +3 -0
  64. data/source/bzs/example/deleteRecords.cpp +13 -0
  65. data/source/bzs/example/deleteRecords_c.cpp +8 -1
  66. data/source/bzs/example/insertRecords.cpp +14 -0
  67. data/source/bzs/example/insertRecords_c.cpp +8 -1
  68. data/source/bzs/example/ormap_c.cpp +8 -1
  69. data/source/bzs/example/queryData.cpp +92 -2
  70. data/source/bzs/example/queryData.h +3 -1
  71. data/source/bzs/example/readRecords.cpp +13 -0
  72. data/source/bzs/example/readRecords_c.cpp +8 -1
  73. data/source/bzs/example/updateRecords.cpp +13 -0
  74. data/source/bzs/example/updateRecords_c.cpp +8 -1
  75. data/source/bzs/example/update_with_transaction.cpp +13 -0
  76. data/source/bzs/example/update_with_transaction_c.cpp +8 -1
  77. data/source/bzs/example/useORMRecord.cpp +9 -3
  78. data/source/bzs/netsvc/client/iconnection.h +8 -0
  79. data/source/bzs/netsvc/client/tcpClient.cpp +61 -16
  80. data/source/bzs/netsvc/client/tcpClient.h +430 -214
  81. data/source/bzs/netsvc/server/serverPipe.cpp +2 -2
  82. data/source/bzs/test/tdclphp/transactd_Test.php +115 -19
  83. data/source/bzs/test/tdclphp/transactd_blob_Test.php +33 -5
  84. data/source/bzs/test/tdclphp/transactd_kanjischema_Test.php +21 -3
  85. data/source/bzs/test/tdclphp/transactd_pool_Test.php +17 -3
  86. data/source/bzs/test/tdclrb/transactd_blob_spec.rb +26 -8
  87. data/source/bzs/test/tdclrb/transactd_kanjischema_spec.rb +13 -6
  88. data/source/bzs/test/tdclrb/transactd_pool_spec.rb +14 -8
  89. data/source/bzs/test/tdclrb/transactd_spec.rb +117 -27
  90. data/source/bzs/test/transactdBench/scaling_bench.cpp +5 -5
  91. data/source/bzs/test/transactdBench/workerBase.h +2 -2
  92. data/source/bzs/test/trdclengn/test_trdclengn.cpp +898 -51
  93. data/source/global/tdclatl/Database.cpp +12 -0
  94. data/source/global/tdclatl/Database.h +4 -0
  95. data/source/global/tdclatl/FieldDef.cpp +19 -0
  96. data/source/global/tdclatl/FieldDef.h +4 -0
  97. data/source/global/tdclatl/FieldDefs.cpp +14 -16
  98. data/source/global/tdclatl/GroupQuery.cpp +21 -16
  99. data/source/global/tdclatl/GroupQuery.h +1 -1
  100. data/source/global/tdclatl/QueryBase.cpp +14 -0
  101. data/source/global/tdclatl/QueryBase.h +2 -0
  102. data/source/global/tdclatl/Record.cpp +41 -10
  103. data/source/global/tdclatl/Record.h +1 -1
  104. data/source/global/tdclatl/Recordset.cpp +117 -31
  105. data/source/global/tdclatl/Recordset.h +6 -5
  106. data/source/global/tdclatl/Table.cpp +24 -28
  107. data/source/global/tdclatl/Table.h +3 -4
  108. data/source/global/tdclatl/activeTable.cpp +149 -103
  109. data/source/global/tdclatl/activeTable.h +1 -1
  110. data/source/global/tdclatl/tdclatl.idl +38 -18
  111. data/transactd.gemspec +1 -1
  112. metadata +8 -4
  113. data/bin/common/tdclc_32_2_2.dll +0 -0
  114. data/bin/common/tdclc_64_2_2.dll +0 -0
@@ -37,7 +37,7 @@
37
37
  #include <random>
38
38
 
39
39
 
40
- extern unsigned int getTransactdIsolation();
40
+ extern int getTransactdIsolation();
41
41
  extern unsigned int getTransactdLockWaitTimeout();
42
42
 
43
43
  namespace bzs
@@ -530,7 +530,8 @@ inline void readAfter(request& req, table* tb, dbExecuter* dbm)
530
530
  req.paramMask |= P_MASK_BLOBBODY;
531
531
  req.data = tb->record();
532
532
  }
533
- }
533
+ }else if (!tb->cursor())
534
+ req.paramMask |= P_MASK_PB_ERASE_BM;
534
535
  req.result = dbm->errorCodeSht(tb->stat());
535
536
  }
536
537
 
@@ -610,57 +611,64 @@ inline int dbExecuter::doReadMultiWithSeek(request& req, int op,
610
611
  int ret = 1;
611
612
  m_tb = getTable(req.pbk->handle);
612
613
  char keynum = m_tb->keyNumByMakeOrder(req.keyNum);
613
- if (m_tb->setKeyNum(keynum))
614
+ if (!m_tb->setKeyNum(keynum))
614
615
  {
615
- m_tb->setKeyValuesPacked((const uchar*)req.keybuf, req.keylen);
616
- m_tb->seekKey((op == TD_KEY_GE_NEXT_MULTI) ? HA_READ_KEY_OR_NEXT
617
- : HA_READ_KEY_OR_PREV,
618
- m_tb->keymap());
619
-
620
- extRequest* ereq = (extRequest*)req.data;
621
- bool noBookmark = (ereq->itype & FILTER_CURRENT_TYPE_NOBOOKMARK) != 0;
622
- bool execPrepared = (ereq->itype & FILTER_TYPE_SUPPLYVALUE) != 0;
623
- // smartReadRecordsHandler scope
624
- {
625
- smartReadRecordsHandler srrh(m_readHandler);
616
+ req.result = m_tb->stat();
617
+ return ret;
618
+ }
626
619
 
627
- if (execPrepared)
628
- {
629
- if (m_tb->preparedStatements.size() < ereq->preparedId)
630
- req.result = STATUS_INVALID_PREPAREID;
631
- else
632
- req.result = m_readHandler->beginPreparExecute(m_tb, ereq, true, nw,
633
- noBookmark,
634
- (prepared*)m_tb->preparedStatements[ereq->preparedId - 1]);
635
- }
620
+ m_tb->setKeyValuesPacked((const uchar*)req.keybuf, req.keylen);
621
+ m_tb->seekKey((op == TD_KEY_GE_NEXT_MULTI) ? HA_READ_KEY_OR_NEXT
622
+ : HA_READ_KEY_OR_PREV,
623
+ m_tb->keymap());
624
+
625
+ extRequest* ereq = (extRequest*)req.data;
626
+ bool noBookmark = (ereq->itype & FILTER_CURRENT_TYPE_NOBOOKMARK) != 0;
627
+ bool execPrepared = (ereq->itype & FILTER_TYPE_SUPPLYVALUE) != 0;
628
+ // smartReadRecordsHandler scope
629
+ {
630
+ smartReadRecordsHandler srrh(m_readHandler);
631
+
632
+ if (execPrepared)
633
+ {
634
+ if (m_tb->preparedStatements.size() < ereq->preparedId)
635
+ req.result = STATUS_INVALID_PREPAREID;
636
636
  else
637
- req.result = m_readHandler->begin(m_tb, ereq, true, nw,
638
- (op == TD_KEY_GE_NEXT_MULTI),
639
- noBookmark);
640
- if (req.result != 0)
641
- return ret;
642
- if (m_tb->stat() == 0)
643
- {
644
- if (op == TD_KEY_GE_NEXT_MULTI)
645
- m_tb->getNextExt(m_readHandler, true, noBookmark);
646
- else if (op == TD_KEY_LE_PREV_MULTI)
647
- m_tb->getPrevExt(m_readHandler, true, noBookmark);
648
- }
649
- req.result = errorCodeSht(m_tb->stat());
650
- DEBUG_WRITELOG2(op, req);
637
+ req.result = m_readHandler->beginPreparExecute(m_tb, ereq, true, nw,
638
+ noBookmark,
639
+ (prepared*)m_tb->preparedStatements[ereq->preparedId - 1]);
651
640
  }
652
- short dummy = 0;
653
- size_t& size = nw->datalen;
654
- size = req.serializeForExt(m_tb, nw);
655
- char* resultBuffer = nw->ptr();
656
- netsvc::server::buffers* optionalData = nw->optionalData();
657
- if ((req.paramMask & P_MASK_BLOBBODY) && m_blobBuffer->fieldCount())
658
- size = req.serializeBlobBody(m_blobBuffer, resultBuffer, size,
659
- FILE_MAP_SIZE, optionalData, dummy);
660
-
661
- DEBUG_PROFILE_END_OP(1, op)
662
- ret = EXECUTE_RESULT_SUCCESS;
641
+ else
642
+ req.result = m_readHandler->begin(m_tb, ereq, true, nw,
643
+ (op == TD_KEY_GE_NEXT_MULTI),
644
+ noBookmark);
645
+ if (req.result != 0)
646
+ return ret;
647
+ if (m_tb->stat() == 0)
648
+ {
649
+ if (op == TD_KEY_GE_NEXT_MULTI)
650
+ m_tb->getNextExt(m_readHandler, true, noBookmark);
651
+ else if (op == TD_KEY_LE_PREV_MULTI)
652
+ m_tb->getPrevExt(m_readHandler, true, noBookmark);
653
+ }
654
+ req.result = errorCodeSht(m_tb->stat());
655
+ if (!m_tb->cursor())
656
+ req.paramMask |= P_MASK_PB_ERASE_BM;
657
+ DEBUG_WRITELOG2(op, req);
663
658
  }
659
+ short dummy = 0;
660
+ size_t& size = nw->datalen;
661
+ size = req.serializeForExt(m_tb, nw);
662
+ char* resultBuffer = nw->ptr();
663
+ netsvc::server::buffers* optionalData = nw->optionalData();
664
+ if ((req.paramMask & P_MASK_BLOBBODY) && m_blobBuffer->fieldCount())
665
+ size = req.serializeBlobBody(m_blobBuffer, resultBuffer, size,
666
+ FILE_MAP_SIZE, optionalData, dummy);
667
+
668
+ DEBUG_PROFILE_END_OP(1, op)
669
+ ret = EXECUTE_RESULT_SUCCESS;
670
+
671
+
664
672
  if (m_tb)
665
673
  m_tb->unUse();
666
674
  return ret;
@@ -682,7 +690,10 @@ inline int dbExecuter::doReadMulti(request& req, int op,
682
690
  {
683
691
  char keynum = m_tb->keyNumByMakeOrder(req.keyNum);
684
692
  if (!m_tb->setKeyNum(keynum))
693
+ {
694
+ req.result = m_tb->stat();
685
695
  return ret;
696
+ }
686
697
  }
687
698
  // smartReadRecordsHandler scope
688
699
  {
@@ -716,6 +727,8 @@ inline int dbExecuter::doReadMulti(request& req, int op,
716
727
  m_tb->stepPrevExt(m_readHandler, incCurrent, noBookmark);
717
728
  req.result = errorCodeSht(m_tb->stat());
718
729
  }
730
+ if (!m_tb->cursor())
731
+ req.paramMask |= P_MASK_PB_ERASE_BM;
719
732
  DEBUG_WRITELOG2(op, req);
720
733
  }
721
734
 
@@ -859,13 +872,18 @@ inline void dbExecuter::doInsert(request& req)
859
872
  req.blobHeader);
860
873
  __int64 aincValue = m_tb->insert(ncc);
861
874
  req.result = errorCodeSht(m_tb->stat());
862
- if (aincValue)
875
+ if (m_tb->stat() == 0)
863
876
  {
864
- req.paramMask = P_MASK_INS_AUTOINC;
865
- req.data = m_tb->record();
877
+ if (aincValue)
878
+ {
879
+ req.paramMask = P_MASK_INS_AUTOINC;
880
+ req.data = m_tb->record();
881
+ }
882
+ else
883
+ req.paramMask = P_MASK_POSBLK | P_MASK_KEYBUF;
866
884
  }
867
- else
868
- req.paramMask = P_MASK_POSBLK | P_MASK_KEYBUF;
885
+ if (!m_tb->cursor())
886
+ req.paramMask |= P_MASK_PB_ERASE_BM;
869
887
  }
870
888
 
871
889
  inline void dbExecuter::doUpdateKey(request& req)
@@ -889,6 +907,8 @@ inline void dbExecuter::doUpdateKey(request& req)
889
907
  }
890
908
  req.result = errorCodeSht(m_tb->stat());
891
909
  req.paramMask = P_MASK_POSBLK | P_MASK_KEYBUF;
910
+ if (!m_tb->cursor())
911
+ req.paramMask |= P_MASK_PB_ERASE_BM;
892
912
  }
893
913
 
894
914
  inline void dbExecuter::doUpdate(request& req)
@@ -904,6 +924,8 @@ inline void dbExecuter::doUpdate(request& req)
904
924
  }
905
925
  req.result = errorCodeSht(m_tb->stat());
906
926
  req.paramMask = P_MASK_POSBLK | P_MASK_KEYBUF;
927
+ if (!m_tb->cursor())
928
+ req.paramMask |= P_MASK_PB_ERASE_BM;
907
929
  }
908
930
 
909
931
  inline void dbExecuter::doDeleteKey(request& req)
@@ -923,6 +945,8 @@ inline void dbExecuter::doDeleteKey(request& req)
923
945
  }
924
946
  req.result = errorCodeSht(m_tb->stat());
925
947
  req.paramMask = P_MASK_POSBLK;
948
+ if (!m_tb->cursor())
949
+ req.paramMask |= P_MASK_PB_ERASE_BM;
926
950
  }
927
951
 
928
952
  inline void dbExecuter::doDelete(request& req)
@@ -933,6 +957,8 @@ inline void dbExecuter::doDelete(request& req)
933
957
  m_tb->del();
934
958
  req.result = errorCodeSht(m_tb->stat());
935
959
  req.paramMask = P_MASK_POSBLK;
960
+ if (!m_tb->cursor())
961
+ req.paramMask |= P_MASK_PB_ERASE_BM;
936
962
  }
937
963
 
938
964
  inline void dbExecuter::doInsertBulk(request& req)
@@ -981,6 +1007,8 @@ inline void dbExecuter::doInsertBulk(request& req)
981
1007
  }
982
1008
  else
983
1009
  req.result = errorCodeSht(m_tb->stat());
1010
+ if (!m_tb->cursor())
1011
+ req.paramMask |= P_MASK_PB_ERASE_BM;
984
1012
  }
985
1013
 
986
1014
  /**
@@ -1004,6 +1032,7 @@ inline void dbExecuter::doStat(request& req)
1004
1032
  memcpy((char*)req.data, &len, sizeof(ushort_td));
1005
1033
  uint rows = (uint)m_tb->recordCount((req.keyNum != 0));
1006
1034
  memcpy((char*)req.data + 6, &rows, sizeof(uint));
1035
+ req.result = errorCodeSht(m_tb->stat());
1007
1036
  }
1008
1037
  else
1009
1038
  req.result = STATUS_BUFFERTOOSMALL;
@@ -1072,7 +1101,10 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1072
1101
  {
1073
1102
  if (op != TD_CONNECT && op != TD_CREATETABLE &&
1074
1103
  op != TD_OPENTABLE && op != TD_GETSERVER_CHARSET)
1104
+ {
1105
+ req.result = STATUS_ACCESS_DENIED;
1075
1106
  return EXECUTE_RESULT_ACCESS_DNIED;
1107
+ }
1076
1108
  }
1077
1109
  switch (op)
1078
1110
  {
@@ -1150,14 +1182,39 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1150
1182
  req.data = (void*)m_tb->position();
1151
1183
  req.resultLen = m_tb->posPtrLen();
1152
1184
  break;
1185
+ case TD_RECONNECT:
1186
+
1187
+ if (!doOpenTable(req))
1188
+ {
1189
+ req.result = ERROR_TD_INVALID_CLINETHOST;
1190
+ break;
1191
+ }
1192
+ {
1193
+ char* p = (char*)req.data;
1194
+ req.keyNum = *p;
1195
+ if (*(++p) == 0)
1196
+ break;
1197
+ req.data = ((char*)req.data) + 2;
1198
+ if (m_tb) m_tb->unUse();
1199
+ }
1200
+ //fall through restore position
1153
1201
  case TD_MOVE_BOOKMARK:
1154
1202
  {
1155
1203
  rowLockMode lck;
1156
1204
  getRowLockMode(opTrn, &lck);
1157
1205
  m_tb = getTable(req.pbk->handle, lck.lock ? SQLCOM_UPDATE : SQLCOM_SELECT);
1158
1206
  m_tb->setRowLock(&lck);
1159
- m_tb->movePos((uchar*)req.data,
1160
- m_tb->keyNumByMakeOrder(req.keyNum));
1207
+ char keynum = req.keyNum;
1208
+ if (keynum != -1)
1209
+ {
1210
+ keynum = m_tb->keyNumByMakeOrder(req.keyNum);
1211
+ if (!m_tb->keynumCheck(keynum))
1212
+ {
1213
+ req.result = STATUS_INVALID_KEYNUM;
1214
+ break;
1215
+ }
1216
+ }
1217
+ m_tb->movePos((uchar*)req.data, keynum);
1161
1218
  if (lck.lock && m_tb->stat())
1162
1219
  m_tb->setRowLockError();
1163
1220
  readAfter(req, m_tb, this);
@@ -1170,7 +1227,8 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1170
1227
  {
1171
1228
  m_tb = NULL;
1172
1229
  return EXECUTE_RESULT_SUCCESS;
1173
- }
1230
+ }else
1231
+ resultBuffer = nw->ptr();
1174
1232
  break;
1175
1233
  case TD_KEY_SEEK_MULTI:
1176
1234
  case TD_KEY_NEXT_MULTI:
@@ -1182,7 +1240,8 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1182
1240
  {
1183
1241
  m_tb = NULL;
1184
1242
  return EXECUTE_RESULT_SUCCESS;
1185
- }
1243
+ }else
1244
+ resultBuffer = nw->ptr();
1186
1245
  break;
1187
1246
  case TD_FILTER_PREPARE:
1188
1247
  m_tb = getTable(req.pbk->handle);
@@ -1207,7 +1266,8 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1207
1266
  *((unsigned short*)req.data) = (unsigned short)m_tb->preparedStatements.size();
1208
1267
  req.resultLen = 2;
1209
1268
  }
1210
- }
1269
+ }else
1270
+ req.result = m_tb->stat();
1211
1271
  break;
1212
1272
  case TD_MOVE_PER:
1213
1273
  m_tb = getTable(req.pbk->handle);
@@ -1221,7 +1281,7 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1221
1281
  req.result = errorCodeSht(m_tb->stat());
1222
1282
  if (m_tb->stat() == 0)
1223
1283
  {
1224
- req.paramMask = P_MASK_DATA | P_MASK_DATALEN;
1284
+ req.paramMask = P_MASK_DATA | P_MASK_DATALEN ;
1225
1285
  req.data = m_tb->percentResult();
1226
1286
  req.resultLen = sizeof(int);
1227
1287
  }
@@ -1252,6 +1312,7 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1252
1312
  req.result = SERVER_CLIENT_NOT_COMPATIBLE;
1253
1313
  break;
1254
1314
  }
1315
+
1255
1316
  case TD_CONNECT:
1256
1317
  if (!connect(req))
1257
1318
  req.result = ERROR_TD_INVALID_CLINETHOST;
@@ -1349,13 +1410,11 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1349
1410
  req.result = getDatabaseCid(req.cid)->aclReload();
1350
1411
  break;
1351
1412
  }
1352
- if (m_tb)
1353
- m_tb->unUse();
1354
1413
  DEBUG_WRITELOG2(op, req)
1355
1414
  DEBUG_ERROR_MEMDUMP(req.result, "error", req.m_readBuffer, *((unsigned int*)req.m_readBuffer))
1356
-
1357
-
1358
1415
  size = req.serialize(m_tb, resultBuffer);
1416
+ if (m_tb)
1417
+ m_tb->unUse();
1359
1418
  short dymmy = 0;
1360
1419
  if ((req.result == 0) && (req.paramMask & P_MASK_BLOBBODY) &&
1361
1420
  m_blobBuffer->fieldCount())
@@ -1395,13 +1454,17 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
1395
1454
 
1396
1455
  catch (...)
1397
1456
  {
1398
- clenupNoException();
1399
- DEBUG_ERROR_MEMDUMP(20001, "error", req.m_readBuffer, *((unsigned int*)req.m_readBuffer))
1400
- req.reset();
1401
- req.result = 20001;
1402
- dumpStdErr(op, req, m_tb);
1403
1457
  try
1404
1458
  {
1459
+ try
1460
+ {
1461
+ clenupNoException();
1462
+ DEBUG_ERROR_MEMDUMP(20001, "error", req.m_readBuffer, *((unsigned int*)req.m_readBuffer))
1463
+ req.reset();
1464
+ req.result = 20001;
1465
+ dumpStdErr(op, req, m_tb);
1466
+ }
1467
+ catch(...){}
1405
1468
  if (m_tb)
1406
1469
  m_tb->close();
1407
1470
  }
@@ -1442,7 +1505,7 @@ size_t dbExecuter::getAcceptMessage(char* message, size_t size)
1442
1505
  ver->srvMajor = TRANSACTD_VER_MAJOR;
1443
1506
  ver->srvMinor = TRANSACTD_VER_MINOR;
1444
1507
  ver->srvRelease = TRANSACTD_VER_RELEASE;
1445
- hst->transaction_isolation = getTransactdIsolation();
1508
+ hst->transaction_isolation = (unsigned short)getTransactdIsolation();
1446
1509
  hst->lock_wait_timeout = getTransactdLockWaitTimeout();
1447
1510
  if (strcmp(g_auth_type, AUTH_TYPE_MYSQL_STR) == 0)
1448
1511
  {
@@ -51,12 +51,18 @@ namespace client {class table;}
51
51
  #define P_MASK_DATALEN 4
52
52
  #define P_MASK_KEYBUF 8
53
53
  #define P_MASK_KEYNUM 16
54
- #define P_MASK_EX_SENDLEN \
55
- 32 //< The data length which transmits to a client is described at 2 bytes
56
- // of the data buffer head.
54
+
55
+ /** The data length which transmits to a client
56
+ * is described at 2 bytes of the data buffer head.
57
+ */
58
+ #define P_MASK_EX_SENDLEN 32
57
59
  #define P_MASK_BLOBBODY 64
58
- #define P_MASK_FINALRET 128 // server sent final result
60
+ #define P_MASK_FINALRET 128 // server sent final result
59
61
  #define P_MASK_FINALDATALEN 256 // server sent final result
62
+ #define P_MASK_PB_BOOKMARK 512 // posblk bookmark writen
63
+ #define P_MASK_PB_ERASE_BM 1024 // posblk bookmark erase command
64
+ #define P_MASK_PB_LOCKED 2048 // posblk row locked
65
+
60
66
 
61
67
  #define P_MASK_ALL \
62
68
  P_MASK_POSBLK | P_MASK_DATA | P_MASK_DATALEN | P_MASK_KEYBUF | P_MASK_KEYNUM
@@ -101,6 +107,9 @@ struct version
101
107
  uchar_td Type;
102
108
  };
103
109
 
110
+ #pragma pack(push, 1)
111
+ pragma_pack1;
112
+
104
113
  struct posblk
105
114
  {
106
115
  posblk() { memset(this, 0, sizeof(posblk)); }
@@ -108,7 +117,12 @@ struct posblk
108
117
  unsigned int handle;
109
118
  client::table* tb;
110
119
  DDBA_PTR allocFunc;
120
+ unsigned char lock;
121
+ unsigned char bookmarkLen;
122
+ char bookmark[1]; //dummy array
111
123
  };
124
+ #pragma pack(pop)
125
+ pragma_pop;
112
126
 
113
127
  struct clientID
114
128
  {
@@ -307,18 +307,17 @@ unsigned int fielddef::charNum(/* int index */) const
307
307
 
308
308
  ushort_td lenByCharnum(uchar_td type, uchar_td charsetIndex, ushort_td charnum)
309
309
  {
310
- ushort_td len;
311
- if (charsetIndex && ((type == ft_mychar) || (type == ft_mywchar) ||
312
- (type == ft_myvarchar) || (type == ft_mywvarchar)))
313
- {
310
+ ushort_td len = charnum;
311
+ if ((type == ft_wstring) || (type == ft_wzstring) || (type == ft_mywchar) ||
312
+ (type == ft_mywvarchar)|| (type == ft_mywvarbinary))
313
+ len = (ushort_td)(mysql::charsize(CHARSET_UTF16LE) * charnum);
314
+ else if (charsetIndex && ((type == ft_mychar) || (type == ft_myvarchar)||
315
+ (type == ft_string) || (type == ft_zstring)|| (type == ft_myvarbinary) ))
314
316
  len = (ushort_td)(mysql::charsize(charsetIndex) * charnum);
315
- if ((type == ft_myvarchar) || (type == ft_mywvarchar))
316
- len += ((len >= 256) ? 2 : 1);
317
- else
318
- len = std::min<ushort_td>(len, 255);
319
- }
317
+ if ((type == ft_myvarchar) || (type == ft_mywvarchar) || (type == ft_myvarbinary) || (type == ft_mywvarbinary))
318
+ len += ((len >= 256) ? 2 : 1);
320
319
  else
321
- len = charnum;
320
+ len = std::min<ushort_td>(len, 255);
322
321
  return len;
323
322
  }
324
323
 
@@ -512,25 +511,36 @@ PACKAGE uchar_td getFilterLogicTypeCode(const _TCHAR* cmpstr)
512
511
  {
513
512
  if (_tcscmp(cmpstr, _T("=")) == 0)
514
513
  return (uchar_td)eEqual;
515
-
516
- if (_tcscmp(cmpstr, _T(">")) == 0)
514
+ else if (_tcscmp(cmpstr, _T(">")) == 0)
517
515
  return (uchar_td)eGreater;
518
-
519
- if (_tcscmp(cmpstr, _T("<")) == 0)
516
+ else if (_tcscmp(cmpstr, _T("<")) == 0)
520
517
  return (uchar_td)eLess;
521
-
522
- if (_tcscmp(cmpstr, _T("<>")) == 0)
518
+ else if (_tcscmp(cmpstr, _T("<>")) == 0)
523
519
  return (uchar_td)eNotEq;
524
-
525
- if (_tcscmp(cmpstr, _T("=>")) == 0)
520
+ else if (_tcscmp(cmpstr, _T("=>")) == 0)
526
521
  return (uchar_td)eGreaterEq;
527
- if (_tcscmp(cmpstr, _T(">=")) == 0)
522
+ else if (_tcscmp(cmpstr, _T(">=")) == 0)
528
523
  return (uchar_td)eGreaterEq;
529
-
530
- if (_tcscmp(cmpstr, _T("=<")) == 0)
524
+ else if (_tcscmp(cmpstr, _T("=<")) == 0)
531
525
  return (uchar_td)eLessEq;
532
- if (_tcscmp(cmpstr, _T("<=")) == 0)
526
+ else if (_tcscmp(cmpstr, _T("<=")) == 0)
533
527
  return (uchar_td)eLessEq;
528
+ else if (_tcscmp(cmpstr, _T("=i")) == 0)
529
+ return (uchar_td)eEqual | CMPLOGICAL_CASEINSENSITIVE;
530
+ else if (_tcscmp(cmpstr, _T(">i")) == 0)
531
+ return (uchar_td)eGreater | CMPLOGICAL_CASEINSENSITIVE;
532
+ else if (_tcscmp(cmpstr, _T("<i")) == 0)
533
+ return (uchar_td)eLess | CMPLOGICAL_CASEINSENSITIVE;
534
+ else if (_tcscmp(cmpstr, _T("<>i")) == 0)
535
+ return (uchar_td)eNotEq | CMPLOGICAL_CASEINSENSITIVE;
536
+ else if (_tcscmp(cmpstr, _T("=>i")) == 0)
537
+ return (uchar_td)eGreaterEq | CMPLOGICAL_CASEINSENSITIVE;
538
+ else if (_tcscmp(cmpstr, _T(">=i")) == 0)
539
+ return (uchar_td)eGreaterEq | CMPLOGICAL_CASEINSENSITIVE;
540
+ else if (_tcscmp(cmpstr, _T("=<i")) == 0)
541
+ return (uchar_td)eLessEq | CMPLOGICAL_CASEINSENSITIVE;
542
+ else if (_tcscmp(cmpstr, _T("<=i")) == 0)
543
+ return (uchar_td)eLessEq | CMPLOGICAL_CASEINSENSITIVE;
534
544
  return 255;
535
545
  }
536
546
 
@@ -184,6 +184,12 @@ PACKAGE ushort_td
184
184
  /* Is field type string ? */
185
185
  PACKAGE bool isStringType(uchar_td type);
186
186
 
187
+ /** @cond INTERNAL */
188
+ #define PAD_CHAR_OPTION_SAVED 1
189
+ #define USE_PAD_CHAR 2
190
+ #define TRIM_PAD_CHAR 4
191
+ /** @endcond */
192
+
187
193
  /* Mark of ** that BizStation Corp internal use only.
188
194
  */
189
195
  template <int N> struct fielddef_t
@@ -225,13 +231,13 @@ public:
225
231
 
226
232
  protected:
227
233
  uchar_td m_charsetIndex; // charctor set index of this field data
228
- uint_td m_schemaCodePage;
229
-
234
+ ushort_td m_schemaCodePage;
235
+ ushort_td m_padCharOptions;
230
236
  public:
231
237
  FLAGS enableFlags; // ** enable flags. see below
232
238
 
233
239
  private:
234
- inline void setSchemaCodePage(uint_td v) { m_schemaCodePage = v; };
240
+ inline void setSchemaCodePage(uint_td v) { m_schemaCodePage = (ushort_td)v; };
235
241
  friend class client::dbdef;
236
242
  };
237
243
 
@@ -370,6 +376,8 @@ public:
370
376
  if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
371
377
  type == ft_lstring)
372
378
  return len < 256 ? 1 : 2;
379
+ else if (type == ft_lvar)
380
+ return 2;
373
381
  return 0;
374
382
  }
375
383
 
@@ -450,6 +458,33 @@ public:
450
458
  return dataLen(ptr);
451
459
  }
452
460
 
461
+ inline void setPadCharSettings(bool set, bool trim)
462
+ {
463
+ m_padCharOptions = 0;
464
+ m_padCharOptions |= PAD_CHAR_OPTION_SAVED;
465
+ if ((type == ft_mychar) || (type == ft_mywchar))
466
+ {
467
+ m_padCharOptions |= USE_PAD_CHAR;
468
+ if (trim)
469
+ m_padCharOptions |= TRIM_PAD_CHAR;
470
+ } // For compatibility with conventional.
471
+ else if ((type == ft_string) || (type == ft_wstring))
472
+ {
473
+ if (set)
474
+ m_padCharOptions |= USE_PAD_CHAR;
475
+ if (trim)
476
+ m_padCharOptions |= TRIM_PAD_CHAR;
477
+ }
478
+ }
479
+
480
+ /* When ft_string or ft_wstring, fill by pad char at write. */
481
+ bool usePadChar() const {return (m_padCharOptions & USE_PAD_CHAR) == USE_PAD_CHAR;}
482
+
483
+ /* When ft_string or ft_wstring or ft_mychar or ft_mywchar,
484
+ remove pad char at read.*/
485
+ bool trimPadChar() const {return (m_padCharOptions & TRIM_PAD_CHAR) == TRIM_PAD_CHAR;}
486
+
487
+
453
488
  /** @cond INTERNAL */
454
489
  /* copy key data for send to mysql
455
490
  * return next copy address.
@@ -534,6 +569,12 @@ public:
534
569
  return *data + size;
535
570
  }
536
571
 
572
+ /* copy blob data for recordset
573
+
574
+ @param blobBlock copy to adddres
575
+ @return new copy to address
576
+
577
+ */
537
578
  inline unsigned char* setBlobFieldPointer(uchar_td* dest, const blobHeader* hd,
538
579
  unsigned char* blobBlock, int fieldNum) const
539
580
  {
@@ -552,6 +593,30 @@ public:
552
593
  ++hd->curRow;
553
594
  return blobBlock + size;
554
595
  }
596
+
597
+ inline void setPadCharDefaultSettings()
598
+ {
599
+ if (!padCharOptionSaved())
600
+ {
601
+ // For compatibility with conventional.
602
+ if ((type == ft_string) || (type == ft_wstring) ||
603
+ (type == ft_mychar) || (type == ft_mywchar))
604
+ {
605
+ m_padCharOptions |= USE_PAD_CHAR;
606
+ m_padCharOptions |= TRIM_PAD_CHAR;
607
+ }
608
+ }
609
+ else if ((type == ft_mychar) || (type == ft_mywchar))
610
+ m_padCharOptions |= USE_PAD_CHAR;
611
+ }
612
+
613
+ /* PadChar options are saved at schema.
614
+ This is for compatibility with conventional.*/
615
+ bool padCharOptionSaved() const
616
+ {
617
+ return (m_padCharOptions & PAD_CHAR_OPTION_SAVED) == PAD_CHAR_OPTION_SAVED;
618
+ }
619
+
555
620
  /** @endcond */
556
621
  };
557
622
 
@@ -667,7 +732,7 @@ public:
667
732
  int autoIncExSpace;
668
733
  uchar_td iconIndex2;
669
734
  uchar_td iconIndex3;
670
- uint_td schemaCodePage; // Code page of this schema stirng data.
735
+ uint_td schemaCodePage; // Code page of this schema string data.
671
736
 
672
737
  private:
673
738
  char formatVersion;
@@ -144,6 +144,7 @@ typedef short_td(__STDCALL* DLLUNLOADCALLBACK_PTR)(dllUnloadCallback func);
144
144
  #define TD_STASTISTICS 94
145
145
  #define TD_KEY_SEEK_MULTI 95
146
146
  #define TD_ACL_RELOAD 96
147
+ #define TD_RECONNECT 97
147
148
 
148
149
  /** create sub operations
149
150
  */
@@ -173,8 +174,8 @@ typedef short_td(__STDCALL* DLLUNLOADCALLBACK_PTR)(dllUnloadCallback func);
173
174
  #define LG_SUBOP_CONNECT 0
174
175
  #define LG_SUBOP_DISCONNECT 1
175
176
  #define LG_SUBOP_NEWCONNECT 3
176
-
177
-
177
+ #define LG_SUBOP_RECONNECT 4
178
+ #define LG_SUBOP_DISCONNECT_EX 5 //for reconnect test
178
179
  /** field types
179
180
  */
180
181
  #define ft_string 0
@@ -386,6 +387,13 @@ typedef short_td(__STDCALL* DLLUNLOADCALLBACK_PTR)(dllUnloadCallback func);
386
387
  #define ERROR_TD_HOSTNAME_NOT_FOUND 3103
387
388
  #define ERROR_TD_CONNECTION_FAILURE 3106
388
389
  #define ERROR_TD_NOT_CONNECTED 3110
390
+ #define ERROR_TD_NET_TIMEOUT 3800
391
+ #define ERROR_TD_NET_REMOTE_DISCONNECT 3801
392
+ #define ERROR_TD_NET_TOO_BIGDATA 3802
393
+ #define ERROR_TD_NET_OTHER 3810
394
+ #define ERROR_TD_C_CLIENT_UNKNOWN 3811
395
+ #define ERROR_TD_RECONNECTED 3900
396
+
389
397
 
390
398
  #define TRANSACTD_SCHEMANAME _T("transactd_schema")
391
399
  #define TYPE_SCHEMA_BDF 0
@@ -451,7 +459,7 @@ struct handshale_t
451
459
  If you change this version then you need change The ($TargetName) project options too.
452
460
  */
453
461
  #define C_INTERFACE_VER_MAJOR "2"//##1 Build marker! Don't remove
454
- #define C_INTERFACE_VER_MINOR "2"//##2 Build marker! Don't remove
462
+ #define C_INTERFACE_VER_MINOR "3"//##2 Build marker! Don't remove
455
463
  #define C_INTERFACE_VER_RELEASE "0"//##3 Build marker! Don't remove
456
464
 
457
465
  /* dnamic load library name.
@@ -515,7 +523,7 @@ struct handshale_t
515
523
  */
516
524
 
517
525
  #define CPP_INTERFACE_VER_MAJOR "2"//##4 Build marker! Don't remove
518
- #define CPP_INTERFACE_VER_MINOR "2"//##5 Build marker! Don't remove
526
+ #define CPP_INTERFACE_VER_MINOR "3"//##5 Build marker! Don't remove
519
527
  #define CPP_INTERFACE_VER_RELEASE "0"//##6 Build marker! Don't remove
520
528
 
521
529
  /* use autolink tdclcpp */
@@ -532,7 +540,7 @@ struct handshale_t
532
540
  #endif
533
541
 
534
542
  #define TRANSACTD_VER_MAJOR 2//##7 Build marker! Don't remove
535
- #define TRANSACTD_VER_MINOR 2//##8 Build marker! Don't remove
543
+ #define TRANSACTD_VER_MINOR 3//##8 Build marker! Don't remove
536
544
  #define TRANSACTD_VER_RELEASE 0//##9 Build marker! Don't remove
537
545
 
538
546
  #endif // BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H