transactd 2.0.1 → 2.1.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 +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
@@ -18,7 +18,7 @@
|
|
18
18
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
19
19
|
02111-1307, USA.
|
20
20
|
================================================================= */
|
21
|
-
|
21
|
+
#include <my_config.h>
|
22
22
|
#include <boost/thread/mutex.hpp>
|
23
23
|
#include <bzs/db/engine/mysql/database.h>
|
24
24
|
|
@@ -44,46 +44,10 @@ struct handle
|
|
44
44
|
short cid;
|
45
45
|
};
|
46
46
|
|
47
|
-
class smartDbsReopen
|
48
|
-
{
|
49
|
-
std::vector<boost::shared_ptr<database> >& m_dbs;
|
50
|
-
|
51
|
-
public:
|
52
|
-
static std::string removeName;
|
53
|
-
|
54
|
-
smartDbsReopen(std::vector<boost::shared_ptr<database> >& dbs) : m_dbs(dbs)
|
55
|
-
{
|
56
|
-
for (size_t i = 0; i < m_dbs.size(); i++)
|
57
|
-
{
|
58
|
-
if (m_dbs[i])
|
59
|
-
{
|
60
|
-
m_dbs[i]->use();
|
61
|
-
m_dbs[i]->unUseTables(false);
|
62
|
-
m_dbs[i]->closeForReopen();
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
~smartDbsReopen()
|
68
|
-
{
|
69
|
-
for (size_t i = 0; i < m_dbs.size(); i++)
|
70
|
-
{
|
71
|
-
if (m_dbs[i])
|
72
|
-
{
|
73
|
-
if (removeName != m_dbs[i]->name())
|
74
|
-
{
|
75
|
-
m_dbs[i]->use();
|
76
|
-
m_dbs[i]->reopen();
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
};
|
82
|
-
|
83
|
-
class dbManager;
|
84
47
|
|
85
48
|
class dbManager
|
86
49
|
{
|
50
|
+
// Lock for isSutdown(), called by another thread
|
87
51
|
mutable boost::mutex m_mutex;
|
88
52
|
|
89
53
|
int m_autoHandle;
|
@@ -101,7 +65,7 @@ protected:
|
|
101
65
|
database* getDatabase(const char* dbname, short cid) const;
|
102
66
|
database* getDatabaseCid(short cid) const;
|
103
67
|
int getDatabaseID(short cid) const;
|
104
|
-
table* getTable(int handle, enum_sql_command cmd = SQLCOM_SELECT) const;
|
68
|
+
table* getTable(int handle, enum_sql_command cmd = SQLCOM_SELECT, engine::mysql::rowLockMode* lck=NULL) const;
|
105
69
|
void checkNewHandle(int newHandle) const;
|
106
70
|
int addHandle(int dbid, int tableid, int assignid = -1);
|
107
71
|
database* useDataBase(int id) const;
|
@@ -16,7 +16,7 @@
|
|
16
16
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
17
17
|
02111-1307, USA.
|
18
18
|
================================================================= */
|
19
|
-
|
19
|
+
#include <my_config.h>
|
20
20
|
#include "errorMessage.h"
|
21
21
|
#undef PACKAGE
|
22
22
|
#include "mysqlInternal.h"
|
@@ -38,7 +38,7 @@ const char* errorMessage(int errorCode)
|
|
38
38
|
case STATUS_PROGRAM_ERROR:
|
39
39
|
return "Program error";
|
40
40
|
case STATUS_CANNOT_LOCK_TABLE:
|
41
|
-
return "Can not open the table
|
41
|
+
return "Can not open the table already locked";
|
42
42
|
case STATUS_TABLE_NOTOPEN:
|
43
43
|
return "Can not open the table";
|
44
44
|
case STATUS_INVALID_KEYNAME:
|
@@ -55,17 +55,21 @@ const char* errorMessage(int errorCode)
|
|
55
55
|
return "";
|
56
56
|
}
|
57
57
|
|
58
|
-
void
|
58
|
+
void printWarningMessage(const int* errorCode, const std::string* message)
|
59
59
|
{
|
60
60
|
int code = errorCode ? *errorCode : 0;
|
61
61
|
std::string msg = errorMessage(code);
|
62
62
|
if (message)
|
63
|
-
msg += " :" + *message;
|
64
|
-
|
65
|
-
if ((code != STATUS_TABLE_NOTOPEN) && (code != STATUS_INVALID_BOOKMARK))
|
66
63
|
{
|
67
|
-
|
64
|
+
if ((msg != "") && (*message != ""))
|
65
|
+
msg += ": " + *message;
|
66
|
+
else
|
67
|
+
msg += *message;
|
68
68
|
}
|
69
|
+
if ((code != STATUS_TABLE_NOTOPEN) &&
|
70
|
+
(code != STATUS_INVALID_BOOKMARK) &&
|
71
|
+
(code != STATUS_CANNOT_LOCK_TABLE))
|
72
|
+
sql_print_warning("Transactd: %s", msg.c_str());
|
69
73
|
}
|
70
74
|
|
71
75
|
} // namespace mysql
|
@@ -32,7 +32,7 @@ namespace mysql
|
|
32
32
|
{
|
33
33
|
|
34
34
|
const char* errorMessage(int errorCode);
|
35
|
-
void
|
35
|
+
void printWarningMessage(const int* errorCode, const std::string* msg);
|
36
36
|
|
37
37
|
} // namespace mysql
|
38
38
|
} // namespace engine
|
@@ -16,9 +16,8 @@
|
|
16
16
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
17
17
|
02111-1307, USA.
|
18
18
|
================================================================= */
|
19
|
-
|
19
|
+
#include <my_config.h>
|
20
20
|
#include "mydebuglog.h"
|
21
|
-
#include "dbManager.h"
|
22
21
|
#include <bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h>
|
23
22
|
#include <bzs/env/crosscompile.h>
|
24
23
|
#include <bzs/env/fileopen.h>
|
@@ -166,14 +166,14 @@ inline void cp_restore_globals(THD* thd)
|
|
166
166
|
my_pthread_setspecific_ptr(THR_MALLOC, 0);
|
167
167
|
}
|
168
168
|
|
169
|
-
inline
|
169
|
+
inline void cp_thd_set_read_only(THD* thd)
|
170
170
|
{
|
171
|
-
|
171
|
+
;
|
172
172
|
}
|
173
173
|
|
174
|
-
inline
|
174
|
+
inline bool cp_thd_get_read_only(THD* thd)
|
175
175
|
{
|
176
|
-
;
|
176
|
+
return false;
|
177
177
|
}
|
178
178
|
|
179
179
|
inline bool cp_open_table(THD* thd, TABLE_LIST* tables,
|
@@ -209,14 +209,14 @@ inline void cp_restore_globals(THD* thd)
|
|
209
209
|
thd->restore_globals();
|
210
210
|
}
|
211
211
|
|
212
|
-
inline
|
212
|
+
inline void cp_thd_set_read_only(THD* thd)
|
213
213
|
{
|
214
|
-
|
214
|
+
thd->tx_read_only = (thd->variables.tx_read_only != 0);
|
215
215
|
}
|
216
216
|
|
217
|
-
inline
|
217
|
+
inline bool cp_thd_get_read_only(THD* thd)
|
218
218
|
{
|
219
|
-
|
219
|
+
return (thd->variables.tx_read_only != 0);
|
220
220
|
}
|
221
221
|
|
222
222
|
inline bool cp_open_table(THD* thd, TABLE_LIST* tables,
|
@@ -92,8 +92,19 @@ void endThread()
|
|
92
92
|
setStackaddr(0);
|
93
93
|
}
|
94
94
|
|
95
|
+
void waitForServerStart()
|
96
|
+
{
|
97
|
+
mysql_mutex_lock(&LOCK_server_started);
|
98
|
+
while (!mysqld_server_started)
|
99
|
+
mysql_cond_wait(&COND_server_started, &LOCK_server_started);
|
100
|
+
mysql_mutex_unlock(&LOCK_server_started);
|
101
|
+
}
|
102
|
+
|
95
103
|
THD* buildTHD()
|
96
104
|
{
|
105
|
+
if (!mysqld_server_started)
|
106
|
+
waitForServerStart();
|
107
|
+
|
97
108
|
THD* thd = new THD();
|
98
109
|
mysql_mutex_lock(&LOCK_thread_count);
|
99
110
|
thd->variables.pseudo_thread_id = thread_id++;
|
@@ -365,7 +365,7 @@ int dbExecuter::commandExec(std::vector<request>& requests,
|
|
365
365
|
writeError(1, buf, "");
|
366
366
|
sql_print_error("%s", boost::diagnostic_information(e).c_str());
|
367
367
|
}
|
368
|
-
|
368
|
+
printWarningMessage(code, msg);
|
369
369
|
}
|
370
370
|
|
371
371
|
catch (...)
|
@@ -90,8 +90,7 @@ activeTable& activeTable::join(recordset& rs, queryBase& q, const _TCHAR* name1,
|
|
90
90
|
const _TCHAR* name2, const _TCHAR* name3,
|
91
91
|
const _TCHAR* name4, const _TCHAR* name5,
|
92
92
|
const _TCHAR* name6, const _TCHAR* name7,
|
93
|
-
const _TCHAR* name8
|
94
|
-
const _TCHAR* name10, const _TCHAR* name11)
|
93
|
+
const _TCHAR* name8)
|
95
94
|
{
|
96
95
|
m_imple->join(*rs.m_imple, q, name1, name2, name3, name4, name5, name6,
|
97
96
|
name7, name8);
|
@@ -102,9 +101,29 @@ activeTable& activeTable::outerJoin(recordset& rs, queryBase& q,
|
|
102
101
|
const _TCHAR* name1, const _TCHAR* name2,
|
103
102
|
const _TCHAR* name3, const _TCHAR* name4,
|
104
103
|
const _TCHAR* name5, const _TCHAR* name6,
|
105
|
-
const _TCHAR* name7, const _TCHAR* name8
|
106
|
-
|
107
|
-
|
104
|
+
const _TCHAR* name7, const _TCHAR* name8)
|
105
|
+
{
|
106
|
+
m_imple->outerJoin(*rs.m_imple, q, name1, name2, name3, name4, name5, name6,
|
107
|
+
name7, name8);
|
108
|
+
return *this;
|
109
|
+
}
|
110
|
+
|
111
|
+
activeTable& activeTable::join(recordset& rs, pq_handle& q, const _TCHAR* name1,
|
112
|
+
const _TCHAR* name2, const _TCHAR* name3,
|
113
|
+
const _TCHAR* name4, const _TCHAR* name5,
|
114
|
+
const _TCHAR* name6, const _TCHAR* name7,
|
115
|
+
const _TCHAR* name8)
|
116
|
+
{
|
117
|
+
m_imple->join(*rs.m_imple, q, name1, name2, name3, name4, name5, name6,
|
118
|
+
name7, name8);
|
119
|
+
return *this;
|
120
|
+
}
|
121
|
+
|
122
|
+
activeTable& activeTable::outerJoin(recordset& rs, pq_handle& q,
|
123
|
+
const _TCHAR* name1, const _TCHAR* name2,
|
124
|
+
const _TCHAR* name3, const _TCHAR* name4,
|
125
|
+
const _TCHAR* name5, const _TCHAR* name6,
|
126
|
+
const _TCHAR* name7, const _TCHAR* name8)
|
108
127
|
{
|
109
128
|
m_imple->outerJoin(*rs.m_imple, q, name1, name2, name3, name4, name5, name6,
|
110
129
|
name7, name8);
|
@@ -123,9 +142,13 @@ activeTable& activeTable::option(int v)
|
|
123
142
|
return *this;
|
124
143
|
}
|
125
144
|
|
126
|
-
|
145
|
+
pq_handle activeTable::prepare(queryBase& q, bool serverPrepare)
|
127
146
|
{
|
147
|
+
return m_imple->prepare(q, serverPrepare);
|
148
|
+
}
|
128
149
|
|
150
|
+
activeTable& activeTable::read(recordset& rs, queryBase& q)
|
151
|
+
{
|
129
152
|
m_imple->read(*rs.m_imple, q);
|
130
153
|
return *this;
|
131
154
|
}
|
@@ -136,6 +159,18 @@ activeTable& activeTable::read(recordset& rs, queryBase& q, validationFunc func)
|
|
136
159
|
return *this;
|
137
160
|
}
|
138
161
|
|
162
|
+
activeTable& activeTable::read(recordset& rs, pq_handle& q)
|
163
|
+
{
|
164
|
+
m_imple->read(*rs.m_imple, q);
|
165
|
+
return *this;
|
166
|
+
}
|
167
|
+
|
168
|
+
activeTable& activeTable::read(recordset& rs, pq_handle& q, validationFunc func)
|
169
|
+
{
|
170
|
+
m_imple->read(*rs.m_imple, q, func);
|
171
|
+
return *this;
|
172
|
+
}
|
173
|
+
|
139
174
|
activeTable* activeTable::create(idatabaseManager* mgr, const _TCHAR* tableName)
|
140
175
|
{
|
141
176
|
return new activeTable(mgr, tableName);
|
@@ -32,6 +32,51 @@ namespace tdap
|
|
32
32
|
namespace client
|
33
33
|
{
|
34
34
|
|
35
|
+
/* For php use */
|
36
|
+
class preparedQuery
|
37
|
+
{
|
38
|
+
pq_handle m_filter;
|
39
|
+
int m_index;
|
40
|
+
public:
|
41
|
+
preparedQuery(pq_handle filter) : m_filter(filter),m_index(0){}
|
42
|
+
|
43
|
+
inline bool supplyValue(int index, const _TCHAR* v)
|
44
|
+
{
|
45
|
+
return client::supplyValue(m_filter, index, v);
|
46
|
+
}
|
47
|
+
|
48
|
+
inline bool supplyValue(int index, __int64 v)
|
49
|
+
{
|
50
|
+
return client::supplyValue(m_filter, index, v);
|
51
|
+
}
|
52
|
+
|
53
|
+
inline bool supplyValue(int index, double v)
|
54
|
+
{
|
55
|
+
return client::supplyValue(m_filter, index, v);
|
56
|
+
}
|
57
|
+
|
58
|
+
inline bool addValue(const _TCHAR* v)
|
59
|
+
{
|
60
|
+
return client::supplyValue(m_filter, m_index++, v);
|
61
|
+
}
|
62
|
+
|
63
|
+
inline bool addValue(__int64 v)
|
64
|
+
{
|
65
|
+
return client::supplyValue(m_filter, m_index++, v);
|
66
|
+
}
|
67
|
+
|
68
|
+
inline bool addValue(double v)
|
69
|
+
{
|
70
|
+
return client::supplyValue(m_filter, m_index++, v);
|
71
|
+
}
|
72
|
+
|
73
|
+
inline void resetAddIndex() { m_index = 0; }
|
74
|
+
/** @cond INTERNAL */
|
75
|
+
inline pq_handle& getFilter() { return m_filter; };
|
76
|
+
/** @endcond */
|
77
|
+
};
|
78
|
+
|
79
|
+
|
35
80
|
class DLLLIB activeTable
|
36
81
|
{
|
37
82
|
class activeTableImple* m_imple;
|
@@ -39,6 +84,13 @@ class DLLLIB activeTable
|
|
39
84
|
activeTable(const activeTable& r);
|
40
85
|
activeTable& operator=(const activeTable& r);
|
41
86
|
|
87
|
+
template<class T>
|
88
|
+
inline void _supplyValue(pq_handle& q, int index, const T v)
|
89
|
+
{
|
90
|
+
if (!supplyValue(q, index, v))
|
91
|
+
THROW_BZS_ERROR_WITH_MSG(_T("Prepared query : supply value error."));
|
92
|
+
}
|
93
|
+
|
42
94
|
public:
|
43
95
|
explicit activeTable(idatabaseManager* mgr, const _TCHAR* tableName);
|
44
96
|
explicit activeTable(dbmanager_ptr& mgr, const _TCHAR* tableName);
|
@@ -53,26 +105,143 @@ public:
|
|
53
105
|
|
54
106
|
writableRecord& getWritableRecord();
|
55
107
|
|
56
|
-
activeTable& join(recordset&
|
108
|
+
activeTable& join(recordset& rs, queryBase& q, const _TCHAR* name1,
|
57
109
|
const _TCHAR* name2 = NULL, const _TCHAR* name3 = NULL,
|
58
110
|
const _TCHAR* name4 = NULL, const _TCHAR* name5 = NULL,
|
59
111
|
const _TCHAR* name6 = NULL, const _TCHAR* name7 = NULL,
|
60
|
-
const _TCHAR* name8 = NULL
|
61
|
-
const _TCHAR* name10 = NULL, const _TCHAR* name11 = NULL);
|
112
|
+
const _TCHAR* name8 = NULL);
|
62
113
|
|
63
114
|
activeTable&
|
64
|
-
outerJoin(recordset&
|
115
|
+
outerJoin(recordset& rs, queryBase& q, const _TCHAR* name1,
|
65
116
|
const _TCHAR* name2 = NULL, const _TCHAR* name3 = NULL,
|
66
117
|
const _TCHAR* name4 = NULL, const _TCHAR* name5 = NULL,
|
67
118
|
const _TCHAR* name6 = NULL, const _TCHAR* name7 = NULL,
|
68
|
-
const _TCHAR* name8 = NULL
|
69
|
-
|
119
|
+
const _TCHAR* name8 = NULL);
|
120
|
+
|
121
|
+
activeTable& join(recordset& rs, pq_handle& q, const _TCHAR* name1,
|
122
|
+
const _TCHAR* name2 = NULL, const _TCHAR* name3 = NULL,
|
123
|
+
const _TCHAR* name4 = NULL, const _TCHAR* name5 = NULL,
|
124
|
+
const _TCHAR* name6 = NULL, const _TCHAR* name7 = NULL,
|
125
|
+
const _TCHAR* name8 = NULL);
|
126
|
+
|
127
|
+
activeTable&
|
128
|
+
outerJoin(recordset& rs, pq_handle& q, const _TCHAR* name1,
|
129
|
+
const _TCHAR* name2 = NULL, const _TCHAR* name3 = NULL,
|
130
|
+
const _TCHAR* name4 = NULL, const _TCHAR* name5 = NULL,
|
131
|
+
const _TCHAR* name6 = NULL, const _TCHAR* name7 = NULL,
|
132
|
+
const _TCHAR* name8 = NULL);
|
70
133
|
|
71
134
|
activeTable& index(int v);
|
72
135
|
table_ptr table() const;
|
73
136
|
activeTable& option(int v);
|
74
|
-
|
75
|
-
activeTable& read(recordset&
|
137
|
+
pq_handle prepare(queryBase& q, bool serverPrepare = false);
|
138
|
+
activeTable& read(recordset& rs, queryBase& q);
|
139
|
+
activeTable& read(recordset& rs, queryBase& q, validationFunc func);
|
140
|
+
activeTable& read(recordset& rs, pq_handle& q);
|
141
|
+
activeTable& read(recordset& rs, pq_handle& q, validationFunc func);
|
142
|
+
|
143
|
+
/** @cond INTERNAL */
|
144
|
+
template<class T0>
|
145
|
+
activeTable& read(recordset& rs, pq_handle& q, const T0 v0)
|
146
|
+
{
|
147
|
+
_supplyValue(q, 0, v0);
|
148
|
+
read(rs, q);
|
149
|
+
return *this;
|
150
|
+
}
|
151
|
+
|
152
|
+
template<class T0, class T1>
|
153
|
+
activeTable& read(recordset& rs, pq_handle& q, const T0 v0, const T1 v1)
|
154
|
+
{
|
155
|
+
_supplyValue(q, 0, v0);
|
156
|
+
_supplyValue(q, 1, v1);
|
157
|
+
read(rs, q);
|
158
|
+
return *this;
|
159
|
+
}
|
160
|
+
|
161
|
+
template<class T0, class T1, class T2>
|
162
|
+
activeTable& read(recordset& rs, pq_handle& q, const T0 v0, const T1 v1,
|
163
|
+
const T2 v2)
|
164
|
+
{
|
165
|
+
_supplyValue(q, 0, v0);
|
166
|
+
_supplyValue(q, 1, v1);
|
167
|
+
_supplyValue(q, 2, v2);
|
168
|
+
read(rs, q);
|
169
|
+
return *this;
|
170
|
+
}
|
171
|
+
|
172
|
+
template<class T0, class T1, class T2, class T3>
|
173
|
+
activeTable& read(recordset& rs, pq_handle& q, const T0 v0, const T1 v1,
|
174
|
+
const T2 v2, const T3 v3)
|
175
|
+
{
|
176
|
+
_supplyValue(q, 0, v0);
|
177
|
+
_supplyValue(q, 1, v1);
|
178
|
+
_supplyValue(q, 2, v2);
|
179
|
+
_supplyValue(q, 3, v3);
|
180
|
+
read(rs, q);
|
181
|
+
return *this;
|
182
|
+
}
|
183
|
+
|
184
|
+
template<class T0, class T1, class T2, class T3, class T4>
|
185
|
+
activeTable& read(recordset& rs, pq_handle& q, const T0 v0, const T1 v1,
|
186
|
+
const T2 v2, const T3 v3, const T4 v4)
|
187
|
+
{
|
188
|
+
_supplyValue(q, 0, v0);
|
189
|
+
_supplyValue(q, 1, v1);
|
190
|
+
_supplyValue(q, 2, v2);
|
191
|
+
_supplyValue(q, 3, v3);
|
192
|
+
_supplyValue(q, 4, v4);
|
193
|
+
read(rs, q);
|
194
|
+
return *this;
|
195
|
+
}
|
196
|
+
|
197
|
+
template<class T0, class T1, class T2, class T3, class T4, class T5>
|
198
|
+
activeTable& read(recordset& rs, pq_handle& q, const T0 v0, const T1 v1,
|
199
|
+
const T2 v2, const T3 v3, const T4 v4, const T5 v5)
|
200
|
+
{
|
201
|
+
_supplyValue(q, 0, v0);
|
202
|
+
_supplyValue(q, 1, v1);
|
203
|
+
_supplyValue(q, 2, v2);
|
204
|
+
_supplyValue(q, 3, v3);
|
205
|
+
_supplyValue(q, 4, v4);
|
206
|
+
_supplyValue(q, 5, v5);
|
207
|
+
read(rs, q);
|
208
|
+
return *this;
|
209
|
+
}
|
210
|
+
|
211
|
+
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
212
|
+
activeTable& read(recordset& rs, pq_handle& q, const T0 v0, const T1 v1,
|
213
|
+
const T2 v2, const T3 v3, const T4 v4, const T5 v5,
|
214
|
+
const T6 v6)
|
215
|
+
{
|
216
|
+
_supplyValue(q, 0, v0);
|
217
|
+
_supplyValue(q, 1, v1);
|
218
|
+
_supplyValue(q, 2, v2);
|
219
|
+
_supplyValue(q, 3, v3);
|
220
|
+
_supplyValue(q, 4, v4);
|
221
|
+
_supplyValue(q, 5, v5);
|
222
|
+
_supplyValue(q, 6, v6);
|
223
|
+
read(rs, q);
|
224
|
+
return *this;
|
225
|
+
}
|
226
|
+
|
227
|
+
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
228
|
+
class T7>
|
229
|
+
activeTable& read(recordset& rs, pq_handle& q, const T0 v0, const T1 v1,
|
230
|
+
const T2 v2, const T3 v3, const T4 v4, const T5 v5,
|
231
|
+
const T6 v6, const T7 v7)
|
232
|
+
{
|
233
|
+
_supplyValue(q, 0, v0);
|
234
|
+
_supplyValue(q, 1, v1);
|
235
|
+
_supplyValue(q, 2, v2);
|
236
|
+
_supplyValue(q, 3, v3);
|
237
|
+
_supplyValue(q, 4, v4);
|
238
|
+
_supplyValue(q, 5, v5);
|
239
|
+
_supplyValue(q, 6, v6);
|
240
|
+
_supplyValue(q, 7, v7);
|
241
|
+
read(rs, q);
|
242
|
+
return *this;
|
243
|
+
}
|
244
|
+
/** @endcond */
|
76
245
|
|
77
246
|
/** @cond INTERNAL */
|
78
247
|
|