transactd 2.4.3 → 2.4.4

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/RELEASE_NOTE-JA.md +21 -0
  3. data/RELEASE_NOTE.md +22 -0
  4. data/bin/common/tdclc_32_2_4.dll +0 -0
  5. data/bin/common/tdclc_64_2_4.dll +0 -0
  6. data/build/swig/ruby/tdclrb_wrap.cpp +1225 -1848
  7. data/build/swig/tdcl.i +77 -13
  8. data/build/tdclc/tdclc.rc +4 -4
  9. data/build/tdclcpp/tdclcpp.rc +4 -4
  10. data/build/tdclrb/tdclrb.rc +4 -4
  11. data/source/bzs/db/protocol/tdap/client/connectionPool.cpp +11 -14
  12. data/source/bzs/db/protocol/tdap/client/connectionPool.h +1 -6
  13. data/source/bzs/db/protocol/tdap/client/dbDef.h +5 -0
  14. data/source/bzs/db/protocol/tdap/client/dllmain.cpp +5 -10
  15. data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +6 -5
  16. data/source/bzs/db/protocol/tdap/client/nsDatabase.h +7 -2
  17. data/source/bzs/db/protocol/tdap/client/nsTable.cpp +5 -5
  18. data/source/bzs/db/protocol/tdap/client/nsTable.h +6 -1
  19. data/source/bzs/db/protocol/tdap/client/trnsctcl.def +1 -1
  20. data/source/bzs/db/protocol/tdap/mysql/request.h +7 -2
  21. data/source/bzs/db/protocol/tdap/tdapSchema.cpp +2 -3
  22. data/source/bzs/db/protocol/tdap/tdapcapi.h +4 -4
  23. data/source/bzs/netsvc/client/tcpClient.h +24 -10
  24. data/source/bzs/test/tdclphp/transactd_Test.php +34 -0
  25. data/source/bzs/test/tdclphp/transactd_pool_Test.php +0 -6
  26. data/source/bzs/test/tdclrb/transactd_spec.rb +34 -0
  27. data/source/bzs/test/trdclengn/test_trdclengn.cpp +4 -1
  28. data/source/global/tdclatl/Database.cpp +29 -7
  29. data/source/global/tdclatl/Database.h +6 -0
  30. data/source/global/tdclatl/DbDef.cpp +49 -45
  31. data/source/global/tdclatl/DbDef.h +1 -0
  32. data/source/global/tdclatl/FieldDef.cpp +14 -0
  33. data/source/global/tdclatl/FieldDef.h +4 -0
  34. data/source/global/tdclatl/FieldDefs.cpp +14 -0
  35. data/source/global/tdclatl/FieldDefs.h +4 -0
  36. data/source/global/tdclatl/GroupQuery.cpp +15 -0
  37. data/source/global/tdclatl/GroupQuery.h +4 -0
  38. data/source/global/tdclatl/KeyDef.cpp +1 -1
  39. data/source/global/tdclatl/KeyDef.h +1 -1
  40. data/source/global/tdclatl/PooledDbManager.cpp +15 -0
  41. data/source/global/tdclatl/PooledDbManager.h +4 -0
  42. data/source/global/tdclatl/PreparedQuery.cpp +15 -0
  43. data/source/global/tdclatl/PreparedQuery.h +4 -0
  44. data/source/global/tdclatl/QueryBase.cpp +15 -0
  45. data/source/global/tdclatl/QueryBase.h +4 -0
  46. data/source/global/tdclatl/Record.cpp +30 -0
  47. data/source/global/tdclatl/Record.h +8 -0
  48. data/source/global/tdclatl/Recordset.cpp +18 -3
  49. data/source/global/tdclatl/Recordset.h +5 -1
  50. data/source/global/tdclatl/RecordsetQuery.cpp +15 -1
  51. data/source/global/tdclatl/RecordsetQuery.h +5 -1
  52. data/source/global/tdclatl/Table.cpp +29 -3
  53. data/source/global/tdclatl/Table.h +5 -0
  54. data/source/global/tdclatl/TableDef.cpp +15 -0
  55. data/source/global/tdclatl/TableDef.h +4 -0
  56. data/source/global/tdclatl/activeTable.cpp +15 -0
  57. data/source/global/tdclatl/activeTable.h +4 -0
  58. data/source/global/tdclatl/tdclatl.idl +16 -10
  59. metadata +2 -2
data/build/swig/tdcl.i CHANGED
@@ -359,6 +359,7 @@ using namespace bzs::db::protocol::tdap::client;
359
359
  %ignore bzs::db::protocol::tdap::client::dbdef::pushBackup;
360
360
  %ignore bzs::db::protocol::tdap::client::dbdef::relateData;
361
361
  %ignore bzs::db::protocol::tdap::client::dbdef::setStat;
362
+ %ignore bzs::db::protocol::tdap::client::dbdef::tdapErr;
362
363
 
363
364
  // * bzs/db/protocol/tdap/client/field.h *
364
365
  %ignore bzs::db::protocol::tdap::client::compBlob;
@@ -585,6 +586,8 @@ using namespace bzs::db::protocol::tdap::client;
585
586
  %ignore bzs::db::protocol::tdap::client::nsdatabase::getTrnsctdEntryPoint;
586
587
  %ignore bzs::db::protocol::tdap::client::nsdatabase::getBtrvEntryPoint;
587
588
  %ignore bzs::db::protocol::tdap::client::nsdatabase::setBtrvEntryPoint;
589
+ %ignore bzs::db::protocol::tdap::client::nsdatabase::tdapErr;
590
+
588
591
 
589
592
  // * bzs/db/protocol/tdap/client/nsTable.h *
590
593
  %ignore bzs::db::protocol::tdap::client::nstable::buflen;
@@ -595,7 +598,9 @@ using namespace bzs::db::protocol::tdap::client;
595
598
  %ignore bzs::db::protocol::tdap::client::nstable::tdap;
596
599
  %ignore bzs::db::protocol::tdap::client::nstable::test;
597
600
  %ignore bzs::db::protocol::tdap::client::nstable::throwError;
598
- %rename(tdapLastErr) bzs::db::protocol::tdap::client::nstable::tdapErr(HWND, _TCHAR*);
601
+ %ignore bzs::db::protocol::tdap::client::nstable::tdapErr(HWND hWnd, _TCHAR* retbuf=NULL);
602
+ %ignore bzs::db::protocol::tdap::client::nstable::tdapErr(HWND hWnd, short_td status, const _TCHAR* tableName = NULL, _TCHAR* retbuf = NULL);
603
+
599
604
 
600
605
  // * bzs/db/protocol/tdap/client/pooledDatabaseManager.h *
601
606
  %ignore bzs::db::protocol::tdap::client::xaTransaction;
@@ -751,21 +756,21 @@ using namespace bzs::db::protocol::tdap::client;
751
756
  %ignore bzs::db::protocol::tdap::client::filterdIterator::operator==;
752
757
  %ignore bzs::db::protocol::tdap::client::filterdIterator::operator!=;
753
758
  %ignore bzs::db::protocol::tdap::client::filterdIterator::operator*;
754
- %ignore bzs::db::protocol::tdap::client::filterdIterator::operator->;
755
- %ignore bzs::db::protocol::tdap::client::find;
756
- %ignore bzs::db::protocol::tdap::client::findRv;
757
- %ignore bzs::db::protocol::tdap::client::for_each;
758
- %ignore bzs::db::protocol::tdap::client::getFindIterator;
759
+ //%ignore bzs::db::protocol::tdap::client::filterdIterator::operator->;
760
+ //%ignore bzs::db::protocol::tdap::client::find;
761
+ //%ignore bzs::db::protocol::tdap::client::findRv;
762
+ //%ignore bzs::db::protocol::tdap::client::for_each;
763
+ //%ignore bzs::db::protocol::tdap::client::getFindIterator;
759
764
  %ignore bzs::db::protocol::tdap::client::getTable;
760
765
  %ignore bzs::db::protocol::tdap::client::insertField;
761
766
  %ignore bzs::db::protocol::tdap::client::insertKey;
762
767
  %ignore bzs::db::protocol::tdap::client::insertRecord;
763
768
  %ignore bzs::db::protocol::tdap::client::insertTable;
764
- %ignore bzs::db::protocol::tdap::client::deleteTable
765
- %ignore bzs::db::protocol::tdap::client::renumberTable
766
- %ignore bzs::db::protocol::tdap::client::deleteField
767
- %ignore bzs::db::protocol::tdap::client::deleteKey
768
- %ignore bzs::db::protocol::tdap::client::validateTableDef
769
+ //%ignore bzs::db::protocol::tdap::client::deleteTable
770
+ //%ignore bzs::db::protocol::tdap::client::renumberTable
771
+ //%ignore bzs::db::protocol::tdap::client::deleteField
772
+ //%ignore bzs::db::protocol::tdap::client::deleteKey
773
+ //%ignore bzs::db::protocol::tdap::client::validateTableDef
769
774
  %ignore bzs::db::protocol::tdap::client::isSameUri;
770
775
  %ignore bzs::db::protocol::tdap::client::lexical_cast;
771
776
  %ignore bzs::db::protocol::tdap::client::openDatabase;
@@ -1043,19 +1048,78 @@ using namespace bzs::db::protocol::tdap::client;
1043
1048
  #undef pragma_pop
1044
1049
  #define pragma_pop
1045
1050
  %include bzs/db/protocol/tdap/tdapcapi.h
1051
+
1052
+ // -- typemap for tabledef::toChar
1053
+ %typemap(in, numinputs=0) (char* buf, const char* s, int size)
1054
+ {
1055
+ int n = 0;
1056
+ if (s) n = strlen(s)*2;
1057
+ $3 = n;
1058
+ if (n) $1 = new char[n];
1059
+ }
1060
+ %typemap(freearg) (char* buf, const char* s, int size)
1061
+ {
1062
+ delete [] $1;
1063
+ }
1046
1064
  %include bzs/db/protocol/tdap/tdapSchema.h
1065
+ %clear char* buf, const char* s, int size;
1066
+ // --
1067
+
1068
+ // -- typemap for nstable::getFilename, getDirUri, statMsg
1069
+ %typemap(in, numinputs=0) (_TCHAR* retbuf)
1070
+ {
1071
+ _TCHAR tmpbuf[1024];
1072
+ $1=tmpbuf;
1073
+ }
1047
1074
  %include bzs/db/protocol/tdap/client/nsTable.h
1075
+ %clear char * retbuf;
1076
+ // --
1077
+
1078
+
1079
+
1080
+ // -- typemap for dbdef::statMsg
1081
+ %typemap(in, numinputs=0) (_TCHAR* retbuf)
1082
+ {
1083
+ _TCHAR tmpbuf[1024];
1084
+ $1=tmpbuf;
1085
+ }
1048
1086
  %include bzs/db/protocol/tdap/client/dbDef.h
1087
+ %clear char * retbuf;
1088
+ // --
1089
+
1090
+
1049
1091
  %include bzs/db/protocol/tdap/client/table.h
1092
+
1093
+ // -- typemap for nsDatabase::readDatabaseDirectory
1094
+ %typemap(in, numinputs=0) (_TCHAR* retbuf, uchar_td len)
1095
+ {
1096
+ char tmpbuf[255];
1097
+ $1=tmpbuf;
1098
+ $2=255;
1099
+ }
1100
+ // nsDatabase::statMsg
1101
+ %typemap(in, numinputs=0) (_TCHAR* retbuf)
1102
+ {
1103
+ _TCHAR tmpbuf[1024];
1104
+ $1=tmpbuf;
1105
+ }
1106
+
1050
1107
  %include bzs/db/protocol/tdap/client/nsDatabase.h
1108
+ %clear _TCHAR* retBuf, uchar_td len;
1109
+ %clear _TCHAR* retbuf;
1110
+ // --
1111
+
1112
+
1051
1113
  %include bzs/db/protocol/tdap/client/database.h
1052
1114
  %include bzs/rtl/benchmark.h
1053
1115
  %include bzs/db/protocol/tdap/mysql/characterset.h
1054
- // typemap for btrTimeStamp::toString/btrdtoa/btrttoa/btrstoa --
1116
+
1117
+ // -- typemap for btrTimeStamp::toString/btrdtoa/btrttoa/btrstoa
1055
1118
  %typemap(in,numinputs=0) (char * retbuf) (char tmpbuf[255]) { $1=tmpbuf; }
1056
1119
  %include bzs/db/protocol/tdap/btrDate.h
1057
1120
  %clear char * retbuf;
1058
- // clear typemap for typemap for btrTimeStamp::toString/btrdtoa/btrttoa/btrstoa --
1121
+ // --
1122
+
1059
1123
  %include bzs/db/protocol/tdap/client/field.h
1060
1124
  %include bzs/db/protocol/tdap/client/fields.h
1061
1125
  %include bzs/db/protocol/tdap/client/memRecord.h
data/build/tdclc/tdclc.rc CHANGED
@@ -29,8 +29,8 @@
29
29
  //
30
30
 
31
31
  VS_VERSION_INFO VERSIONINFO
32
- FILEVERSION 2,4,2,92
33
- PRODUCTVERSION 2,4,2,92
32
+ FILEVERSION 2,4,4,97
33
+ PRODUCTVERSION 2,4,4,97
34
34
  FILEFLAGSMASK 0x3fL
35
35
  #ifdef _DEBUG
36
36
  FILEFLAGS 0x1L
@@ -47,9 +47,9 @@ BEGIN
47
47
  BEGIN
48
48
  VALUE "CompanyName", "BizStation Corp."
49
49
  VALUE "FileDescription", "Transactd C client"
50
- VALUE "FileVersion", "2.4.2.92"
50
+ VALUE "FileVersion", "2.4.4.97"
51
51
  VALUE "LegalCopyright", "Copyright(C) 2014 BizStation Corp"
52
- VALUE "ProductVersion", "2.4.2.92"
52
+ VALUE "ProductVersion", "2.4.4.97"
53
53
  VALUE "ProductName", "Transactd Client (GPL V2)"
54
54
  END
55
55
  END
@@ -29,8 +29,8 @@
29
29
  //
30
30
 
31
31
  VS_VERSION_INFO VERSIONINFO
32
- FILEVERSION 2,4,3,92
33
- PRODUCTVERSION 2,4,3,92
32
+ FILEVERSION 2,4,4,97
33
+ PRODUCTVERSION 2,4,4,97
34
34
  FILEFLAGSMASK 0x3fL
35
35
  #ifdef _DEBUG
36
36
  FILEFLAGS 0x1L
@@ -47,9 +47,9 @@ BEGIN
47
47
  BEGIN
48
48
  VALUE "CompanyName", "BizStation Corp."
49
49
  VALUE "FileDescription", "Transactd C++ client"
50
- VALUE "FileVersion", "2.4.3.92"
50
+ VALUE "FileVersion", "2.4.4.97"
51
51
  VALUE "LegalCopyright", "Copyright(C) 2014 BizStation Corp"
52
- VALUE "ProductVersion", "2.4.3.92"
52
+ VALUE "ProductVersion", "2.4.4.97"
53
53
  VALUE "ProductName", "Transactd Client (GPL V2)"
54
54
  END
55
55
  END
@@ -29,8 +29,8 @@
29
29
  //
30
30
 
31
31
  VS_VERSION_INFO VERSIONINFO
32
- FILEVERSION 2,4,3,92
33
- PRODUCTVERSION 2,4,3,92
32
+ FILEVERSION 2,4,4,97
33
+ PRODUCTVERSION 2,4,4,97
34
34
  FILEFLAGSMASK 0x3fL
35
35
  #ifdef _DEBUG
36
36
  FILEFLAGS 0x1L
@@ -47,9 +47,9 @@ BEGIN
47
47
  BEGIN
48
48
  VALUE "CompanyName", "BizStation Corp."
49
49
  VALUE "FileDescription", "Transactd Ruby client"
50
- VALUE "FileVersion", "2.4.3.92"
50
+ VALUE "FileVersion", "2.4.4.97"
51
51
  VALUE "LegalCopyright", "Copyright(C) 2014 BizStation Corp"
52
- VALUE "ProductVersion", "2.4.3.92"
52
+ VALUE "ProductVersion", "2.4.4.97"
53
53
  VALUE "ProductName", "Transactd Client (GPL V2)"
54
54
  END
55
55
  END
@@ -71,12 +71,6 @@ void busyWait(busyWaitArguments* args)
71
71
  }
72
72
  #endif // TRANSACTD_RB_CALL_WITHOUT_GVL
73
73
 
74
- short __STDCALL dllUnloadCallbackFunc()
75
- {
76
- cpool.reset(0);
77
- cpool.m_regitfunc = NULL;
78
- return 0;
79
- }
80
74
 
81
75
  void releaseConnection(stdDbmCconnectionPool* pool)
82
76
  {
@@ -87,19 +81,22 @@ template <class Database_Ptr>
87
81
  connectionPool<Database_Ptr>::connectionPool(int maxConnections)
88
82
  : m_maxConnections(maxConnections)
89
83
  {
90
- #ifdef USE_DLLUNLOAD_CALLBACK
91
- m_regitfunc = nsdatabase::getDllUnloadCallbackFunc();
92
- if (m_regitfunc)
93
- m_regitfunc(dllUnloadCallbackFunc);
84
+ #ifdef _WIN32
85
+ m_shutdownFunc = nsdatabase::getWinTPoolShutdownFunc();
94
86
  #else
95
- m_regitfunc = NULL;
87
+ m_shutdownFunc = NULL;
96
88
  #endif
97
89
  }
98
90
 
99
91
  template <class Database_Ptr> connectionPool<Database_Ptr>::~connectionPool()
100
92
  {
101
- if (m_regitfunc)
102
- m_regitfunc(NULL);
93
+ if (m_shutdownFunc)
94
+ {
95
+ m_shutdownFunc();
96
+ #ifndef SWIGRUBY
97
+ reset(0);
98
+ #endif
99
+ }
103
100
  }
104
101
 
105
102
  template <class Database_Ptr>
@@ -231,7 +228,7 @@ bool connectionPool<Database_Ptr>::reset(int waitSec)
231
228
  lck.lock();
232
229
  #endif
233
230
  bool flag = true;
234
- for (int j = 0; j < waitSec * 100; j++)
231
+ for (int j = 0; j < waitSec * 10; j++)
235
232
  {
236
233
  flag = false;
237
234
  for (size_t i = 0; i < m_dbs.size(); i++)
@@ -60,12 +60,7 @@ template <class Database_Ptr> class connectionPool
60
60
  mutable boost::condition m_busy;
61
61
  int m_maxConnections;
62
62
  Database_Ptr addOne(const connectParams& param);
63
- #if (__BCPLUSPLUS__)
64
- public:
65
- #endif
66
- DLLUNLOADCALLBACK_PTR m_regitfunc;
67
- friend short __STDCALL dllUnloadCallbackFunc();
68
-
63
+ WIN_TPOOL_SHUTDOWN_PTR m_shutdownFunc;
69
64
  public:
70
65
  connectionPool(int maxConnections = 0);
71
66
  ~connectionPool();
@@ -126,6 +126,11 @@ public:
126
126
  {
127
127
  return nstable::tdapErr(hWnd, retbuf);
128
128
  }
129
+ inline _TCHAR* statMsg(_TCHAR* retbuf)
130
+ {
131
+ nstable::tdapErr(0, retbuf);
132
+ return retbuf;
133
+ }
129
134
 
130
135
  void reopen(char_td mode = TD_OPEN_READONLY);
131
136
  using nstable::setStat;
@@ -41,7 +41,7 @@ using namespace bzs::netsvc::client;
41
41
  #endif
42
42
 
43
43
  void writeErrorLog(int err, const char* msg);
44
- dllUnloadCallback dllUnloadCallbackFunc = NULL;
44
+ bool win_thread_pool_shutdown = false;
45
45
 
46
46
  #ifdef USETLS
47
47
  tls_key g_tlsiID1;
@@ -105,9 +105,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
105
105
  {
106
106
  try
107
107
  {
108
- if (dllUnloadCallbackFunc)
109
- dllUnloadCallbackFunc();
110
- delete m_cons;
108
+ delete m_cons;
111
109
  }
112
110
  catch(...){}
113
111
  m_cons = NULL;
@@ -154,8 +152,6 @@ void onUnloadLibrary(void)
154
152
  {
155
153
  if (m_cons)
156
154
  {
157
- if (dllUnloadCallbackFunc)
158
- dllUnloadCallbackFunc();
159
155
  delete m_cons;
160
156
  m_cons = NULL;
161
157
  #ifdef USETLS
@@ -286,7 +282,6 @@ extern "C" PACKAGE_OSX short_td __STDCALL
286
282
  client_t->req().paramMask = P_MASK_POSBLK | P_MASK_DATA |
287
283
  P_MASK_DATALEN | P_MASK_EX_SENDLEN;
288
284
  break;
289
- case TD_GETDIRECTORY:
290
285
  case TD_SETDIRECTORY:
291
286
  break;
292
287
  case TD_VERSION:
@@ -353,6 +348,7 @@ extern "C" PACKAGE_OSX short_td __STDCALL
353
348
  P_MASK_DATALEN | P_MASK_KEYBUF | P_MASK_KEYNUM;
354
349
  break;
355
350
  case TD_RESET_CLIENT:
351
+ case TD_GETDIRECTORY:
356
352
  client_t->req().paramMask = P_MASK_KEYONLY;
357
353
  break;
358
354
  case TD_BUILD_INDEX:
@@ -507,8 +503,7 @@ extern "C" PACKAGE_OSX short_td __STDCALL
507
503
  return BTRCALLID(op, pbk, data, datalen, keybuf, keylen, keyNum, cid);
508
504
  }
509
505
 
510
- extern "C" PACKAGE_OSX short_td __STDCALL CallbackRegist(dllUnloadCallback func)
506
+ extern "C" PACKAGE_OSX void __STDCALL BeginWinThreadPoolShutdown()
511
507
  {
512
- dllUnloadCallbackFunc = func;
513
- return 0;
508
+ win_thread_pool_shutdown = true;
514
509
  }
@@ -760,13 +760,13 @@ bool nsdatabase::isUseTransactd() const
760
760
  return (m_btrcallid == getTrnsctdEntryPoint());
761
761
  }
762
762
 
763
- void nsdatabase::readDatabaseDirectory(_TCHAR* retBuf, uchar_td buflen)
763
+ void nsdatabase::readDatabaseDirectory(_TCHAR* retbuf, uchar_td buflen)
764
764
  {
765
765
  // keynum is drive name A=1 B=2 C=3 0=default
766
766
  char tmp[128];
767
767
  m_stat = m_btrcallid(TD_GETDIRECTORY, NULL, NULL, NULL, tmp, 128, 0,
768
768
  m_nsimpl->cidPtr);
769
- toTChar(retBuf, tmp, buflen);
769
+ toTCharCopy(retbuf, tmp, buflen);
770
770
  }
771
771
 
772
772
  bool nsdatabase::connect(const _TCHAR* URI, bool newConnection)
@@ -982,14 +982,15 @@ void nsdatabase::setCheckTablePtr(bool v)
982
982
  g_checkTablePtr = v;
983
983
  }
984
984
 
985
- DLLUNLOADCALLBACK_PTR nsdatabase::getDllUnloadCallbackFunc()
985
+ WIN_TPOOL_SHUTDOWN_PTR nsdatabase::getWinTPoolShutdownFunc()
986
986
  {
987
987
  if (hTrsdDLL == NULL)
988
988
  hTrsdDLL = LoadLibraryA(LIB_PREFIX TDCLC_LIBNAME);
989
989
  if (hTrsdDLL)
990
- return (DLLUNLOADCALLBACK_PTR)GetProcAddress((HINSTANCE)hTrsdDLL,
991
- "CallbackRegist");
990
+ return (WIN_TPOOL_SHUTDOWN_PTR)GetProcAddress((HINSTANCE)hTrsdDLL,
991
+ "BeginWinThreadPoolShutdown");
992
992
  return NULL;
993
+
993
994
  }
994
995
 
995
996
  } // namespace client
@@ -114,13 +114,18 @@ public:
114
114
  ushort_td trxIsolationServer() const ;
115
115
  ushort_td trxLockWaitTimeoutServer() const ;
116
116
  short_td tdapErr(HWND hWnd, _TCHAR* retbuf = NULL);
117
+ inline _TCHAR* statMsg(_TCHAR* retbuf)
118
+ {
119
+ tdapErr(0, retbuf);
120
+ return retbuf;
121
+ }
117
122
  bool useLongFilename();
118
123
  void setUseLongFilename(bool value);
119
124
  void getBtrVersion(btrVersions* versions, uchar_td* posblk);
120
125
  bool setUseTransactd();
121
126
  bool isTransactdUri(const _TCHAR* uri);
122
127
  bool isUseTransactd() const;
123
- void readDatabaseDirectory(_TCHAR* retBuf, uchar_td len);
128
+ void readDatabaseDirectory(_TCHAR* retbuf, uchar_td len);
124
129
  bool connect(const _TCHAR* uri, bool newConnection = false);
125
130
  bool disconnect(const _TCHAR* uri = _T(""));
126
131
  bool disconnectForReconnectTest(); //for connection brokn emulate
@@ -134,7 +139,7 @@ public:
134
139
  /** @cond INTERNAL */
135
140
  void setTestPtrIgnore(bool v);
136
141
  bool isTestPtrIgnore() const;
137
- static DLLUNLOADCALLBACK_PTR getDllUnloadCallbackFunc();
142
+ static WIN_TPOOL_SHUTDOWN_PTR getWinTPoolShutdownFunc();
138
143
  static bool testTablePtr(nstable* ptr);
139
144
  static void setCheckTablePtr(bool v);
140
145
  /** @endcond */
@@ -957,12 +957,12 @@ _TCHAR* nstable::getDirURI(const _TCHAR* path, _TCHAR* buf)
957
957
  /* Get file name from full path name.
958
958
  *
959
959
  */
960
- _TCHAR* nstable::getFileName(const _TCHAR* path, _TCHAR* filename)
960
+ _TCHAR* nstable::getFileName(const _TCHAR* path, _TCHAR* retbuf)
961
961
  {
962
962
 
963
963
  _TUCHAR* p = (_TUCHAR*)_tcsmrchr((const _TUCHAR*)path, PSEPARATOR_C);
964
964
  _TUCHAR* p2 = (_TUCHAR*)_tcsmrchr((const _TUCHAR*)path, '=');
965
- filename[0] = 0x00;
965
+ retbuf[0] = 0x00;
966
966
  if (p2 > p)
967
967
  p = p2;
968
968
 
@@ -970,12 +970,12 @@ _TCHAR* nstable::getFileName(const _TCHAR* path, _TCHAR* filename)
970
970
  {
971
971
  p++;
972
972
  if (*p)
973
- _tcscpy(filename, (_TCHAR*)p);
973
+ _tcscpy(retbuf, (_TCHAR*)p);
974
974
  }
975
975
  else
976
- _tcscpy(filename, path);
976
+ _tcscpy(retbuf, path);
977
977
 
978
- return filename;
978
+ return retbuf;
979
979
  }
980
980
 
981
981
  bool nstable::existsFile(const _TCHAR* filename)
@@ -186,6 +186,11 @@ public:
186
186
  {
187
187
  return doBtrvErr(hWnd, retbuf);
188
188
  }
189
+ inline _TCHAR* statMsg(_TCHAR* retbuf)
190
+ {
191
+ doBtrvErr(0, retbuf);
192
+ return retbuf;
193
+ }
189
194
 
190
195
  void beginBulkInsert(int maxBuflen);
191
196
  void abortBulkInsert() { doAbortBulkInsert(); }
@@ -220,7 +225,7 @@ public:
220
225
  void unlock(bookmark_td& bm);
221
226
  void unlock();
222
227
  char_td mode() const;
223
- static _TCHAR* getFileName(const _TCHAR* uri, _TCHAR* filename);
228
+ static _TCHAR* getFileName(const _TCHAR* uri, _TCHAR* retbuf);
224
229
  static short_td tdapErr(HWND hWnd, short_td status,
225
230
  const _TCHAR* tableName = NULL,
226
231
  _TCHAR* retbuf = NULL);
@@ -7,5 +7,5 @@ EXPORTS
7
7
  BTRV @4
8
8
  BTRCALLID32 @5
9
9
  BTRCALL32 @6
10
- CallbackRegist @7
10
+ BeginWinThreadPoolShutdown @7
11
11
 
@@ -133,9 +133,14 @@ public:
133
133
  if (P_MASK_DATALEN & paramMask)
134
134
  memcpy(datalenPtr, (const char*)&resultLen, sizeof(uint_td));
135
135
 
136
- if (tb && (P_MASK_KEYBUF & paramMask))
136
+ if (P_MASK_KEYBUF & paramMask)
137
137
  {
138
- keylen = tb->keyPackCopy((uchar*)p + sizeof(keylen_td));
138
+ if (tb)
139
+ keylen = tb->keyPackCopy((uchar*)p + sizeof(keylen_td));
140
+ else if (keylen && keylen < MAX_KEYLEN)
141
+ memcpy((uchar*)p + sizeof(keylen_td), keybuf, keylen);
142
+ else
143
+ keylen = 0;
139
144
  memcpy(p, (const char*)&keylen, sizeof(keylen_td));
140
145
  p += sizeof(keylen_td);
141
146
  p += keylen;
@@ -264,9 +264,8 @@ const char* tabledef::toChar(char* buf, const char* s, int size)
264
264
  #ifdef LINUX
265
265
  if (schemaCodePage != CP_UTF8)
266
266
  {
267
- char* p = namebufA();
268
- u8tombc(s, strlen(s), p, size);
269
- return p;
267
+ u8tombc(s, strlen(s), buf, size);
268
+ return buf;
270
269
  }
271
270
  #endif
272
271
  strncpy_s(buf, size, s, size - 1);
@@ -71,7 +71,7 @@ typedef short_td(__STDCALL* BTRCALLID_PTR)(ushort_td, void*, void*, uint_td*,
71
71
  void*, keylen_td, char_td,
72
72
  uchar_td*);
73
73
 
74
- typedef short_td(__STDCALL* DLLUNLOADCALLBACK_PTR)(dllUnloadCallback func);
74
+ typedef void(__STDCALL* WIN_TPOOL_SHUTDOWN_PTR)();
75
75
 
76
76
  /** buffer size
77
77
  */
@@ -503,7 +503,7 @@ struct handshale_t
503
503
  */
504
504
  #define C_INTERFACE_VER_MAJOR "2"//##1 Build marker! Don't remove
505
505
  #define C_INTERFACE_VER_MINOR "4"//##2 Build marker! Don't remove
506
- #define C_INTERFACE_VER_RELEASE "2"//##3 Build marker! Don't remove
506
+ #define C_INTERFACE_VER_RELEASE "4"//##3 Build marker! Don't remove
507
507
 
508
508
  /* dnamic load library name.
509
509
  The default extention of Mac is ".boudle", Therefore ".so" is popular. */
@@ -567,7 +567,7 @@ struct handshale_t
567
567
 
568
568
  #define CPP_INTERFACE_VER_MAJOR "2"//##4 Build marker! Don't remove
569
569
  #define CPP_INTERFACE_VER_MINOR "4"//##5 Build marker! Don't remove
570
- #define CPP_INTERFACE_VER_RELEASE "3"//##6 Build marker! Don't remove
570
+ #define CPP_INTERFACE_VER_RELEASE "4"//##6 Build marker! Don't remove
571
571
 
572
572
  /* use autolink tdclcpp */
573
573
  #if (__BCPLUSPLUS__ || _MSC_VER)
@@ -584,6 +584,6 @@ struct handshale_t
584
584
 
585
585
  #define TRANSACTD_VER_MAJOR 2//##7 Build marker! Don't remove
586
586
  #define TRANSACTD_VER_MINOR 4//##8 Build marker! Don't remove
587
- #define TRANSACTD_VER_RELEASE 2//##9 Build marker! Don't remove
587
+ #define TRANSACTD_VER_RELEASE 4//##9 Build marker! Don't remove
588
588
 
589
589
  #endif // BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H
@@ -58,6 +58,10 @@ using namespace boost::system;
58
58
  #define ERROR_TD_NET_TOO_BIGDATA 3802
59
59
  #define MAX_DATA_SIZE 10485760 // 10MB
60
60
 
61
+ #ifdef _WIN32
62
+ extern bool win_thread_pool_shutdown;
63
+ #endif
64
+
61
65
  namespace bzs
62
66
  {
63
67
  namespace netsvc
@@ -149,7 +153,7 @@ class connectionBase : public connection
149
153
  protected:
150
154
  friend class connections;
151
155
 
152
- asio::io_service m_ios;
156
+ asio::io_service* m_ios;
153
157
  asio::ip::tcp::endpoint m_ep;
154
158
  idirectReadHandler* m_reader;
155
159
  size_t m_readLen;
@@ -175,10 +179,20 @@ protected:
175
179
 
176
180
  public:
177
181
  connectionBase(asio::ip::tcp::endpoint& ep)
178
- : m_ep(ep), m_reader(NULL), m_refCount(0),
182
+ : m_ios(new asio::io_service),
183
+ m_ep(ep), m_reader(NULL), m_refCount(0),
179
184
  m_charsetServer(-1), m_connected(false), m_isHandShakable(true)
180
185
  {
181
186
  }
187
+ virtual ~connectionBase()
188
+ {
189
+ #ifdef _WIN32
190
+ if (!win_thread_pool_shutdown)
191
+ delete m_ios;
192
+ #else
193
+ delete m_ios;
194
+ #endif
195
+ }
182
196
  void setDirectReadHandler(idirectReadHandler* p){ m_reader = p; }
183
197
  bool isHandShakable() const {return m_isHandShakable;};
184
198
  const boost::system::error_code& error() const { return m_e; };
@@ -358,9 +372,9 @@ protected:
358
372
  {
359
373
  try
360
374
  {
361
- m_ios.stop();
375
+ m_ios->stop();
362
376
  m_socket.close();
363
- m_ios.reset();
377
+ m_ios->reset();
364
378
  }
365
379
  catch (...)
366
380
  {
@@ -390,14 +404,14 @@ protected:
390
404
  void reconnect(asio::ip::tcp::endpoint& ep)
391
405
  {
392
406
  cleanup();
393
- m_ios.reset();
407
+ m_ios->reset();
394
408
  m_ep = ep;
395
409
  connect();
396
410
  }
397
411
 
398
412
  public:
399
413
  connectionImple(asio::ip::tcp::endpoint& ep)
400
- : connectionBase(ep)/*, m_datalen(0)*/, m_socket(m_ios)
414
+ : connectionBase(ep)/*, m_datalen(0)*/, m_socket(*m_ios)
401
415
  {
402
416
  }
403
417
  };
@@ -512,8 +526,8 @@ class tcpConnection : public connectionImple<asio::ip::tcp::socket>
512
526
  setTimer(connections::connectTimeout);
513
527
  m_socket.async_connect(m_ep,
514
528
  bind(&tcpConnection::on_connect, this, _error_holder));
515
- m_ios.run();
516
- m_ios.reset();
529
+ m_ios->run();
530
+ m_ios->reset();
517
531
  }
518
532
 
519
533
  void connect()
@@ -522,7 +536,7 @@ class tcpConnection : public connectionImple<asio::ip::tcp::socket>
522
536
  m_socket.connect(m_ep);
523
537
  m_e = error_code(getErrorCode(), SYSTEM_CATEGORY);
524
538
  on_connect(m_e);
525
- m_ios.reset();
539
+ m_ios->reset();
526
540
  }
527
541
  #endif
528
542
 
@@ -595,7 +609,7 @@ public:
595
609
  tcpConnection(asio::ip::tcp::endpoint& ep)
596
610
  : connectionImple<asio::ip::tcp::socket>(ep),s_io(m_socket)
597
611
  #ifdef USE_CONNECT_TIMER
598
- , m_timer(m_ios)
612
+ , m_timer(*m_ios)
599
613
  #endif
600
614
  {
601
615
  m_readbuf.resize(READBUF_SIZE);