transactd 1.0.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +1 -1
- data/README-JA +1 -1
- data/bin/common/tdclc_32_1_1.dll +0 -0
- data/bin/common/tdclc_64_1_1.dll +0 -0
- data/build/common/transactd_common.cmake +6 -2
- data/build/tdclc/CMakeLists.txt +9 -0
- data/build/tdclc/tdclc_32.cbproj +2 -10
- data/build/tdclc/tdclc_64.cbproj +2 -9
- data/build/tdclcpp/tdclcpp_bcb_32.cbproj +3 -7
- data/build/tdclcpp/tdclcpp_bcb_64.cbproj +1 -15
- data/build/tdclrb/CMakeLists.txt +12 -4
- data/build/tdclrb/GEM_VERSION +2 -2
- data/source/bzs/db/engine/mysql/mysqlThd.cpp +5 -4
- data/source/bzs/db/engine/mysql/mysqlThd.h +1 -1
- data/source/bzs/db/protocol/tdap/btrDate.cpp +15 -4
- data/source/bzs/db/protocol/tdap/client/client.cpp +2 -2
- data/source/bzs/db/protocol/tdap/client/client.h +46 -18
- data/source/bzs/db/protocol/tdap/client/databaseFactory.cpp +53 -11
- data/source/bzs/db/protocol/tdap/client/dllmain.cpp +50 -28
- data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +5 -2
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +19 -1
- data/source/bzs/db/protocol/tdap/tdapSchema.cpp +16 -5
- data/source/bzs/db/protocol/tdap/tdapcapi.h +9 -4
- data/source/bzs/db/transactd/transactd.cpp +22 -8
- data/source/bzs/env/compiler.h +6 -0
- data/source/bzs/env/crosscompile.h +9 -1
- data/source/bzs/example/changeSchema.cpp +6 -6
- data/source/bzs/example/changeSchema_c.cpp +4 -4
- data/source/bzs/example/createDatabase.cpp +7 -7
- data/source/bzs/example/deleteRecords.cpp +2 -2
- data/source/bzs/example/deleteRecords_c.cpp +1 -1
- data/source/bzs/example/dropDatabase.cpp +4 -1
- data/source/bzs/example/dropDatabase_c.cpp +1 -1
- data/source/bzs/example/insertRecords.cpp +1 -1
- data/source/bzs/example/readRecords.cpp +1 -1
- data/source/bzs/example/updateRecords.cpp +1 -1
- data/source/bzs/example/update_with_transaction.cpp +1 -1
- data/source/bzs/example/update_with_transaction_c.cpp +1 -1
- data/source/bzs/netsvc/client/tcpClient.cpp +3 -2
- data/source/bzs/rtl/datetime.cpp +15 -5
- data/source/bzs/test/trdclengn/test_trdclengn.cpp +1 -1
- metadata +3 -3
- data/bin/common/tdclc_32_1_0.dll +0 -0
- data/bin/common/tdclc_64_1_0.dll +0 -0
@@ -50,8 +50,8 @@ using namespace bzs::netsvc::client;
|
|
50
50
|
void writeErrorLog(int err, const char* msg);
|
51
51
|
|
52
52
|
|
53
|
-
#
|
54
|
-
|
53
|
+
#ifdef USETLS
|
54
|
+
tls_key g_tlsiID1;
|
55
55
|
#else
|
56
56
|
__THREAD clientID __THREAD_BCB g_cid;
|
57
57
|
__THREAD bool __THREAD_BCB g_initCid = false;
|
@@ -66,7 +66,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
|
|
66
66
|
{
|
67
67
|
if (reason == DLL_PROCESS_ATTACH)
|
68
68
|
{
|
69
|
-
#ifdef
|
69
|
+
#ifdef USETLS
|
70
70
|
if ((g_tlsiID = TlsAlloc()) == TLS_OUT_OF_INDEXES)
|
71
71
|
return FALSE;
|
72
72
|
if ((g_tlsiID1 = TlsAlloc()) == TLS_OUT_OF_INDEXES)
|
@@ -74,16 +74,12 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
|
|
74
74
|
#endif
|
75
75
|
|
76
76
|
m_cons = new connections(PIPENAME);
|
77
|
-
}else if(reason ==
|
77
|
+
}else if(reason == DLL_THREAD_DETACH)
|
78
78
|
{
|
79
|
-
#ifdef
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
p->id = 1;
|
84
|
-
p->aid[0] = 'G';
|
85
|
-
p->aid[1] = 'X';
|
86
|
-
TlsSetValue(g_tlsiID1, p);
|
79
|
+
#ifdef USETLS
|
80
|
+
delete (bzs::db::protocol::tdap::client::client*)tls_getspecific(g_tlsiID);
|
81
|
+
#else
|
82
|
+
delete g_client;
|
87
83
|
#endif
|
88
84
|
}
|
89
85
|
else if (reason == DLL_PROCESS_DETACH)
|
@@ -91,7 +87,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
|
|
91
87
|
delete m_cons;
|
92
88
|
m_cons=NULL;
|
93
89
|
|
94
|
-
#ifdef
|
90
|
+
#ifdef USETLS
|
95
91
|
TlsFree(g_tlsiID);
|
96
92
|
TlsFree(g_tlsiID1);
|
97
93
|
|
@@ -106,12 +102,21 @@ void __attribute__ ((destructor)) onUnloadLibrary(void);
|
|
106
102
|
|
107
103
|
void onLoadLibrary(void)
|
108
104
|
{
|
109
|
-
|
105
|
+
m_cons = new connections(PIPENAME);
|
106
|
+
#ifdef USETLS
|
107
|
+
pthread_key_create(&g_tlsiID, NULL);
|
108
|
+
pthread_key_create(&g_tlsiID1, NULL);
|
109
|
+
#endif
|
110
|
+
|
110
111
|
}
|
111
112
|
void onUnloadLibrary(void)
|
112
113
|
{
|
113
|
-
|
114
|
-
|
114
|
+
delete m_cons;
|
115
|
+
m_cons=NULL;
|
116
|
+
#ifdef USETLS
|
117
|
+
pthread_key_delete(g_tlsiID);
|
118
|
+
pthread_key_delete(g_tlsiID1);
|
119
|
+
#endif
|
115
120
|
}
|
116
121
|
#endif
|
117
122
|
|
@@ -120,22 +125,20 @@ extern "C" short_td __STDCALL
|
|
120
125
|
uint_td* datalen, void_td* keybuf, keylen_td keylen,
|
121
126
|
char_td keyNum, clientID* cid)
|
122
127
|
{
|
123
|
-
bzs::db::protocol::tdap::client::client* client_t;
|
124
|
-
if ((client_t = getClientThread()) == NULL)
|
125
|
-
{
|
126
|
-
client_t = new bzs::db::protocol::tdap::client::client();
|
127
|
-
setClientThread(client_t);
|
128
|
-
}
|
128
|
+
bzs::db::protocol::tdap::client::client* client_t = getClientThread();
|
129
129
|
|
130
130
|
short_td ret;
|
131
131
|
try
|
132
132
|
{
|
133
|
-
//op = op%100;
|
134
133
|
|
135
134
|
if ((TD_GET_BLOB_BUF != op) && (TD_ADD_SENDBLOB != op))
|
136
135
|
client_t->setParam(op, pbk,data,datalen,keybuf,keylen,keyNum,cid);
|
137
136
|
|
138
|
-
if (client_t->stop_if())
|
137
|
+
if (client_t->stop_if())
|
138
|
+
{
|
139
|
+
client_t->cleanup();
|
140
|
+
return 0;
|
141
|
+
}
|
139
142
|
if (cid==NULL) return 1;
|
140
143
|
|
141
144
|
switch(op)
|
@@ -154,7 +157,10 @@ extern "C" short_td __STDCALL
|
|
154
157
|
if (client_t->readServerCharsetIndex())
|
155
158
|
client_t->create();
|
156
159
|
else
|
160
|
+
{
|
161
|
+
client_t->cleanup();
|
157
162
|
return 1;
|
163
|
+
}
|
158
164
|
}
|
159
165
|
else if (op == TD_OPENTABLE)
|
160
166
|
client_t->req().paramMask = P_MASK_ALL;
|
@@ -190,6 +196,7 @@ extern "C" short_td __STDCALL
|
|
190
196
|
break;
|
191
197
|
case TD_UNLOCK:
|
192
198
|
case TD_UPDATE_PART:
|
199
|
+
client_t->cleanup();
|
193
200
|
return 0;
|
194
201
|
case TD_REC_DELETE:
|
195
202
|
case TD_CLOSETABLE:
|
@@ -271,13 +278,18 @@ extern "C" short_td __STDCALL
|
|
271
278
|
}else
|
272
279
|
client_t->req().result = STATUS_BUFFERTOOSMALL;
|
273
280
|
if (datalen < sizeof(btrVersion)*2)
|
281
|
+
{
|
282
|
+
client_t->cleanup();
|
274
283
|
return 0;
|
284
|
+
}
|
275
285
|
break;
|
276
286
|
}
|
277
287
|
|
278
288
|
|
279
289
|
}
|
280
|
-
|
290
|
+
short_td ret = client_t->execute();
|
291
|
+
client_t->cleanup();
|
292
|
+
return ret;
|
281
293
|
}
|
282
294
|
catch(boost::system::system_error &e)
|
283
295
|
{
|
@@ -364,8 +376,18 @@ void writeErrorLog(int err, const char* msg)
|
|
364
376
|
|
365
377
|
inline clientID* getCid()
|
366
378
|
{
|
367
|
-
#ifdef
|
368
|
-
|
379
|
+
#ifdef USETLS
|
380
|
+
clientID* p = (clientID*)tls_getspecific(g_tlsiID1);
|
381
|
+
if (p==NULL)
|
382
|
+
{
|
383
|
+
clientID* p = new clientID();
|
384
|
+
memset(p, 0, sizeof(clientID));
|
385
|
+
p->id = 1;
|
386
|
+
p->aid[0] = 'G';
|
387
|
+
p->aid[1] = 'X';
|
388
|
+
tls_setspecific(g_tlsiID1, p);
|
389
|
+
}
|
390
|
+
return p;
|
369
391
|
#else
|
370
392
|
return &g_cid;
|
371
393
|
#endif
|
@@ -374,7 +396,7 @@ inline clientID* getCid()
|
|
374
396
|
|
375
397
|
void initCid()
|
376
398
|
{
|
377
|
-
#ifndef
|
399
|
+
#ifndef USETLS
|
378
400
|
if (!g_initCid)
|
379
401
|
{
|
380
402
|
g_initCid = true;
|
@@ -185,7 +185,7 @@ boost::mutex g_mutex;
|
|
185
185
|
|
186
186
|
nsdatabase::nsdatabase() : m_stat(0)
|
187
187
|
{
|
188
|
-
|
188
|
+
|
189
189
|
int type = 0;
|
190
190
|
if (hBtrvDLL == 0x00)
|
191
191
|
type = smartLoadLibrary();
|
@@ -193,8 +193,11 @@ nsdatabase::nsdatabase() : m_stat(0)
|
|
193
193
|
m_btrcallid = getBtrvEntryPoint();
|
194
194
|
if (m_btrcallid == NULL)
|
195
195
|
m_btrcallid = getTrnsctdEntryPoint();
|
196
|
+
if (!m_btrcallid)
|
197
|
+
nstable::throwError(_T("Can't load C Interface library"), ERROR_LOAD_CLIBRARY);
|
196
198
|
|
197
|
-
|
199
|
+
m_nsimpl = new nsdbimpl();
|
200
|
+
if ((type == 2) || MYTICALLID)
|
198
201
|
setUseLongFilename(true);
|
199
202
|
else
|
200
203
|
{
|
@@ -54,6 +54,20 @@ namespace mysql
|
|
54
54
|
static const char* TableNameTitle = "dbfile=";
|
55
55
|
static const char* BdfNameTitle = ".bdf";
|
56
56
|
|
57
|
+
std::string& toLowerCaseName(std::string& name , bool forSql)
|
58
|
+
{
|
59
|
+
if (forSql)
|
60
|
+
{
|
61
|
+
char tmp[MAX_PATH];
|
62
|
+
strcpy_s(tmp, MAX_PATH, name.c_str());
|
63
|
+
my_casedn_str(global_system_variables.collation_server, tmp);
|
64
|
+
name = tmp;
|
65
|
+
}
|
66
|
+
else
|
67
|
+
boost::algorithm::to_lower(name);
|
68
|
+
return name;
|
69
|
+
}
|
70
|
+
|
57
71
|
std::string getDatabaseName(const request& req, bool forSql)
|
58
72
|
{
|
59
73
|
std::vector<std::string> ssc ;
|
@@ -74,7 +88,11 @@ std::string getDatabaseName(const request& req, bool forSql)
|
|
74
88
|
std::vector<std::string> db;
|
75
89
|
split(db, ss[3], "?");
|
76
90
|
if (db.size()>0)
|
91
|
+
{
|
92
|
+
if (g_tableNmaeLower)
|
93
|
+
toLowerCaseName(db[0], forSql);
|
77
94
|
return db[0];
|
95
|
+
}
|
78
96
|
}
|
79
97
|
}
|
80
98
|
}
|
@@ -107,7 +125,7 @@ std::string getTableName(const std::string& src, bool forSql)
|
|
107
125
|
|
108
126
|
name = name.substr(pos, pos2 - pos);
|
109
127
|
if (g_tableNmaeLower)
|
110
|
-
|
128
|
+
toLowerCaseName(name, forSql);
|
111
129
|
return name;
|
112
130
|
}
|
113
131
|
|
@@ -29,11 +29,16 @@
|
|
29
29
|
|
30
30
|
#pragma package(smart_init)
|
31
31
|
|
32
|
+
#undef USETLS
|
33
|
+
#if ((defined(_WIN32) && _MSC_VER) || __APPLE__)
|
34
|
+
#define USETLS
|
35
|
+
#endif
|
36
|
+
|
32
37
|
|
33
|
-
#
|
34
|
-
extern
|
38
|
+
#ifdef USETLS
|
39
|
+
extern tls_key g_tlsiID_SC1;
|
35
40
|
#else
|
36
|
-
wchar_t __THREAD g_nameBuf[266]={
|
41
|
+
wchar_t __THREAD g_nameBuf[266]={0};
|
37
42
|
#endif
|
38
43
|
|
39
44
|
|
@@ -52,8 +57,14 @@ namespace tdap
|
|
52
57
|
|
53
58
|
inline wchar_t* namebuf()
|
54
59
|
{
|
55
|
-
#
|
56
|
-
|
60
|
+
#ifdef USETLS
|
61
|
+
_TCHAR* p = (_TCHAR*)tls_getspecific(g_tlsiID_SC1);
|
62
|
+
if (p == NULL)
|
63
|
+
{
|
64
|
+
p = (_TCHAR*)new wchar_t[256];
|
65
|
+
tls_setspecific(g_tlsiID_SC1, p);
|
66
|
+
}
|
67
|
+
return p;
|
57
68
|
#else
|
58
69
|
return g_nameBuf;
|
59
70
|
#endif
|
@@ -328,6 +328,7 @@ typedef short_td (__STDCALL *BTRCALLID_PTR)(ushort_td,void*,void*, uint_td*
|
|
328
328
|
#define STATUS_INVALID_FIELDNAME STATUS_INVALID_FIELD_OFFSET
|
329
329
|
#define ERROR_TD_INVALID_CLINETHOST 171
|
330
330
|
#define ERROR_NOSPECIFY_TABLE 176
|
331
|
+
#define ERROR_LOAD_CLIBRARY 200
|
331
332
|
#define NET_BAD_SRB_FORMAT 3021
|
332
333
|
#define ERROR_TD_HOSTNAME_NOT_FOUND 3103
|
333
334
|
#define ERROR_TD_CONNECTION_FAILURE 3106
|
@@ -363,11 +364,15 @@ typedef short_td (__STDCALL *BTRCALLID_PTR)(ushort_td,void*,void*, uint_td*
|
|
363
364
|
If you change this version then you need change The ($TargetName) project options too.
|
364
365
|
*/
|
365
366
|
#define C_INTERFACE_VER_MAJOR "1"//##1 Build marker! Don't remove
|
366
|
-
#define C_INTERFACE_VER_MINOR "
|
367
|
-
#define C_INTERFACE_VER_RELEASE "
|
367
|
+
#define C_INTERFACE_VER_MINOR "1"//##2 Build marker! Don't remove
|
368
|
+
#define C_INTERFACE_VER_RELEASE "2"//##3 Build marker! Don't remove
|
368
369
|
|
369
370
|
#ifdef LINUX
|
371
|
+
#ifdef __APPLE__
|
372
|
+
#define C_INTERFACE_VERSTR "." C_INTERFACE_VER_MAJOR "." C_INTERFACE_VER_MINOR ".so"//use loadlibrary
|
373
|
+
#else
|
370
374
|
#define C_INTERFACE_VERSTR ".so." C_INTERFACE_VER_MAJOR "." C_INTERFACE_VER_MINOR//use loadlibrary
|
375
|
+
#endif
|
371
376
|
#else
|
372
377
|
#define C_INTERFACE_VERSTR "_" C_INTERFACE_VER_MAJOR "_" C_INTERFACE_VER_MINOR ".dll"//use loadlibrary
|
373
378
|
#endif
|
@@ -410,7 +415,7 @@ typedef short_td (__STDCALL *BTRCALLID_PTR)(ushort_td,void*,void*, uint_td*
|
|
410
415
|
|
411
416
|
#define CPP_INTERFACE_VER_MAJOR "1"//##4 Build marker! Don't remove
|
412
417
|
#define CPP_INTERFACE_VER_MINOR "1"//##5 Build marker! Don't remove
|
413
|
-
#define CPP_INTERFACE_VER_RELEASE "
|
418
|
+
#define CPP_INTERFACE_VER_RELEASE "2"//##6 Build marker! Don't remove
|
414
419
|
|
415
420
|
#ifdef _WIN32
|
416
421
|
#define CPP_INTERFACE_VERSTR "_" COMPILER_VERSTR "_" TD_LIB_PART "_" CPP_INTERFACE_VER_MAJOR "_" CPP_INTERFACE_VER_MINOR //use autolink
|
@@ -418,6 +423,6 @@ typedef short_td (__STDCALL *BTRCALLID_PTR)(ushort_td,void*,void*, uint_td*
|
|
418
423
|
|
419
424
|
#define TRANSACTD_VER_MAJOR 1//##7 Build marker! Don't remove
|
420
425
|
#define TRANSACTD_VER_MINOR 1//##8 Build marker! Don't remove
|
421
|
-
#define TRANSACTD_VER_RELEASE
|
426
|
+
#define TRANSACTD_VER_RELEASE 2//##9 Build marker! Don't remove
|
422
427
|
|
423
428
|
#endif //BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H
|
@@ -297,7 +297,24 @@ mysql_declare_plugin(transactd)
|
|
297
297
|
mysql_declare_plugin_end;
|
298
298
|
|
299
299
|
#ifdef USETLS
|
300
|
-
extern
|
300
|
+
extern tls_key g_tlsiID;
|
301
|
+
|
302
|
+
#ifdef __APPLE__
|
303
|
+
|
304
|
+
void __attribute__ ((constructor)) onLoadLibrary(void);
|
305
|
+
void __attribute__ ((destructor)) onUnloadLibrary(void);
|
306
|
+
|
307
|
+
void onLoadLibrary(void)
|
308
|
+
{
|
309
|
+
pthread_key_create(&g_tlsiID, NULL);
|
310
|
+
}
|
311
|
+
|
312
|
+
void onUnloadLibrary(void)
|
313
|
+
{
|
314
|
+
pthread_key_delete(g_tlsiID);
|
315
|
+
}
|
316
|
+
|
317
|
+
#else //WIN32
|
301
318
|
|
302
319
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
303
320
|
{
|
@@ -306,13 +323,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
306
323
|
case DLL_PROCESS_ATTACH:
|
307
324
|
if ((g_tlsiID = TlsAlloc()) == TLS_OUT_OF_INDEXES)
|
308
325
|
return FALSE;
|
309
|
-
TlsSetValue(g_tlsiID, 0);
|
310
326
|
break;
|
311
|
-
case DLL_THREAD_ATTACH:
|
312
|
-
TlsSetValue(g_tlsiID, 0);
|
313
|
-
break;
|
314
|
-
case DLL_THREAD_DETACH:
|
315
|
-
break;
|
316
327
|
case DLL_PROCESS_DETACH:
|
317
328
|
TlsFree(g_tlsiID);
|
318
329
|
break;
|
@@ -322,4 +333,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
322
333
|
return TRUE;
|
323
334
|
}
|
324
335
|
|
325
|
-
#endif
|
336
|
+
#endif //__APPLE__
|
337
|
+
|
338
|
+
#endif //USETLS
|
339
|
+
|
data/source/bzs/env/compiler.h
CHANGED
@@ -145,6 +145,14 @@
|
|
145
145
|
#define localtime_x(_tm, time) (localtime_s(_tm, time)==0)
|
146
146
|
#endif//__BORLANDC__
|
147
147
|
|
148
|
-
|
148
|
+
#ifdef _WIN32
|
149
|
+
#define tls_key DWORD
|
150
|
+
#define tls_getspecific(A) TlsGetValue(A)
|
151
|
+
#define tls_setspecific(A, B) TlsSetValue(A, B)
|
152
|
+
#else
|
153
|
+
#define tls_key pthread_key_t
|
154
|
+
#define tls_getspecific(A) pthread_getspecific(A)
|
155
|
+
#define tls_setspecific(A, B) pthread_setspecific(A, B)
|
156
|
+
#endif
|
149
157
|
|
150
158
|
#endif //BZS_ENV_CROSSCOMPILE_H
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include <stdio.h>
|
2
2
|
#include <bzs/db/protocol/tdap/client/database.h>
|
3
3
|
#include <bzs/db/protocol/tdap/client/table.h>
|
4
|
-
#include <bzs/db/protocol/tdap/client/
|
4
|
+
#include <bzs/db/protocol/tdap/client/dbDef.h>
|
5
5
|
#include <boost/bind.hpp>
|
6
6
|
using namespace bzs::db::protocol::tdap::client;
|
7
7
|
using namespace bzs::db::protocol::tdap;
|
@@ -36,19 +36,19 @@ bool changeUserTable(dbdef* def)
|
|
36
36
|
{
|
37
37
|
|
38
38
|
//change name size
|
39
|
-
tabledef
|
40
|
-
fielddef* fd = &td->fieldDefs[fieldnum_name];
|
39
|
+
tabledef** td = def->tableDefPtr(tablenum_user);
|
40
|
+
fielddef* fd = &(*td)->fieldDefs[fieldnum_name];
|
41
41
|
fd->setLenByCharnum(64);
|
42
42
|
|
43
43
|
//add tel field
|
44
|
-
fd = def->insertField(td->id, td->fieldCount);
|
44
|
+
fd = def->insertField((*td)->id, (*td)->fieldCount);
|
45
45
|
fd->setName(_T("tel"));
|
46
46
|
fd->type = ft_mychar;
|
47
47
|
fd->setCharsetIndex( CHARSET_LATIN1);
|
48
48
|
fd->setLenByCharnum(16);
|
49
49
|
|
50
50
|
//write user table schema
|
51
|
-
def->updateTableDef(td->id);
|
51
|
+
def->updateTableDef((*td)->id);
|
52
52
|
if (def->stat() != 0)
|
53
53
|
{
|
54
54
|
showError(_T("edit schema table"), NULL, def->stat());
|
@@ -70,7 +70,7 @@ bool openDbExclusive(database* db, const _TCHAR* uri)
|
|
70
70
|
return true;
|
71
71
|
}
|
72
72
|
|
73
|
-
void
|
73
|
+
void __STDCALL onCopyData(database* db, int recordCount, int count, bool &cancel)
|
74
74
|
{
|
75
75
|
if (count == 0)
|
76
76
|
_tprintf(_T("\n"));
|
@@ -25,17 +25,17 @@ static const short fieldnum_name = 1;
|
|
25
25
|
void changeUserTable(dbdef* def)
|
26
26
|
{
|
27
27
|
//change name size
|
28
|
-
tabledef
|
29
|
-
fielddef* fd = &td->fieldDefs[fieldnum_name];
|
28
|
+
tabledef** td = def->tableDefPtr(tablenum_user);
|
29
|
+
fielddef* fd = &(*td)->fieldDefs[fieldnum_name];
|
30
30
|
fd->setLenByCharnum(64);
|
31
31
|
|
32
32
|
//add tel field
|
33
33
|
int size = lenByCharnum(ft_mychar, CHARSET_LATIN1, 16);
|
34
|
-
fd = insertField(def, td->id, td->fieldCount, _T("tel"), ft_mychar, size);
|
34
|
+
fd = insertField(def, (*td)->id, (*td)->fieldCount, _T("tel"), ft_mychar, size);
|
35
35
|
fd->setCharsetIndex(CHARSET_LATIN1);
|
36
36
|
|
37
37
|
//write user table schema
|
38
|
-
updateTableDef(def, td->id);
|
38
|
+
updateTableDef(def, (*td)->id);
|
39
39
|
}
|
40
40
|
|
41
41
|
void __stdcall onCopyData(database* db, int recordCount, int count, bool &cancel)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include <stdio.h>
|
2
2
|
#include <bzs/db/protocol/tdap/client/database.h>
|
3
3
|
#include <bzs/db/protocol/tdap/client/table.h>
|
4
|
-
#include <bzs/db/protocol/tdap/client/
|
4
|
+
#include <bzs/db/protocol/tdap/client/dbDef.h>
|
5
5
|
|
6
6
|
using namespace bzs::db::protocol::tdap::client;
|
7
7
|
using namespace bzs::db::protocol::tdap;
|
@@ -104,8 +104,8 @@ bool createUserTableSchema(dbdef* def)
|
|
104
104
|
|
105
105
|
//Insert table
|
106
106
|
tabledef td;
|
107
|
-
td.setTableName(
|
108
|
-
td.setFileName(
|
107
|
+
td.setTableName(_T("user"));
|
108
|
+
td.setFileName(_T("user.dat"));
|
109
109
|
td.id =1;
|
110
110
|
td.charsetIndex = CHARSET_UTF8B4;
|
111
111
|
def->insertTable(&td);
|
@@ -167,8 +167,8 @@ bool createGroupTableSchema(dbdef* def)
|
|
167
167
|
|
168
168
|
//Insert table
|
169
169
|
tabledef td;
|
170
|
-
td.setTableName(
|
171
|
-
td.setFileName(
|
170
|
+
td.setTableName(_T("group1"));
|
171
|
+
td.setFileName(_T("group1.dat"));
|
172
172
|
td.id = 2;
|
173
173
|
td.charsetIndex = CHARSET_UTF8B4;
|
174
174
|
def->insertTable(&td);
|
@@ -216,8 +216,8 @@ bool createPictureTableSchema(dbdef* def)
|
|
216
216
|
{
|
217
217
|
//Insert table
|
218
218
|
tabledef td;
|
219
|
-
td.setTableName(
|
220
|
-
td.setFileName(
|
219
|
+
td.setTableName(_T("picture"));
|
220
|
+
td.setFileName(_T("picture.dat"));
|
221
221
|
td.id = 3;
|
222
222
|
td.charsetIndex = CHARSET_LATIN1;
|
223
223
|
def->insertTable(&td);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include <stdio.h>
|
2
2
|
#include <bzs/db/protocol/tdap/client/database.h>
|
3
3
|
#include <bzs/db/protocol/tdap/client/table.h>
|
4
|
-
#include <bzs/db/protocol/tdap/client/
|
4
|
+
#include <bzs/db/protocol/tdap/client/dbDef.h>
|
5
5
|
|
6
6
|
|
7
7
|
using namespace bzs::db::protocol::tdap::client;
|
@@ -77,7 +77,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|
77
77
|
else
|
78
78
|
{
|
79
79
|
if (deleteUser(tbu))
|
80
|
-
_tprintf(_T("
|
80
|
+
_tprintf(_T("Delete records success. \n"));
|
81
81
|
tbu->release();
|
82
82
|
}
|
83
83
|
db->close();
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include <stdio.h>
|
2
2
|
#include <bzs/db/protocol/tdap/client/database.h>
|
3
3
|
#include <bzs/db/protocol/tdap/client/table.h>
|
4
|
-
#include <bzs/db/protocol/tdap/client/
|
4
|
+
#include <bzs/db/protocol/tdap/client/dbDef.h>
|
5
5
|
|
6
6
|
using namespace bzs::db::protocol::tdap::client;
|
7
7
|
using namespace bzs::db::protocol::tdap;
|
@@ -52,7 +52,10 @@ int _tmain(int argc, _TCHAR* argv[])
|
|
52
52
|
if (db->stat() != 0)
|
53
53
|
showError(_T("drop daatabase"), NULL, db->stat());
|
54
54
|
result = db->stat();
|
55
|
+
if (result == 0)
|
56
|
+
_tprintf(_T("Drop daatabase success. \n"));
|
55
57
|
db->close();
|
58
|
+
|
56
59
|
}
|
57
60
|
database::destroy(db);
|
58
61
|
return result;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include <stdio.h>
|
2
2
|
#include <bzs/db/protocol/tdap/client/database.h>
|
3
3
|
#include <bzs/db/protocol/tdap/client/table.h>
|
4
|
-
#include <bzs/db/protocol/tdap/client/
|
4
|
+
#include <bzs/db/protocol/tdap/client/dbDef.h>
|
5
5
|
#include <iostream>
|
6
6
|
#include <fstream>
|
7
7
|
#include <vector>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include <stdio.h>
|
2
2
|
#include <bzs/db/protocol/tdap/client/database.h>
|
3
3
|
#include <bzs/db/protocol/tdap/client/table.h>
|
4
|
-
#include <bzs/db/protocol/tdap/client/
|
4
|
+
#include <bzs/db/protocol/tdap/client/dbDef.h>
|
5
5
|
#include <vector>
|
6
6
|
|
7
7
|
using namespace bzs::db::protocol::tdap::client;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include <stdio.h>
|
2
2
|
#include <bzs/db/protocol/tdap/client/database.h>
|
3
3
|
#include <bzs/db/protocol/tdap/client/table.h>
|
4
|
-
#include <bzs/db/protocol/tdap/client/
|
4
|
+
#include <bzs/db/protocol/tdap/client/dbDef.h>
|
5
5
|
|
6
6
|
|
7
7
|
using namespace bzs::db::protocol::tdap::client;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include <stdio.h>
|
2
2
|
#include <bzs/db/protocol/tdap/client/database.h>
|
3
3
|
#include <bzs/db/protocol/tdap/client/table.h>
|
4
|
-
#include <bzs/db/protocol/tdap/client/
|
4
|
+
#include <bzs/db/protocol/tdap/client/dbDef.h>
|
5
5
|
|
6
6
|
|
7
7
|
using namespace bzs::db::protocol::tdap::client;
|
@@ -68,7 +68,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|
68
68
|
//Commit transaction. If an error throwed then abort transaction automaticaly.
|
69
69
|
trn.end();
|
70
70
|
|
71
|
-
std::cout << "
|
71
|
+
std::cout << "Update records success." << std::endl;
|
72
72
|
return 0;
|
73
73
|
}
|
74
74
|
|
@@ -147,7 +147,7 @@ connection* connections::getConnectionPipe()
|
|
147
147
|
|
148
148
|
bool connections::disconnect(connection* c)
|
149
149
|
{
|
150
|
-
if (!c) return false;
|
150
|
+
//if (!c) return false;
|
151
151
|
mutex::scoped_lock lck(m_mutex);
|
152
152
|
c->release();
|
153
153
|
if (c->refCount()==0)
|
@@ -161,8 +161,9 @@ bool connections::disconnect(connection* c)
|
|
161
161
|
}
|
162
162
|
}
|
163
163
|
delete c;
|
164
|
+
return true;
|
164
165
|
}
|
165
|
-
return
|
166
|
+
return false;
|
166
167
|
}
|
167
168
|
|
168
169
|
/** If ep is local then isUseNamedPipe is true
|
data/source/bzs/rtl/datetime.cpp
CHANGED
@@ -32,17 +32,27 @@
|
|
32
32
|
#pragma package(smart_init) // BCB package
|
33
33
|
#pragma warning(disable:4996) // VC++ unsafe function
|
34
34
|
|
35
|
-
|
36
|
-
#if (defined(_WIN32) && _MSC_VER)
|
37
|
-
|
35
|
+
#undef USETLS
|
36
|
+
#if ((defined(_WIN32) && _MSC_VER) || __APPLE__)
|
37
|
+
#define USETLS
|
38
|
+
#endif
|
39
|
+
|
40
|
+
#ifdef USETLS
|
41
|
+
extern tls_key g_tlsiID_SC3;
|
38
42
|
#else
|
39
43
|
__THREAD _TCHAR __THREAD_BCB g_date[30];
|
40
44
|
#endif
|
41
45
|
|
42
46
|
inline _TCHAR* databuf()
|
43
47
|
{
|
44
|
-
#
|
45
|
-
|
48
|
+
#ifdef USETLS
|
49
|
+
_TCHAR* p = (_TCHAR*)tls_getspecific(g_tlsiID_SC3);
|
50
|
+
if (p == NULL)
|
51
|
+
{
|
52
|
+
p = (_TCHAR*)new wchar_t[45];
|
53
|
+
tls_setspecific(g_tlsiID_SC3, p);
|
54
|
+
}
|
55
|
+
return p;
|
46
56
|
#else
|
47
57
|
return g_date;
|
48
58
|
#endif
|
@@ -1720,7 +1720,7 @@ void testStringFileter(database* db)
|
|
1720
1720
|
BOOST_CHECK_MESSAGE(0 == db->stat(), "createNewDataBase");
|
1721
1721
|
|
1722
1722
|
db->open(makeUri(PROTOCOL, HOSTNAME, _T("testString"), BDFNAME), 0, 0);
|
1723
|
-
BOOST_CHECK_MESSAGE(0 == db->stat(), "createNewDataBase 1");
|
1723
|
+
BOOST_CHECK_MESSAGE(0 == db->stat(), "createNewDataBase 1 stat = " << db->stat());
|
1724
1724
|
|
1725
1725
|
doTestStringFileter(db, 1, _T("zstring"), ft_zstring, ft_wzstring);
|
1726
1726
|
if (isUtf16leSupport(db))
|