transactd 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/BUILD_UNIX-JA +6 -6
- data/README +16 -16
- data/README-JA +16 -16
- data/bin/common/tdclc_32_2_1.dll +0 -0
- data/bin/common/tdclc_64_2_1.dll +0 -0
- data/build/common/transactd_cl_common.cmake +0 -1
- data/build/common/transactd_common.cmake +28 -38
- data/build/swig/ruby/ruby.swg +36 -30
- data/build/swig/ruby/tdclrb_wrap.cpp +35016 -0
- data/build/swig/tdcl.i +217 -62
- data/build/tdclc/CMakeLists.txt +14 -26
- data/build/tdclc/libtdclcm.map +4 -0
- data/build/tdclc/tdclc.cbproj +1 -1
- data/build/tdclc/tdclc.rc +0 -0
- data/build/tdclcpp/CMakeLists.txt +7 -22
- data/build/tdclcpp/tdclcpp.rc +0 -0
- data/build/tdclcpp/tdclcpp_bc.cbproj +1 -1
- data/build/tdclrb/CMakeLists.txt +7 -49
- data/build/tdclrb/tdclrb.rc +62 -0
- data/source/bzs/db/blobBuffer.h +5 -0
- data/source/bzs/db/blobStructs.h +2 -0
- data/source/bzs/db/engine/mysql/IReadRecords.h +9 -0
- data/source/bzs/db/engine/mysql/database.cpp +391 -169
- data/source/bzs/db/engine/mysql/database.h +178 -40
- data/source/bzs/db/engine/mysql/dbManager.cpp +45 -3
- data/source/bzs/db/engine/mysql/dbManager.h +3 -39
- data/source/bzs/db/engine/mysql/errorMessage.cpp +11 -7
- data/source/bzs/db/engine/mysql/errorMessage.h +1 -1
- data/source/bzs/db/engine/mysql/mydebuglog.cpp +1 -2
- data/source/bzs/db/engine/mysql/mysqlInternal.h +8 -8
- data/source/bzs/db/engine/mysql/mysqlThd.cpp +11 -0
- data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +1 -1
- data/source/bzs/db/protocol/tdap/client/activeTable.cpp +41 -6
- data/source/bzs/db/protocol/tdap/client/activeTable.h +177 -8
- data/source/bzs/db/protocol/tdap/client/activeTableImple.h +141 -62
- data/source/bzs/db/protocol/tdap/client/client.cpp +39 -35
- data/source/bzs/db/protocol/tdap/client/client.h +52 -25
- data/source/bzs/db/protocol/tdap/client/connectionPool.cpp +17 -0
- data/source/bzs/db/protocol/tdap/client/connectionPool.h +1 -0
- data/source/bzs/db/protocol/tdap/client/database.cpp +5 -1
- data/source/bzs/db/protocol/tdap/client/database.h +1 -1
- data/source/bzs/db/protocol/tdap/client/databaseFactory.cpp +49 -12
- data/source/bzs/db/protocol/tdap/client/databaseManager.h +42 -5
- data/source/bzs/db/protocol/tdap/client/dbDef.cpp +4 -2
- data/source/bzs/db/protocol/tdap/client/dllmain.cpp +71 -41
- data/source/bzs/db/protocol/tdap/client/errorMessage_ja.cpp +49 -49
- data/source/bzs/db/protocol/tdap/client/field.cpp +22 -13
- data/source/bzs/db/protocol/tdap/client/field.h +7 -3
- data/source/bzs/db/protocol/tdap/client/fieldDDF.cpp +1 -1
- data/source/bzs/db/protocol/tdap/client/fieldNameAlias.cpp +0 -1
- data/source/bzs/db/protocol/tdap/client/fieldNameAlias.h +1 -0
- data/source/bzs/db/protocol/tdap/client/fields.h +111 -24
- data/source/bzs/db/protocol/tdap/client/fileDDF.cpp +1 -1
- data/source/bzs/db/protocol/tdap/client/filter.h +687 -310
- data/source/bzs/db/protocol/tdap/client/groupQuery.cpp +12 -4
- data/source/bzs/db/protocol/tdap/client/indexDDF.cpp +1 -1
- data/source/bzs/db/protocol/tdap/client/memRecord.cpp +190 -32
- data/source/bzs/db/protocol/tdap/client/memRecord.h +64 -22
- data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +4 -4
- data/source/bzs/db/protocol/tdap/client/nsDatabase.h +4 -2
- data/source/bzs/db/protocol/tdap/client/nsTable.cpp +6 -3
- data/source/bzs/db/protocol/tdap/client/nsTable.h +1 -1
- data/source/bzs/db/protocol/tdap/client/pooledDatabaseManager.h +19 -8
- data/source/bzs/db/protocol/tdap/client/recordsetImple.h +194 -87
- data/source/bzs/db/protocol/tdap/client/request.h +84 -26
- data/source/bzs/db/protocol/tdap/client/stringConverter.h +22 -12
- data/source/bzs/db/protocol/tdap/client/table.cpp +494 -286
- data/source/bzs/db/protocol/tdap/client/table.h +48 -5
- data/source/bzs/db/protocol/tdap/client/trdboostapi.h +133 -87
- data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +22 -22
- data/source/bzs/db/protocol/tdap/client/trdormapi.h +43 -18
- data/source/bzs/db/protocol/tdap/client/trnsctcl.def +3 -3
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +1 -0
- data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +268 -74
- data/source/bzs/db/protocol/tdap/mysql/request.h +4 -4
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +179 -43
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +4 -4
- data/source/bzs/db/protocol/tdap/tdapRequest.h +15 -14
- data/source/bzs/db/protocol/tdap/tdapSchema.h +125 -90
- data/source/bzs/db/protocol/tdap/tdapcapi.h +46 -5
- data/source/bzs/db/transactd/appModule.h +1 -1
- data/source/bzs/db/transactd/connManager.cpp +2 -0
- data/source/bzs/db/transactd/transactd.cpp +1 -0
- data/source/bzs/env/compiler.h +10 -0
- data/source/bzs/env/mbcswchrLinux.cpp +42 -6
- data/source/bzs/env/mbcswchrLinux.h +40 -12
- data/source/bzs/example/queryData.cpp +33 -4
- data/source/bzs/netsvc/client/iconnection.h +107 -0
- data/source/bzs/netsvc/client/tcpClient.cpp +15 -1
- data/source/bzs/netsvc/client/tcpClient.h +96 -87
- data/source/bzs/netsvc/server/serverCpt.cpp +5 -6
- data/source/bzs/rtl/benchmark.cpp +2 -2
- data/source/bzs/rtl/stringBuffers.cpp +3 -3
- data/source/bzs/rtl/stringBuffers.h +2 -2
- data/source/bzs/test/tdclatl/bench_query_atl.js +92 -99
- data/source/bzs/test/tdclatl/test_query_atl.js +224 -115
- data/source/bzs/test/tdclphp/bench.php +126 -101
- data/source/bzs/test/tdclphp/transactd_Test.php +1122 -158
- data/source/bzs/test/tdclrb/bench_tdclcpp.rb +12 -14
- data/source/bzs/test/tdclrb/transactd_spec.rb +1127 -142
- data/source/bzs/test/transactdBench/query_bench.cpp +32 -15
- data/source/bzs/test/transactdBench/scaling_bench.cpp +32 -7
- data/source/bzs/test/transactdBench/transactdBench.cpp +1 -1
- data/source/bzs/test/transactdBench/workerBase.h +46 -0
- data/source/bzs/test/transactdBench/workerMySQLImple.h +15 -7
- data/source/bzs/test/transactdBench/workerTransactdImple.h +10 -18
- data/source/bzs/test/trdclengn/test_trdclengn.cpp +1487 -174
- data/source/global/ormsrcgen/main.cpp +2 -0
- data/source/global/tdclatl/Database.cpp +2 -2
- data/source/global/tdclatl/Database.h +1 -1
- data/source/global/tdclatl/FieldDefs.cpp +0 -3
- data/source/global/tdclatl/PooledDbManager.cpp +2 -2
- data/source/global/tdclatl/PooledDbManager.h +1 -1
- data/source/global/tdclatl/PreparedQuery.cpp +53 -0
- data/source/global/tdclatl/PreparedQuery.h +61 -0
- data/source/global/tdclatl/QueryBase.cpp +2 -1
- data/source/global/tdclatl/QueryBase.h +1 -1
- data/source/global/tdclatl/Record.cpp +3 -15
- data/source/global/tdclatl/Recordset.cpp +15 -10
- data/source/global/tdclatl/Recordset.h +3 -0
- data/source/global/tdclatl/Table.cpp +42 -7
- data/source/global/tdclatl/Table.h +3 -1
- data/source/global/tdclatl/activeTable.cpp +264 -76
- data/source/global/tdclatl/activeTable.h +12 -3
- data/source/global/tdclatl/tdclatl.idl +92 -10
- data/source/linux/charsetConvert.h +7 -7
- data/transactd.gemspec +14 -27
- metadata +18 -27
- data/bin/common/tdclc_32_2_0.dll +0 -0
- data/bin/common/tdclc_64_2_0.dll +0 -0
- data/build/swig/php/generate.cmake.in +0 -56
- data/build/swig/php/generate.cmd.in +0 -47
- data/build/swig/php/php.swg +0 -197
- data/build/swig/php/transactd.no_yield.php +0 -4494
- data/build/swig/php/transactd.no_yield.php.git.patch +0 -685
- data/build/swig/php/transactd.no_yield.php.patch +0 -685
- data/build/swig/php/transactd.yield.php +0 -4461
- data/build/swig/php/transactd.yield.php.git.patch +0 -652
- data/build/swig/php/transactd.yield.php.patch +0 -652
- data/build/swig/ruby/generate.cmake.in +0 -35
- data/build/swig/ruby/generate.cmd.in +0 -19
- data/build/tdclc/BUILDNUMBER.txt +0 -1
- data/build/tdclcpp/BUILDNUMBER.txt +0 -1
- data/build/tdclrb/BUILDNUMBER.txt +0 -1
- data/build/tdclrb/GEM_RELEASE_VERSION +0 -1
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
#include "nsTable.h"
|
|
22
22
|
#include <vector>
|
|
23
23
|
#include <stdio.h>
|
|
24
|
+
#include <boost/shared_ptr.hpp>
|
|
25
|
+
|
|
24
26
|
namespace bzs
|
|
25
27
|
{
|
|
26
28
|
|
|
@@ -57,6 +59,7 @@ public:
|
|
|
57
59
|
virtual ~multiRecordAlocator() {}
|
|
58
60
|
virtual void init(size_t recordCount, size_t recordLen, int addType,
|
|
59
61
|
const class table* tb) = 0;
|
|
62
|
+
virtual unsigned char* allocBlobBlock(size_t size) = 0;
|
|
60
63
|
virtual unsigned char* ptr(size_t row, int stat) = 0;
|
|
61
64
|
virtual void setJoinType(int v) = 0;
|
|
62
65
|
virtual void setInvalidRecord(size_t row, bool v) = 0;
|
|
@@ -67,21 +70,26 @@ public:
|
|
|
67
70
|
virtual void removeLastMemBlock(int row) = 0;
|
|
68
71
|
};
|
|
69
72
|
|
|
73
|
+
class filter;
|
|
74
|
+
typedef boost::shared_ptr<filter> pq_handle;
|
|
75
|
+
|
|
70
76
|
/** @endcond */
|
|
71
77
|
|
|
72
78
|
class DLLLIB table : public nstable
|
|
73
79
|
{
|
|
80
|
+
static void* __STDCALL DDBA(client::table* tb, uint_td size);
|
|
81
|
+
|
|
74
82
|
friend class recordCache;
|
|
75
83
|
friend class database;
|
|
76
84
|
friend class filter;
|
|
77
85
|
friend class fields;
|
|
86
|
+
friend struct logic;
|
|
78
87
|
|
|
79
88
|
struct tbimpl* m_impl;
|
|
80
89
|
class fielddefs* m_fddefs;
|
|
81
90
|
tabledef* m_tableDef;
|
|
82
91
|
|
|
83
92
|
uchar_td charset() const;
|
|
84
|
-
bool checkFindDirection(ushort_td op);
|
|
85
93
|
bool checkIndex(short index) const;
|
|
86
94
|
void getKeySpec(keySpec* ks, bool SpecifyKeyNum = false);
|
|
87
95
|
const bzs::db::blobHeader* getBlobHeader();
|
|
@@ -102,12 +110,14 @@ class DLLLIB table : public nstable
|
|
|
102
110
|
bool setSeekValueField(int row);
|
|
103
111
|
void btrvSeekMulti();
|
|
104
112
|
bool doSeekMultiAfter(int row);
|
|
105
|
-
|
|
113
|
+
void* doDdba(uint_td size);
|
|
114
|
+
bool recordsLoop(ushort_td& op);
|
|
106
115
|
protected:
|
|
107
116
|
explicit table(nsdatabase* pbe); // Inheritance is impossible
|
|
108
117
|
virtual ~table();
|
|
109
118
|
void* dataBak() const;
|
|
110
|
-
void
|
|
119
|
+
void* reallocDataBuffer(uint_td v);
|
|
120
|
+
int dataBufferLen() const;
|
|
111
121
|
void setBookMarks(int StartId, void* Data, ushort_td Count);
|
|
112
122
|
uint_td unPack(char* ptr, size_t size);
|
|
113
123
|
uint_td pack(char* ptr, size_t size);
|
|
@@ -131,6 +141,7 @@ protected:
|
|
|
131
141
|
void init(tabledef* def, short filenum, bool regularDir);
|
|
132
142
|
void* attachBuffer(void* newPtr, bool unpack = false, size_t size = 0);
|
|
133
143
|
void dettachBuffer();
|
|
144
|
+
bool doPrepare();
|
|
134
145
|
|
|
135
146
|
virtual void doInit(tabledef* def, short filenum, bool regularDir);
|
|
136
147
|
|
|
@@ -178,7 +189,13 @@ public:
|
|
|
178
189
|
void findNext(bool notIncCurrent = true);
|
|
179
190
|
void findPrev(bool notIncCurrent = true);
|
|
180
191
|
bookmark_td bookmarkFindCurrent() const;
|
|
181
|
-
|
|
192
|
+
pq_handle setQuery(const queryBase* query, bool serverPrepare=false);
|
|
193
|
+
pq_handle prepare(const queryBase* query, bool serverPrepare=false)
|
|
194
|
+
{
|
|
195
|
+
return setQuery(query, serverPrepare);
|
|
196
|
+
}
|
|
197
|
+
void setPrepare(const pq_handle stmt);
|
|
198
|
+
|
|
182
199
|
void setFilter(const _TCHAR* str, ushort_td rejectCount,
|
|
183
200
|
ushort_td cacheCount, bool autoEscape = true);
|
|
184
201
|
short fieldNumByName(const _TCHAR* name);
|
|
@@ -389,7 +406,9 @@ inline std::_tstring lexical_cast(float v)
|
|
|
389
406
|
|
|
390
407
|
inline std::_tstring lexical_cast(const _TCHAR* v)
|
|
391
408
|
{
|
|
392
|
-
|
|
409
|
+
if (v)
|
|
410
|
+
return std::_tstring(v);
|
|
411
|
+
return std::_tstring(_T(""));
|
|
393
412
|
}
|
|
394
413
|
|
|
395
414
|
class qlogic
|
|
@@ -578,6 +597,30 @@ public:
|
|
|
578
597
|
static query* create(); // implemet int activeTable.cpp
|
|
579
598
|
};
|
|
580
599
|
|
|
600
|
+
/** @cond INTERNAL */
|
|
601
|
+
int DLLLIB makeSupplyValues(/*in out*/const _TCHAR* values[], int size,
|
|
602
|
+
const _TCHAR* value, const _TCHAR* value1 = NULL,
|
|
603
|
+
const _TCHAR* value2 = NULL, const _TCHAR* value3 = NULL,
|
|
604
|
+
const _TCHAR* value4 = NULL, const _TCHAR* value5 = NULL,
|
|
605
|
+
const _TCHAR* value6 = NULL, const _TCHAR* value7 = NULL,
|
|
606
|
+
const _TCHAR* value8 = NULL, const _TCHAR* value9 = NULL,
|
|
607
|
+
const _TCHAR* value10 = NULL);
|
|
608
|
+
/** @endcond */
|
|
609
|
+
|
|
610
|
+
bool DLLLIB supplyValues(pq_handle& filter, const _TCHAR* values[], int size);
|
|
611
|
+
bool DLLLIB supplyValue(pq_handle& filter, int index, const _TCHAR* v);
|
|
612
|
+
bool DLLLIB supplyValue(pq_handle& filter, int index, short v);
|
|
613
|
+
bool DLLLIB supplyValue(pq_handle& filter, int index, int v);
|
|
614
|
+
bool DLLLIB supplyValue(pq_handle& filter, int index, __int64 v);
|
|
615
|
+
bool DLLLIB supplyValue(pq_handle& filter, int index, float v);
|
|
616
|
+
bool DLLLIB supplyValue(pq_handle& filter, int index, double v);
|
|
617
|
+
|
|
618
|
+
//bool DLLLIB supplyInValues(pq_handle& filter, const _TCHAR* values[], size_t size, int segments);
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
581
624
|
#pragma warning(default : 4251)
|
|
582
625
|
|
|
583
626
|
} // namespace client
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_TRDBOOSTAPI_H
|
|
2
2
|
#define BZS_DB_PROTOCOL_TDAP_CLIENT_TRDBOOSTAPI_H
|
|
3
3
|
/*=================================================================
|
|
4
|
-
Copyright (C) 2013 BizStation Corp All rights reserved.
|
|
4
|
+
Copyright (C) 2013 2014 BizStation Corp All rights reserved.
|
|
5
5
|
|
|
6
6
|
This program is free software; you can redistribute it and/or
|
|
7
7
|
modify it under the terms of the GNU General Public License
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
#include <boost/shared_ptr.hpp>
|
|
23
23
|
#include <boost/noncopyable.hpp>
|
|
24
24
|
#include <iterator>
|
|
25
|
-
|
|
26
25
|
#include <stdio.h>
|
|
27
26
|
|
|
28
27
|
#if defined(__GNUC__)
|
|
@@ -78,8 +77,11 @@ public:
|
|
|
78
77
|
const _TCHAR* dbname, const _TCHAR* schemaTable)
|
|
79
78
|
: m_type(TYPE_SCHEMA_BDF), m_mode(TD_OPEN_READONLY)
|
|
80
79
|
{
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
const _TCHAR* ext = _T(".bdf");
|
|
81
|
+
if (_tcscmp(schemaTable, TRANSACTD_SCHEMANAME)==0)
|
|
82
|
+
ext = _T("");
|
|
83
|
+
_stprintf_s(m_buf, MAX_PATH, _T("%s://%s/%s?dbfile=%s%s"), protocol,
|
|
84
|
+
hostOrIp, dbname, schemaTable, ext);
|
|
83
85
|
}
|
|
84
86
|
inline explicit connectParams(const _TCHAR* uri)
|
|
85
87
|
: m_type(TYPE_SCHEMA_BDF), m_mode(TD_OPEN_READONLY)
|
|
@@ -92,11 +94,14 @@ public:
|
|
|
92
94
|
{
|
|
93
95
|
if (m_type != v)
|
|
94
96
|
{
|
|
95
|
-
m_buf[_tcslen(m_buf) - 3]
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
if ((_tcslen(m_buf) > 3) && m_buf[_tcslen(m_buf) - 3] == _T('.'))
|
|
98
|
+
{
|
|
99
|
+
m_buf[_tcslen(m_buf) - 3] = 0x00;
|
|
100
|
+
if (v == TYPE_SCHEMA_BDF)
|
|
101
|
+
_tcscat_s(m_buf, MAX_PATH, _T("bdf"));
|
|
102
|
+
else
|
|
103
|
+
_tcscat_s(m_buf, MAX_PATH, _T("ddf"));
|
|
104
|
+
}
|
|
100
105
|
}
|
|
101
106
|
m_type = v;
|
|
102
107
|
}
|
|
@@ -182,7 +187,7 @@ public:
|
|
|
182
187
|
virtual void endTrn() = 0;
|
|
183
188
|
virtual void abortTrn() = 0;
|
|
184
189
|
virtual int enableTrn() = 0;
|
|
185
|
-
virtual void beginSnapshot() = 0;
|
|
190
|
+
virtual void beginSnapshot(short bias = CONSISTENT_READ) = 0;
|
|
186
191
|
virtual void endSnapshot() = 0;
|
|
187
192
|
virtual const _TCHAR* uri() const = 0;
|
|
188
193
|
virtual char_td mode() const = 0;
|
|
@@ -198,28 +203,31 @@ class tableIterator
|
|
|
198
203
|
|
|
199
204
|
table& m_tb;
|
|
200
205
|
fields m_fds;
|
|
206
|
+
ushort_td m_lockBias;
|
|
201
207
|
|
|
202
208
|
public:
|
|
203
|
-
inline tableIterator(table& tb) : m_tb(tb), m_fds(tb)
|
|
209
|
+
inline tableIterator(table& tb, ushort_td lockBias = 0) : m_tb(tb), m_fds(tb),m_lockBias(lockBias)
|
|
204
210
|
{
|
|
205
211
|
readStatusCheck(tb, _T("tableIterator"));
|
|
206
212
|
}
|
|
207
213
|
|
|
208
214
|
table& tb() const { return m_tb; };
|
|
209
215
|
|
|
216
|
+
void setLockBias(ushort_td v) { m_lockBias = v; }
|
|
217
|
+
|
|
210
218
|
inline fields& operator*() { return m_fds; }
|
|
211
219
|
|
|
212
220
|
inline fields* operator->() { return &m_fds; }
|
|
213
221
|
|
|
214
222
|
inline tableIterator& operator++()
|
|
215
223
|
{
|
|
216
|
-
T::increment(m_tb);
|
|
224
|
+
T::increment(m_tb, m_lockBias);
|
|
217
225
|
return *this;
|
|
218
226
|
}
|
|
219
227
|
|
|
220
228
|
inline tableIterator& operator--()
|
|
221
229
|
{
|
|
222
|
-
T::decrement(m_tb);
|
|
230
|
+
T::decrement(m_tb, m_lockBias);
|
|
223
231
|
return *this;
|
|
224
232
|
}
|
|
225
233
|
|
|
@@ -304,57 +312,57 @@ typedef filterdIterator<indexRvIterator> filterdIndexRvIterator;
|
|
|
304
312
|
typedef filterdIterator<stepRvIterator> filterdStepRvIterator;
|
|
305
313
|
typedef filterdIterator<findRvIterator> filterdFindRvIterator;
|
|
306
314
|
|
|
307
|
-
inline indexIterator readIndex(table_ptr tb, eIndexOpType op)
|
|
315
|
+
inline indexIterator readIndex(table_ptr tb, eIndexOpType op, ushort_td lockBias = 0)
|
|
308
316
|
{
|
|
309
317
|
|
|
310
318
|
switch (op)
|
|
311
319
|
{
|
|
312
320
|
case eSeekEqual:
|
|
313
|
-
tb->seek();
|
|
321
|
+
tb->seek(lockBias);
|
|
314
322
|
break;
|
|
315
323
|
case eSeekFirst:
|
|
316
|
-
tb->seekFirst();
|
|
324
|
+
tb->seekFirst(lockBias);
|
|
317
325
|
break;
|
|
318
326
|
case eSeekGreaterOrEqual:
|
|
319
|
-
tb->seekGreater(true);
|
|
327
|
+
tb->seekGreater(true, lockBias);
|
|
320
328
|
break;
|
|
321
329
|
case eSeekGreater:
|
|
322
|
-
tb->seekGreater(false);
|
|
330
|
+
tb->seekGreater(false, lockBias);
|
|
323
331
|
break;
|
|
324
332
|
default:
|
|
325
333
|
assert(0);
|
|
326
334
|
readStatusCheck(*tb, _T("readIndex"));
|
|
327
335
|
}
|
|
328
|
-
return indexIterator(*tb);
|
|
336
|
+
return indexIterator(*tb, lockBias);
|
|
329
337
|
}
|
|
330
338
|
|
|
331
|
-
inline indexRvIterator readIndexRv(table_ptr tb, eIndexOpType op)
|
|
339
|
+
inline indexRvIterator readIndexRv(table_ptr tb, eIndexOpType op, ushort_td lockBias = 0)
|
|
332
340
|
{
|
|
333
341
|
|
|
334
342
|
switch (op)
|
|
335
343
|
{
|
|
336
344
|
case eSeekEqual:
|
|
337
|
-
tb->seek();
|
|
345
|
+
tb->seek(lockBias);
|
|
338
346
|
break;
|
|
339
347
|
case eSeekLast:
|
|
340
|
-
tb->seekLast();
|
|
348
|
+
tb->seekLast(lockBias);
|
|
341
349
|
break;
|
|
342
350
|
case eSeekLessThanOrEqual:
|
|
343
|
-
tb->seekLessThan(true);
|
|
351
|
+
tb->seekLessThan(true, lockBias);
|
|
344
352
|
break;
|
|
345
353
|
case eSeekLessThan:
|
|
346
|
-
tb->seekLessThan(false);
|
|
354
|
+
tb->seekLessThan(false, lockBias);
|
|
347
355
|
break;
|
|
348
356
|
default:
|
|
349
357
|
assert(0);
|
|
350
358
|
readStatusCheck(*tb, _T("readIndexRv"));
|
|
351
359
|
}
|
|
352
|
-
return indexRvIterator(*tb);
|
|
360
|
+
return indexRvIterator(*tb, lockBias);
|
|
353
361
|
}
|
|
354
362
|
|
|
355
363
|
template <class T>
|
|
356
364
|
inline indexIterator readIndex(table_ptr tb, eIndexOpType op, char_td keynum,
|
|
357
|
-
T func)
|
|
365
|
+
T func, ushort_td lockBias = 0)
|
|
358
366
|
{
|
|
359
367
|
tb->setKeyNum(keynum);
|
|
360
368
|
if (&func)
|
|
@@ -362,12 +370,12 @@ inline indexIterator readIndex(table_ptr tb, eIndexOpType op, char_td keynum,
|
|
|
362
370
|
fields fds(*tb);
|
|
363
371
|
func(fds);
|
|
364
372
|
}
|
|
365
|
-
return readIndex(tb, op);
|
|
373
|
+
return readIndex(tb, op, lockBias);
|
|
366
374
|
}
|
|
367
375
|
|
|
368
376
|
template <class T>
|
|
369
377
|
inline indexRvIterator readIndexRv(table_ptr tb, eIndexOpType op,
|
|
370
|
-
char_td keynum, T func)
|
|
378
|
+
char_td keynum, T func, ushort_td lockBias = 0)
|
|
371
379
|
{
|
|
372
380
|
tb->setKeyNum(keynum);
|
|
373
381
|
if (&func)
|
|
@@ -375,7 +383,7 @@ inline indexRvIterator readIndexRv(table_ptr tb, eIndexOpType op,
|
|
|
375
383
|
fields fds(*tb);
|
|
376
384
|
func(fds);
|
|
377
385
|
}
|
|
378
|
-
return readIndexRv(tb, op);
|
|
386
|
+
return readIndexRv(tb, op, lockBias);
|
|
379
387
|
}
|
|
380
388
|
|
|
381
389
|
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
|
@@ -542,118 +550,143 @@ inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
|
|
542
550
|
}
|
|
543
551
|
/** @endcond */
|
|
544
552
|
|
|
545
|
-
inline stepIterator readStep(table_ptr tb)
|
|
553
|
+
inline stepIterator readStep(table_ptr tb, ushort_td lockBias = 0)
|
|
546
554
|
{
|
|
547
|
-
tb->stepFirst();
|
|
548
|
-
return stepIterator(*tb);
|
|
555
|
+
tb->stepFirst(lockBias);
|
|
556
|
+
return stepIterator(*tb, lockBias);
|
|
549
557
|
}
|
|
550
558
|
|
|
551
|
-
inline stepRvIterator readStepRv(table_ptr tb)
|
|
559
|
+
inline stepRvIterator readStepRv(table_ptr tb, ushort_td lockBias = 0)
|
|
552
560
|
{
|
|
553
|
-
tb->stepLast();
|
|
554
|
-
return stepRvIterator(*tb);
|
|
561
|
+
tb->stepLast(lockBias);
|
|
562
|
+
return stepRvIterator(*tb, lockBias);
|
|
555
563
|
}
|
|
556
564
|
|
|
557
|
-
|
|
565
|
+
|
|
566
|
+
inline pq_handle setQuery(table_ptr& tb, const queryBase& q,
|
|
567
|
+
bool serverPrepare = false)
|
|
568
|
+
{
|
|
569
|
+
pq_handle stmt = tb->setQuery(&q, serverPrepare);
|
|
570
|
+
readStatusCheck(*tb, _T("setQuery"));
|
|
571
|
+
return stmt;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/** @cond INTERNAL */
|
|
575
|
+
inline pq_handle setQuery(table_ptr& tb, const pq_handle& q)
|
|
576
|
+
{
|
|
577
|
+
tb->setPrepare(q);
|
|
578
|
+
return q;
|
|
579
|
+
}
|
|
580
|
+
/** @endcond */
|
|
581
|
+
|
|
582
|
+
inline pq_handle prepare(table_ptr& tb, const queryBase& q, bool serverPrepare=false)
|
|
583
|
+
{
|
|
584
|
+
pq_handle stmt = tb->prepare(&q, serverPrepare);
|
|
585
|
+
readStatusCheck(*tb, _T("prepare"));
|
|
586
|
+
return stmt;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
template <class Q, class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
|
558
590
|
class T7>
|
|
559
|
-
inline findIterator find(table_ptr tb, const char_td keynum, const
|
|
591
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const Q& q,
|
|
560
592
|
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
|
|
561
593
|
const T4 kv4, const T5 kv5, const T6 kv6, const T7 kv7)
|
|
562
594
|
{
|
|
563
|
-
|
|
595
|
+
setQuery(tb, q);
|
|
564
596
|
keyValueSetter<T0, T1, T2, T3, T4, T5, T6, T7>::set(
|
|
565
597
|
tb, keynum, kv0, kv1, kv2, kv3, kv4, kv5, kv6, kv7);
|
|
566
598
|
tb->find(table::findForword);
|
|
567
599
|
return findIterator(*tb);
|
|
568
600
|
}
|
|
569
601
|
|
|
602
|
+
|
|
570
603
|
/** @cond INTERNAL */
|
|
571
604
|
|
|
572
|
-
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
|
573
|
-
inline findIterator find(table_ptr tb, const char_td keynum, const
|
|
605
|
+
template <class Q, class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
|
606
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const Q& q,
|
|
574
607
|
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
|
|
575
608
|
const T4 kv4, const T5 kv5, const T6 kv6)
|
|
576
609
|
{
|
|
577
|
-
|
|
610
|
+
setQuery(tb, q);
|
|
578
611
|
keyValueSetter<T0, T1, T2, T3, T4, T5, T6>::set(tb, keynum, kv0, kv1, kv2,
|
|
579
612
|
kv3, kv4, kv5, kv6);
|
|
580
613
|
tb->find(table::findForword);
|
|
581
614
|
return findIterator(*tb);
|
|
582
615
|
}
|
|
583
616
|
|
|
584
|
-
template <class T0, class T1, class T2, class T3, class T4, class T5>
|
|
585
|
-
inline findIterator find(table_ptr tb, const char_td keynum, const
|
|
617
|
+
template <class Q, class T0, class T1, class T2, class T3, class T4, class T5>
|
|
618
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const Q& q,
|
|
586
619
|
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
|
|
587
620
|
const T4 kv4, const T5 kv5)
|
|
588
621
|
{
|
|
589
|
-
|
|
622
|
+
setQuery(tb, q);
|
|
590
623
|
keyValueSetter<T0, T1, T2, T3, T4, T5>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
|
591
624
|
kv4, kv5);
|
|
592
625
|
tb->find(table::findForword);
|
|
593
626
|
return findIterator(*tb);
|
|
594
627
|
}
|
|
595
628
|
|
|
596
|
-
template <class T0, class T1, class T2, class T3, class T4>
|
|
597
|
-
inline findIterator find(table_ptr tb, const char_td keynum, const
|
|
629
|
+
template <class Q, class T0, class T1, class T2, class T3, class T4>
|
|
630
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const Q& q,
|
|
598
631
|
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
|
|
599
632
|
const T4 kv4)
|
|
600
633
|
{
|
|
601
|
-
|
|
634
|
+
setQuery(tb, q);
|
|
602
635
|
keyValueSetter<T0, T1, T2, T3, T4>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
|
603
636
|
kv4);
|
|
604
637
|
tb->find(table::findForword);
|
|
605
638
|
return findIterator(*tb);
|
|
606
639
|
}
|
|
607
640
|
|
|
608
|
-
template <class T0, class T1, class T2, class T3>
|
|
609
|
-
inline findIterator find(table_ptr tb, const char_td keynum, const
|
|
641
|
+
template <class Q, class T0, class T1, class T2, class T3>
|
|
642
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const Q& q,
|
|
610
643
|
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3)
|
|
611
644
|
{
|
|
612
|
-
|
|
645
|
+
setQuery(tb, q);
|
|
613
646
|
keyValueSetter<T0, T1, T2, T3>::set(tb, keynum, kv0, kv1, kv2, kv3);
|
|
614
647
|
tb->find(table::findForword);
|
|
615
648
|
return findIterator(*tb);
|
|
616
649
|
}
|
|
617
650
|
|
|
618
|
-
template <class T0, class T1, class T2>
|
|
619
|
-
inline findIterator find(table_ptr tb, const char_td keynum, const
|
|
651
|
+
template <class Q, class T0, class T1, class T2>
|
|
652
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const Q& q,
|
|
620
653
|
const T0 kv0, const T1 kv1, const T2 kv2)
|
|
621
654
|
{
|
|
622
|
-
|
|
655
|
+
setQuery(tb, q);
|
|
623
656
|
keyValueSetter<T0, T1, T2>::set(tb, keynum, kv0, kv1, kv2);
|
|
624
657
|
tb->find(table::findForword);
|
|
625
658
|
return findIterator(*tb);
|
|
626
659
|
}
|
|
627
660
|
|
|
628
|
-
template <class T0, class T1>
|
|
629
|
-
inline findIterator find(table_ptr tb, const char_td keynum, const
|
|
661
|
+
template <class Q, class T0, class T1>
|
|
662
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const Q& q,
|
|
630
663
|
const T0 kv0, const T1 kv1)
|
|
631
664
|
{
|
|
632
|
-
|
|
665
|
+
setQuery(tb, q);
|
|
633
666
|
keyValueSetter<T0, T1>::set(tb, keynum, kv0, kv1);
|
|
634
667
|
tb->find(table::findForword);
|
|
635
668
|
return findIterator(*tb);
|
|
636
669
|
}
|
|
637
670
|
|
|
638
|
-
template <class T0>
|
|
639
|
-
inline findIterator find(table_ptr tb, const char_td keynum, const
|
|
671
|
+
template <class Q, class T0>
|
|
672
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const Q& q,
|
|
640
673
|
const T0 kv0)
|
|
641
674
|
{
|
|
642
|
-
|
|
675
|
+
setQuery(tb, q);
|
|
643
676
|
keyValueSetter<T0>::set(tb, keynum, kv0);
|
|
644
677
|
tb->find(table::findForword);
|
|
645
678
|
return findIterator(*tb);
|
|
646
679
|
}
|
|
647
680
|
/** @endcond */
|
|
648
681
|
|
|
649
|
-
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
|
682
|
+
template <class Q, class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
|
650
683
|
class T7>
|
|
651
684
|
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
|
652
|
-
const
|
|
685
|
+
const Q& q, const T0 kv0, const T1 kv1,
|
|
653
686
|
const T2 kv2, const T3 kv3, const T4 kv4,
|
|
654
687
|
const T5 kv5, const T6 kv6, const T7 kv7)
|
|
655
688
|
{
|
|
656
|
-
|
|
689
|
+
setQuery(tb, q);
|
|
657
690
|
keyValueSetter<T0, T1, T2, T3, T4, T5, T6, T7>::set(
|
|
658
691
|
tb, keynum, kv0, kv1, kv2, kv3, kv4, kv5, kv6, kv7);
|
|
659
692
|
tb->find(table::findBackForword);
|
|
@@ -662,80 +695,80 @@ inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
|
|
662
695
|
|
|
663
696
|
/** @cond INTERNAL */
|
|
664
697
|
|
|
665
|
-
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
|
698
|
+
template <class Q, class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
|
666
699
|
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
|
667
|
-
const
|
|
700
|
+
const Q& q, const T0 kv0, const T1 kv1,
|
|
668
701
|
const T2 kv2, const T3 kv3, const T4 kv4,
|
|
669
702
|
const T5 kv5, const T6 kv6)
|
|
670
703
|
{
|
|
671
|
-
|
|
704
|
+
setQuery(tb, q);
|
|
672
705
|
keyValueSetter<T0, T1, T2, T3, T4, T5, T6>::set(tb, keynum, kv0, kv1, kv2,
|
|
673
706
|
kv3, kv4, kv5, kv6);
|
|
674
707
|
tb->find(table::findBackForword);
|
|
675
708
|
return findRvIterator(*tb);
|
|
676
709
|
}
|
|
677
710
|
|
|
678
|
-
template <class T0, class T1, class T2, class T3, class T4, class T5>
|
|
711
|
+
template <class Q, class T0, class T1, class T2, class T3, class T4, class T5>
|
|
679
712
|
inline findRvIterator
|
|
680
|
-
findRv(table_ptr tb, const char_td keynum, const
|
|
713
|
+
findRv(table_ptr tb, const char_td keynum, const Q& q, const T0 kv0,
|
|
681
714
|
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4, const T5 kv5)
|
|
682
715
|
{
|
|
683
|
-
|
|
716
|
+
setQuery(tb, q);
|
|
684
717
|
keyValueSetter<T0, T1, T2, T3, T4, T5>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
|
685
718
|
kv4, kv5);
|
|
686
719
|
tb->find(table::findBackForword);
|
|
687
720
|
return findRvIterator(*tb);
|
|
688
721
|
}
|
|
689
722
|
|
|
690
|
-
template <class T0, class T1, class T2, class T3, class T4>
|
|
723
|
+
template <class Q, class T0, class T1, class T2, class T3, class T4>
|
|
691
724
|
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
|
692
|
-
const
|
|
725
|
+
const Q& q, const T0 kv0, const T1 kv1,
|
|
693
726
|
const T2 kv2, const T3 kv3, const T4 kv4)
|
|
694
727
|
{
|
|
695
|
-
|
|
728
|
+
setQuery(tb, q);
|
|
696
729
|
keyValueSetter<T0, T1, T2, T3, T4>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
|
697
730
|
kv4);
|
|
698
731
|
tb->find(table::findBackForword);
|
|
699
732
|
return findRvIterator(*tb);
|
|
700
733
|
}
|
|
701
734
|
|
|
702
|
-
template <class T0, class T1, class T2, class T3>
|
|
735
|
+
template <class Q, class T0, class T1, class T2, class T3>
|
|
703
736
|
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
|
704
|
-
const
|
|
737
|
+
const Q& q, const T0 kv0, const T1 kv1,
|
|
705
738
|
const T2 kv2, const T3 kv3)
|
|
706
739
|
{
|
|
707
|
-
|
|
740
|
+
setQuery(tb, q);
|
|
708
741
|
keyValueSetter<T0, T1, T2, T3>::set(tb, keynum, kv0, kv1, kv2, kv3);
|
|
709
742
|
tb->find(table::findBackForword);
|
|
710
743
|
return findRvIterator(*tb);
|
|
711
744
|
}
|
|
712
745
|
|
|
713
|
-
template <class T0, class T1, class T2>
|
|
746
|
+
template <class Q, class T0, class T1, class T2>
|
|
714
747
|
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
|
715
|
-
const
|
|
748
|
+
const Q& q, const T0 kv0, const T1 kv1,
|
|
716
749
|
const T2 kv2)
|
|
717
750
|
{
|
|
718
|
-
|
|
751
|
+
setQuery(tb, q);
|
|
719
752
|
keyValueSetter<T0, T1, T2>::set(tb, keynum, kv0, kv1, kv2);
|
|
720
753
|
tb->find(table::findBackForword);
|
|
721
754
|
return findRvIterator(*tb);
|
|
722
755
|
}
|
|
723
756
|
|
|
724
|
-
template <class T0, class T1>
|
|
757
|
+
template <class Q, class T0, class T1>
|
|
725
758
|
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
|
726
|
-
const
|
|
759
|
+
const Q& q, const T0 kv0, const T1 kv1)
|
|
727
760
|
{
|
|
728
|
-
|
|
761
|
+
setQuery(tb, q);
|
|
729
762
|
keyValueSetter<T0, T1>::set(tb, keynum, kv0, kv1);
|
|
730
763
|
tb->find(table::findBackForword);
|
|
731
764
|
return findRvIterator(*tb);
|
|
732
765
|
}
|
|
733
766
|
|
|
734
|
-
template <class T0>
|
|
767
|
+
template <class Q, class T0>
|
|
735
768
|
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
|
736
|
-
const
|
|
769
|
+
const Q& q, const T0 kv0)
|
|
737
770
|
{
|
|
738
|
-
|
|
771
|
+
setQuery(tb, q);
|
|
739
772
|
keyValueSetter<T0>::set(tb, keynum, kv0);
|
|
740
773
|
tb->find(table::findBackForword);
|
|
741
774
|
return findRvIterator(*tb);
|
|
@@ -892,15 +925,28 @@ template <class Database_Ptr> inline void dropDatabase(Database_Ptr db)
|
|
|
892
925
|
}
|
|
893
926
|
|
|
894
927
|
template <class Database_Ptr>
|
|
895
|
-
inline table_ptr openTable(Database_Ptr db, const _TCHAR* name)
|
|
928
|
+
inline table_ptr openTable(Database_Ptr db, const _TCHAR* name, short mode = TD_OPEN_NORMAL)
|
|
896
929
|
{
|
|
897
|
-
table_ptr p(db->openTable(name), releaseTable);
|
|
930
|
+
table_ptr p(db->openTable(name, mode), releaseTable);
|
|
898
931
|
if (db->stat())
|
|
899
932
|
nstable::throwError((std::_tstring(_T("Open table ")) + name).c_str(),
|
|
900
933
|
db->stat());
|
|
901
934
|
return p;
|
|
902
935
|
}
|
|
903
936
|
|
|
937
|
+
template <class Database_Ptr>
|
|
938
|
+
inline table_ptr openTable(Database_Ptr db, short tableid, short mode = TD_OPEN_NORMAL)
|
|
939
|
+
{
|
|
940
|
+
table_ptr p(db->openTable(tableid, mode), releaseTable);
|
|
941
|
+
if (db->stat())
|
|
942
|
+
{
|
|
943
|
+
_TCHAR buf[50];
|
|
944
|
+
_stprintf_s(buf, 50, _T("Open table id = %d"), tableid);
|
|
945
|
+
nstable::throwError(buf, db->stat());
|
|
946
|
+
}
|
|
947
|
+
return p;
|
|
948
|
+
}
|
|
949
|
+
|
|
904
950
|
template <class Database_Ptr>
|
|
905
951
|
inline void dropTable(Database_Ptr db, const _TCHAR* name)
|
|
906
952
|
{
|
|
@@ -1160,7 +1206,7 @@ template <class DB> class transaction
|
|
|
1160
1206
|
short m_bias;
|
|
1161
1207
|
|
|
1162
1208
|
public:
|
|
1163
|
-
inline transaction(DB db, short bias =
|
|
1209
|
+
inline transaction(DB db, short bias = SINGLELOCK_READ_COMMITED +
|
|
1164
1210
|
NOWAIT_WRITE)
|
|
1165
1211
|
: m_db(db), m_bias(bias){};
|
|
1166
1212
|
inline ~transaction()
|
|
@@ -1184,7 +1230,7 @@ template <class DB> class snapshot
|
|
|
1184
1230
|
DB m_db;
|
|
1185
1231
|
|
|
1186
1232
|
public:
|
|
1187
|
-
snapshot(DB db) : m_db(db) { m_db->beginSnapshot(); }
|
|
1233
|
+
snapshot(DB db, short bias = CONSISTENT_READ) : m_db(db) { m_db->beginSnapshot(bias); }
|
|
1188
1234
|
|
|
1189
1235
|
~snapshot() { m_db->endSnapshot(); }
|
|
1190
1236
|
};
|