transactd 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/BUILD_UNIX-JA +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
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#ifndef SRCGENH
|
|
2
|
+
#define SRCGENH
|
|
3
|
+
/*=================================================================
|
|
4
|
+
Copyright (C) 2014 BizStation Corp All rights reserved.
|
|
5
|
+
|
|
6
|
+
This program is free software; you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU General Public License
|
|
8
|
+
as published by the Free Software Foundation; either version 2
|
|
9
|
+
of the License, or (at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
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
|
|
19
|
+
02111-1307, USA.
|
|
20
|
+
=================================================================*/
|
|
21
|
+
|
|
22
|
+
#include <bzs/db/protocol/tdap/client/table.h>
|
|
23
|
+
#include <bzs/db/protocol/tdap/client/dbDef.h>
|
|
24
|
+
#include <vector>
|
|
25
|
+
#include "confParam.h"
|
|
26
|
+
#include "fieldName.h"
|
|
27
|
+
|
|
28
|
+
using namespace bzs::db::protocol::tdap;
|
|
29
|
+
typedef std::vector<std::string> strings;
|
|
30
|
+
|
|
31
|
+
class cppSrcGen
|
|
32
|
+
{
|
|
33
|
+
const tabledef* m_tabledef;
|
|
34
|
+
conf_parmas& m_pm;
|
|
35
|
+
CFiledNameResolver m_fnames;
|
|
36
|
+
int typeNum(int type);
|
|
37
|
+
std::string typeName(int typeNum, int len);
|
|
38
|
+
std::string membaName(fielddef* fielddef);
|
|
39
|
+
void replace(std::string& source, const char* convTgtStr,
|
|
40
|
+
const std::string& replaceStr);
|
|
41
|
+
std::string makeFdiMembaString();
|
|
42
|
+
std::string makeFdiResolverString();
|
|
43
|
+
std::string makeDataMembaString();
|
|
44
|
+
std::string makeDataMembaFuncString();
|
|
45
|
+
std::string makeDataMembaFuncDecString();
|
|
46
|
+
std::string makeDataMembaInitString();
|
|
47
|
+
std::string makeMapReadString();
|
|
48
|
+
std::string makeMapReadStringLine(int index);
|
|
49
|
+
std::string makeMapKeyCompString();
|
|
50
|
+
std::string makeMapKeyValueString();
|
|
51
|
+
std::string makeMapWriteString();
|
|
52
|
+
std::string makeMapWriteStringLine(int index);
|
|
53
|
+
std::string makeMapAutoIncString();
|
|
54
|
+
std::string makeMapKeyEnumString();
|
|
55
|
+
|
|
56
|
+
std::string makeNameSpaceBegin(const std::vector<std::string>& list);
|
|
57
|
+
std::string makeNameSpaceEnd(const std::vector<std::string>& list);
|
|
58
|
+
std::string makeIncludeGurdeString(bool data);
|
|
59
|
+
std::string makeFileName(bool data, bool header);
|
|
60
|
+
const char* typeString(int type, int size);
|
|
61
|
+
std::string membaNameSet(std::string s);
|
|
62
|
+
std::string membaNameGet(std::string s);
|
|
63
|
+
bool doMake(const std::string templeHeader, const std::string templeCpp,
|
|
64
|
+
bool data);
|
|
65
|
+
|
|
66
|
+
public:
|
|
67
|
+
cppSrcGen(const tabledef* tabledef, conf_parmas& pm);
|
|
68
|
+
|
|
69
|
+
void make();
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
#endif // SRCGENH
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
#pragma hdrstop
|
|
3
|
+
#include "%className%.h"
|
|
4
|
+
using namespace std;
|
|
5
|
+
|
|
6
|
+
% nameSpaceBegin %
|
|
7
|
+
|
|
8
|
+
struct imple
|
|
9
|
+
{
|
|
10
|
+
% datamemba % imple() : % menbaInit %
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
% className % :: % className % (void* owner)
|
|
14
|
+
: m_impl(new imple()){
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
%
|
|
19
|
+
className % :: % className % (const % className % &rt)
|
|
20
|
+
: m_impl(new imple())
|
|
21
|
+
{
|
|
22
|
+
*m_impl = *(rt.m_impl);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
% className % ::~ % className % () { delete m_impl; }
|
|
26
|
+
|
|
27
|
+
% className % & % className % ::operator=(const % className % &rt)
|
|
28
|
+
{
|
|
29
|
+
if (this != &rt)
|
|
30
|
+
{
|
|
31
|
+
*m_impl = *(rt.m_impl);
|
|
32
|
+
}
|
|
33
|
+
return *this;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
% dataClassMembaFunc %
|
|
37
|
+
|
|
38
|
+
% className % * % className % ::create(void* owner)
|
|
39
|
+
{
|
|
40
|
+
return new % className % (owner);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
% className % *create(% className % _ptr_list & mdls, int)
|
|
44
|
+
{
|
|
45
|
+
return % className % ::create(&mdls);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
% nameSpaceEnd %
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#ifndef % includegurde % H
|
|
2
|
+
#define % includegurde % H
|
|
3
|
+
|
|
4
|
+
#include <bzs/env/tstring.h>
|
|
5
|
+
#include <boost/shared_ptr.hpp>
|
|
6
|
+
#include <vector>
|
|
7
|
+
#include <bzs/db/protocol/tdap/btrDate.h>
|
|
8
|
+
namespace td = bzs::db::protocol::tdap;
|
|
9
|
+
|
|
10
|
+
% nameSpaceBegin %
|
|
11
|
+
|
|
12
|
+
class % extern % % className %
|
|
13
|
+
{
|
|
14
|
+
protected:
|
|
15
|
+
struct imple* m_impl;
|
|
16
|
+
|
|
17
|
+
public:
|
|
18
|
+
% className % (void* owner);
|
|
19
|
+
% className % (const % className % &rt);
|
|
20
|
+
~ % className % ();
|
|
21
|
+
% className % &operator=(const % className % &rt);
|
|
22
|
+
% dataClassMembaFuncDec % static % className % *create(void* owner);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
typedef boost::shared_ptr< % className % > % className % _ptr;
|
|
26
|
+
typedef std::vector< % className % _ptr> % className % _ptr_list;
|
|
27
|
+
typedef std::vector< % className % *> % className % _list;
|
|
28
|
+
typedef boost::shared_ptr< % className % _list> % className % _list_ptr;
|
|
29
|
+
|
|
30
|
+
% className % *create(% className % _ptr_list & mdls, int);
|
|
31
|
+
|
|
32
|
+
% nameSpaceEnd %
|
|
33
|
+
|
|
34
|
+
#endif //%includegurde%H
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
#pragma hdrstop
|
|
3
|
+
#include "%className%_map.h"
|
|
4
|
+
#include <bzs/env/tstring.h>
|
|
5
|
+
using namespace std;
|
|
6
|
+
using namespace bzs::db::protocol::tdap::client;
|
|
7
|
+
|
|
8
|
+
% nameSpaceMapBegin %
|
|
9
|
+
|
|
10
|
+
/* class %className%_fdi */
|
|
11
|
+
void % className % _fdi::init(table* tb){ % fdiResolver % }
|
|
12
|
+
|
|
13
|
+
% className % _fdi* createFdi(% className % _fdi*)
|
|
14
|
+
{
|
|
15
|
+
return new % className % _fdi();
|
|
16
|
+
}
|
|
17
|
+
void destroyFdi(% className % _fdi * p) { delete p; }
|
|
18
|
+
void initFdi(% className % _fdi * fdi, td::client::table * tb)
|
|
19
|
+
{
|
|
20
|
+
fdi->init(tb);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* class %className%_orm */
|
|
24
|
+
bool % className %
|
|
25
|
+
_orm::compKeyValue(% className % &l, % className % &r, int keyNum) const
|
|
26
|
+
{
|
|
27
|
+
% keyComp %
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void % className %
|
|
31
|
+
_orm::setKeyValues(% className % &m, const fields& fds, int keyNum)
|
|
32
|
+
{
|
|
33
|
+
% writeKeyValue %
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void % className %
|
|
37
|
+
_orm::writeMap(% className % &m, const fields& fds, int optipn)
|
|
38
|
+
{
|
|
39
|
+
% write %
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void % className %
|
|
43
|
+
_orm::readMap(% className % &m, const fields& fds, int optipn)
|
|
44
|
+
{
|
|
45
|
+
% read %
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void % className % _orm::readAuntoincValue(% className % &m, const fields& fds,
|
|
49
|
+
int optipn){ % autoinc % }
|
|
50
|
+
|
|
51
|
+
% nameSpaceMapEnd %
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#ifndef % includegurde % _MAPH
|
|
2
|
+
#define % includegurde % _MAPH
|
|
3
|
+
|
|
4
|
+
#include "%className%.h"
|
|
5
|
+
#include <bzs/db/protocol/tdap/client/trdboostapi.h>
|
|
6
|
+
|
|
7
|
+
% nameSpaceMapBegin %
|
|
8
|
+
|
|
9
|
+
class % extern % % className % _fdi
|
|
10
|
+
{
|
|
11
|
+
public:
|
|
12
|
+
% fdiMemba %
|
|
13
|
+
|
|
14
|
+
void init(td::client::table * tb);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
% className % _fdi* createFdi(% className % _fdi*);
|
|
18
|
+
void destroyFdi(% className % _fdi * p);
|
|
19
|
+
void initFdi(% className % _fdi * fdi, td::client::table * tb);
|
|
20
|
+
|
|
21
|
+
class % extern % % className % _orm
|
|
22
|
+
{
|
|
23
|
+
const % className % _fdi& m_fdi;
|
|
24
|
+
|
|
25
|
+
// noncopyable
|
|
26
|
+
% className % _orm(const % className % _orm&);
|
|
27
|
+
% className % _orm& operator=(const % className % _orm&);
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
enum key
|
|
31
|
+
{
|
|
32
|
+
% keyEnum %
|
|
33
|
+
};
|
|
34
|
+
% className % _orm(const % className % _fdi & fdi) : m_fdi(fdi) {}
|
|
35
|
+
bool compKeyValue(% className % &l, % className % &r, int keyNum) const;
|
|
36
|
+
void setKeyValues(% className % &m, const td::client::fields& fds,
|
|
37
|
+
int keyNum);
|
|
38
|
+
void writeMap(% className % &m, const td::client::fields& fds, int optipn);
|
|
39
|
+
void readMap(% className % &m, const td::client::fields& fds, int optipn);
|
|
40
|
+
void readAuntoincValue(% className % &m, const td::client::fields& fds,
|
|
41
|
+
int optipn);
|
|
42
|
+
const _TCHAR* getTableName() { return _T("%tableName%"); }
|
|
43
|
+
|
|
44
|
+
/* must define mdl_typename */
|
|
45
|
+
typedef % className % mdl_typename;
|
|
46
|
+
|
|
47
|
+
/* must define fdi_typename
|
|
48
|
+
If fdi is not used, It is considered as default
|
|
49
|
+
"typedef fdibase fdi_typename"
|
|
50
|
+
If using different FDI(s),In this case, the class of fdi is specified like
|
|
51
|
+
"activeTable<group, group_fdi>" at the instance creation of activeTable.
|
|
52
|
+
*/
|
|
53
|
+
typedef % className % _fdi fdi_typename;
|
|
54
|
+
|
|
55
|
+
/* if use not vector collection, please spcecify your_collection_type */
|
|
56
|
+
/* typedef mdlsHandler<%className%_orm, your_collection_type>
|
|
57
|
+
collection_orm_typename;*/
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
% nameSpaceMapEnd %
|
|
61
|
+
|
|
62
|
+
#endif //%includegurde%_ORMH
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
### ###
|
|
2
|
+
### Transactd O/R mapper source code generator configurations ###
|
|
3
|
+
### ###
|
|
4
|
+
|
|
5
|
+
## Programing language of the source code which will be generated
|
|
6
|
+
lang = cpp
|
|
7
|
+
|
|
8
|
+
## Number of the template files
|
|
9
|
+
files = 2
|
|
10
|
+
|
|
11
|
+
## Paths of the template files
|
|
12
|
+
## Remove extensions (ex:".cpp" ".h") if the template is C++.
|
|
13
|
+
file1 = ormDataClass_template
|
|
14
|
+
file2 = ormMapClass_template
|
|
15
|
+
|
|
16
|
+
## Output directory
|
|
17
|
+
saveDir =
|
|
18
|
+
|
|
19
|
+
## Prefix of setter
|
|
20
|
+
setPrefix = set
|
|
21
|
+
|
|
22
|
+
## Prefix of getter
|
|
23
|
+
getPrefix = get
|
|
24
|
+
|
|
25
|
+
## Export keyword macro for export classes
|
|
26
|
+
## Uncomment to enable the macro which wraps export keywords
|
|
27
|
+
## (such as __declspec(dllexport)). If you use the generated
|
|
28
|
+
## classes in DLL, uncomment below.
|
|
29
|
+
#externWord=AGRPACK
|
|
30
|
+
|
|
31
|
+
## Path of the file which includes field aliases list
|
|
32
|
+
#fieldRenameList = c:\xxx or ~/xxx
|
|
33
|
+
|
|
34
|
+
## Namespace of the data class (ex:name_space = bzs)
|
|
35
|
+
#name_space =
|
|
36
|
+
|
|
37
|
+
## Namespace of the map class (ex:name_space = bzs/map)
|
|
38
|
+
#name_space_map =
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/*=================================================================
|
|
2
|
+
Copyright (C) 2014 BizStation Corp All rights reserved.
|
|
3
|
+
|
|
4
|
+
This program is free software; you can redistribute it and/or
|
|
5
|
+
modify it under the terms of the GNU General Public License
|
|
6
|
+
as published by the Free Software Foundation; either version 2
|
|
7
|
+
of the License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program; if not, write to the Free Software
|
|
16
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
17
|
+
02111-1307, USA.
|
|
18
|
+
=================================================================*/
|
|
19
|
+
#pragma hdrstop
|
|
20
|
+
|
|
21
|
+
#include <bzs/db/protocol/tdap/client/serializer.h>
|
|
22
|
+
#include <bzs/db/protocol/tdap/client/databaseManager.h>
|
|
23
|
+
#include <bzs/rtl/benchmark.h>
|
|
24
|
+
#include <stdio.h>
|
|
25
|
+
#include <stdlib.h>
|
|
26
|
+
#include <locale.h>
|
|
27
|
+
#include <iostream>
|
|
28
|
+
#include <boost/program_options.hpp>
|
|
29
|
+
|
|
30
|
+
#ifdef __BCPLUSPLUS__
|
|
31
|
+
#define BZS_LINK_BOOST_PROGRAM_OPTIONS
|
|
32
|
+
#include <bzs/env/boost_bcb_link.h>
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
using namespace bzs::db::protocol::tdap::client;
|
|
36
|
+
using namespace boost::program_options;
|
|
37
|
+
|
|
38
|
+
//---------------------------------------------------------------------------
|
|
39
|
+
struct cmd_parmas
|
|
40
|
+
{
|
|
41
|
+
std::string query;
|
|
42
|
+
std::string ivalues;
|
|
43
|
+
bool print;
|
|
44
|
+
cmd_parmas() : print(false) {}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
enum eEncoding
|
|
48
|
+
{
|
|
49
|
+
eEAuto = 0,
|
|
50
|
+
eEAnsi = 1,
|
|
51
|
+
eEUnicode = 2,
|
|
52
|
+
eEUtf8 = 3
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
void analyzeBom(unsigned char* p, eEncoding& type)
|
|
56
|
+
{
|
|
57
|
+
if ((p[0] == 0xFF) && (p[1] == 0xFE))
|
|
58
|
+
type = eEUnicode;
|
|
59
|
+
else if ((p[0] == 0xEF) && (p[1] == 0xBB) && (p[2] == 0xBF))
|
|
60
|
+
type = eEUtf8;
|
|
61
|
+
else
|
|
62
|
+
type = eEAnsi;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
bool readInputValues(const char* filename,
|
|
66
|
+
std::vector<std::_tstring>& inputValues)
|
|
67
|
+
{
|
|
68
|
+
// Linux : A input file encording is utf8.
|
|
69
|
+
// Windows multibyte: A input file encording is utf8.
|
|
70
|
+
// Windows unicode : A input file encording is locale charset.
|
|
71
|
+
FILE* fp = fopen(filename, "rt");
|
|
72
|
+
if (!fp)
|
|
73
|
+
{
|
|
74
|
+
_ftprintf(stderr, _T("Error ! Can not open the input file (%s)\n"),
|
|
75
|
+
filename);
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
char tmp[5];
|
|
79
|
+
eEncoding encodeing = eEAnsi;
|
|
80
|
+
fseek(fp, 0L, SEEK_SET);
|
|
81
|
+
|
|
82
|
+
if (fgets(tmp, 4, fp))
|
|
83
|
+
{
|
|
84
|
+
analyzeBom((unsigned char*)tmp, encodeing);
|
|
85
|
+
if (encodeing == eEAnsi)
|
|
86
|
+
fseek(fp, 0L, SEEK_SET);
|
|
87
|
+
else if (encodeing == eEUnicode)
|
|
88
|
+
fseek(fp, 2L, SEEK_SET);
|
|
89
|
+
else if (encodeing == eEUtf8)
|
|
90
|
+
fseek(fp, 3L, SEEK_SET);
|
|
91
|
+
}
|
|
92
|
+
if ((encodeing == eEAnsi) || (encodeing == eEUtf8))
|
|
93
|
+
{
|
|
94
|
+
char buf[512];
|
|
95
|
+
while (fgets(buf, 512, fp))
|
|
96
|
+
{
|
|
97
|
+
buf[strlen(buf) - 1] = 0x00;
|
|
98
|
+
#ifdef _UNICODE
|
|
99
|
+
wchar_t wbuf[1024];
|
|
100
|
+
UINT codePage = (encodeing == eEUtf8) ? CP_UTF8 : CP_ACP;
|
|
101
|
+
MultiByteToWideChar(codePage,
|
|
102
|
+
(codePage == CP_UTF8) ? 0 : MB_PRECOMPOSED, buf,
|
|
103
|
+
-1, wbuf, 1024);
|
|
104
|
+
inputValues.push_back(wbuf);
|
|
105
|
+
#else
|
|
106
|
+
inputValues.push_back(buf);
|
|
107
|
+
#endif //_UNICODE
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else
|
|
111
|
+
{
|
|
112
|
+
#ifndef _WIN32
|
|
113
|
+
_ftprintf(
|
|
114
|
+
stderr,
|
|
115
|
+
_T("Error ! Can not read the unicode encording input file(%s).\n"),
|
|
116
|
+
filename);
|
|
117
|
+
#else
|
|
118
|
+
wchar_t wbuf[512];
|
|
119
|
+
while (fgetws(wbuf, 512, fp))
|
|
120
|
+
{
|
|
121
|
+
wbuf[wcslen(wbuf) - 1] = 0x00;
|
|
122
|
+
#ifdef _UNICODE
|
|
123
|
+
inputValues.push_back(wbuf);
|
|
124
|
+
#else
|
|
125
|
+
char buf[1024];
|
|
126
|
+
WideCharToMultiByte(CP_UTF8, 0, wbuf, -1, buf, 1024, NULL, NULL);
|
|
127
|
+
inputValues.push_back(buf);
|
|
128
|
+
#endif //_UNICODE
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#endif
|
|
132
|
+
}
|
|
133
|
+
fclose(fp);
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
void printResult(recordset& rs)
|
|
138
|
+
{
|
|
139
|
+
const fielddefs& fields = *rs.fieldDefs();
|
|
140
|
+
for (int j = 0; j < (int)fields.size(); ++j)
|
|
141
|
+
_tprintf(_T("%s\t"), fields[j].name());
|
|
142
|
+
_tprintf(_T("\n"));
|
|
143
|
+
|
|
144
|
+
for (int i = 0; i < (int)rs.size(); ++i)
|
|
145
|
+
{
|
|
146
|
+
row& m = rs[i];
|
|
147
|
+
for (int j = 0; j < (int)m.size(); ++j)
|
|
148
|
+
{
|
|
149
|
+
_tprintf(_T("%s\t"), m[(short)j].c_str());
|
|
150
|
+
if (j == (int)m.size() - 1)
|
|
151
|
+
_tprintf(_T("\n"));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
void execute(queryStatements* qs, recordset* rs,
|
|
157
|
+
std::vector<std::_tstring>* values)
|
|
158
|
+
{
|
|
159
|
+
qs->execute(*rs, values);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
#pragma argsused
|
|
163
|
+
int _tmain(int argc, _TCHAR* argv[])
|
|
164
|
+
{
|
|
165
|
+
#ifdef _WIN32
|
|
166
|
+
// set locale to current user locale.
|
|
167
|
+
std::locale::global(std::locale(""));
|
|
168
|
+
#endif
|
|
169
|
+
|
|
170
|
+
// setup command line options
|
|
171
|
+
cmd_parmas pm;
|
|
172
|
+
options_description opt("command line option");
|
|
173
|
+
opt.add_options()("query,q", value<std::string>(&pm.query),
|
|
174
|
+
"prepared query file path")(
|
|
175
|
+
"values,v", value<std::string>(&pm.ivalues),
|
|
176
|
+
"prepared input values file path")("print,p", value<bool>(&pm.print),
|
|
177
|
+
"print out result");
|
|
178
|
+
variables_map values;
|
|
179
|
+
try
|
|
180
|
+
{
|
|
181
|
+
store(parse_command_line(argc, argv, opt), values);
|
|
182
|
+
notify(values);
|
|
183
|
+
if (!values.count("query")
|
|
184
|
+
/*|| !values.count("values")*/)
|
|
185
|
+
{
|
|
186
|
+
std::cout << opt << std::endl;
|
|
187
|
+
return 1;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
disbDbManager dbm;
|
|
191
|
+
// boost::shared_ptr<queryStatements> qs(queryStatements::create(dbm),
|
|
192
|
+
// boost::bind(&queryStatements::release, qs.get()));
|
|
193
|
+
queryStatements qs(dbm);
|
|
194
|
+
recordset rs;
|
|
195
|
+
std::vector<std::_tstring> inputValues;
|
|
196
|
+
|
|
197
|
+
if (values.count("values") &&
|
|
198
|
+
!readInputValues(pm.ivalues.c_str(), inputValues))
|
|
199
|
+
return 1;
|
|
200
|
+
|
|
201
|
+
const _TCHAR* path;
|
|
202
|
+
#ifdef _UNICODE
|
|
203
|
+
wchar_t buf[2048];
|
|
204
|
+
MultiByteToWideChar(CP_UTF8, 0, pm.query.c_str(), -1, buf, 2048);
|
|
205
|
+
path = buf;
|
|
206
|
+
#else
|
|
207
|
+
path = pm.query.c_str();
|
|
208
|
+
#endif
|
|
209
|
+
qs.load(path);
|
|
210
|
+
// bzs::rtl::benchmark::report2(boost::bind(execute, &qs, &rs,
|
|
211
|
+
// &inputValues), "execute");
|
|
212
|
+
bzs::rtl::benchmark::start();
|
|
213
|
+
execute(&qs, &rs, &inputValues);
|
|
214
|
+
int t = bzs::rtl::benchmark::stop();
|
|
215
|
+
if (pm.print)
|
|
216
|
+
printResult(rs);
|
|
217
|
+
char tmp[120];
|
|
218
|
+
sprintf_s(tmp, 120, "OK, %lu record(s) :", rs.size());
|
|
219
|
+
bzs::rtl::benchmark::showTimes(t, tmp);
|
|
220
|
+
|
|
221
|
+
fflush(stdout);
|
|
222
|
+
|
|
223
|
+
return 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
catch (bzs::rtl::exception& e)
|
|
227
|
+
{
|
|
228
|
+
_ftprintf(stderr, _T("Error ! %s\n"), getMsg(e)->c_str());
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
catch (std::exception& e)
|
|
232
|
+
{
|
|
233
|
+
std::cout << e.what() << std::endl;
|
|
234
|
+
}
|
|
235
|
+
return 1;
|
|
236
|
+
}
|
|
237
|
+
//---------------------------------------------------------------------------
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*=================================================================
|
|
2
|
+
Copyright (C) 2014 BizStation Corp All rights reserved.
|
|
3
|
+
|
|
4
|
+
This program is free software; you can redistribute it and/or
|
|
5
|
+
modify it under the terms of the GNU General Public License
|
|
6
|
+
as published by the Free Software Foundation; either version 2
|
|
7
|
+
of the License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program; if not, write to the Free Software
|
|
16
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
17
|
+
02111-1307, USA.
|
|
18
|
+
=================================================================*/
|
|
19
|
+
#include "stdafx.h"
|
|
20
|
+
#include "ConnectParams.h"
|
|
21
|
+
|
|
22
|
+
using namespace bzs::db::protocol::tdap::client;
|
|
23
|
+
|
|
24
|
+
STDMETHODIMP CConnectParams::Init(BSTR protocol, BSTR hostOrIp, BSTR dbname,
|
|
25
|
+
BSTR schemaTable)
|
|
26
|
+
{
|
|
27
|
+
if (m_param)
|
|
28
|
+
delete m_param;
|
|
29
|
+
m_param = new connectParams(protocol, hostOrIp, dbname, schemaTable);
|
|
30
|
+
return S_OK;
|
|
31
|
+
}
|
|
32
|
+
STDMETHODIMP CConnectParams::put_Uri(BSTR val)
|
|
33
|
+
{
|
|
34
|
+
if (m_param)
|
|
35
|
+
delete m_param;
|
|
36
|
+
m_param = new connectParams(val);
|
|
37
|
+
return S_OK;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
STDMETHODIMP CConnectParams::get_Uri(BSTR* retVal)
|
|
41
|
+
{
|
|
42
|
+
if (m_param)
|
|
43
|
+
{
|
|
44
|
+
CComBSTR ret;
|
|
45
|
+
ret = m_param->uri();
|
|
46
|
+
*retVal = ret.Copy();
|
|
47
|
+
}
|
|
48
|
+
return S_OK;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
STDMETHODIMP CConnectParams::put_Mode(short val)
|
|
52
|
+
{
|
|
53
|
+
if (m_param)
|
|
54
|
+
m_param->setMode((char_td)val);
|
|
55
|
+
return S_OK;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
STDMETHODIMP CConnectParams::get_Mode(short* retVal)
|
|
59
|
+
{
|
|
60
|
+
if (m_param)
|
|
61
|
+
*retVal = m_param->mode();
|
|
62
|
+
return S_OK;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
STDMETHODIMP CConnectParams::put_Type(short val)
|
|
66
|
+
{
|
|
67
|
+
if (m_param)
|
|
68
|
+
m_param->setType(val);
|
|
69
|
+
return S_OK;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
STDMETHODIMP CConnectParams::get_Type(short* retVal)
|
|
73
|
+
{
|
|
74
|
+
if (m_param)
|
|
75
|
+
*retVal = m_param->type();
|
|
76
|
+
return S_OK;
|
|
77
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
/*=================================================================
|
|
3
|
+
Copyright (C) 2014 BizStation Corp All rights reserved.
|
|
4
|
+
|
|
5
|
+
This program is free software; you can redistribute it and/or
|
|
6
|
+
modify it under the terms of the GNU General Public License
|
|
7
|
+
as published by the Free Software Foundation; either version 2
|
|
8
|
+
of the License, or (at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with this program; if not, write to the Free Software
|
|
17
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
18
|
+
02111-1307, USA.
|
|
19
|
+
=================================================================*/
|
|
20
|
+
#include "resource.h"
|
|
21
|
+
#include "tdclatl_i.h"
|
|
22
|
+
#include <bzs/db/protocol/tdap/client/trdboostapi.h>
|
|
23
|
+
|
|
24
|
+
using namespace ATL;
|
|
25
|
+
|
|
26
|
+
class ATL_NO_VTABLE CConnectParams
|
|
27
|
+
: public CComObjectRootEx<CComSingleThreadModel>,
|
|
28
|
+
public CComCoClass<CConnectParams, &CLSID_ConnectParams>,
|
|
29
|
+
public IDispatchImpl<IConnectParams, &IID_IConnectParams,
|
|
30
|
+
&LIBID_transactd, /* wMajor = */ 1, /* wMinor = */ 0>
|
|
31
|
+
{
|
|
32
|
+
|
|
33
|
+
bzs::db::protocol::tdap::client::connectParams* m_param;
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
CConnectParams() : m_param(NULL) {}
|
|
37
|
+
|
|
38
|
+
bzs::db::protocol::tdap::client::connectParams* internalConnectParams()
|
|
39
|
+
{
|
|
40
|
+
return m_param;
|
|
41
|
+
}
|
|
42
|
+
DECLARE_REGISTRY_RESOURCEID(IDR_CONNECTPARAM)
|
|
43
|
+
|
|
44
|
+
BEGIN_COM_MAP(CConnectParams)
|
|
45
|
+
COM_INTERFACE_ENTRY(IConnectParams)
|
|
46
|
+
COM_INTERFACE_ENTRY(IDispatch)
|
|
47
|
+
END_COM_MAP()
|
|
48
|
+
|
|
49
|
+
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
50
|
+
|
|
51
|
+
HRESULT FinalConstruct()
|
|
52
|
+
{
|
|
53
|
+
delete m_param;
|
|
54
|
+
return S_OK;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void FinalRelease(){};
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
STDMETHOD(Init)(BSTR protocol, BSTR hostOrIp, BSTR dbname,
|
|
61
|
+
BSTR schemaTable);
|
|
62
|
+
STDMETHOD(put_Uri)(BSTR val);
|
|
63
|
+
STDMETHOD(get_Uri)(BSTR* retVal);
|
|
64
|
+
STDMETHOD(put_Mode)(short val);
|
|
65
|
+
STDMETHOD(get_Mode)(short* retVal);
|
|
66
|
+
STDMETHOD(put_Type)(short val);
|
|
67
|
+
STDMETHOD(get_Type)(short* retVal);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
OBJECT_ENTRY_AUTO(__uuidof(ConnectParams), CConnectParams)
|