transactd 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{BUILD_UNIX-JA → BUILD_UNIX-JA.md} +6 -6
- data/CMakeLists.txt +20 -15
- data/{README-JA → README-JA.md} +23 -23
- data/{README → README.md} +22 -24
- data/RELEASE_NOTE +120 -0
- data/RELEASE_NOTE-JA +110 -0
- data/bin/common/tdclc_32_2_4.dll +0 -0
- data/bin/common/tdclc_64_2_4.dll +0 -0
- data/build/common/get_ruby_path.cmake +1 -1
- data/build/swig/ruby/tdclrb_wrap.cpp +1319 -830
- data/build/swig/tdcl.i +22 -2
- data/build/tdclc/tdclc.cbproj +1 -1
- data/build/tdclc/tdclc.rc +4 -4
- data/build/tdclcpp/tdclcpp.rc +4 -4
- data/build/tdclcpp/tdclcpp_bc.cbproj +2 -1
- data/build/tdclrb/CMakeLists.txt +6 -1
- data/build/tdclrb/bldgem/extconf.rb +5 -1
- data/build/tdclrb/tdclrb.rc +4 -4
- data/source/bzs/db/engine/mysql/database.cpp +44 -40
- data/source/bzs/db/engine/mysql/database.h +28 -8
- data/source/bzs/db/engine/mysql/dbManager.cpp +2 -0
- data/source/bzs/db/engine/mysql/dbManager.h +2 -7
- data/source/bzs/db/engine/mysql/mysqlInternal.h +79 -7
- data/source/bzs/db/protocol/hs/hsCommandExecuter.h +5 -1
- data/source/bzs/db/protocol/tdap/client/activeTable.cpp +32 -8
- data/source/bzs/db/protocol/tdap/client/activeTable.h +17 -4
- data/source/bzs/db/protocol/tdap/client/activeTableImple.h +10 -4
- data/source/bzs/db/protocol/tdap/client/client.cpp +51 -6
- data/source/bzs/db/protocol/tdap/client/client.h +41 -11
- data/source/bzs/db/protocol/tdap/client/connMgr.cpp +51 -15
- data/source/bzs/db/protocol/tdap/client/connMgr.h +6 -1
- data/source/bzs/db/protocol/tdap/client/database.cpp +26 -5
- data/source/bzs/db/protocol/tdap/client/database.h +3 -2
- data/source/bzs/db/protocol/tdap/client/dbDef.cpp +38 -28
- data/source/bzs/db/protocol/tdap/client/dbDef.h +1 -1
- data/source/bzs/db/protocol/tdap/client/dllmain.cpp +2 -32
- data/source/bzs/db/protocol/tdap/client/field.cpp +0 -1
- data/source/bzs/db/protocol/tdap/client/filter.h +60 -33
- data/source/bzs/db/protocol/tdap/client/groupQuery.cpp +2 -5
- data/source/bzs/db/protocol/tdap/client/memRecord.cpp +9 -0
- data/source/bzs/db/protocol/tdap/client/memRecord.h +1 -0
- data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +99 -48
- data/source/bzs/db/protocol/tdap/client/nsDatabase.h +5 -2
- data/source/bzs/db/protocol/tdap/client/nsTable.cpp +76 -26
- data/source/bzs/db/protocol/tdap/client/nsTable.h +6 -4
- data/source/bzs/db/protocol/tdap/client/request.h +28 -11
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +19 -11
- data/source/bzs/db/protocol/tdap/client/table.cpp +157 -70
- data/source/bzs/db/protocol/tdap/client/table.h +20 -5
- data/source/bzs/db/protocol/tdap/client/trdboostapi.h +57 -4
- data/source/bzs/db/protocol/tdap/client/trdormapi.h +55 -20
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +65 -31
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +2 -0
- data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +24 -36
- data/source/bzs/db/protocol/tdap/mysql/request.h +1 -1
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +98 -18
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +12 -7
- data/source/bzs/db/protocol/tdap/tdapRequest.h +3 -8
- data/source/bzs/db/protocol/tdap/tdapSchema.cpp +1 -9
- data/source/bzs/db/protocol/tdap/tdapSchema.h +31 -1
- data/source/bzs/db/protocol/tdap/tdapcapi.h +49 -6
- data/source/bzs/db/protocol/tdap/uri.h +41 -6
- data/source/bzs/db/transactd/appModule.cpp +0 -1
- data/source/bzs/db/transactd/appModule.h +0 -2
- data/source/bzs/db/transactd/connManager.cpp +202 -33
- data/source/bzs/db/transactd/connManager.h +11 -4
- data/source/bzs/db/transactd/connectionRecord.h +19 -5
- data/source/bzs/db/transactd/transactd.cpp +39 -8
- data/source/bzs/env/crosscompile.cpp +1 -1
- data/source/bzs/example/queryData.cpp +1 -1
- data/source/bzs/netsvc/client/iconnection.h +2 -0
- data/source/bzs/netsvc/client/tcpClient.cpp +48 -26
- data/source/bzs/netsvc/client/tcpClient.h +171 -106
- data/source/bzs/netsvc/server/IAppModule.h +0 -1
- data/source/bzs/netsvc/server/serverPipe.cpp +5 -1
- data/source/bzs/netsvc/server/serverPipe.h +2 -1
- data/source/bzs/test/tdclatl/test_query_atl.js +105 -0
- data/source/bzs/test/tdclphp/transactd_Test.php +129 -11
- data/source/bzs/test/tdclrb/transactd_spec.rb +74 -2
- data/source/bzs/test/transactdBench/scaling_bench.cpp +1 -1
- data/source/bzs/test/trdclengn/test_trdclengn.cpp +45 -20
- data/source/global/tdclatl/Bookmark.cpp +28 -0
- data/source/global/tdclatl/Bookmark.h +65 -0
- data/source/global/tdclatl/Database.cpp +2 -2
- data/source/global/tdclatl/Database.h +1 -3
- data/source/global/tdclatl/DbDef.cpp +6 -0
- data/source/global/tdclatl/DbDef.h +1 -0
- data/source/global/tdclatl/QueryBase.cpp +29 -0
- data/source/global/tdclatl/QueryBase.h +4 -0
- data/source/global/tdclatl/Record.cpp +14 -2
- data/source/global/tdclatl/Record.h +1 -1
- data/source/global/tdclatl/Table.cpp +80 -16
- data/source/global/tdclatl/Table.h +23 -8
- data/source/global/tdclatl/_IDatabaseEvents_CP.h +39 -0
- data/source/global/tdclatl/activeTable.cpp +2 -2
- data/source/global/tdclatl/activeTable.h +1 -1
- data/source/global/tdclatl/tdclatl.idl +64 -14
- metadata +12 -12
- data/bin/common/tdclc_32_2_3.dll +0 -0
- data/bin/common/tdclc_64_2_3.dll +0 -0
- data/build/tdclcpp/BUILDNUMBER.txt +0 -1
- data/build/tdclrb/BUILDNUMBER.txt +0 -1
- /data/{BUILD_WIN-JA → BUILD_WIN-JA.md} +0 -0
- /data/{README_ORMSRCGEN-JA → README_ORMSRCGEN-JA.md} +0 -0
- /data/{README_ORMSRCGEN → README_ORMSRCGEN.md} +0 -0
@@ -269,6 +269,8 @@ int dbExecuter::errorCode(int ha_error)
|
|
269
269
|
return STATUS_CANNOT_LOCK_TABLE;
|
270
270
|
else if(ha_error == ER_BAD_DB_ERROR)
|
271
271
|
return ERROR_NO_DATABASE;
|
272
|
+
else if(ha_error == ER_NO_SUCH_TABLE)
|
273
|
+
return STATUS_TABLE_NOTOPEN;
|
272
274
|
return MYSQL_ERROR_OFFSET + ha_error;
|
273
275
|
}
|
274
276
|
|
@@ -475,7 +477,7 @@ inline bool dbExecuter::doCreateTable(request& req)
|
|
475
477
|
|
476
478
|
|
477
479
|
// open table and assign handle
|
478
|
-
inline bool dbExecuter::doOpenTable(request& req)
|
480
|
+
inline bool dbExecuter::doOpenTable(request& req, bool reconnect)
|
479
481
|
{
|
480
482
|
database* db;
|
481
483
|
bool ret = getDatabaseWithAuth(req, &db);
|
@@ -494,7 +496,8 @@ inline bool dbExecuter::doOpenTable(request& req)
|
|
494
496
|
}
|
495
497
|
// if error occured that throw no exception
|
496
498
|
tb = db->openTable(getTableName(req), req.keyNum, getOwnerName(req));
|
497
|
-
|
499
|
+
if (db->stat())
|
500
|
+
req.result = (short_td)errorCode(db->stat());
|
498
501
|
}
|
499
502
|
|
500
503
|
if (tb)
|
@@ -505,7 +508,16 @@ inline bool dbExecuter::doOpenTable(request& req)
|
|
505
508
|
uint hdl = addHandle(getDatabaseID(req.cid), tb->id());
|
506
509
|
m_tb = getTable(hdl);
|
507
510
|
req.pbk->handle = hdl;
|
508
|
-
|
511
|
+
if (!reconnect)
|
512
|
+
{
|
513
|
+
ushort_td len = m_tb->posPtrLen();
|
514
|
+
if ((m_tb->tableFlags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) && !m_tb->primaryKey())
|
515
|
+
len = 0xFFFF;
|
516
|
+
memcpy(req.data, &len , sizeof(ushort_td));
|
517
|
+
req.resultLen = sizeof(ushort_td);
|
518
|
+
req.paramMask = P_MASK_POSBLK | P_MASK_DATA | P_MASK_DATALEN;
|
519
|
+
}else
|
520
|
+
req.paramMask = P_MASK_POSBLK;
|
509
521
|
}
|
510
522
|
catch (bzs::rtl::exception& e)
|
511
523
|
{
|
@@ -686,7 +698,7 @@ inline int dbExecuter::doReadMulti(request& req, int op,
|
|
686
698
|
bool execPrepared = (ereq->itype & FILTER_TYPE_SUPPLYVALUE) != 0;
|
687
699
|
|
688
700
|
bool forword = (op == TD_KEY_NEXT_MULTI) || (op == TD_POS_NEXT_MULTI);
|
689
|
-
if (op == TD_KEY_SEEK_MULTI)
|
701
|
+
if (op == TD_KEY_SEEK_MULTI && !(ereq->itype & FILTER_TYPE_SEEKS_BOOKMARKS))
|
690
702
|
{
|
691
703
|
char keynum = m_tb->keyNumByMakeOrder(req.keyNum);
|
692
704
|
if (!m_tb->setKeyNum(keynum))
|
@@ -713,8 +725,14 @@ inline int dbExecuter::doReadMulti(request& req, int op,
|
|
713
725
|
if (req.result != 0)
|
714
726
|
return ret;
|
715
727
|
if (op == TD_KEY_SEEK_MULTI)
|
716
|
-
|
717
|
-
|
728
|
+
{
|
729
|
+
if (ereq->itype & FILTER_TYPE_SEEKS_BOOKMARKS)
|
730
|
+
req.result =
|
731
|
+
errorCodeSht(seekBookmarkEach((extRequestSeeks*)req.data, noBookmark));
|
732
|
+
else
|
733
|
+
req.result =
|
734
|
+
errorCodeSht(seekEach((extRequestSeeks*)req.data, noBookmark));
|
735
|
+
}
|
718
736
|
else
|
719
737
|
{
|
720
738
|
if (op == TD_KEY_NEXT_MULTI)
|
@@ -769,6 +787,34 @@ inline __int64 intValue(const unsigned char* p, int len)
|
|
769
787
|
return 0;
|
770
788
|
}
|
771
789
|
|
790
|
+
//FILTER_TYPE_SEEKS_BOOKMARKS
|
791
|
+
inline short dbExecuter::seekBookmarkEach(extRequestSeeks* ereq, bool noBookmark)
|
792
|
+
{
|
793
|
+
short stat = 0;
|
794
|
+
seek* fd = &ereq->seekData;
|
795
|
+
|
796
|
+
for (int i = 0; i < ereq->logicalCount; ++i)
|
797
|
+
{
|
798
|
+
m_tb->movePos((uchar*)fd->ptr, -1);
|
799
|
+
if (m_tb->stat() == 0)
|
800
|
+
{
|
801
|
+
if (noBookmark)
|
802
|
+
stat = m_readHandler->write((const unsigned char *)_T("dummy"), 0);
|
803
|
+
else
|
804
|
+
stat =
|
805
|
+
m_readHandler->write(m_tb->position(), m_tb->posPtrLen());
|
806
|
+
}
|
807
|
+
else
|
808
|
+
stat = m_readHandler->write(NULL, 0);
|
809
|
+
if (stat)
|
810
|
+
break;
|
811
|
+
fd = fd->next();
|
812
|
+
}
|
813
|
+
if (stat == 0)
|
814
|
+
stat = STATUS_REACHED_FILTER_COND;
|
815
|
+
return stat;
|
816
|
+
}
|
817
|
+
|
772
818
|
inline short dbExecuter::seekEach(extRequestSeeks* ereq, bool noBookmark)
|
773
819
|
{
|
774
820
|
|
@@ -1184,7 +1230,7 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
|
|
1184
1230
|
break;
|
1185
1231
|
case TD_RECONNECT:
|
1186
1232
|
|
1187
|
-
if (!doOpenTable(req))
|
1233
|
+
if (!doOpenTable(req, true))
|
1188
1234
|
{
|
1189
1235
|
req.result = ERROR_TD_INVALID_CLINETHOST;
|
1190
1236
|
break;
|
@@ -1337,8 +1383,15 @@ int dbExecuter::commandExec(request& req, netsvc::server::netWriter* nw)
|
|
1337
1383
|
m_tb = getTable(req.pbk->handle);
|
1338
1384
|
if (m_tb)
|
1339
1385
|
{
|
1386
|
+
std::string tbname = m_tb->name();
|
1340
1387
|
m_tb->close();
|
1341
1388
|
m_tb = NULL;
|
1389
|
+
if ((req.keyNum == CR_SUBOP_DROP) && (tbname == TRANSACTD_SCHEMANAME))
|
1390
|
+
{
|
1391
|
+
database* db = getDatabaseCid(req.cid);
|
1392
|
+
req.result = ddl_dropTable(db, tbname, db->name(), tbname);
|
1393
|
+
}
|
1394
|
+
|
1342
1395
|
}
|
1343
1396
|
break;
|
1344
1397
|
case TD_BUILD_INDEX:
|
@@ -1528,21 +1581,43 @@ connMgrExecuter::connMgrExecuter(request& req, unsigned __int64 parent)
|
|
1528
1581
|
{
|
1529
1582
|
}
|
1530
1583
|
|
1584
|
+
int serialize(request& req, char* buf, size_t& size, const connManager::records& records, short stat)
|
1585
|
+
{
|
1586
|
+
req.reset();
|
1587
|
+
req.paramMask = P_MASK_DATA | P_MASK_DATALEN;
|
1588
|
+
if (records.size())
|
1589
|
+
req.data = (void*)&records[0];
|
1590
|
+
else
|
1591
|
+
req.paramMask = P_MASK_DATALEN;
|
1592
|
+
req.resultLen = (uint_td)(sizeof(record) * records.size());
|
1593
|
+
req.result = stat;
|
1594
|
+
size = req.serialize(NULL, buf);
|
1595
|
+
return EXECUTE_RESULT_SUCCESS;
|
1596
|
+
}
|
1597
|
+
|
1531
1598
|
int connMgrExecuter::read(char* buf, size_t& size)
|
1532
1599
|
{
|
1533
1600
|
connManager st(m_modHandle);
|
1534
1601
|
unsigned __int64* mod = (unsigned __int64*)m_req.keybuf;
|
1602
|
+
return serialize(m_req, buf, size, st.getRecords(mod[0], (int)mod[1]), st.stat());
|
1603
|
+
}
|
1535
1604
|
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
return
|
1605
|
+
int connMgrExecuter::definedDatabaseList(char* buf, size_t& size)
|
1606
|
+
{
|
1607
|
+
connManager st(m_modHandle);
|
1608
|
+
return serialize(m_req, buf, size, st.getDefinedDatabaseList(), st.stat());
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
int connMgrExecuter::systemVariables(char* buf, size_t& size)
|
1612
|
+
{
|
1613
|
+
connManager st(m_modHandle);
|
1614
|
+
return serialize(m_req, buf, size, st.systemVariables(), st.stat());
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
int connMgrExecuter::schemaTableList(char* buf, size_t& size)
|
1618
|
+
{
|
1619
|
+
connManager st(m_modHandle);
|
1620
|
+
return serialize(m_req, buf, size, st.schemaTableList((const char*)m_req.keybuf), st.stat());
|
1546
1621
|
}
|
1547
1622
|
|
1548
1623
|
int connMgrExecuter::disconnectOne(char* buf, size_t& size)
|
@@ -1558,7 +1633,6 @@ int connMgrExecuter::disconnectOne(char* buf, size_t& size)
|
|
1558
1633
|
int connMgrExecuter::disconnectAll(char* buf, size_t& size)
|
1559
1634
|
{
|
1560
1635
|
connManager st(m_modHandle);
|
1561
|
-
|
1562
1636
|
st.disconnectAll();
|
1563
1637
|
m_req.reset();
|
1564
1638
|
size = m_req.serialize(NULL, buf);
|
@@ -1573,6 +1647,12 @@ int connMgrExecuter::commandExec(netsvc::server::netWriter* nw)
|
|
1573
1647
|
return disconnectOne(nw->ptr(), nw->datalen);
|
1574
1648
|
else if (m_req.keyNum == TD_STSTCS_DISCONNECT_ALL)
|
1575
1649
|
return disconnectAll(nw->ptr(), nw->datalen);
|
1650
|
+
else if(m_req.keyNum == TD_STSTCS_DATABASE_LIST)
|
1651
|
+
return definedDatabaseList(nw->ptr(), nw->datalen);
|
1652
|
+
else if(m_req.keyNum == TD_STSTCS_SYSTEM_VARIABLES)
|
1653
|
+
return systemVariables(nw->ptr(), nw->datalen);
|
1654
|
+
else if(m_req.keyNum == TD_STSTCS_SCHEMA_TABLE_LIST)
|
1655
|
+
return schemaTableList(nw->ptr(), nw->datalen);
|
1576
1656
|
return 0;
|
1577
1657
|
}
|
1578
1658
|
|
@@ -43,7 +43,6 @@ namespace db
|
|
43
43
|
{
|
44
44
|
class blobBuffer;
|
45
45
|
namespace engine{namespace mysql{class database;}}
|
46
|
-
|
47
46
|
namespace protocol
|
48
47
|
{
|
49
48
|
namespace tdap
|
@@ -72,7 +71,7 @@ class dbExecuter : public engine::mysql::dbManager
|
|
72
71
|
std::string makeSQLcreateTable(const request& req);
|
73
72
|
bool connect(request& req);
|
74
73
|
inline bool doCreateTable(request& req);
|
75
|
-
inline bool doOpenTable(request& req);
|
74
|
+
inline bool doOpenTable(request& req, bool reconnect=false);
|
76
75
|
inline void doSeekKey(request& req, int op, engine::mysql::rowLockMode* lock);
|
77
76
|
inline void doMoveFirst(request& req, engine::mysql::rowLockMode* lock);
|
78
77
|
inline void doMoveKey(request& req, int op, engine::mysql::rowLockMode* lock);
|
@@ -89,6 +88,7 @@ class dbExecuter : public engine::mysql::dbManager
|
|
89
88
|
inline void doInsertBulk(request& req);
|
90
89
|
inline void doStat(request& req);
|
91
90
|
inline short seekEach(extRequestSeeks* ereq, bool noBookMark);
|
91
|
+
inline short seekBookmarkEach(extRequestSeeks* ereq, bool noBookmark);
|
92
92
|
inline bool doAuthentication(request& req, engine::mysql::database* db);
|
93
93
|
bool getDatabaseWithAuth(request& req, engine::mysql::database** db, bool connect=false);
|
94
94
|
public:
|
@@ -97,7 +97,7 @@ public:
|
|
97
97
|
int commandExec(request& req, netsvc::server::netWriter* nw);
|
98
98
|
size_t getAcceptMessage(char* message, size_t size);
|
99
99
|
int errorCode(int ha_error);
|
100
|
-
short_td errorCodeSht(int ha_error)
|
100
|
+
inline short_td errorCodeSht(int ha_error)
|
101
101
|
{
|
102
102
|
return (short_td)errorCode(ha_error);
|
103
103
|
}
|
@@ -111,11 +111,14 @@ class connMgrExecuter
|
|
111
111
|
request& m_req;
|
112
112
|
__int64 m_modHandle;
|
113
113
|
|
114
|
-
|
115
|
-
|
114
|
+
int definedDatabaseList(char* buf, size_t& size);
|
115
|
+
int schemaTableList(char* buf, size_t& size);
|
116
|
+
int systemVariables(char* buf, size_t& size);
|
116
117
|
int read(char* buf, size_t& size);
|
117
118
|
int disconnectOne(char* buf, size_t& size);
|
118
119
|
int disconnectAll(char* buf, size_t& size);
|
120
|
+
public:
|
121
|
+
connMgrExecuter(request& req, unsigned __int64 parent);
|
119
122
|
int commandExec(netsvc::server::netWriter* nw);
|
120
123
|
};
|
121
124
|
|
@@ -150,9 +153,11 @@ public:
|
|
150
153
|
|
151
154
|
bool isShutDown() { return m_dbExec->isShutDown(); }
|
152
155
|
|
153
|
-
void cleanup(){}
|
156
|
+
void cleanup(){}
|
157
|
+
|
158
|
+
const engine::mysql::databases& dbs() const { return m_dbExec->dbs(); }
|
154
159
|
|
155
|
-
|
160
|
+
boost::mutex& mutex() { return m_dbExec->mutex(); }
|
156
161
|
};
|
157
162
|
|
158
163
|
} // namespace mysql
|
@@ -82,8 +82,6 @@ namespace client {class table;}
|
|
82
82
|
P_MASK_POSBLK | P_MASK_DATA | P_MASK_DATALEN | P_MASK_KEYBUF
|
83
83
|
#define P_MASK_INS_AUTOINC P_MASK_MOVPOS
|
84
84
|
|
85
|
-
#pragma pack(push, 1)
|
86
|
-
pragma_pack1;
|
87
85
|
|
88
86
|
|
89
87
|
#define CLIENTID_SIZE 2
|
@@ -99,6 +97,8 @@ typedef void*(__STDCALL* DDBA_PTR)(client::table* tb, uint_td size);
|
|
99
97
|
|
100
98
|
/** tdap version info struct
|
101
99
|
*/
|
100
|
+
#pragma pack(push, 1)
|
101
|
+
pragma_pack1;
|
102
102
|
|
103
103
|
struct version
|
104
104
|
{
|
@@ -107,9 +107,6 @@ struct version
|
|
107
107
|
uchar_td Type;
|
108
108
|
};
|
109
109
|
|
110
|
-
#pragma pack(push, 1)
|
111
|
-
pragma_pack1;
|
112
|
-
|
113
110
|
struct posblk
|
114
111
|
{
|
115
112
|
posblk() { memset(this, 0, sizeof(posblk)); }
|
@@ -120,9 +117,7 @@ struct posblk
|
|
120
117
|
unsigned char lock;
|
121
118
|
unsigned char bookmarkLen;
|
122
119
|
char bookmark[1]; //dummy array
|
123
|
-
};
|
124
|
-
#pragma pack(pop)
|
125
|
-
pragma_pop;
|
120
|
+
};
|
126
121
|
|
127
122
|
struct clientID
|
128
123
|
{
|
@@ -275,15 +275,7 @@ const char* tabledef::toChar(char* buf, const char* s, int size)
|
|
275
275
|
|
276
276
|
#endif // NOT _UNICODE
|
277
277
|
|
278
|
-
|
279
|
-
{
|
280
|
-
return ((type == ft_string) || (type == ft_zstring) ||
|
281
|
-
(type == ft_wstring) || (type == ft_wzstring) ||
|
282
|
-
(type == ft_myvarchar) || (type == ft_myvarbinary) ||
|
283
|
-
(type == ft_mywvarchar) || (type == ft_mywvarbinary) ||
|
284
|
-
(type == ft_myblob) || (type == ft_mytext) || (type == ft_mychar) ||
|
285
|
-
(type == ft_mywchar) || (type == ft_lstring) || (type == ft_note));
|
286
|
-
}
|
278
|
+
|
287
279
|
|
288
280
|
bool fielddef::isStringType() const
|
289
281
|
{
|
@@ -182,7 +182,37 @@ PACKAGE ushort_td
|
|
182
182
|
#endif // MYSQL_DYNAMIC_PLUGIN
|
183
183
|
|
184
184
|
/* Is field type string ? */
|
185
|
-
|
185
|
+
inline bool isStringTypeForIndex(uchar_td type)
|
186
|
+
{
|
187
|
+
switch (type)
|
188
|
+
{
|
189
|
+
case ft_string:
|
190
|
+
case ft_zstring:
|
191
|
+
case ft_wstring:
|
192
|
+
case ft_wzstring:
|
193
|
+
case ft_mychar:
|
194
|
+
case ft_mywchar:
|
195
|
+
case ft_myvarchar:
|
196
|
+
case ft_myvarbinary:
|
197
|
+
case ft_mywvarchar:
|
198
|
+
case ft_mywvarbinary:
|
199
|
+
return true;
|
200
|
+
}
|
201
|
+
return false;
|
202
|
+
}
|
203
|
+
|
204
|
+
inline bool isStringType(uchar_td type)
|
205
|
+
{
|
206
|
+
switch (type)
|
207
|
+
{
|
208
|
+
case ft_myblob:
|
209
|
+
case ft_mytext:
|
210
|
+
case ft_lstring:
|
211
|
+
case ft_note:
|
212
|
+
return true;
|
213
|
+
}
|
214
|
+
return isStringTypeForIndex(type);
|
215
|
+
}
|
186
216
|
|
187
217
|
/** @cond INTERNAL */
|
188
218
|
#define PAD_CHAR_OPTION_SAVED 1
|
@@ -29,11 +29,23 @@ typedef void void_td;
|
|
29
29
|
typedef short short_td;
|
30
30
|
typedef unsigned char uchar_td;
|
31
31
|
typedef char char_td;
|
32
|
-
typedef uint_td bookmark_td;
|
33
32
|
typedef int percentage_td;
|
34
|
-
|
35
33
|
typedef ushort_td keylen_td;
|
36
34
|
|
35
|
+
/* Wnen change MAX_BOOKMARK_SIZE, database.h REF_SIZE_MAX too */
|
36
|
+
#define MAX_BOOKMARK_SIZE 112 // innodb unique key max 767 byte
|
37
|
+
struct BOOKMARK
|
38
|
+
{
|
39
|
+
uchar_td val[MAX_BOOKMARK_SIZE];
|
40
|
+
bool empty;
|
41
|
+
BOOKMARK():empty(true){}
|
42
|
+
bool isEmpty()
|
43
|
+
{
|
44
|
+
return empty;
|
45
|
+
}
|
46
|
+
};
|
47
|
+
typedef BOOKMARK bookmark_td;
|
48
|
+
|
37
49
|
/** tdap c interface
|
38
50
|
*/
|
39
51
|
#if (defined(__BORLANDC__) && !defined(__clang__))
|
@@ -64,6 +76,7 @@ typedef short_td(__STDCALL* DLLUNLOADCALLBACK_PTR)(dllUnloadCallback func);
|
|
64
76
|
/** buffer size
|
65
77
|
*/
|
66
78
|
#define POS_BLOCK_SIZE 128
|
79
|
+
#define BTRV_BOOKMARK_SIZE 4
|
67
80
|
#ifndef MAX_KEYLEN
|
68
81
|
#define MAX_KEYLEN 0X3FF // 1023
|
69
82
|
#endif
|
@@ -167,7 +180,9 @@ typedef short_td(__STDCALL* DLLUNLOADCALLBACK_PTR)(dllUnloadCallback func);
|
|
167
180
|
#define TD_STSTCS_READ 0
|
168
181
|
#define TD_STSTCS_DISCONNECT_ONE 1
|
169
182
|
#define TD_STSTCS_DISCONNECT_ALL 2
|
170
|
-
|
183
|
+
#define TD_STSTCS_DATABASE_LIST 3
|
184
|
+
#define TD_STSTCS_SYSTEM_VARIABLES 4
|
185
|
+
#define TD_STSTCS_SCHEMA_TABLE_LIST 5
|
171
186
|
/** connect sub operation
|
172
187
|
*/
|
173
188
|
|
@@ -394,6 +409,13 @@ typedef short_td(__STDCALL* DLLUNLOADCALLBACK_PTR)(dllUnloadCallback func);
|
|
394
409
|
#define ERROR_TD_C_CLIENT_UNKNOWN 3811
|
395
410
|
#define ERROR_TD_RECONNECTED 3900
|
396
411
|
|
412
|
+
inline bool canRecoverNetError(short code)
|
413
|
+
{
|
414
|
+
return (code >= ERROR_TD_CONNECTION_FAILURE) &&
|
415
|
+
(code < ERROR_TD_RECONNECTED) &&
|
416
|
+
(code != ERROR_TD_NET_TOO_BIGDATA);
|
417
|
+
}
|
418
|
+
|
397
419
|
|
398
420
|
#define TRANSACTD_SCHEMANAME _T("transactd_schema")
|
399
421
|
#define TYPE_SCHEMA_BDF 0
|
@@ -401,6 +423,7 @@ typedef short_td(__STDCALL* DLLUNLOADCALLBACK_PTR)(dllUnloadCallback func);
|
|
401
423
|
|
402
424
|
#define FILTER_CURRENT_TYPE_NOTINC 0
|
403
425
|
#define FILTER_CURRENT_TYPE_INC 1
|
426
|
+
#define FILTER_TYPE_SEEKS_BOOKMARKS 1 //with FILTER_TYPE_SEEKS only
|
404
427
|
#define FILTER_CURRENT_TYPE_NOBOOKMARK 2
|
405
428
|
#define FILTER_TYPE_SUPPLYVALUE 4
|
406
429
|
#define FILTER_TYPE_FORWORD 4 //at preparing only
|
@@ -453,13 +476,33 @@ struct handshale_t
|
|
453
476
|
|
454
477
|
#define HST_OPTION_NO_SCRAMBLE 1
|
455
478
|
|
479
|
+
/* server system variables index */
|
480
|
+
#define TD_VER_DB 0
|
481
|
+
#define TD_VER_SERVER 1
|
482
|
+
#define TD_VAR_LISTENADDRESS 2
|
483
|
+
#define TD_VAR_LISTENPORT 3
|
484
|
+
#define TD_VAR_HOSTCHECKNAME 4
|
485
|
+
#define TD_VAR_MAXTCPCONNECTIONS 5
|
486
|
+
#define TD_VAR_TABLENAMELOWER 6
|
487
|
+
#define TD_VAR_POOLTHREADS 7
|
488
|
+
#define TD_VAR_TCPSERVERTYPE 8
|
489
|
+
#define TD_VAR_LOCKWAITTIMEOUT 9
|
490
|
+
#define TD_VAR_ISOLATION 10
|
491
|
+
#define TD_VAR_AUTHTYPE 11
|
492
|
+
#define TD_VAR_PIPESHAREMEMSIZE 12
|
493
|
+
#define TD_VAR_MAXPIPECONNECTIONS 13
|
494
|
+
#define TD_VAR_USEPIPE 14
|
495
|
+
#define TD_VAR_HSLISTENPORT 15
|
496
|
+
#define TD_VAR_USEHS 16
|
497
|
+
#define TD_VAR_SIZE 17
|
498
|
+
|
456
499
|
/** @endcond */
|
457
500
|
|
458
501
|
/* In the case of "tdclcppxxx" library of msvc, The ($TargetName) is not changed automatically.
|
459
502
|
If you change this version then you need change The ($TargetName) project options too.
|
460
503
|
*/
|
461
504
|
#define C_INTERFACE_VER_MAJOR "2"//##1 Build marker! Don't remove
|
462
|
-
#define C_INTERFACE_VER_MINOR "
|
505
|
+
#define C_INTERFACE_VER_MINOR "4"//##2 Build marker! Don't remove
|
463
506
|
#define C_INTERFACE_VER_RELEASE "0"//##3 Build marker! Don't remove
|
464
507
|
|
465
508
|
/* dnamic load library name.
|
@@ -523,7 +566,7 @@ struct handshale_t
|
|
523
566
|
*/
|
524
567
|
|
525
568
|
#define CPP_INTERFACE_VER_MAJOR "2"//##4 Build marker! Don't remove
|
526
|
-
#define CPP_INTERFACE_VER_MINOR "
|
569
|
+
#define CPP_INTERFACE_VER_MINOR "4"//##5 Build marker! Don't remove
|
527
570
|
#define CPP_INTERFACE_VER_RELEASE "0"//##6 Build marker! Don't remove
|
528
571
|
|
529
572
|
/* use autolink tdclcpp */
|
@@ -540,7 +583,7 @@ struct handshale_t
|
|
540
583
|
#endif
|
541
584
|
|
542
585
|
#define TRANSACTD_VER_MAJOR 2//##7 Build marker! Don't remove
|
543
|
-
#define TRANSACTD_VER_MINOR
|
586
|
+
#define TRANSACTD_VER_MINOR 4//##8 Build marker! Don't remove
|
544
587
|
#define TRANSACTD_VER_RELEASE 0//##9 Build marker! Don't remove
|
545
588
|
|
546
589
|
#endif // BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H
|
@@ -49,12 +49,14 @@ inline const _TCHAR* protocol(const _TCHAR* uri)
|
|
49
49
|
st = _tcsstr(uri, _T("btrv://"));
|
50
50
|
return _T("btrv");
|
51
51
|
}
|
52
|
-
return _T("");
|
53
52
|
}
|
54
53
|
|
55
|
-
inline
|
54
|
+
inline void endPoint(const _TCHAR* uri,
|
55
|
+
_TCHAR* host, size_t hostSize,
|
56
|
+
_TCHAR* port, size_t portSize)
|
56
57
|
{
|
57
|
-
|
58
|
+
if (host) host[0] = 0x00;
|
59
|
+
if (port) port[0] = 0x00;
|
58
60
|
const _TCHAR* st = _tcsstr(uri, _T("@"));
|
59
61
|
if (st)
|
60
62
|
++st;
|
@@ -65,13 +67,46 @@ inline const _TCHAR* hostName(const _TCHAR* uri, _TCHAR* buf, size_t size)
|
|
65
67
|
}
|
66
68
|
if (st)
|
67
69
|
{
|
68
|
-
const _TCHAR* en = _tcsstr(st, _T("
|
70
|
+
const _TCHAR* en = _tcsstr(st, _T(":"));
|
69
71
|
if (en && en > st)
|
70
72
|
{
|
71
|
-
|
72
|
-
|
73
|
+
if (host)
|
74
|
+
{
|
75
|
+
_tcsncpy_s(host, hostSize, st, en - st);
|
76
|
+
host[en - st] = 0x00;
|
77
|
+
}
|
78
|
+
if (port)
|
79
|
+
{
|
80
|
+
st = en + 1;
|
81
|
+
en = _tcsstr(st, _T("/"));
|
82
|
+
if (en && en > st)
|
83
|
+
{
|
84
|
+
_tcsncpy_s(port, portSize, st, en - st);
|
85
|
+
port[en - st] = 0x00;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
else if (host)
|
90
|
+
{
|
91
|
+
en = _tcsstr(st, _T("/"));
|
92
|
+
if (en && en > st)
|
93
|
+
{
|
94
|
+
_tcsncpy_s(host, hostSize, st, en - st);
|
95
|
+
host[en - st] = 0x00;
|
96
|
+
}
|
73
97
|
}
|
74
98
|
}
|
99
|
+
}
|
100
|
+
|
101
|
+
inline const _TCHAR* hostName(const _TCHAR* uri, _TCHAR* buf, size_t size)
|
102
|
+
{
|
103
|
+
endPoint(uri, buf, size, NULL, 0);
|
104
|
+
return buf;
|
105
|
+
}
|
106
|
+
|
107
|
+
inline const _TCHAR* port(const _TCHAR* uri, _TCHAR* buf, size_t size)
|
108
|
+
{
|
109
|
+
endPoint(uri, NULL, 0, buf, size);
|
75
110
|
return buf;
|
76
111
|
}
|
77
112
|
|
@@ -442,7 +442,6 @@ int module::execute(netsvc::server::IResultBuffer& result, size_t& size,
|
|
442
442
|
{
|
443
443
|
m_commandExecuter->parse(m_readBuf, m_readSize);
|
444
444
|
m_nw->reset(&result, optionalData);
|
445
|
-
boost::mutex::scoped_lock lck(m_mutex);
|
446
445
|
int ret = m_commandExecuter->execute(m_nw);
|
447
446
|
if (m_useThreadPool)
|
448
447
|
cleanup();
|
@@ -41,7 +41,6 @@ namespace transactd
|
|
41
41
|
class module : public netsvc::server::IAppModule, private boost::noncopyable
|
42
42
|
{
|
43
43
|
friend class connManager;
|
44
|
-
mutable boost::mutex m_mutex;
|
45
44
|
boost::shared_ptr<protocol::ICommandExecuter> m_commandExecuter;
|
46
45
|
const boost::asio::ip::tcp::endpoint m_endpoint;
|
47
46
|
bzs::netsvc::server::iconnection* m_connection;
|
@@ -63,7 +62,6 @@ public:
|
|
63
62
|
bool isShutDown() { return m_commandExecuter->isShutDown(); }
|
64
63
|
bool checkHost(const char* hostCheckname, /*out*/char* hostName, int size);
|
65
64
|
void disconnect();
|
66
|
-
boost::mutex& mutex() const { return m_mutex; };
|
67
65
|
};
|
68
66
|
|
69
67
|
} // namespace transactd
|