transactd 1.2.0 → 2.0.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 +46 -67
- data/BUILD_WIN-JA +106 -63
- data/CMakeLists.txt +40 -15
- data/README +219 -75
- data/README-JA +207 -76
- data/README_ORMSRCGEN +118 -0
- data/README_ORMSRCGEN-JA +115 -0
- data/bin/common/tdclc_32_2_0.dll +0 -0
- data/bin/common/tdclc_64_2_0.dll +0 -0
- data/build/common/check_for_link_iconv.cmake +18 -14
- data/build/common/create_symlink.cmake.in +25 -0
- data/build/common/get_boost_libs.cmake +23 -23
- data/build/common/options.cmake +0 -66
- data/build/common/smart_install.cmake +3 -3
- data/build/common/transactd.rc.in +15 -5
- data/build/common/transactd_cl_common.cmake +37 -18
- data/build/common/transactd_cl_output.cmake +55 -13
- data/build/common/transactd_common.cmake +108 -31
- data/build/swig/php/generate.cmake.in +15 -17
- data/build/swig/php/generate.cmd.in +15 -9
- data/build/swig/php/php.swg +124 -82
- data/build/swig/php/transactd.no_yield.php +4494 -0
- data/build/swig/php/transactd.no_yield.php.git.patch +685 -0
- data/build/swig/php/transactd.no_yield.php.patch +685 -0
- data/build/swig/php/transactd.yield.php +4461 -0
- data/build/swig/php/transactd.yield.php.git.patch +652 -0
- data/build/swig/php/transactd.yield.php.patch +652 -0
- data/build/swig/referencecounter.h +79 -0
- data/build/swig/ruby/ruby.swg +226 -76
- data/build/swig/ruby/threadBlockRegionWrapper.h +71 -0
- data/build/swig/ruby/without_gvl.swg +87 -0
- data/build/swig/tdcl.i +659 -170
- data/build/swig/validatablepointer.h +91 -0
- data/build/tdclc/CMakeLists.txt +49 -34
- data/build/tdclc/{tdclc_64.cbproj → tdclc.cbproj} +65 -20
- data/build/tdclc/tdclc.rc +0 -0
- data/build/tdclcpp/CMakeLists.txt +84 -20
- data/build/tdclcpp/tdclcpp.rc +0 -0
- data/build/tdclcpp/{tdclcpp_bcb_64.cbproj → tdclcpp_bc.cbproj} +168 -44
- data/build/tdclrb/CMakeLists.txt +84 -66
- data/build/tdclrb/bldgem/extconf.rb +28 -3
- data/build/tdclrb/gem/helper.rb +11 -1
- data/build/tdclrb/gem_output.cmake +20 -16
- data/index_ja.html +15 -0
- data/source/bzs/db/IBlobBuffer.h +15 -17
- data/source/bzs/db/blobBuffer.h +186 -140
- data/source/bzs/db/blobStructs.h +37 -37
- data/source/bzs/db/engine/mysql/IReadRecords.h +34 -34
- data/source/bzs/db/engine/mysql/bookmark.h +150 -147
- data/source/bzs/db/engine/mysql/database.cpp +1721 -1526
- data/source/bzs/db/engine/mysql/database.h +608 -370
- data/source/bzs/db/engine/mysql/dbManager.cpp +213 -201
- data/source/bzs/db/engine/mysql/dbManager.h +115 -104
- data/source/bzs/db/engine/mysql/errorMessage.cpp +49 -50
- data/source/bzs/db/engine/mysql/errorMessage.h +25 -26
- data/source/bzs/db/engine/mysql/fieldAccess.h +55 -61
- data/source/bzs/db/engine/mysql/mydebuglog.cpp +326 -292
- data/source/bzs/db/engine/mysql/mydebuglog.h +63 -55
- data/source/bzs/db/engine/mysql/mysqlInternal.h +182 -125
- data/source/bzs/db/engine/mysql/mysqlThd.cpp +121 -121
- data/source/bzs/db/engine/mysql/mysqlThd.h +20 -20
- data/source/bzs/db/engine/mysql/percentageKey.h +241 -228
- data/source/bzs/db/protocol/ICommandExecuter.h +18 -17
- data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +543 -514
- data/source/bzs/db/protocol/hs/hsCommandExecuter.h +155 -158
- data/source/bzs/db/protocol/tdap/btrDate.cpp +213 -180
- data/source/bzs/db/protocol/tdap/btrDate.h +39 -37
- data/source/bzs/db/protocol/tdap/client/activeTable.cpp +173 -0
- data/source/bzs/db/protocol/tdap/client/activeTable.h +165 -0
- data/source/bzs/db/protocol/tdap/client/activeTableImple.h +370 -0
- data/source/bzs/db/protocol/tdap/client/bulkInsert.h +13 -23
- data/source/bzs/db/protocol/tdap/client/client.cpp +81 -68
- data/source/bzs/db/protocol/tdap/client/client.h +361 -320
- data/source/bzs/db/protocol/tdap/client/connMgr.cpp +17 -22
- data/source/bzs/db/protocol/tdap/client/connMgr.h +17 -19
- data/source/bzs/db/protocol/tdap/client/connectionPool.cpp +243 -0
- data/source/bzs/db/protocol/tdap/client/connectionPool.h +109 -0
- data/source/bzs/db/protocol/tdap/client/database.cpp +327 -219
- data/source/bzs/db/protocol/tdap/client/database.h +141 -118
- data/source/bzs/db/protocol/tdap/client/databaseFactory.cpp +60 -62
- data/source/bzs/db/protocol/tdap/client/databaseManager.h +255 -0
- data/source/bzs/db/protocol/tdap/client/dbDef.cpp +315 -202
- data/source/bzs/db/protocol/tdap/client/dbDef.h +40 -32
- data/source/bzs/db/protocol/tdap/client/dllmain.cpp +390 -371
- data/source/bzs/db/protocol/tdap/client/errorMessage.cpp +148 -56
- data/source/bzs/db/protocol/tdap/client/errorMessage_ja.cpp +149 -57
- data/source/bzs/db/protocol/tdap/client/export.h +35 -0
- data/source/bzs/db/protocol/tdap/client/field.cpp +1985 -0
- data/source/bzs/db/protocol/tdap/client/field.h +393 -0
- data/source/bzs/db/protocol/tdap/client/fieldDDF.cpp +14 -14
- data/source/bzs/db/protocol/tdap/client/fieldDDF.h +11 -14
- data/source/bzs/db/protocol/tdap/client/fieldNameAlias.cpp +123 -0
- data/source/bzs/db/protocol/tdap/client/fieldNameAlias.h +58 -0
- data/source/bzs/db/protocol/tdap/client/fields.h +178 -0
- data/source/bzs/db/protocol/tdap/client/fileDDF.cpp +13 -16
- data/source/bzs/db/protocol/tdap/client/fileDDF.h +11 -17
- data/source/bzs/db/protocol/tdap/client/filter.h +423 -259
- data/source/bzs/db/protocol/tdap/client/groupComp.h +117 -0
- data/source/bzs/db/protocol/tdap/client/groupQuery.cpp +818 -0
- data/source/bzs/db/protocol/tdap/client/groupQuery.h +281 -0
- data/source/bzs/db/protocol/tdap/client/indexDDF.cpp +14 -17
- data/source/bzs/db/protocol/tdap/client/indexDDF.h +11 -14
- data/source/bzs/db/protocol/tdap/client/memRecord.cpp +231 -0
- data/source/bzs/db/protocol/tdap/client/memRecord.h +145 -0
- data/source/bzs/db/protocol/tdap/client/memRecordset.cpp +448 -0
- data/source/bzs/db/protocol/tdap/client/memRecordset.h +159 -0
- data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +300 -173
- data/source/bzs/db/protocol/tdap/client/nsDatabase.h +53 -36
- data/source/bzs/db/protocol/tdap/client/nsTable.cpp +171 -128
- data/source/bzs/db/protocol/tdap/client/nsTable.h +121 -87
- data/source/bzs/db/protocol/tdap/client/pooledDatabaseManager.h +173 -0
- data/source/bzs/db/protocol/tdap/client/recordset.cpp +209 -0
- data/source/bzs/db/protocol/tdap/client/recordset.h +86 -0
- data/source/bzs/db/protocol/tdap/client/recordsetImple.h +596 -0
- data/source/bzs/db/protocol/tdap/client/request.h +227 -170
- data/source/bzs/db/protocol/tdap/client/serializer.cpp +1288 -0
- data/source/bzs/db/protocol/tdap/client/serializer.h +295 -0
- data/source/bzs/db/protocol/tdap/client/sharedData.cpp +9 -12
- data/source/bzs/db/protocol/tdap/client/sharedData.h +18 -16
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +494 -473
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.h +51 -53
- data/source/bzs/db/protocol/tdap/client/stringConverter.h +214 -148
- data/source/bzs/db/protocol/tdap/client/table.cpp +929 -1665
- data/source/bzs/db/protocol/tdap/client/table.h +413 -87
- data/source/bzs/db/protocol/tdap/client/trdboostapi.h +642 -534
- data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +25 -40
- data/source/bzs/db/protocol/tdap/client/trdclcppautolink.h +11 -15
- data/source/bzs/db/protocol/tdap/client/trdormapi.h +378 -437
- data/source/bzs/db/protocol/tdap/client/trnsctcl.def +1 -1
- data/source/bzs/db/protocol/tdap/fieldComp.h +127 -0
- data/source/bzs/db/protocol/tdap/myDateTime.cpp +352 -345
- data/source/bzs/db/protocol/tdap/mysql/characterset.cpp +75 -78
- data/source/bzs/db/protocol/tdap/mysql/characterset.h +18 -19
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +216 -199
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +23 -14
- data/source/bzs/db/protocol/tdap/mysql/debuglog.cpp +354 -314
- data/source/bzs/db/protocol/tdap/mysql/debuglog.h +57 -47
- data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +905 -739
- data/source/bzs/db/protocol/tdap/mysql/request.h +152 -159
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +1044 -879
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +87 -81
- data/source/bzs/db/protocol/tdap/tdapRequest.h +162 -130
- data/source/bzs/db/protocol/tdap/tdapSchema.cpp +368 -166
- data/source/bzs/db/protocol/tdap/tdapSchema.h +702 -566
- data/source/bzs/db/protocol/tdap/tdapcapi.h +387 -353
- data/source/bzs/db/transactd/appBuilderImple.h +21 -20
- data/source/bzs/db/transactd/appModule.cpp +350 -98
- data/source/bzs/db/transactd/appModule.h +31 -37
- data/source/bzs/db/transactd/connManager.cpp +138 -135
- data/source/bzs/db/transactd/connManager.h +28 -21
- data/source/bzs/db/transactd/connectionRecord.h +39 -39
- data/source/bzs/db/transactd/transactd.cpp +217 -203
- data/source/bzs/env/boost_bcb_link.h +131 -0
- data/source/bzs/env/compiler.h +136 -79
- data/source/bzs/env/crosscompile.cpp +57 -57
- data/source/bzs/env/crosscompile.h +130 -115
- data/source/bzs/env/fileopen.h +7 -8
- data/source/bzs/env/mbcswchrLinux.cpp +4 -9
- data/source/bzs/env/mbcswchrLinux.h +37 -34
- data/source/bzs/env/tcharMinGW.h +59 -0
- data/source/bzs/env/tstring.h +90 -95
- data/source/bzs/example/changeSchema.cpp +22 -23
- data/source/bzs/example/changeSchema_c.cpp +22 -24
- data/source/bzs/example/connection_pool_c.cpp +49 -104
- data/source/bzs/example/createDatabase.cpp +40 -47
- data/source/bzs/example/createDatabase_c.cpp +38 -43
- data/source/bzs/example/deleteRecords.cpp +10 -15
- data/source/bzs/example/deleteRecords_c.cpp +10 -14
- data/source/bzs/example/dropDatabase.cpp +3 -9
- data/source/bzs/example/dropDatabase_c.cpp +5 -6
- data/source/bzs/example/insertRecords.cpp +37 -29
- data/source/bzs/example/insertRecords_c.cpp +19 -25
- data/source/bzs/example/ormap_c.cpp +621 -0
- data/source/bzs/example/queryData.cpp +371 -0
- data/source/bzs/example/queryData.h +16 -0
- data/source/bzs/example/query_c.cpp +109 -0
- data/source/bzs/example/readRecords.cpp +27 -27
- data/source/bzs/example/readRecords_c.cpp +25 -23
- data/source/bzs/example/updateRecords.cpp +16 -21
- data/source/bzs/example/updateRecords_c.cpp +8 -12
- data/source/bzs/example/update_with_transaction.cpp +21 -24
- data/source/bzs/example/update_with_transaction_c.cpp +12 -15
- data/source/bzs/example/useORMRecord.cpp +177 -0
- data/source/bzs/netsvc/client/tcpClient.cpp +167 -156
- data/source/bzs/netsvc/client/tcpClient.h +541 -489
- data/source/bzs/netsvc/server/IAppModule.h +119 -32
- data/source/bzs/netsvc/server/iserver.h +21 -23
- data/source/bzs/netsvc/server/serverCpt.cpp +421 -391
- data/source/bzs/netsvc/server/serverCpt.h +41 -43
- data/source/bzs/netsvc/server/serverPipe.cpp +580 -565
- data/source/bzs/netsvc/server/serverPipe.h +44 -45
- data/source/bzs/netsvc/server/serverTpool.cpp +333 -303
- data/source/bzs/netsvc/server/serverTpool.h +38 -43
- data/source/bzs/rtl/benchmark.cpp +91 -31
- data/source/bzs/rtl/benchmark.h +76 -22
- data/source/bzs/rtl/datetime.cpp +231 -233
- data/source/bzs/rtl/datetime.h +16 -16
- data/source/bzs/rtl/debuglog.cpp +48 -51
- data/source/bzs/rtl/debuglog.h +55 -44
- data/source/bzs/rtl/exception.h +55 -48
- data/source/bzs/rtl/stl_uty.cpp +27 -28
- data/source/bzs/rtl/stl_uty.h +28 -29
- data/source/bzs/rtl/stringBuffers.cpp +8 -6
- data/source/bzs/rtl/stringBuffers.h +16 -9
- data/source/bzs/rtl/strtrim.cpp +90 -91
- data/source/bzs/rtl/strtrim.h +14 -16
- data/source/bzs/test/tdclatl/bench_query_atl.js +647 -0
- data/source/bzs/test/tdclatl/bench_tdclatl.js +303 -303
- data/source/bzs/test/tdclatl/test_query_atl.js +669 -0
- data/source/bzs/test/tdclphp/bench.php +357 -0
- data/source/bzs/test/tdclphp/transactd_Test.php +907 -303
- data/source/bzs/test/tdclphp/transactd_blob_Test.php +21 -49
- data/source/bzs/test/tdclphp/transactd_datetime_Test.php +41 -75
- data/source/bzs/test/tdclphp/transactd_kanjischema_Test.php +23 -37
- data/source/bzs/test/tdclphp/transactd_pool_Test.php +120 -0
- data/source/bzs/test/tdclrb/bench_tdclcpp.rb +4 -6
- data/source/bzs/test/tdclrb/prepare.rb +15 -12
- data/source/bzs/test/tdclrb/transactd_blob_spec.rb +29 -32
- data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +0 -29
- data/source/bzs/test/tdclrb/transactd_kanjischema_spec.rb +18 -19
- data/source/bzs/test/tdclrb/transactd_pool_spec.rb +107 -0
- data/source/bzs/test/tdclrb/transactd_spec.rb +734 -142
- data/source/bzs/test/transactdBench/query_bench.cpp +156 -0
- data/source/bzs/test/transactdBench/scaling_bench.cpp +265 -0
- data/source/bzs/test/transactdBench/transactdBench.cpp +107 -83
- data/source/bzs/test/transactdBench/transactdBench2.cpp +122 -83
- data/source/bzs/test/transactdBench/workerBase.cpp +5 -0
- data/source/bzs/test/transactdBench/workerBase.h +88 -0
- data/source/bzs/test/transactdBench/workerMySQLImple.h +333 -0
- data/source/bzs/test/transactdBench/workerTransactdImple.h +201 -0
- data/source/bzs/test/trdclengn/test_blob.cpp +121 -73
- data/source/bzs/test/trdclengn/test_trdclengn.cpp +1244 -426
- data/source/global/ormsrcgen/confParam.h +80 -0
- data/source/global/ormsrcgen/fieldName.cpp +77 -0
- data/source/global/ormsrcgen/fieldName.h +43 -0
- data/source/global/ormsrcgen/main.cpp +196 -0
- data/source/global/ormsrcgen/srcgen.cpp +763 -0
- data/source/global/ormsrcgen/srcgen.h +72 -0
- data/source/global/ormsrcgen/template/fieldNameList_sample.txt +2 -0
- data/source/global/ormsrcgen/template/ormDataClass_template.cpp +48 -0
- data/source/global/ormsrcgen/template/ormDataClass_template.h +34 -0
- data/source/global/ormsrcgen/template/ormMapClass_template.cpp +51 -0
- data/source/global/ormsrcgen/template/ormMapClass_template.h +62 -0
- data/source/global/ormsrcgen/template/template.cnf +38 -0
- data/source/global/querystmts/querystmts.cpp +237 -0
- data/source/global/tdclatl/ConnectParams.cpp +77 -0
- data/source/global/tdclatl/ConnectParams.h +70 -0
- data/source/global/tdclatl/Database.cpp +132 -128
- data/source/global/tdclatl/Database.h +60 -49
- data/source/global/tdclatl/DbDef.cpp +68 -64
- data/source/global/tdclatl/DbDef.h +36 -36
- data/source/global/tdclatl/Field.cpp +12 -17
- data/source/global/tdclatl/Field.h +15 -12
- data/source/global/tdclatl/FieldDef.cpp +75 -36
- data/source/global/tdclatl/FieldDef.h +38 -19
- data/source/global/tdclatl/FieldDefs.cpp +74 -0
- data/source/global/tdclatl/FieldDefs.h +56 -0
- data/source/global/tdclatl/FieldNames.cpp +99 -0
- data/source/global/tdclatl/FieldNames.h +66 -0
- data/source/global/tdclatl/Flags.cpp +75 -37
- data/source/global/tdclatl/Flags.h +13 -12
- data/source/global/tdclatl/GroupQuery.cpp +119 -0
- data/source/global/tdclatl/GroupQuery.h +65 -0
- data/source/global/tdclatl/KeyDef.cpp +15 -14
- data/source/global/tdclatl/KeyDef.h +20 -17
- data/source/global/tdclatl/KeySegment.cpp +13 -12
- data/source/global/tdclatl/PooledDbManager.cpp +223 -0
- data/source/global/tdclatl/PooledDbManager.h +76 -0
- data/source/global/tdclatl/QueryBase.cpp +206 -127
- data/source/global/tdclatl/QueryBase.h +55 -59
- data/source/global/tdclatl/Record.cpp +214 -0
- data/source/global/tdclatl/Record.h +96 -0
- data/source/global/tdclatl/Recordset.cpp +278 -0
- data/source/global/tdclatl/Recordset.h +83 -0
- data/source/global/tdclatl/RecordsetQuery.cpp +118 -0
- data/source/global/tdclatl/RecordsetQuery.h +126 -0
- data/source/global/tdclatl/Table.cpp +57 -60
- data/source/global/tdclatl/Table.h +32 -29
- data/source/global/tdclatl/TableDef.cpp +63 -62
- data/source/global/tdclatl/TableDef.h +20 -22
- data/source/global/tdclatl/TdVersion.cpp +3 -3
- data/source/global/tdclatl/TdVersion.h +15 -11
- data/source/global/tdclatl/_IDatabaseEvents_CP.h +99 -92
- data/source/global/tdclatl/activeTable.cpp +355 -0
- data/source/global/tdclatl/activeTable.h +79 -0
- data/source/global/tdclatl/dllmain.cpp +4 -3
- data/source/global/tdclatl/dllmain.h +7 -6
- data/source/global/tdclatl/keySegment.h +22 -18
- data/source/global/tdclatl/resource.h +0 -0
- data/source/global/tdclatl/stdafx.h +6 -4
- data/source/global/tdclatl/targetver.h +0 -1
- data/source/global/tdclatl/tdclatl.cpp +10 -5
- data/source/global/tdclatl/tdclatl.idl +530 -14
- data/source/linux/charsetConvert.h +78 -79
- data/source/linux/linuxTypes.h +9 -12
- data/source/linux/tchar.h +168 -166
- data/transactd.gemspec +24 -16
- metadata +98 -12
- data/bin/common/tdclc_32_1_2.dll +0 -0
- data/bin/common/tdclc_64_1_2.dll +0 -0
- data/build/tdclc/tdclc_32.cbproj +0 -173
- data/build/tdclcpp/tdclcpp_bcb_32.cbproj +0 -232
- data/build/tdclrb/GEM_VERSION +0 -3
- data/source/bzs/db/protocol/tdap/client/filter.cpp +0 -43
- data/source/bzs/example/useORM.cpp +0 -585
@@ -1,5 +1,5 @@
|
|
1
|
-
#ifndef
|
2
|
-
#define
|
1
|
+
#ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_TRDBOOSTAPI_H
|
2
|
+
#define BZS_DB_PROTOCOL_TDAP_CLIENT_TRDBOOSTAPI_H
|
3
3
|
/*=================================================================
|
4
4
|
Copyright (C) 2013 BizStation Corp All rights reserved.
|
5
5
|
|
@@ -14,22 +14,23 @@
|
|
14
14
|
GNU General Public License for more details.
|
15
15
|
|
16
16
|
You should have received a copy of the GNU General Public License
|
17
|
-
along with this program; if not, write to the Free Software
|
18
|
-
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
17
|
+
along with this program; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
19
19
|
02111-1307, USA.
|
20
20
|
=================================================================*/
|
21
|
-
#include
|
21
|
+
#include "trdboostapiInternal.h"
|
22
22
|
#include <boost/shared_ptr.hpp>
|
23
23
|
#include <boost/noncopyable.hpp>
|
24
|
+
#include <iterator>
|
24
25
|
|
25
26
|
#include <stdio.h>
|
26
27
|
|
27
|
-
#if defined(__GNUC__)
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
#if defined(__GNUC__)
|
29
|
+
#if (!defined(__clang__) && \
|
30
|
+
((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)))
|
31
|
+
#error "Your GCC version is too old. 4.3 or later versions are required."
|
32
|
+
#endif
|
31
33
|
#endif
|
32
|
-
|
33
34
|
|
34
35
|
namespace bzs
|
35
36
|
{
|
@@ -42,228 +43,212 @@ namespace tdap
|
|
42
43
|
namespace client
|
43
44
|
{
|
44
45
|
|
45
|
-
enum eIndexOpType
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
typedef boost::shared_ptr<database>database_ptr;
|
56
|
-
typedef boost::shared_ptr<table>table_ptr;
|
57
|
-
|
46
|
+
enum eIndexOpType
|
47
|
+
{
|
48
|
+
eSeekEqual,
|
49
|
+
eSeekFirst,
|
50
|
+
eSeekLast,
|
51
|
+
eSeekGreaterOrEqual,
|
52
|
+
eSeekGreater,
|
53
|
+
eSeekLessThanOrEqual,
|
54
|
+
eSeekLessThan
|
55
|
+
};
|
58
56
|
|
57
|
+
enum eStepOpType
|
58
|
+
{
|
59
|
+
eStepFirst,
|
60
|
+
eStepLast
|
61
|
+
};
|
59
62
|
|
63
|
+
enum eFindCurrntType
|
64
|
+
{
|
65
|
+
ePosNeedNext = 1,
|
66
|
+
ePosNeedNone = 0,
|
67
|
+
ePosNeedPrev = -1
|
68
|
+
};
|
60
69
|
|
61
|
-
class
|
70
|
+
class connectParams
|
62
71
|
{
|
63
|
-
|
64
|
-
|
72
|
+
_TCHAR m_buf[MAX_PATH];
|
73
|
+
short m_type;
|
74
|
+
char_td m_mode;
|
65
75
|
|
66
76
|
public:
|
67
|
-
inline
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
inline const char* a_str() const {return m_tb.getFVAstr(m_index);}
|
72
|
-
|
73
|
-
inline int i() const {return m_tb.getFVint(m_index);}
|
74
|
-
|
75
|
-
inline short i16() const {return m_tb.getFVsht(m_index);}
|
76
|
-
|
77
|
-
inline __int64 i64() const {return m_tb.getFV64(m_index);}
|
78
|
-
|
79
|
-
inline float f() const {return m_tb.getFVflt(m_index);}
|
80
|
-
|
81
|
-
inline double d() const {return m_tb.getFVdbl(m_index);}
|
82
|
-
|
83
|
-
inline field& operator = (const _TCHAR* p)
|
77
|
+
inline connectParams(const _TCHAR* protocol, const _TCHAR* hostOrIp,
|
78
|
+
const _TCHAR* dbname, const _TCHAR* schemaTable)
|
79
|
+
: m_type(TYPE_SCHEMA_BDF), m_mode(TD_OPEN_READONLY)
|
84
80
|
{
|
85
|
-
|
86
|
-
|
81
|
+
_stprintf_s(m_buf, MAX_PATH, _T("%s://%s/%s?dbfile=%s.bdf"), protocol,
|
82
|
+
hostOrIp, dbname, schemaTable);
|
87
83
|
}
|
88
|
-
|
89
|
-
|
84
|
+
inline explicit connectParams(const _TCHAR* uri)
|
85
|
+
: m_type(TYPE_SCHEMA_BDF), m_mode(TD_OPEN_READONLY)
|
90
86
|
{
|
91
|
-
|
92
|
-
return *this;
|
87
|
+
_tcscpy_s(m_buf, MAX_PATH, uri);
|
93
88
|
}
|
89
|
+
inline void setMode(char_td v) { m_mode = v; }
|
94
90
|
|
95
|
-
|
96
|
-
inline field& operator = (const char* p)
|
91
|
+
inline void setType(short v)
|
97
92
|
{
|
98
|
-
|
99
|
-
|
93
|
+
if (m_type != v)
|
94
|
+
{
|
95
|
+
m_buf[_tcslen(m_buf) - 3] = 0x00;
|
96
|
+
if (v == TYPE_SCHEMA_BDF)
|
97
|
+
_tcscat_s(m_buf, MAX_PATH, _T("bdf"));
|
98
|
+
else
|
99
|
+
_tcscat_s(m_buf, MAX_PATH, _T("ddf"));
|
100
|
+
}
|
101
|
+
m_type = v;
|
100
102
|
}
|
101
103
|
|
102
|
-
inline
|
103
|
-
{
|
104
|
-
m_tb.setFVA(m_index, p.c_str());
|
105
|
-
return *this;
|
106
|
-
}
|
104
|
+
inline const _TCHAR* uri() const { return m_buf; }
|
107
105
|
|
108
|
-
|
106
|
+
inline char_td mode() const { return m_mode; };
|
109
107
|
|
110
|
-
inline
|
111
|
-
|
112
|
-
m_tb.setFV(m_index, v);
|
113
|
-
return *this;
|
114
|
-
}
|
108
|
+
inline short type() const { return m_type; };
|
109
|
+
};
|
115
110
|
|
116
|
-
|
111
|
+
inline const _TCHAR* host(const _TCHAR* uri, _TCHAR* buf, size_t size)
|
112
|
+
{
|
113
|
+
buf[0] = 0x00;
|
114
|
+
const _TCHAR* st = _tcsstr(uri, _T("://"));
|
115
|
+
if (st)
|
117
116
|
{
|
118
|
-
|
119
|
-
|
117
|
+
const _TCHAR* en = _tcsstr(st + 3, _T("/"));
|
118
|
+
if (en)
|
119
|
+
{
|
120
|
+
_tcsncpy_s(buf, size, st + 3, en - (st + 3));
|
121
|
+
buf[en - (st + 3)] = 0x00;
|
122
|
+
}
|
120
123
|
}
|
124
|
+
return buf;
|
125
|
+
}
|
121
126
|
|
122
|
-
|
127
|
+
inline const _TCHAR* dbname(const _TCHAR* uri, _TCHAR* buf, size_t size)
|
128
|
+
{
|
129
|
+
buf[0] = 0x00;
|
130
|
+
const _TCHAR* st = _tcsstr(uri, _T("://"));
|
131
|
+
if (st)
|
123
132
|
{
|
124
|
-
|
125
|
-
|
133
|
+
st = _tcsstr(st + 3, _T("/"));
|
134
|
+
if (st)
|
135
|
+
{
|
136
|
+
const _TCHAR* en = _tcsstr(st + 1, _T("?"));
|
137
|
+
if (en)
|
138
|
+
{
|
139
|
+
_tcsncpy_s(buf, size, st + 1, en - (st + 1));
|
140
|
+
buf[en - (st + 1)] = 0x00;
|
141
|
+
}
|
142
|
+
}
|
126
143
|
}
|
144
|
+
return buf;
|
145
|
+
}
|
127
146
|
|
128
|
-
|
147
|
+
inline const _TCHAR* schemaTable(const _TCHAR* uri, _TCHAR* buf, size_t size)
|
148
|
+
{
|
149
|
+
buf[0] = 0x00;
|
150
|
+
const _TCHAR* st = _tcsrchr(uri, _T('='));
|
151
|
+
if (st)
|
129
152
|
{
|
130
|
-
|
131
|
-
|
153
|
+
const _TCHAR* en = _tcsrchr(uri, _T('.'));
|
154
|
+
if (en)
|
155
|
+
{
|
156
|
+
_tcsncpy_s(buf, size, st + 1, en - (st + 1));
|
157
|
+
buf[en - (st + 1)] = 0x00;
|
158
|
+
}
|
132
159
|
}
|
160
|
+
return buf;
|
161
|
+
}
|
133
162
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
inline bool operator == (int v) {return (v == i());};
|
139
|
-
|
140
|
-
inline bool operator != (short v) {return (v != i16());};
|
141
|
-
inline bool operator == (short v) {return (v == i16());};
|
142
|
-
|
143
|
-
inline bool operator != (__int64 v) {return (v != i64());};
|
144
|
-
inline bool operator == (__int64 v) {return (v == i64());};
|
145
|
-
|
146
|
-
inline bool operator != (float v) {return (v != f());};
|
147
|
-
inline bool operator == (float v) {return (v == f());};
|
148
|
-
|
149
|
-
inline bool operator != (double v) {return (v != d());};
|
150
|
-
inline bool operator == (double v) {return (v == d());};
|
163
|
+
/* databaseManager interface
|
164
|
+
If use some databases, implemnt a this interface and set the activeTable
|
165
|
+
constructor
|
166
|
+
Create table by name and option from suitable database.
|
151
167
|
|
152
|
-
|
153
|
-
|
154
|
-
};
|
155
|
-
|
156
|
-
class fields
|
168
|
+
*/
|
169
|
+
class idatabaseManager
|
157
170
|
{
|
158
|
-
table& m_tb;
|
159
|
-
|
160
|
-
public:
|
161
|
-
inline explicit fields(table& tb) : m_tb(tb) {};
|
162
|
-
inline explicit fields(table_ptr tb) : m_tb(*tb) {};
|
163
|
-
inline void clearValues(){m_tb.clearBuffer();};
|
164
|
-
inline field operator[](size_t index) const {return field(m_tb, (short)index);}
|
165
|
-
|
166
|
-
inline field operator()(const _TCHAR* name) const {
|
167
|
-
return field(m_tb, m_tb.fieldNumByName(name));}
|
168
|
-
inline table& tb() const {return m_tb;}
|
169
|
-
|
170
|
-
inline size_t size() {return m_tb.tableDef()->fieldCount;}
|
171
|
-
|
172
|
-
inline field fd(size_t index) const {return field(m_tb, (short)index);}
|
173
171
|
|
174
|
-
inline field fd(const _TCHAR* name) const {return field(m_tb, m_tb.fieldNumByName(name));}
|
175
|
-
};
|
176
|
-
|
177
|
-
class filterParams
|
178
|
-
{
|
179
|
-
std::_tstring m_str;
|
180
|
-
int m_rejectCount;
|
181
|
-
int m_maxRecords;
|
182
172
|
public:
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
173
|
+
virtual ~idatabaseManager(){};
|
174
|
+
virtual void reset(int) = 0;
|
175
|
+
virtual table_ptr table(const _TCHAR* name) = 0;
|
176
|
+
virtual database* db() const = 0;
|
177
|
+
virtual void use(const connectParams* param = NULL) = 0;
|
178
|
+
virtual void unUse() = 0;
|
179
|
+
virtual void setOption(__int64 v) = 0;
|
180
|
+
virtual __int64 option() = 0;
|
181
|
+
virtual void beginTrn(short bias) = 0;
|
182
|
+
virtual void endTrn() = 0;
|
183
|
+
virtual void abortTrn() = 0;
|
184
|
+
virtual int enableTrn() = 0;
|
185
|
+
virtual void beginSnapshot() = 0;
|
186
|
+
virtual void endSnapshot() = 0;
|
187
|
+
virtual const _TCHAR* uri() const = 0;
|
188
|
+
virtual char_td mode() const = 0;
|
189
|
+
virtual bool isOpened() const = 0;
|
190
|
+
virtual short_td stat() const = 0;
|
191
|
+
virtual uchar_td* clientID() const = 0;
|
193
192
|
};
|
194
193
|
|
195
194
|
template <class T>
|
196
195
|
class tableIterator
|
196
|
+
: public std::iterator<std::bidirectional_iterator_tag, fields, void>
|
197
197
|
{
|
198
198
|
|
199
199
|
table& m_tb;
|
200
200
|
fields m_fds;
|
201
201
|
|
202
|
-
inline tableIterator() : m_tb(*((table*)0)), m_fds(*((table*)0)) {};
|
203
|
-
|
204
202
|
public:
|
205
|
-
static const tableIterator eos;
|
206
|
-
|
207
203
|
inline tableIterator(table& tb) : m_tb(tb), m_fds(tb)
|
208
204
|
{
|
209
|
-
|
210
|
-
nstable::throwError(std::_tstring(_T("tableIterator")).c_str(), &tb);
|
211
|
-
|
205
|
+
readStatusCheck(tb, _T("tableIterator"));
|
212
206
|
}
|
213
207
|
|
214
|
-
table& tb() const {return m_tb;};
|
208
|
+
table& tb() const { return m_tb; };
|
215
209
|
|
216
|
-
inline fields& operator*() {return m_fds;}
|
210
|
+
inline fields& operator*() { return m_fds; }
|
217
211
|
|
218
|
-
inline fields* operator->() {return &m_fds;}
|
212
|
+
inline fields* operator->() { return &m_fds; }
|
219
213
|
|
220
|
-
inline tableIterator& operator++()
|
214
|
+
inline tableIterator& operator++()
|
215
|
+
{
|
221
216
|
T::increment(m_tb);
|
222
217
|
return *this;
|
223
218
|
}
|
224
219
|
|
225
|
-
inline tableIterator& operator--()
|
220
|
+
inline tableIterator& operator--()
|
221
|
+
{
|
226
222
|
T::decrement(m_tb);
|
227
223
|
return *this;
|
228
224
|
}
|
229
225
|
|
230
|
-
inline bool operator
|
226
|
+
inline bool operator==(const tableIterator& v) { return m_tb.stat() != 0; }
|
231
227
|
|
232
|
-
inline bool operator
|
228
|
+
inline bool operator!=(const tableIterator& v) { return m_tb.stat() == 0; }
|
233
229
|
|
230
|
+
inline bool isEnd() { return m_tb.stat() != 0; }
|
234
231
|
};
|
232
|
+
|
235
233
|
typedef tableIterator<indexNavi> indexIterator;
|
236
234
|
typedef tableIterator<indexFindNavi> findIterator;
|
237
235
|
typedef tableIterator<stepNavi> stepIterator;
|
238
236
|
|
239
|
-
|
240
|
-
template <> const indexIterator indexIterator::eos;
|
241
|
-
template <> const findIterator findIterator::eos;
|
242
|
-
template <> const stepIterator stepIterator::eos;
|
243
|
-
|
244
|
-
|
245
|
-
|
246
237
|
typedef tableIterator<indexRvNavi> indexRvIterator;
|
247
238
|
typedef tableIterator<indexRvFindNavi> findRvIterator;
|
248
239
|
typedef tableIterator<stepRvNavi> stepRvIterator;
|
249
240
|
|
250
|
-
|
251
|
-
template <> const indexRvIterator indexRvIterator::eos;
|
252
|
-
template <> const findRvIterator findRvIterator::eos;
|
253
|
-
template <> const stepRvIterator stepRvIterator::eos;
|
254
|
-
|
255
|
-
|
256
|
-
|
257
241
|
static const int filter_validate_value = 0;
|
258
242
|
static const int filter_validate_block = 1;
|
259
243
|
static const int filter_invalidate_value = 2;
|
260
244
|
|
261
|
-
typedef boost::function
|
245
|
+
typedef boost::function<int(const fields&)> validationFunc;
|
262
246
|
|
263
|
-
#define VALIDATION_FUNC(FUNC_PTR, PTR)
|
247
|
+
#define VALIDATION_FUNC(FUNC_PTR, PTR) boost::bind(FUNC_PTR, PTR, fields_type)
|
264
248
|
|
265
|
-
template<class T>
|
249
|
+
template <class T>
|
266
250
|
class filterdIterator
|
251
|
+
: public std::iterator<std::input_iterator_tag, fields, void>
|
267
252
|
{
|
268
253
|
T& m_it;
|
269
254
|
validationFunc m_func;
|
@@ -273,14 +258,9 @@ class filterdIterator
|
|
273
258
|
if (v == filter_invalidate_value)
|
274
259
|
m_it.tb().setStat(STATUS_EOF);
|
275
260
|
return v;
|
276
|
-
|
277
261
|
}
|
278
262
|
|
279
263
|
public:
|
280
|
-
static const filterdIterator<T> eos;
|
281
|
-
|
282
|
-
filterdIterator() : m_it(*((T*)0)), m_func(NULL) {}
|
283
|
-
|
284
264
|
filterdIterator(T& it, validationFunc func) : m_it(it), m_func(func)
|
285
265
|
{
|
286
266
|
int v = callFunc();
|
@@ -288,27 +268,32 @@ public:
|
|
288
268
|
operator++();
|
289
269
|
}
|
290
270
|
|
271
|
+
inline fields operator*() { return m_it.operator*(); }
|
291
272
|
|
292
|
-
inline fields operator
|
293
|
-
|
294
|
-
inline fields* operator->() {return m_it.operator->();}
|
273
|
+
inline fields* operator->() { return m_it.operator->(); }
|
295
274
|
|
296
275
|
T& operator++()
|
297
276
|
{
|
298
277
|
int v;
|
299
|
-
do
|
278
|
+
do
|
279
|
+
{
|
300
280
|
++m_it;
|
301
281
|
v = callFunc();
|
302
|
-
}
|
303
|
-
while (v == filter_validate_block);
|
282
|
+
} while (v == filter_validate_block);
|
304
283
|
return m_it;
|
305
284
|
}
|
306
285
|
|
286
|
+
inline bool operator==(const filterdIterator& v)
|
287
|
+
{
|
288
|
+
return m_it.operator==(v.m_it);
|
289
|
+
}
|
307
290
|
|
308
|
-
inline bool operator
|
309
|
-
|
310
|
-
|
291
|
+
inline bool operator!=(const filterdIterator& v)
|
292
|
+
{
|
293
|
+
return m_it.operator!=(v.m_it);
|
294
|
+
}
|
311
295
|
|
296
|
+
inline bool isEnd() { return m_it.isEnd(); }
|
312
297
|
};
|
313
298
|
|
314
299
|
typedef filterdIterator<indexIterator> filterdIndexIterator;
|
@@ -319,69 +304,57 @@ typedef filterdIterator<indexRvIterator> filterdIndexRvIterator;
|
|
319
304
|
typedef filterdIterator<stepRvIterator> filterdStepRvIterator;
|
320
305
|
typedef filterdIterator<findRvIterator> filterdFindRvIterator;
|
321
306
|
|
322
|
-
|
323
|
-
|
324
|
-
template<>
|
325
|
-
const filterdIndexIterator filterdIndexIterator::eos;
|
326
|
-
|
327
|
-
template<>
|
328
|
-
const filterdStepIterator filterdStepIterator::eos;
|
329
|
-
|
330
|
-
template<>
|
331
|
-
const filterdFindIterator filterdFindIterator::eos;
|
332
|
-
|
333
|
-
template<>
|
334
|
-
const filterdIndexRvIterator filterdIndexRvIterator::eos;
|
335
|
-
|
336
|
-
template<>
|
337
|
-
const filterdStepRvIterator filterdStepRvIterator::eos;
|
338
|
-
|
339
|
-
template<>
|
340
|
-
const filterdFindRvIterator filterdFindRvIterator::eos;
|
341
|
-
|
342
|
-
|
343
|
-
indexIterator readIndex(table_ptr tb, eIndexOpType op)
|
307
|
+
inline indexIterator readIndex(table_ptr tb, eIndexOpType op)
|
344
308
|
{
|
345
309
|
|
346
310
|
switch (op)
|
347
311
|
{
|
348
|
-
case eSeekEqual:
|
312
|
+
case eSeekEqual:
|
313
|
+
tb->seek();
|
349
314
|
break;
|
350
|
-
case eSeekFirst:
|
315
|
+
case eSeekFirst:
|
316
|
+
tb->seekFirst();
|
351
317
|
break;
|
352
|
-
case eSeekGreaterOrEqual:
|
318
|
+
case eSeekGreaterOrEqual:
|
319
|
+
tb->seekGreater(true);
|
353
320
|
break;
|
354
|
-
case eSeekGreater:
|
321
|
+
case eSeekGreater:
|
322
|
+
tb->seekGreater(false);
|
355
323
|
break;
|
356
324
|
default:
|
357
325
|
assert(0);
|
358
|
-
|
326
|
+
readStatusCheck(*tb, _T("readIndex"));
|
359
327
|
}
|
360
328
|
return indexIterator(*tb);
|
361
329
|
}
|
362
330
|
|
363
|
-
indexRvIterator readIndexRv(table_ptr tb, eIndexOpType op)
|
331
|
+
inline indexRvIterator readIndexRv(table_ptr tb, eIndexOpType op)
|
364
332
|
{
|
365
333
|
|
366
334
|
switch (op)
|
367
335
|
{
|
368
|
-
case eSeekEqual:
|
336
|
+
case eSeekEqual:
|
337
|
+
tb->seek();
|
369
338
|
break;
|
370
|
-
case eSeekLast:
|
339
|
+
case eSeekLast:
|
340
|
+
tb->seekLast();
|
371
341
|
break;
|
372
|
-
case eSeekLessThanOrEqual:
|
342
|
+
case eSeekLessThanOrEqual:
|
343
|
+
tb->seekLessThan(true);
|
373
344
|
break;
|
374
|
-
case eSeekLessThan:
|
345
|
+
case eSeekLessThan:
|
346
|
+
tb->seekLessThan(false);
|
375
347
|
break;
|
376
348
|
default:
|
377
349
|
assert(0);
|
378
|
-
|
350
|
+
readStatusCheck(*tb, _T("readIndexRv"));
|
379
351
|
}
|
380
352
|
return indexRvIterator(*tb);
|
381
353
|
}
|
382
354
|
|
383
|
-
template<class T>
|
384
|
-
inline indexIterator readIndex(table_ptr tb, eIndexOpType op, char_td keynum,
|
355
|
+
template <class T>
|
356
|
+
inline indexIterator readIndex(table_ptr tb, eIndexOpType op, char_td keynum,
|
357
|
+
T func)
|
385
358
|
{
|
386
359
|
tb->setKeyNum(keynum);
|
387
360
|
if (&func)
|
@@ -390,11 +363,11 @@ inline indexIterator readIndex(table_ptr tb, eIndexOpType op, char_td keynum, T
|
|
390
363
|
func(fds);
|
391
364
|
}
|
392
365
|
return readIndex(tb, op);
|
393
|
-
|
394
366
|
}
|
395
367
|
|
396
|
-
template<class T>
|
397
|
-
inline indexRvIterator readIndexRv(table_ptr tb, eIndexOpType op,
|
368
|
+
template <class T>
|
369
|
+
inline indexRvIterator readIndexRv(table_ptr tb, eIndexOpType op,
|
370
|
+
char_td keynum, T func)
|
398
371
|
{
|
399
372
|
tb->setKeyNum(keynum);
|
400
373
|
if (&func)
|
@@ -403,154 +376,171 @@ inline indexRvIterator readIndexRv(table_ptr tb, eIndexOpType op, char_td keynum
|
|
403
376
|
func(fds);
|
404
377
|
}
|
405
378
|
return readIndexRv(tb, op);
|
406
|
-
|
407
379
|
}
|
408
380
|
|
409
|
-
template <class T0, class T1, class T2, class T3
|
410
|
-
|
411
|
-
inline indexIterator
|
412
|
-
|
413
|
-
|
381
|
+
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
382
|
+
class T7>
|
383
|
+
inline indexIterator
|
384
|
+
readIndex_v(table_ptr tb, eIndexOpType op, const char_td keynum, const T0 kv0,
|
385
|
+
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4,
|
386
|
+
const T5 kv5, const T6 kv6, const T7 kv7)
|
414
387
|
{
|
415
|
-
keyValueSetter<T0, T1, T2, T3, T4, T5, T6, T7>::
|
416
|
-
|
388
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6, T7>::set(
|
389
|
+
tb, keynum, kv0, kv1, kv2, kv3, kv4, kv5, kv6, kv7);
|
417
390
|
return readIndex(tb, op);
|
418
391
|
}
|
419
392
|
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
393
|
+
/** @cond INTERNAL */
|
394
|
+
|
395
|
+
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
396
|
+
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
397
|
+
const char_td keynum, const T0 kv0,
|
398
|
+
const T1 kv1, const T2 kv2, const T3 kv3,
|
399
|
+
const T4 kv4, const T5 kv5, const T6 kv6)
|
425
400
|
{
|
426
|
-
keyValueSetter<T0, T1, T2, T3, T4, T5, T6>::
|
427
|
-
|
401
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6>::set(tb, keynum, kv0, kv1, kv2,
|
402
|
+
kv3, kv4, kv5, kv6);
|
428
403
|
return readIndex(tb, op);
|
429
404
|
}
|
430
405
|
|
431
|
-
template <class T0, class T1, class T2, class T3
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
406
|
+
template <class T0, class T1, class T2, class T3, class T4, class T5>
|
407
|
+
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
408
|
+
const char_td keynum, const T0 kv0,
|
409
|
+
const T1 kv1, const T2 kv2, const T3 kv3,
|
410
|
+
const T4 kv4, const T5 kv5)
|
436
411
|
{
|
437
|
-
keyValueSetter<T0, T1, T2, T3, T4, T5>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
412
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
413
|
+
kv4, kv5);
|
438
414
|
return readIndex(tb, op);
|
439
415
|
}
|
440
416
|
|
441
417
|
template <class T0, class T1, class T2, class T3, class T4>
|
442
|
-
inline indexIterator
|
443
|
-
|
418
|
+
inline indexIterator
|
419
|
+
readIndex_v(table_ptr tb, eIndexOpType op, const char_td keynum, const T0 kv0,
|
420
|
+
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4)
|
444
421
|
{
|
445
|
-
keyValueSetter<T0, T1, T2, T3, T4>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
422
|
+
keyValueSetter<T0, T1, T2, T3, T4>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
423
|
+
kv4);
|
446
424
|
return readIndex(tb, op);
|
447
425
|
}
|
448
426
|
|
449
427
|
template <class T0, class T1, class T2, class T3>
|
450
|
-
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
451
|
-
|
428
|
+
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
429
|
+
const char_td keynum, const T0 kv0,
|
430
|
+
const T1 kv1, const T2 kv2, const T3 kv3)
|
452
431
|
{
|
453
432
|
keyValueSetter<T0, T1, T2, T3>::set(tb, keynum, kv0, kv1, kv2, kv3);
|
454
433
|
return readIndex(tb, op);
|
455
434
|
}
|
456
435
|
|
457
436
|
template <class T0, class T1, class T2>
|
458
|
-
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
459
|
-
|
437
|
+
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
438
|
+
const char_td keynum, const T0 kv0,
|
439
|
+
const T1 kv1, const T2 kv2)
|
460
440
|
{
|
461
441
|
keyValueSetter<T0, T1, T2>::set(tb, keynum, kv0, kv1, kv2);
|
462
442
|
return readIndex(tb, op);
|
463
443
|
}
|
464
444
|
|
465
445
|
template <class T0, class T1>
|
466
|
-
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
467
|
-
|
446
|
+
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
447
|
+
const char_td keynum, const T0 kv0,
|
448
|
+
const T1 kv1)
|
468
449
|
{
|
469
450
|
keyValueSetter<T0, T1>::set(tb, keynum, kv0, kv1);
|
470
451
|
return readIndex(tb, op);
|
471
452
|
}
|
472
453
|
|
473
454
|
template <class T0>
|
474
|
-
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
475
|
-
|
455
|
+
inline indexIterator readIndex_v(table_ptr tb, eIndexOpType op,
|
456
|
+
const char_td keynum, const T0 kv0)
|
476
457
|
{
|
477
458
|
keyValueSetter<T0>::set(tb, keynum, kv0);
|
478
459
|
return readIndex(tb, op);
|
479
460
|
}
|
461
|
+
/** @endcond */
|
480
462
|
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
463
|
+
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
464
|
+
class T7>
|
465
|
+
inline indexRvIterator
|
466
|
+
readIndexRv_v(table_ptr tb, eIndexOpType op, const char_td keynum, const T0 kv0,
|
467
|
+
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4,
|
468
|
+
const T5 kv5, const T6 kv6, const T7 kv7)
|
487
469
|
{
|
488
|
-
keyValueSetter<T0, T1, T2, T3, T4, T5, T6, T7>::
|
489
|
-
|
470
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6, T7>::set(
|
471
|
+
tb, keynum, kv0, kv1, kv2, kv3, kv4, kv5, kv6, kv7);
|
490
472
|
return readIndexRv(tb, op);
|
491
473
|
}
|
492
474
|
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
475
|
+
/** @cond INTERNAL */
|
476
|
+
|
477
|
+
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
478
|
+
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
479
|
+
const char_td keynum, const T0 kv0,
|
480
|
+
const T1 kv1, const T2 kv2, const T3 kv3,
|
481
|
+
const T4 kv4, const T5 kv5, const T6 kv6)
|
498
482
|
{
|
499
|
-
keyValueSetter<T0, T1, T2, T3, T4, T5, T6>::
|
500
|
-
|
483
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6>::set(tb, keynum, kv0, kv1, kv2,
|
484
|
+
kv3, kv4, kv5, kv6);
|
501
485
|
return readIndexRv(tb, op);
|
502
486
|
}
|
503
487
|
|
504
|
-
template <class T0, class T1, class T2, class T3
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
488
|
+
template <class T0, class T1, class T2, class T3, class T4, class T5>
|
489
|
+
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
490
|
+
const char_td keynum, const T0 kv0,
|
491
|
+
const T1 kv1, const T2 kv2, const T3 kv3,
|
492
|
+
const T4 kv4, const T5 kv5)
|
509
493
|
{
|
510
|
-
keyValueSetter<T0, T1, T2, T3, T4, T5>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
494
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
495
|
+
kv4, kv5);
|
511
496
|
return readIndexRv(tb, op);
|
512
497
|
}
|
513
498
|
|
514
499
|
template <class T0, class T1, class T2, class T3, class T4>
|
515
|
-
inline indexRvIterator
|
516
|
-
|
500
|
+
inline indexRvIterator
|
501
|
+
readIndexRv_v(table_ptr tb, eIndexOpType op, const char_td keynum, const T0 kv0,
|
502
|
+
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4)
|
517
503
|
{
|
518
|
-
keyValueSetter<T0, T1, T2, T3, T4>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
504
|
+
keyValueSetter<T0, T1, T2, T3, T4>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
505
|
+
kv4);
|
519
506
|
return readIndexRv(tb, op);
|
520
507
|
}
|
521
508
|
|
522
509
|
template <class T0, class T1, class T2, class T3>
|
523
|
-
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
524
|
-
|
510
|
+
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
511
|
+
const char_td keynum, const T0 kv0,
|
512
|
+
const T1 kv1, const T2 kv2, const T3 kv3)
|
525
513
|
{
|
526
514
|
keyValueSetter<T0, T1, T2, T3>::set(tb, keynum, kv0, kv1, kv2, kv3);
|
527
515
|
return readIndexRv(tb, op);
|
528
516
|
}
|
529
517
|
|
530
518
|
template <class T0, class T1, class T2>
|
531
|
-
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
532
|
-
|
519
|
+
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
520
|
+
const char_td keynum, const T0 kv0,
|
521
|
+
const T1 kv1, const T2 kv2)
|
533
522
|
{
|
534
523
|
keyValueSetter<T0, T1, T2>::set(tb, keynum, kv0, kv1, kv2);
|
535
524
|
return readIndexRv(tb, op);
|
536
525
|
}
|
537
526
|
|
538
527
|
template <class T0, class T1>
|
539
|
-
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
540
|
-
|
528
|
+
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
529
|
+
const char_td keynum, const T0 kv0,
|
530
|
+
const T1 kv1)
|
541
531
|
{
|
542
532
|
keyValueSetter<T0, T1>::set(tb, keynum, kv0, kv1);
|
543
533
|
return readIndexRv(tb, op);
|
544
534
|
}
|
545
535
|
|
546
536
|
template <class T0>
|
547
|
-
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
548
|
-
|
537
|
+
inline indexRvIterator readIndexRv_v(table_ptr tb, eIndexOpType op,
|
538
|
+
const char_td keynum, const T0 kv0)
|
549
539
|
{
|
550
540
|
keyValueSetter<T0>::set(tb, keynum, kv0);
|
551
541
|
return readIndexRv(tb, op);
|
552
542
|
}
|
553
|
-
|
543
|
+
/** @endcond */
|
554
544
|
|
555
545
|
inline stepIterator readStep(table_ptr tb)
|
556
546
|
{
|
@@ -564,259 +554,282 @@ inline stepRvIterator readStepRv(table_ptr tb)
|
|
564
554
|
return stepRvIterator(*tb);
|
565
555
|
}
|
566
556
|
|
567
|
-
|
568
|
-
|
569
|
-
findIterator find(table_ptr tb, const char_td keynum, const
|
570
|
-
|
557
|
+
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
558
|
+
class T7>
|
559
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const queryBase& q,
|
560
|
+
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
|
561
|
+
const T4 kv4, const T5 kv5, const T6 kv6, const T7 kv7)
|
571
562
|
{
|
572
|
-
tb->
|
573
|
-
|
574
|
-
|
563
|
+
tb->setQuery(&q);
|
564
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6, T7>::set(
|
565
|
+
tb, keynum, kv0, kv1, kv2, kv3, kv4, kv5, kv6, kv7);
|
575
566
|
tb->find(table::findForword);
|
576
|
-
|
567
|
+
return findIterator(*tb);
|
577
568
|
}
|
578
569
|
|
570
|
+
/** @cond INTERNAL */
|
571
|
+
|
579
572
|
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
580
|
-
findIterator find(table_ptr tb, const char_td keynum, const
|
581
|
-
|
573
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const queryBase& q,
|
574
|
+
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
|
575
|
+
const T4 kv4, const T5 kv5, const T6 kv6)
|
582
576
|
{
|
583
|
-
tb->
|
584
|
-
|
577
|
+
tb->setQuery(&q);
|
578
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6>::set(tb, keynum, kv0, kv1, kv2,
|
579
|
+
kv3, kv4, kv5, kv6);
|
585
580
|
tb->find(table::findForword);
|
586
|
-
|
581
|
+
return findIterator(*tb);
|
587
582
|
}
|
588
583
|
|
589
584
|
template <class T0, class T1, class T2, class T3, class T4, class T5>
|
590
|
-
findIterator find(table_ptr tb, const char_td keynum, const
|
591
|
-
|
585
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const queryBase& q,
|
586
|
+
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
|
587
|
+
const T4 kv4, const T5 kv5)
|
592
588
|
{
|
593
|
-
tb->
|
594
|
-
|
589
|
+
tb->setQuery(&q);
|
590
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
591
|
+
kv4, kv5);
|
595
592
|
tb->find(table::findForword);
|
596
|
-
|
593
|
+
return findIterator(*tb);
|
597
594
|
}
|
598
595
|
|
599
596
|
template <class T0, class T1, class T2, class T3, class T4>
|
600
|
-
findIterator find(table_ptr tb, const char_td keynum, const
|
601
|
-
|
597
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const queryBase& q,
|
598
|
+
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3,
|
599
|
+
const T4 kv4)
|
602
600
|
{
|
603
|
-
tb->
|
604
|
-
|
601
|
+
tb->setQuery(&q);
|
602
|
+
keyValueSetter<T0, T1, T2, T3, T4>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
603
|
+
kv4);
|
605
604
|
tb->find(table::findForword);
|
606
|
-
|
605
|
+
return findIterator(*tb);
|
607
606
|
}
|
608
607
|
|
609
608
|
template <class T0, class T1, class T2, class T3>
|
610
|
-
findIterator find(table_ptr tb, const char_td keynum, const
|
611
|
-
|
609
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const queryBase& q,
|
610
|
+
const T0 kv0, const T1 kv1, const T2 kv2, const T3 kv3)
|
612
611
|
{
|
613
|
-
tb->
|
614
|
-
|
612
|
+
tb->setQuery(&q);
|
613
|
+
keyValueSetter<T0, T1, T2, T3>::set(tb, keynum, kv0, kv1, kv2, kv3);
|
615
614
|
tb->find(table::findForword);
|
616
|
-
|
615
|
+
return findIterator(*tb);
|
617
616
|
}
|
618
617
|
|
619
618
|
template <class T0, class T1, class T2>
|
620
|
-
findIterator find(table_ptr tb, const char_td keynum, const
|
621
|
-
|
619
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const queryBase& q,
|
620
|
+
const T0 kv0, const T1 kv1, const T2 kv2)
|
622
621
|
{
|
623
|
-
tb->
|
624
|
-
|
622
|
+
tb->setQuery(&q);
|
623
|
+
keyValueSetter<T0, T1, T2>::set(tb, keynum, kv0, kv1, kv2);
|
625
624
|
tb->find(table::findForword);
|
626
|
-
|
625
|
+
return findIterator(*tb);
|
627
626
|
}
|
628
627
|
|
629
628
|
template <class T0, class T1>
|
630
|
-
findIterator find(table_ptr tb, const char_td keynum, const
|
631
|
-
|
629
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const queryBase& q,
|
630
|
+
const T0 kv0, const T1 kv1)
|
632
631
|
{
|
633
|
-
tb->
|
634
|
-
|
632
|
+
tb->setQuery(&q);
|
633
|
+
keyValueSetter<T0, T1>::set(tb, keynum, kv0, kv1);
|
635
634
|
tb->find(table::findForword);
|
636
|
-
|
635
|
+
return findIterator(*tb);
|
637
636
|
}
|
638
637
|
|
639
638
|
template <class T0>
|
640
|
-
findIterator find(table_ptr tb, const char_td keynum, const
|
641
|
-
|
639
|
+
inline findIterator find(table_ptr tb, const char_td keynum, const queryBase& q,
|
640
|
+
const T0 kv0)
|
642
641
|
{
|
643
|
-
tb->
|
644
|
-
|
642
|
+
tb->setQuery(&q);
|
643
|
+
keyValueSetter<T0>::set(tb, keynum, kv0);
|
645
644
|
tb->find(table::findForword);
|
646
|
-
|
645
|
+
return findIterator(*tb);
|
647
646
|
}
|
647
|
+
/** @endcond */
|
648
648
|
|
649
|
-
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
650
|
-
|
651
|
-
|
649
|
+
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
650
|
+
class T7>
|
651
|
+
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
652
|
+
const queryBase& q, const T0 kv0, const T1 kv1,
|
653
|
+
const T2 kv2, const T3 kv3, const T4 kv4,
|
654
|
+
const T5 kv5, const T6 kv6, const T7 kv7)
|
652
655
|
{
|
653
|
-
tb->
|
654
|
-
|
655
|
-
|
656
|
+
tb->setQuery(&q);
|
657
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6, T7>::set(
|
658
|
+
tb, keynum, kv0, kv1, kv2, kv3, kv4, kv5, kv6, kv7);
|
656
659
|
tb->find(table::findBackForword);
|
657
|
-
|
660
|
+
return findRvIterator(*tb);
|
658
661
|
}
|
659
662
|
|
663
|
+
/** @cond INTERNAL */
|
664
|
+
|
660
665
|
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
661
|
-
findRvIterator findRv(table_ptr tb, const char_td keynum,
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
+
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
667
|
+
const queryBase& q, const T0 kv0, const T1 kv1,
|
668
|
+
const T2 kv2, const T3 kv3, const T4 kv4,
|
669
|
+
const T5 kv5, const T6 kv6)
|
670
|
+
{
|
671
|
+
tb->setQuery(&q);
|
672
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6>::set(tb, keynum, kv0, kv1, kv2,
|
673
|
+
kv3, kv4, kv5, kv6);
|
666
674
|
tb->find(table::findBackForword);
|
667
|
-
|
675
|
+
return findRvIterator(*tb);
|
668
676
|
}
|
669
677
|
|
670
678
|
template <class T0, class T1, class T2, class T3, class T4, class T5>
|
671
|
-
findRvIterator
|
672
|
-
|
679
|
+
inline findRvIterator
|
680
|
+
findRv(table_ptr tb, const char_td keynum, const queryBase& q, const T0 kv0,
|
681
|
+
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4, const T5 kv5)
|
673
682
|
{
|
674
|
-
tb->
|
675
|
-
|
683
|
+
tb->setQuery(&q);
|
684
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
685
|
+
kv4, kv5);
|
676
686
|
tb->find(table::findBackForword);
|
677
|
-
|
687
|
+
return findRvIterator(*tb);
|
678
688
|
}
|
679
689
|
|
680
690
|
template <class T0, class T1, class T2, class T3, class T4>
|
681
|
-
findRvIterator findRv(table_ptr tb, const char_td keynum,
|
682
|
-
|
691
|
+
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
692
|
+
const queryBase& q, const T0 kv0, const T1 kv1,
|
693
|
+
const T2 kv2, const T3 kv3, const T4 kv4)
|
683
694
|
{
|
684
|
-
tb->
|
685
|
-
|
695
|
+
tb->setQuery(&q);
|
696
|
+
keyValueSetter<T0, T1, T2, T3, T4>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
697
|
+
kv4);
|
686
698
|
tb->find(table::findBackForword);
|
687
|
-
|
699
|
+
return findRvIterator(*tb);
|
688
700
|
}
|
689
701
|
|
690
702
|
template <class T0, class T1, class T2, class T3>
|
691
|
-
findRvIterator findRv(table_ptr tb, const char_td keynum,
|
692
|
-
|
703
|
+
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
704
|
+
const queryBase& q, const T0 kv0, const T1 kv1,
|
705
|
+
const T2 kv2, const T3 kv3)
|
693
706
|
{
|
694
|
-
tb->
|
695
|
-
|
707
|
+
tb->setQuery(&q);
|
708
|
+
keyValueSetter<T0, T1, T2, T3>::set(tb, keynum, kv0, kv1, kv2, kv3);
|
696
709
|
tb->find(table::findBackForword);
|
697
|
-
|
710
|
+
return findRvIterator(*tb);
|
698
711
|
}
|
699
712
|
|
700
713
|
template <class T0, class T1, class T2>
|
701
|
-
findRvIterator findRv(table_ptr tb, const char_td keynum,
|
702
|
-
|
714
|
+
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
715
|
+
const queryBase& q, const T0 kv0, const T1 kv1,
|
716
|
+
const T2 kv2)
|
703
717
|
{
|
704
|
-
tb->
|
705
|
-
|
718
|
+
tb->setQuery(&q);
|
719
|
+
keyValueSetter<T0, T1, T2>::set(tb, keynum, kv0, kv1, kv2);
|
706
720
|
tb->find(table::findBackForword);
|
707
|
-
|
721
|
+
return findRvIterator(*tb);
|
708
722
|
}
|
709
723
|
|
710
724
|
template <class T0, class T1>
|
711
|
-
findRvIterator findRv(table_ptr tb, const char_td keynum,
|
712
|
-
|
725
|
+
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
726
|
+
const queryBase& q, const T0 kv0, const T1 kv1)
|
713
727
|
{
|
714
|
-
tb->
|
715
|
-
|
728
|
+
tb->setQuery(&q);
|
729
|
+
keyValueSetter<T0, T1>::set(tb, keynum, kv0, kv1);
|
716
730
|
tb->find(table::findBackForword);
|
717
|
-
|
731
|
+
return findRvIterator(*tb);
|
718
732
|
}
|
719
733
|
|
720
734
|
template <class T0>
|
721
|
-
findRvIterator findRv(table_ptr tb, const char_td keynum,
|
722
|
-
|
735
|
+
inline findRvIterator findRv(table_ptr tb, const char_td keynum,
|
736
|
+
const queryBase& q, const T0 kv0)
|
723
737
|
{
|
724
|
-
tb->
|
725
|
-
|
738
|
+
tb->setQuery(&q);
|
739
|
+
keyValueSetter<T0>::set(tb, keynum, kv0);
|
726
740
|
tb->find(table::findBackForword);
|
727
|
-
|
741
|
+
return findRvIterator(*tb);
|
728
742
|
}
|
729
743
|
|
730
|
-
|
731
|
-
|
744
|
+
/** @endcond */
|
745
|
+
|
746
|
+
inline findIterator getFindIterator(indexIterator it, const queryBase& q,
|
747
|
+
bool isCurrentValid)
|
732
748
|
|
733
749
|
{
|
734
|
-
if (it
|
735
|
-
|
736
|
-
it.tb().
|
737
|
-
|
738
|
-
|
739
|
-
|
750
|
+
if (!it.isEnd())
|
751
|
+
{
|
752
|
+
it.tb().setQuery(&q);
|
753
|
+
if (!isCurrentValid)
|
754
|
+
it.tb().findNext(false);
|
755
|
+
}
|
740
756
|
return findIterator(it.tb());
|
741
757
|
}
|
742
758
|
|
743
|
-
findRvIterator getFindIterator(indexRvIterator it, const
|
744
|
-
|
759
|
+
inline findRvIterator getFindIterator(indexRvIterator it, const queryBase& q,
|
760
|
+
bool isCurrentValid)
|
745
761
|
{
|
746
|
-
if (it
|
747
|
-
it.tb().
|
762
|
+
if (!it.isEnd())
|
763
|
+
it.tb().setQuery(&q);
|
748
764
|
if (!isCurrentValid)
|
749
765
|
it.tb().findPrev(false);
|
750
766
|
return findRvIterator(it.tb());
|
751
767
|
}
|
752
768
|
|
753
|
-
|
754
|
-
|
769
|
+
template <class Database_Ptr>
|
770
|
+
bool isSameUri(const connectParams* param, const Database_Ptr& db)
|
755
771
|
{
|
756
|
-
|
757
|
-
|
758
|
-
|
772
|
+
return db && db->isOpened() && (_tcsicmp(param->uri(), db->uri()) == 0) &&
|
773
|
+
(param->mode() == db->mode());
|
774
|
+
}
|
759
775
|
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
_stprintf_s(m_buf, MAX_PATH, _T("%s://%s/%s?dbfile=%s.bdf")
|
765
|
-
, protocol, hostOrIp, dbname, schemaTable);
|
776
|
+
inline void releaseDatabase(database* db)
|
777
|
+
{
|
778
|
+
database::destroy(db);
|
779
|
+
}
|
766
780
|
|
767
|
-
|
768
|
-
|
781
|
+
inline void releaseTable(table* p)
|
782
|
+
{
|
783
|
+
if (p)
|
769
784
|
{
|
770
|
-
|
771
|
-
|
785
|
+
if (nsdatabase::testTablePtr(p))
|
786
|
+
p->release();
|
772
787
|
}
|
773
|
-
|
774
|
-
|
775
|
-
inline void setType(short v){m_type = v;}
|
776
|
-
|
777
|
-
inline const _TCHAR* uri() const {return m_buf;}
|
778
|
-
|
779
|
-
inline short mode() const {return m_mode;};
|
780
|
-
|
781
|
-
inline short type() const {return m_type;};
|
782
|
-
|
783
|
-
};
|
784
|
-
|
785
|
-
inline void releaseDatabase(database* db) {database::destroy(db);}
|
786
|
-
|
787
|
-
inline void releaseTable(table* p) {if (p) p->release();}
|
788
|
+
}
|
788
789
|
|
789
|
-
inline database_ptr
|
790
|
+
inline database_ptr createDatabaseObject()
|
790
791
|
{
|
791
792
|
database_ptr p(database::create(), releaseDatabase);
|
792
793
|
return p;
|
793
794
|
}
|
794
795
|
|
795
796
|
template <class Database_Ptr, class ConnectParam_type>
|
796
|
-
inline void connect(Database_Ptr db, const ConnectParam_type& connPrams,
|
797
|
+
inline void connect(Database_Ptr db, const ConnectParam_type& connPrams,
|
798
|
+
bool newConnection)
|
797
799
|
{
|
798
800
|
db->connect(connPrams.uri(), newConnection);
|
799
801
|
if (db->stat())
|
800
|
-
nstable::throwError(
|
801
|
-
|
802
|
+
nstable::throwError(
|
803
|
+
(std::_tstring(_T("Connect database ")) + connPrams.uri()).c_str(),
|
804
|
+
db->stat());
|
802
805
|
}
|
803
806
|
|
807
|
+
/*template <>
|
808
|
+
inline void connect(idatabaseManager* db, const connectParams& connPrams, bool
|
809
|
+
newConnection)
|
810
|
+
{
|
811
|
+
db->connect(connPrams, newConnection);
|
812
|
+
if (db->stat())
|
813
|
+
nstable::throwError((std::_tstring(_T("Connect database ")) +
|
814
|
+
connPrams.uri()).c_str(), db->stat());
|
815
|
+
|
816
|
+
}*/
|
817
|
+
|
804
818
|
template <class Database_Ptr>
|
805
819
|
inline void disconnect(Database_Ptr db, const connectParams& connPrams)
|
806
820
|
{
|
807
821
|
db->disconnect(connPrams.uri());
|
808
822
|
if (db->stat())
|
809
|
-
nstable::throwError((std::_tstring(_T("Disconnect database ")) +
|
810
|
-
|
823
|
+
nstable::throwError((std::_tstring(_T("Disconnect database ")) +
|
824
|
+
connPrams.uri()).c_str(),
|
825
|
+
db->stat());
|
811
826
|
}
|
812
827
|
|
813
|
-
template <class Database_Ptr>
|
814
|
-
inline void disconnect(Database_Ptr db)
|
828
|
+
template <class Database_Ptr> inline void disconnect(Database_Ptr db)
|
815
829
|
{
|
816
830
|
db->disconnect();
|
817
831
|
if (db->stat())
|
818
832
|
nstable::throwError(_T("Disconnect database "), db->stat());
|
819
|
-
|
820
833
|
}
|
821
834
|
|
822
835
|
template <class Database_Ptr>
|
@@ -824,7 +837,9 @@ inline void createDatabase(Database_Ptr db, const connectParams& connPrams)
|
|
824
837
|
{
|
825
838
|
db->create(connPrams.uri());
|
826
839
|
if (db->stat())
|
827
|
-
nstable::throwError(
|
840
|
+
nstable::throwError(
|
841
|
+
(std::_tstring(_T("Create database ")) + connPrams.uri()).c_str(),
|
842
|
+
db->stat());
|
828
843
|
}
|
829
844
|
|
830
845
|
template <class Database_Ptr>
|
@@ -832,36 +847,48 @@ inline void createDatabase(Database_Ptr db, const _TCHAR* uri)
|
|
832
847
|
{
|
833
848
|
db->create(uri);
|
834
849
|
if (db->stat())
|
835
|
-
nstable::throwError(
|
850
|
+
nstable::throwError(
|
851
|
+
(std::_tstring(_T("Create database ")) + uri).c_str(), db->stat());
|
836
852
|
}
|
837
853
|
|
838
|
-
|
839
854
|
template <class Database_Ptr, class ConnectParam_type>
|
840
855
|
inline void openDatabase(Database_Ptr db, const ConnectParam_type& connPrams)
|
841
856
|
{
|
842
857
|
db->open(connPrams.uri(), connPrams.type(), connPrams.mode());
|
843
858
|
if (db->stat())
|
844
|
-
nstable::throwError(
|
845
|
-
|
859
|
+
nstable::throwError(
|
860
|
+
(std::_tstring(_T("Open database ")) + connPrams.uri()).c_str(),
|
861
|
+
db->stat());
|
846
862
|
}
|
847
863
|
|
848
864
|
template <class Database_Ptr>
|
849
|
-
inline void openDatabase(Database_Ptr db, const _TCHAR* uri,
|
850
|
-
|
865
|
+
inline void openDatabase(Database_Ptr db, const _TCHAR* uri,
|
866
|
+
short schemaType = 0, short mode = -2,
|
867
|
+
const _TCHAR* dir = NULL,
|
868
|
+
const _TCHAR* ownername = NULL)
|
851
869
|
{
|
852
870
|
db->open(uri, schemaType, mode, dir, ownername);
|
853
871
|
if (db->stat())
|
854
|
-
nstable::throwError(
|
855
|
-
|
872
|
+
nstable::throwError(
|
873
|
+
(std::_tstring(_T("Open database ")) + std::_tstring(uri)).c_str(),
|
874
|
+
db->stat());
|
856
875
|
}
|
857
876
|
|
858
877
|
template <class Database_Ptr>
|
859
|
-
inline void
|
878
|
+
inline void connectOpen(Database_Ptr db, const connectParams& connPrams,
|
879
|
+
bool newConnection)
|
880
|
+
{
|
881
|
+
if (newConnection)
|
882
|
+
connect(db, connPrams, newConnection);
|
883
|
+
openDatabase(db, connPrams);
|
884
|
+
}
|
885
|
+
|
886
|
+
template <class Database_Ptr> inline void dropDatabase(Database_Ptr db)
|
860
887
|
{
|
861
888
|
db->drop();
|
862
889
|
if (db->stat())
|
863
|
-
nstable::throwError(std::_tstring(_T("Drop database ")).c_str(),
|
864
|
-
|
890
|
+
nstable::throwError(std::_tstring(_T("Drop database ")).c_str(),
|
891
|
+
db->stat());
|
865
892
|
}
|
866
893
|
|
867
894
|
template <class Database_Ptr>
|
@@ -869,13 +896,22 @@ inline table_ptr openTable(Database_Ptr db, const _TCHAR* name)
|
|
869
896
|
{
|
870
897
|
table_ptr p(db->openTable(name), releaseTable);
|
871
898
|
if (db->stat())
|
872
|
-
nstable::throwError((std::_tstring(_T("Open table ")) + name).c_str(),
|
899
|
+
nstable::throwError((std::_tstring(_T("Open table ")) + name).c_str(),
|
900
|
+
db->stat());
|
873
901
|
return p;
|
902
|
+
}
|
874
903
|
|
904
|
+
template <class Database_Ptr>
|
905
|
+
inline void dropTable(Database_Ptr db, const _TCHAR* name)
|
906
|
+
{
|
907
|
+
db->dropTable(name);
|
908
|
+
if (db->stat())
|
909
|
+
nstable::throwError((std::_tstring(_T("Drop table ")) + name).c_str(),
|
910
|
+
db->stat());
|
875
911
|
}
|
876
912
|
|
877
913
|
template <class Database_Ptr>
|
878
|
-
inline void convertTable(Database_Ptr db, short tableid, copyDataFn func=NULL)
|
914
|
+
inline void convertTable(Database_Ptr db, short tableid, copyDataFn func = NULL)
|
879
915
|
{
|
880
916
|
|
881
917
|
if (db->existsTableFile(tableid, NULL))
|
@@ -887,38 +923,45 @@ inline void convertTable(Database_Ptr db, short tableid, copyDataFn func=NULL)
|
|
887
923
|
{
|
888
924
|
assert(db->dbDef());
|
889
925
|
db->dbDef()->popBackup(tableid);
|
890
|
-
nstable::throwError(std::_tstring(_T("Convert table ")).c_str(),
|
926
|
+
nstable::throwError(std::_tstring(_T("Convert table ")).c_str(),
|
927
|
+
db->stat());
|
891
928
|
}
|
892
929
|
}
|
893
930
|
}
|
894
931
|
|
895
932
|
template <class Database_Ptr>
|
896
|
-
inline void convertTable(Database_Ptr db, const _TCHAR* name,
|
933
|
+
inline void convertTable(Database_Ptr db, const _TCHAR* name,
|
934
|
+
copyDataFn func = NULL)
|
897
935
|
{
|
898
936
|
assert(db->dbDef());
|
899
937
|
short tablenum = db->dbDef()->tableNumByName(name);
|
900
938
|
convertTable(db, tablenum, func);
|
901
939
|
}
|
902
940
|
|
903
|
-
inline void insertTable(dbdef* def, short id, const _TCHAR* name,
|
941
|
+
inline void insertTable(dbdef* def, short id, const _TCHAR* name,
|
942
|
+
unsigned short charsetIndex)
|
904
943
|
{
|
905
944
|
tabledef td;
|
906
945
|
td.setTableName(name);
|
907
946
|
td.setFileName(name);
|
908
|
-
td.id =id;
|
947
|
+
td.id = id;
|
909
948
|
td.charsetIndex = (uchar_td)charsetIndex;
|
910
949
|
def->insertTable(&td);
|
911
950
|
if (def->stat() != 0)
|
912
|
-
nstable::throwError(
|
951
|
+
nstable::throwError(
|
952
|
+
(std::_tstring(_T("Insert tabledef ")) + name).c_str(),
|
953
|
+
def->stat());
|
913
954
|
}
|
914
955
|
|
915
|
-
inline fielddef* insertField(dbdef* def, short tableid, short fieldNum
|
916
|
-
|
956
|
+
inline fielddef* insertField(dbdef* def, short tableid, short fieldNum,
|
957
|
+
const _TCHAR* name, uchar_td type, ushort_td len)
|
917
958
|
{
|
918
959
|
|
919
|
-
fielddef* fd =
|
960
|
+
fielddef* fd = def->insertField(tableid, fieldNum);
|
920
961
|
if (def->stat() != 0)
|
921
|
-
nstable::throwError(
|
962
|
+
nstable::throwError(
|
963
|
+
(std::_tstring(_T("Insert fielddef ")) + name).c_str(),
|
964
|
+
def->stat());
|
922
965
|
|
923
966
|
fd->setName(name);
|
924
967
|
fd->type = type;
|
@@ -928,9 +971,10 @@ inline fielddef* insertField(dbdef* def, short tableid, short fieldNum
|
|
928
971
|
|
929
972
|
inline keydef* insertKey(dbdef* def, short tableid, short insertIndex)
|
930
973
|
{
|
931
|
-
keydef* kd =
|
974
|
+
keydef* kd = def->insertKey(tableid, insertIndex);
|
932
975
|
if (def->stat() != 0)
|
933
|
-
nstable::throwError(std::_tstring(_T("Insert keydef ")).c_str(),
|
976
|
+
nstable::throwError(std::_tstring(_T("Insert keydef ")).c_str(),
|
977
|
+
def->stat());
|
934
978
|
return kd;
|
935
979
|
}
|
936
980
|
|
@@ -942,176 +986,240 @@ inline void updateTableDef(dbdef* def, short tableid)
|
|
942
986
|
std::_tstring s;
|
943
987
|
if (def->tableDefs(tableid))
|
944
988
|
s = def->tableDefs(tableid)->tableName();
|
945
|
-
nstable::throwError((std::_tstring(_T("Update tabledef ")) + s).c_str(),
|
989
|
+
nstable::throwError((std::_tstring(_T("Update tabledef ")) + s).c_str(),
|
990
|
+
def->stat());
|
946
991
|
}
|
947
992
|
}
|
948
993
|
|
949
|
-
|
950
|
-
|
994
|
+
/** @cond INTERNAL */
|
995
|
+
|
996
|
+
template <class T> inline table* getTable(T& it)
|
951
997
|
{
|
952
|
-
it.tb()
|
953
|
-
|
954
|
-
nstable::throwError(std::_tstring(_T("Insert record")).c_str(), &(it.tb()));
|
998
|
+
return &(it.tb());
|
999
|
+
}
|
955
1000
|
|
1001
|
+
template <> inline table* getTable(table_ptr& tb)
|
1002
|
+
{
|
1003
|
+
return tb.get();
|
956
1004
|
}
|
957
1005
|
|
958
|
-
template
|
959
|
-
inline void updateRecord(const T& it, bool ncc = true)
|
1006
|
+
template <> inline table* getTable(table*& tb)
|
960
1007
|
{
|
961
|
-
|
962
|
-
|
963
|
-
nstable::throwError(std::_tstring(_T("Update record")).c_str(), &(it.tb()));
|
1008
|
+
return tb;
|
1009
|
+
}
|
964
1010
|
|
1011
|
+
/** @endcond */
|
1012
|
+
|
1013
|
+
template <class T> inline void insertRecord(T& some, bool ncc = true)
|
1014
|
+
{
|
1015
|
+
table* tb = getTable(some);
|
1016
|
+
tb->insert(ncc);
|
1017
|
+
if (tb->stat() != 0)
|
1018
|
+
nstable::throwError(std::_tstring(_T("Insert record")).c_str(), tb);
|
965
1019
|
}
|
966
1020
|
|
967
|
-
inline void updateRecord(fields& fd, char_td keynum)
|
1021
|
+
inline void updateRecord(fields& fd, const char_td keynum)
|
968
1022
|
{
|
969
1023
|
fd.tb().setKeyNum(keynum);
|
970
|
-
|
1024
|
+
fd.tb().update(nstable::changeInKey);
|
971
1025
|
if (fd.tb().stat() != 0)
|
972
|
-
nstable::throwError(std::_tstring(_T("Update record")).c_str(),
|
1026
|
+
nstable::throwError(std::_tstring(_T("Update record")).c_str(),
|
1027
|
+
&(fd.tb()));
|
973
1028
|
}
|
974
1029
|
|
975
|
-
inline void
|
1030
|
+
template <class T> inline void updateRecord(T& some, bool ncc = true)
|
976
1031
|
{
|
977
|
-
|
978
|
-
|
979
|
-
if (
|
980
|
-
|
1032
|
+
table* tb = getTable(some);
|
1033
|
+
tb->update((nstable::eUpdateType)ncc);
|
1034
|
+
if (tb->stat() != 0)
|
1035
|
+
nstable::throwError(std::_tstring(_T("Update record")).c_str(), tb);
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
template <class T> inline void deleteRecord(T& some)
|
1039
|
+
{
|
1040
|
+
table* tb = getTable(some);
|
1041
|
+
tb->del(false /*inKey*/);
|
1042
|
+
if (tb->stat() != 0)
|
1043
|
+
nstable::throwError(std::_tstring(_T("Delete record")).c_str(), tb);
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
template <class T> inline void deleteRecord(T& some, const char_td keynum)
|
1047
|
+
{
|
1048
|
+
table* tb = getTable(some);
|
1049
|
+
|
1050
|
+
tb->setKeyNum(keynum);
|
1051
|
+
tb->del(true /*inKey*/);
|
1052
|
+
if (tb->stat() != 0)
|
1053
|
+
nstable::throwError(std::_tstring(_T("Delete record")).c_str(), tb);
|
981
1054
|
}
|
982
1055
|
|
983
|
-
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
984
|
-
|
985
|
-
|
1056
|
+
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6,
|
1057
|
+
class T7>
|
1058
|
+
inline void deleteRecord(table_ptr tb, const char_td keynum, const T0 kv0,
|
1059
|
+
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4,
|
1060
|
+
const T5 kv5, const T6 kv6, const T7 kv7)
|
986
1061
|
{
|
987
|
-
|
988
|
-
|
989
|
-
|
1062
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6, T7>::set(
|
1063
|
+
tb, keynum, kv0, kv1, kv2, kv3, kv4, kv5, kv6, kv7);
|
1064
|
+
fields fd(tb);
|
1065
|
+
deleteRecord(fd, keynum);
|
990
1066
|
}
|
1067
|
+
/** @cond INTERNAL */
|
991
1068
|
|
992
1069
|
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
|
993
|
-
void deleteRecord(table_ptr tb, const char_td keynum
|
994
|
-
|
1070
|
+
inline void deleteRecord(table_ptr tb, const char_td keynum, const T0 kv0,
|
1071
|
+
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4,
|
1072
|
+
const T5 kv5, const T6 kv6)
|
995
1073
|
{
|
996
|
-
|
997
|
-
|
998
|
-
|
1074
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5, T6>::set(tb, keynum, kv0, kv1, kv2,
|
1075
|
+
kv3, kv4, kv5, kv6);
|
1076
|
+
fields fd(tb);
|
1077
|
+
deleteRecord(fd, keynum);
|
999
1078
|
}
|
1000
1079
|
|
1001
1080
|
template <class T0, class T1, class T2, class T3, class T4, class T5>
|
1002
|
-
void deleteRecord(table_ptr tb, const char_td keynum
|
1003
|
-
|
1081
|
+
inline void deleteRecord(table_ptr tb, const char_td keynum, const T0 kv0,
|
1082
|
+
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4,
|
1083
|
+
const T5 kv5)
|
1004
1084
|
{
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1085
|
+
keyValueSetter<T0, T1, T2, T3, T4, T5>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
1086
|
+
kv4, kv5);
|
1087
|
+
fields fd(tb);
|
1088
|
+
deleteRecord(fd, keynum);
|
1008
1089
|
}
|
1009
1090
|
|
1010
1091
|
template <class T0, class T1, class T2, class T3, class T4>
|
1011
|
-
void deleteRecord(table_ptr tb, const char_td keynum
|
1012
|
-
|
1092
|
+
inline void deleteRecord(table_ptr tb, const char_td keynum, const T0 kv0,
|
1093
|
+
const T1 kv1, const T2 kv2, const T3 kv3, const T4 kv4)
|
1013
1094
|
{
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1095
|
+
keyValueSetter<T0, T1, T2, T3, T4>::set(tb, keynum, kv0, kv1, kv2, kv3,
|
1096
|
+
kv4);
|
1097
|
+
fields fd(tb);
|
1098
|
+
deleteRecord(fd, keynum);
|
1017
1099
|
}
|
1018
1100
|
|
1019
1101
|
template <class T0, class T1, class T2, class T3>
|
1020
|
-
void deleteRecord(table_ptr tb, const char_td keynum
|
1021
|
-
|
1102
|
+
inline void deleteRecord(table_ptr tb, const char_td keynum, const T0 kv0,
|
1103
|
+
const T1 kv1, const T2 kv2, const T3 kv3)
|
1022
1104
|
{
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1105
|
+
keyValueSetter<T0, T1, T2, T3>::set(tb, keynum, kv0, kv1, kv2, kv3);
|
1106
|
+
fields fd(tb);
|
1107
|
+
deleteRecord(fd, keynum);
|
1026
1108
|
}
|
1027
1109
|
|
1028
1110
|
template <class T0, class T1, class T2>
|
1029
|
-
void deleteRecord(table_ptr tb, const char_td keynum
|
1030
|
-
|
1111
|
+
inline void deleteRecord(table_ptr tb, const char_td keynum, const T0 kv0,
|
1112
|
+
const T1 kv1, const T2 kv2)
|
1031
1113
|
{
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1114
|
+
keyValueSetter<T0, T1, T2>::set(tb, keynum, kv0, kv1, kv2);
|
1115
|
+
fields fd(tb);
|
1116
|
+
deleteRecord(fd, keynum);
|
1035
1117
|
}
|
1036
1118
|
|
1037
1119
|
template <class T0, class T1>
|
1038
|
-
void deleteRecord(table_ptr tb, const char_td keynum
|
1039
|
-
|
1120
|
+
inline void deleteRecord(table_ptr tb, const char_td keynum, const T0 kv0,
|
1121
|
+
const T1 kv1)
|
1040
1122
|
{
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1123
|
+
keyValueSetter<T0, T1>::set(tb, keynum, kv0, kv1);
|
1124
|
+
fields fd(tb);
|
1125
|
+
deleteRecord(fd, keynum);
|
1044
1126
|
}
|
1045
1127
|
|
1046
1128
|
template <class T0>
|
1047
|
-
void deleteRecord(table_ptr tb, const char_td keynum
|
1048
|
-
,const T0 kv0)
|
1129
|
+
inline void deleteRecord(table_ptr tb, const char_td keynum, const T0 kv0)
|
1049
1130
|
{
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1131
|
+
keyValueSetter<T0>::set(tb, keynum, kv0);
|
1132
|
+
fields fd(tb);
|
1133
|
+
deleteRecord(fd, keynum);
|
1053
1134
|
}
|
1135
|
+
/** @endcond */
|
1054
1136
|
|
1055
|
-
template <class T>
|
1056
|
-
inline void deleteRecord(const T& it)
|
1137
|
+
template <class T, class F> void for_each(T iterator, F func)
|
1057
1138
|
{
|
1058
|
-
|
1059
|
-
if (it.tb().stat() != 0)
|
1060
|
-
nstable::throwError(std::_tstring(_T("Delete record")).c_str(), &(it.tb()));
|
1139
|
+
std::for_each(iterator, iterator, func);
|
1061
1140
|
}
|
1062
1141
|
|
1142
|
+
/** Shared pointer of idatabaseManager. */
|
1143
|
+
typedef boost::shared_ptr<idatabaseManager> dbmanager_ptr;
|
1144
|
+
|
1145
|
+
template <class T> inline T createDatabaseForConnectionPool(T& p);
|
1063
1146
|
|
1064
|
-
|
1065
|
-
|
1147
|
+
/** @cond INTERNAL */
|
1148
|
+
template <> inline database_ptr createDatabaseForConnectionPool(database_ptr& p)
|
1149
|
+
{
|
1150
|
+
return createDatabaseObject();
|
1151
|
+
}
|
1152
|
+
/** @endcond */
|
1066
1153
|
|
1067
|
-
|
1154
|
+
/* Exception safe trnasction
|
1155
|
+
It can use for database and idatabaseManager.
|
1156
|
+
*/
|
1157
|
+
template <class DB> class transaction
|
1068
1158
|
{
|
1069
|
-
|
1159
|
+
DB m_db;
|
1070
1160
|
short m_bias;
|
1071
|
-
public:
|
1072
|
-
transaction(database_ptr db, short bias=LOCK_SINGLE_NOWAIT + PARALLEL_TRN + NOWAIT_WRITE)
|
1073
|
-
:m_db(db),m_bias(bias){};
|
1074
|
-
~transaction(){if (m_db->enableTrn()) m_db->abortTrn();};
|
1075
|
-
void begin(){m_db->beginTrn(m_bias);}
|
1076
|
-
void end(){m_db->endTrn();}
|
1077
|
-
void abort(){m_db->abortTrn();}
|
1078
1161
|
|
1162
|
+
public:
|
1163
|
+
inline transaction(DB db, short bias = LOCK_SINGLE_NOWAIT + PARALLEL_TRN +
|
1164
|
+
NOWAIT_WRITE)
|
1165
|
+
: m_db(db), m_bias(bias){};
|
1166
|
+
inline ~transaction()
|
1167
|
+
{
|
1168
|
+
if (m_db->enableTrn())
|
1169
|
+
m_db->abortTrn();
|
1170
|
+
};
|
1171
|
+
inline void begin() { m_db->beginTrn(m_bias); }
|
1172
|
+
inline void end() { m_db->endTrn(); }
|
1173
|
+
inline void abort() { m_db->abortTrn(); }
|
1079
1174
|
};
|
1080
1175
|
|
1081
|
-
|
1176
|
+
/** transaction for database */
|
1177
|
+
typedef transaction<database_ptr> dbTransaction;
|
1178
|
+
|
1179
|
+
/** transaction for idatabaseManager */
|
1180
|
+
typedef transaction<dbmanager_ptr> dbmTransaction;
|
1181
|
+
|
1182
|
+
template <class DB> class snapshot
|
1082
1183
|
{
|
1083
|
-
|
1184
|
+
DB m_db;
|
1185
|
+
|
1084
1186
|
public:
|
1085
|
-
|
1086
|
-
{
|
1087
|
-
m_db->beginSnapshot();
|
1088
|
-
}
|
1187
|
+
snapshot(DB db) : m_db(db) { m_db->beginSnapshot(); }
|
1089
1188
|
|
1090
|
-
~
|
1091
|
-
{
|
1092
|
-
m_db->endSnapshot();
|
1093
|
-
}
|
1189
|
+
~snapshot() { m_db->endSnapshot(); }
|
1094
1190
|
};
|
1095
1191
|
|
1192
|
+
/** snapshot for database */
|
1193
|
+
typedef snapshot<database_ptr> dbSnapshot;
|
1194
|
+
|
1195
|
+
/** snapshot for idatabaseManager */
|
1196
|
+
typedef snapshot<idatabaseManager*> dbmSnapshot;
|
1096
1197
|
|
1097
1198
|
class autoBulkinsert
|
1098
1199
|
{
|
1099
1200
|
table_ptr m_tb;
|
1201
|
+
|
1100
1202
|
public:
|
1101
|
-
autoBulkinsert(table_ptr tb, int bufsize = BULKBUFSIZE):m_tb(tb)
|
1203
|
+
autoBulkinsert(table_ptr tb, int bufsize = BULKBUFSIZE) : m_tb(tb)
|
1102
1204
|
{
|
1103
1205
|
m_tb->beginBulkInsert(bufsize);
|
1104
1206
|
}
|
1105
|
-
~autoBulkinsert(){m_tb->commitBulkInsert();}
|
1106
1207
|
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
}
|
1208
|
+
/* For activeObject */
|
1209
|
+
template <class T>
|
1210
|
+
autoBulkinsert(T& tba, int bufsize = BULKBUFSIZE)
|
1211
|
+
: m_tb(tba.table())
|
1212
|
+
{
|
1213
|
+
m_tb->beginBulkInsert(bufsize);
|
1214
|
+
}
|
1114
1215
|
|
1216
|
+
~autoBulkinsert() { m_tb->commitBulkInsert(); }
|
1217
|
+
};
|
1115
1218
|
|
1219
|
+
} // namespace client
|
1220
|
+
} // namespace tdap
|
1221
|
+
} // namespace protocol
|
1222
|
+
} // namespace db
|
1223
|
+
} // namespace bzs
|
1116
1224
|
|
1117
|
-
#endif
|
1225
|
+
#endif // BZS_DB_PROTOCOL_TDAP_CLIENT_TRDBOOSTAPI_H
|