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,566 +1,702 @@
|
|
1
|
-
#ifndef
|
2
|
-
#define
|
3
|
-
/* =================================================================
|
4
|
-
Copyright (C) 2000-2013 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/tdapcapi.h>
|
23
|
-
#include <string.h>
|
24
|
-
#include <algorithm>
|
25
|
-
#include <wchar.h>
|
26
|
-
#include <bzs/env/compiler.h>
|
27
|
-
#include <bzs/env/crosscompile.h>
|
28
|
-
#include <bzs/db/protocol/tdap/mysql/characterset.h>
|
29
|
-
|
30
|
-
namespace bzs
|
31
|
-
{
|
32
|
-
namespace db
|
33
|
-
{
|
34
|
-
namespace protocol
|
35
|
-
{
|
36
|
-
namespace tdap
|
37
|
-
{
|
38
|
-
|
39
|
-
namespace client
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
unsigned short
|
58
|
-
|
59
|
-
unsigned short
|
60
|
-
unsigned short
|
61
|
-
unsigned short
|
62
|
-
unsigned short
|
63
|
-
unsigned short
|
64
|
-
unsigned short
|
65
|
-
unsigned short
|
66
|
-
unsigned short
|
67
|
-
unsigned short
|
68
|
-
unsigned short
|
69
|
-
unsigned short
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
unsigned short
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
unsigned short
|
85
|
-
unsigned short
|
86
|
-
unsigned short
|
87
|
-
unsigned short
|
88
|
-
unsigned short
|
89
|
-
unsigned short
|
90
|
-
unsigned short
|
91
|
-
unsigned short
|
92
|
-
unsigned short
|
93
|
-
unsigned short
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
*/
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
/*
|
127
|
-
*/
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
static const int
|
156
|
-
|
157
|
-
static const int
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
ushort_td
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
uchar_td
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
inline const char*
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
inline
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
}
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
inline
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
if (
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
if ((type ==
|
415
|
-
|
416
|
-
|
417
|
-
}
|
418
|
-
|
419
|
-
inline
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
inline const
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
inline
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
}
|
522
|
-
|
523
|
-
/*
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
}
|
564
|
-
|
565
|
-
|
566
|
-
|
1
|
+
#ifndef BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_H
|
2
|
+
#define BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_H
|
3
|
+
/* =================================================================
|
4
|
+
Copyright (C) 2000-2013 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/tdapcapi.h>
|
23
|
+
#include <string.h>
|
24
|
+
#include <algorithm>
|
25
|
+
#include <wchar.h>
|
26
|
+
#include <bzs/env/compiler.h>
|
27
|
+
#include <bzs/env/crosscompile.h>
|
28
|
+
#include <bzs/db/protocol/tdap/mysql/characterset.h>
|
29
|
+
|
30
|
+
namespace bzs
|
31
|
+
{
|
32
|
+
namespace db
|
33
|
+
{
|
34
|
+
namespace protocol
|
35
|
+
{
|
36
|
+
namespace tdap
|
37
|
+
{
|
38
|
+
|
39
|
+
namespace client
|
40
|
+
{
|
41
|
+
class dbdef;
|
42
|
+
}
|
43
|
+
|
44
|
+
#pragma pack(push, 1)
|
45
|
+
pragma_pack1;
|
46
|
+
|
47
|
+
using std::min;
|
48
|
+
using std::max;
|
49
|
+
|
50
|
+
#ifdef SWIG
|
51
|
+
|
52
|
+
/* For swig interface
|
53
|
+
Export names .
|
54
|
+
*/
|
55
|
+
union FLAGS
|
56
|
+
{
|
57
|
+
unsigned short all;
|
58
|
+
|
59
|
+
unsigned short bit0 : 1;
|
60
|
+
unsigned short bit1 : 1;
|
61
|
+
unsigned short bit2 : 1;
|
62
|
+
unsigned short bit3 : 1;
|
63
|
+
unsigned short bit4 : 1;
|
64
|
+
unsigned short bit5 : 1;
|
65
|
+
unsigned short bit6 : 1;
|
66
|
+
unsigned short bit7 : 1;
|
67
|
+
unsigned short bit8 : 1;
|
68
|
+
unsigned short bit9 : 1;
|
69
|
+
unsigned short bitA : 1;
|
70
|
+
unsigned short bitB : 1;
|
71
|
+
unsigned short bitC : 1;
|
72
|
+
unsigned short bitD : 1;
|
73
|
+
unsigned short bitE : 1;
|
74
|
+
unsigned short bitF : 1;
|
75
|
+
};
|
76
|
+
#else // NOT SWIG
|
77
|
+
|
78
|
+
union FLAGS
|
79
|
+
{
|
80
|
+
unsigned short all;
|
81
|
+
|
82
|
+
struct
|
83
|
+
{
|
84
|
+
unsigned short bit0 : 1;
|
85
|
+
unsigned short bit1 : 1;
|
86
|
+
unsigned short bit2 : 1;
|
87
|
+
unsigned short bit3 : 1;
|
88
|
+
unsigned short bit4 : 1;
|
89
|
+
unsigned short bit5 : 1;
|
90
|
+
unsigned short bit6 : 1;
|
91
|
+
unsigned short bit7 : 1;
|
92
|
+
unsigned short bit8 : 1;
|
93
|
+
unsigned short bit9 : 1;
|
94
|
+
unsigned short bitA : 1;
|
95
|
+
unsigned short bitB : 1;
|
96
|
+
unsigned short bitC : 1;
|
97
|
+
unsigned short bitD : 1;
|
98
|
+
unsigned short bitE : 1;
|
99
|
+
unsigned short bitF : 1;
|
100
|
+
};
|
101
|
+
};
|
102
|
+
#endif // NOT SWIG
|
103
|
+
|
104
|
+
/* brief Key infomation for create table operation
|
105
|
+
*/
|
106
|
+
struct keySpec
|
107
|
+
{
|
108
|
+
ushort_td keyPos; /* key position */
|
109
|
+
ushort_td keyLen; /* key length */
|
110
|
+
FLAGS keyFlag; /* key flag */
|
111
|
+
uint_td keyCount; /* key count */
|
112
|
+
uchar_td keyType; /* key type of extended */
|
113
|
+
uchar_td nullValue; /* value of null */
|
114
|
+
uchar_td reserve2[2]; /* reserved */
|
115
|
+
uchar_td keyNo; /* fixed key number */
|
116
|
+
uchar_td acsNo; /* no acs */
|
117
|
+
}; /* total 16 byte */
|
118
|
+
|
119
|
+
/* brief File infomation for create table operation
|
120
|
+
*/
|
121
|
+
struct fileSpec
|
122
|
+
{
|
123
|
+
ushort_td recLen; /* record length */
|
124
|
+
ushort_td pageSize; /* page sise */
|
125
|
+
ushort_td indexCount; /* index count */
|
126
|
+
uint_td recCount; /* record count for stat */
|
127
|
+
FLAGS fileFlag; /* file flags */
|
128
|
+
uchar_td reserve1[2]; /* reserved */
|
129
|
+
ushort_td preAlloc; /* page allocation count */
|
130
|
+
keySpec keySpecs[1]; /* key specs */
|
131
|
+
}; /* total ? byte */
|
132
|
+
|
133
|
+
/* brief A key segment infomation
|
134
|
+
*/
|
135
|
+
struct keySegment
|
136
|
+
{
|
137
|
+
uchar_td fieldNum; // Refarence field buymber
|
138
|
+
FLAGS flags; // key flags. 11 to 15bit is not use.
|
139
|
+
};
|
140
|
+
|
141
|
+
/* brief A key infomation
|
142
|
+
*/
|
143
|
+
#define MAX_KEY_SEGMENT 8
|
144
|
+
|
145
|
+
struct keydef
|
146
|
+
{
|
147
|
+
uchar_td segmentCount; // Number of segment
|
148
|
+
keySegment segments[MAX_KEY_SEGMENT]; // key segments . max 8 segments
|
149
|
+
uchar_td keyNumber; // key number
|
150
|
+
};
|
151
|
+
|
152
|
+
static const int MYSQL_FDNAME_SIZE = 64;
|
153
|
+
static const int MYSQL_TBNAME_SIZE = 64;
|
154
|
+
static const int PERVASIVE_FDNAME_SIZE = 20;
|
155
|
+
static const int FIELD_NAME_SIZE = MYSQL_FDNAME_SIZE;
|
156
|
+
static const int TABLE_NAME_SIZE = 32;
|
157
|
+
static const int FILE_NAME_SIZE = 266;
|
158
|
+
|
159
|
+
#if (defined(__x86_32__) || __APPLE_32__)
|
160
|
+
static const int TABLEDEF_FILLER_SIZE = 21; // 25-4;
|
161
|
+
#else
|
162
|
+
static const int TABLEDEF_FILLER_SIZE = 9; // 17-8;
|
163
|
+
#endif
|
164
|
+
|
165
|
+
#ifndef MYSQL_DYNAMIC_PLUGIN
|
166
|
+
|
167
|
+
/* A field type name that specified by a type is returned.
|
168
|
+
*/
|
169
|
+
PACKAGE const _TCHAR* getTypeName(short type);
|
170
|
+
|
171
|
+
/* A field alignment that specified by a type is returned.
|
172
|
+
*/
|
173
|
+
PACKAGE int getTypeAlign(short type);
|
174
|
+
|
175
|
+
/* calcurate byts of char type by charctor number.
|
176
|
+
*/
|
177
|
+
PACKAGE ushort_td
|
178
|
+
lenByCharnum(uchar_td type, uchar_td charsetIndex, ushort_td charnum);
|
179
|
+
|
180
|
+
#endif // MYSQL_DYNAMIC_PLUGIN
|
181
|
+
|
182
|
+
/* Is field type string ? */
|
183
|
+
PACKAGE bool isStringType(uchar_td type);
|
184
|
+
|
185
|
+
/* Mark of ** that BizStation Corp internal use only.
|
186
|
+
*/
|
187
|
+
template <int N> struct fielddef_t
|
188
|
+
{
|
189
|
+
protected:
|
190
|
+
char m_name[N];
|
191
|
+
|
192
|
+
public:
|
193
|
+
uchar_td type; // type (zstring integer)
|
194
|
+
ushort_td len; // length
|
195
|
+
uchar_td decimals; // ** decimals
|
196
|
+
char viewNum; // ** An order of a list view column
|
197
|
+
ushort_td viewWidth; // ** view width pix
|
198
|
+
double max; // ** max value
|
199
|
+
double min; // ** min value
|
200
|
+
double defValue; // ** default value
|
201
|
+
uchar_td lookTable; // ** reference table number
|
202
|
+
uchar_td lookField; // ** field number of reference table
|
203
|
+
uchar_td lookFields[3]; // ** View fields of reference bit567
|
204
|
+
ushort_td pos; // Field offset position from record image
|
205
|
+
ushort_td defViewWidth; // ** default view wifth
|
206
|
+
|
207
|
+
protected:
|
208
|
+
char m_chainChar[2];
|
209
|
+
|
210
|
+
public:
|
211
|
+
ushort_td ddfid; // ddf field id
|
212
|
+
ushort_td filterId; // ** filter id for reference
|
213
|
+
uchar_td filterKeynum; // ** key number for reference
|
214
|
+
uchar_td nullValue; // null value
|
215
|
+
ushort_td userOption; // ** option
|
216
|
+
uchar_td lookDBNum; // ** database number of reference bitD
|
217
|
+
ushort_td keylen; // key length for mysql of part key
|
218
|
+
|
219
|
+
protected:
|
220
|
+
uchar_td m_charsetIndex; // charctor set index of this field data
|
221
|
+
uint_td m_schemaCodePage;
|
222
|
+
|
223
|
+
public:
|
224
|
+
FLAGS enableFlags; // ** enable flags. see below
|
225
|
+
|
226
|
+
private:
|
227
|
+
inline void setSchemaCodePage(uint_td v) { m_schemaCodePage = v; };
|
228
|
+
friend class client::dbdef;
|
229
|
+
};
|
230
|
+
|
231
|
+
/* This is only for BizStation Corp internal.
|
232
|
+
enableFlags
|
233
|
+
bit0 show list view
|
234
|
+
bit1 enable max value
|
235
|
+
bit2 enable min value
|
236
|
+
bit3 enable default value
|
237
|
+
bit4 enable lookTable
|
238
|
+
bit5 enable lookFields[0]
|
239
|
+
bit6 enable lookFields[1]
|
240
|
+
bit7 enable lookFields[2]
|
241
|
+
bit8 It append to a front column.
|
242
|
+
bit9 enable reference filter
|
243
|
+
bitA call field name rename function.
|
244
|
+
bitB disbale export this field data.
|
245
|
+
bitC not show list view but add select field list
|
246
|
+
bitD enable lookDBNum
|
247
|
+
bitE field value is changed
|
248
|
+
*/
|
249
|
+
|
250
|
+
typedef fielddef_t<MYSQL_FDNAME_SIZE> fielddef_t_my;
|
251
|
+
typedef fielddef_t<PERVASIVE_FDNAME_SIZE> fielddef_t_pv;
|
252
|
+
|
253
|
+
#ifdef SWIG
|
254
|
+
%template(fielddef_t_my) fielddef_t<MYSQL_FDNAME_SIZE>;
|
255
|
+
#endif // SWIG
|
256
|
+
|
257
|
+
struct PACKAGE fielddef : public fielddef_t_my
|
258
|
+
{
|
259
|
+
#ifdef _UNICODE
|
260
|
+
const wchar_t* name() const; // Return a field name.
|
261
|
+
const wchar_t* name(wchar_t* buf) const; // Return a field name to bufffer .
|
262
|
+
const wchar_t* chainChar() const; // ** internal use only.
|
263
|
+
void setName(const wchar_t* s);
|
264
|
+
void setChainChar(const wchar_t* s); // ** internal use only.
|
265
|
+
#else // NOT _UNICODE
|
266
|
+
|
267
|
+
#ifdef MYSQL_DYNAMIC_PLUGIN
|
268
|
+
|
269
|
+
inline const char* name() const { return m_name; };
|
270
|
+
|
271
|
+
inline const char* chainChar() const { return m_chainChar; };
|
272
|
+
|
273
|
+
inline void setName(const char* s)
|
274
|
+
{
|
275
|
+
strncpy_s(m_name, FIELD_NAME_SIZE, s, sizeof(m_name) - 1);
|
276
|
+
};
|
277
|
+
|
278
|
+
inline void setChainChar(const char* s)
|
279
|
+
{
|
280
|
+
strncpy_s(m_chainChar, 2, s, sizeof(m_chainChar) - 1);
|
281
|
+
};
|
282
|
+
|
283
|
+
#else // NOT MYSQL_DYNAMIC_PLUGIN
|
284
|
+
const char* name() const;
|
285
|
+
const char* name(char* buf) const;
|
286
|
+
const char* chainChar() const;
|
287
|
+
void setName(const char* s);
|
288
|
+
void setChainChar(const char* s);
|
289
|
+
#endif // NOT MYSQL_DYNAMIC_PLUGIN
|
290
|
+
#endif // NOT _UNICODE
|
291
|
+
|
292
|
+
inline const char* nameA() const { return m_name; };
|
293
|
+
|
294
|
+
inline void setNameA(const char* s)
|
295
|
+
{
|
296
|
+
strncpy_s(m_name, FIELD_NAME_SIZE, s, sizeof(m_name) - 1);
|
297
|
+
};
|
298
|
+
#ifndef MYSQL_DYNAMIC_PLUGIN
|
299
|
+
|
300
|
+
inline const _TCHAR* typeName() const { return getTypeName(type); };
|
301
|
+
|
302
|
+
inline int align() const { return getTypeAlign(type); };
|
303
|
+
|
304
|
+
inline void setLenByCharnum(ushort_td charnum)
|
305
|
+
{
|
306
|
+
len = lenByCharnum(type, m_charsetIndex, charnum);
|
307
|
+
}
|
308
|
+
|
309
|
+
#endif // MYSQL_DYNAMIC_PLUGIN
|
310
|
+
|
311
|
+
private:
|
312
|
+
/* Is variable key type
|
313
|
+
*/
|
314
|
+
inline bool isKeyVarType() const
|
315
|
+
{
|
316
|
+
return (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
|
317
|
+
(type == ft_myblob) || (type == ft_mytext));
|
318
|
+
}
|
319
|
+
|
320
|
+
/* max key segment length. not include sizeBytes.
|
321
|
+
*/
|
322
|
+
inline ushort_td maxKeylen() const { return keylen ? keylen : len; };
|
323
|
+
|
324
|
+
inline ushort_td keyFromVarlen() const
|
325
|
+
{
|
326
|
+
if ((type >= ft_myvarchar) && (type <= ft_mywvarbinary))
|
327
|
+
return len < 256 ? 1 : 2;
|
328
|
+
else if ((type == ft_myblob) || (type == ft_mytext))
|
329
|
+
return len - 8;
|
330
|
+
return 0;
|
331
|
+
}
|
332
|
+
|
333
|
+
public:
|
334
|
+
inline unsigned int codePage() const
|
335
|
+
{
|
336
|
+
return mysql::codePage((unsigned short)m_charsetIndex);
|
337
|
+
}
|
338
|
+
|
339
|
+
/* data image for key
|
340
|
+
* param ptr address of record buffer
|
341
|
+
*/
|
342
|
+
inline const uchar_td* keyData(const uchar_td* ptr) const
|
343
|
+
{
|
344
|
+
if ((type == ft_myblob) || (type == ft_mytext))
|
345
|
+
return blobDataPtr(ptr);
|
346
|
+
int sizeByte = varLenBytes();
|
347
|
+
return ptr + sizeByte;
|
348
|
+
}
|
349
|
+
|
350
|
+
inline uint_td keyDataLen(const uchar_td* ptr) const
|
351
|
+
{
|
352
|
+
if ((type == ft_myblob) || (type == ft_mytext))
|
353
|
+
return blobDataLen(ptr);
|
354
|
+
return dataLen(ptr);
|
355
|
+
}
|
356
|
+
|
357
|
+
/* copy key data for send to mysql
|
358
|
+
* return next copy address.
|
359
|
+
*/
|
360
|
+
inline uchar_td* keyCopy(uchar_td* to, const uchar_td* from)
|
361
|
+
{
|
362
|
+
|
363
|
+
ushort_td kl = maxKeylen(); // size of max key segmnet for mysql
|
364
|
+
ushort_td copylen = kl;
|
365
|
+
memset(to, 0x00, kl);
|
366
|
+
ushort_td keyVarlen =
|
367
|
+
keyFromVarlen(); // size of var sizeByte for record.
|
368
|
+
if (keyVarlen)
|
369
|
+
{
|
370
|
+
copylen = (ushort_td)std::min<uint_td>((uint_td)copylen,
|
371
|
+
keyDataLen(from));
|
372
|
+
memcpy(to, ©len, 2);
|
373
|
+
to += 2;
|
374
|
+
from = keyData(from);
|
375
|
+
}
|
376
|
+
memcpy(to, from, copylen);
|
377
|
+
return to + kl - keyVarlen;
|
378
|
+
}
|
379
|
+
|
380
|
+
/* Get keyValue from keybuf for seek mode error description
|
381
|
+
* return next copy key address.
|
382
|
+
*/
|
383
|
+
inline const uchar_td* getKeyValueFromKeybuf(const uchar_td* from,
|
384
|
+
const uchar_td** data,
|
385
|
+
ushort_td& size)
|
386
|
+
{
|
387
|
+
ushort_td keyVarlen =
|
388
|
+
keyFromVarlen(); // size of var sizeByte for record.
|
389
|
+
if (keyVarlen)
|
390
|
+
{
|
391
|
+
size = *((ushort_td*)from);
|
392
|
+
*data = from + 2;
|
393
|
+
}
|
394
|
+
else
|
395
|
+
{
|
396
|
+
size = maxKeylen();
|
397
|
+
*data = from;
|
398
|
+
}
|
399
|
+
return *data + size;
|
400
|
+
}
|
401
|
+
|
402
|
+
/* length bytes of var field
|
403
|
+
*/
|
404
|
+
inline int varLenBytes() const
|
405
|
+
{
|
406
|
+
if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
|
407
|
+
type == ft_lstring)
|
408
|
+
return len < 256 ? 1 : 2;
|
409
|
+
return 0;
|
410
|
+
}
|
411
|
+
|
412
|
+
inline uint_td blobLenBytes() const
|
413
|
+
{
|
414
|
+
if ((type == ft_myblob) || (type == ft_mytext))
|
415
|
+
return len - 8;
|
416
|
+
return 0;
|
417
|
+
}
|
418
|
+
|
419
|
+
inline int maxVarDatalen() const
|
420
|
+
{
|
421
|
+
if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) ||
|
422
|
+
type == ft_lstring)
|
423
|
+
return (len < 256) ? len - 1 : len - 2;
|
424
|
+
else if (type == ft_lvar)
|
425
|
+
return len - 4;
|
426
|
+
else if ((type == ft_myblob) || (type == ft_mytext))
|
427
|
+
{
|
428
|
+
switch (len - 8)
|
429
|
+
{
|
430
|
+
case 1:
|
431
|
+
return 0xFF;
|
432
|
+
case 2:
|
433
|
+
return 0xFFFF;
|
434
|
+
case 3:
|
435
|
+
return 0xFFFFFF;
|
436
|
+
case 4:
|
437
|
+
return 0xFFFFFFFF;
|
438
|
+
}
|
439
|
+
return 0;
|
440
|
+
}
|
441
|
+
return 0;
|
442
|
+
}
|
443
|
+
|
444
|
+
/* data length
|
445
|
+
*/
|
446
|
+
inline uint_td dataLen(const uchar_td* ptr) const
|
447
|
+
{
|
448
|
+
int blen = varLenBytes();
|
449
|
+
if (blen == 0)
|
450
|
+
return len;
|
451
|
+
else if (blen == 1)
|
452
|
+
return *((unsigned char*)ptr);
|
453
|
+
return *((unsigned short*)ptr);
|
454
|
+
}
|
455
|
+
|
456
|
+
inline uint_td blobDataLen(const uchar_td* ptr) const
|
457
|
+
{
|
458
|
+
int blen = blobLenBytes();
|
459
|
+
if (blen == 0)
|
460
|
+
return len;
|
461
|
+
uint_td v = 0;
|
462
|
+
memcpy(&v, ptr, blen);
|
463
|
+
return v;
|
464
|
+
}
|
465
|
+
|
466
|
+
inline const uchar_td* blobDataPtr(const uchar_td* ptr) const
|
467
|
+
{
|
468
|
+
int blen = blobLenBytes();
|
469
|
+
if (blen == 0)
|
470
|
+
return NULL;
|
471
|
+
const uchar_td** p = (const uchar_td**)(ptr + blen);
|
472
|
+
return *p;
|
473
|
+
}
|
474
|
+
|
475
|
+
/* Is string type or not.
|
476
|
+
*/
|
477
|
+
bool isStringType() const;
|
478
|
+
|
479
|
+
inline bool isNumericType() const
|
480
|
+
{
|
481
|
+
return ((type == ft_integer) || (type == ft_decimal) ||
|
482
|
+
(type == ft_money) || (type == ft_logical) ||
|
483
|
+
(type == ft_numeric) || (type == ft_bfloat) ||
|
484
|
+
(type == ft_uinteger) || (type == ft_autoinc) ||
|
485
|
+
(type == ft_bit) || (type == ft_numericsts) ||
|
486
|
+
(type == ft_numericsa) || (type == ft_autoIncUnsigned));
|
487
|
+
}
|
488
|
+
|
489
|
+
/* Charctor numbers from charset.
|
490
|
+
*/
|
491
|
+
unsigned int charNum() const;
|
492
|
+
|
493
|
+
inline void setCharsetIndex(uchar_td index)
|
494
|
+
{
|
495
|
+
m_charsetIndex = index;
|
496
|
+
if ((type == ft_wstring) || (type == ft_wzstring) ||
|
497
|
+
(type == ft_mywvarchar) || (type == ft_mywvarbinary) ||
|
498
|
+
(type == ft_mywchar))
|
499
|
+
m_charsetIndex = CHARSET_UTF16LE;
|
500
|
+
}
|
501
|
+
|
502
|
+
inline uchar_td charsetIndex() const { return m_charsetIndex; };
|
503
|
+
|
504
|
+
inline uint_td unPackCopy(uchar_td* dest, const uchar_td* src) const
|
505
|
+
{
|
506
|
+
int clen = varLenBytes();
|
507
|
+
if (clen == 0)
|
508
|
+
clen = len;
|
509
|
+
else if (clen == 1)
|
510
|
+
clen += *((unsigned char*)src);
|
511
|
+
else
|
512
|
+
clen += *((unsigned short*)src);
|
513
|
+
memcpy(dest, src, clen);
|
514
|
+
return clen;
|
515
|
+
}
|
516
|
+
};
|
517
|
+
|
518
|
+
namespace client
|
519
|
+
{
|
520
|
+
class dbdef;
|
521
|
+
}
|
522
|
+
|
523
|
+
/* Mark of ** that BizStation Corp internal use only.
|
524
|
+
*/
|
525
|
+
struct PACKAGE tabledef
|
526
|
+
{
|
527
|
+
friend class client::dbdef; // for formatVersion
|
528
|
+
|
529
|
+
tabledef() { cleanup(); }
|
530
|
+
|
531
|
+
void cleanup()
|
532
|
+
{
|
533
|
+
memset(this, 0, sizeof(tabledef));
|
534
|
+
formatVersion = 1;
|
535
|
+
primaryKeyNum = -1;
|
536
|
+
parentKeyNum = -1;
|
537
|
+
replicaKeyNum = -1;
|
538
|
+
pageSize = 2048;
|
539
|
+
}
|
540
|
+
|
541
|
+
#ifdef _UNICODE
|
542
|
+
const wchar_t* fileName() const; // file name
|
543
|
+
const wchar_t* tableName() const; // table name
|
544
|
+
void setFileName(const wchar_t* s);
|
545
|
+
void setTableName(const wchar_t* s);
|
546
|
+
const char* toChar(char* buf, const wchar_t* s, int size);
|
547
|
+
|
548
|
+
#else
|
549
|
+
#ifdef MYSQL_DYNAMIC_PLUGIN
|
550
|
+
|
551
|
+
const char* fileName() const { return m_fileName; };
|
552
|
+
|
553
|
+
const char* tableName() const { return m_tableName; };
|
554
|
+
|
555
|
+
inline void setFileName(const char* s) { setFileNameA(s); };
|
556
|
+
|
557
|
+
inline void setTableName(const char* s) { setTableNameA(s); };
|
558
|
+
|
559
|
+
inline const char* toChar(char* buf, const char* s, int size)
|
560
|
+
{
|
561
|
+
strncpy_s(buf, size, s, size - 1);
|
562
|
+
return buf;
|
563
|
+
};
|
564
|
+
#else
|
565
|
+
const char* fileName() const;
|
566
|
+
const char* tableName() const;
|
567
|
+
void setFileName(const char* s);
|
568
|
+
void setTableName(const char* s);
|
569
|
+
const char* toChar(char* buf, const char* s, int size);
|
570
|
+
#endif // MYSQL_DYNAMIC_PLUGIN
|
571
|
+
#endif
|
572
|
+
|
573
|
+
const char* fileNameA() const { return m_fileName; };
|
574
|
+
|
575
|
+
const char* tableNameA() const { return m_tableName; };
|
576
|
+
|
577
|
+
inline void setFileNameA(const char* s)
|
578
|
+
{
|
579
|
+
strncpy_s(m_fileName, FILE_NAME_SIZE, s, FILE_NAME_SIZE - 1);
|
580
|
+
}
|
581
|
+
|
582
|
+
inline void setTableNameA(const char* s)
|
583
|
+
{
|
584
|
+
strncpy_s(m_tableName, TABLE_NAME_SIZE, s, sizeof(m_tableName) - 1);
|
585
|
+
}
|
586
|
+
|
587
|
+
ushort_td id; // table id
|
588
|
+
|
589
|
+
#ifdef SWIG
|
590
|
+
/* For swig interface
|
591
|
+
export field names.
|
592
|
+
*/
|
593
|
+
ushort_td pageSize; // page size
|
594
|
+
ushort_td varSize; // second field length
|
595
|
+
#else
|
596
|
+
|
597
|
+
union
|
598
|
+
{
|
599
|
+
ushort_td pageSize; // page size
|
600
|
+
ushort_td varSize; // second field length
|
601
|
+
};
|
602
|
+
#endif
|
603
|
+
|
604
|
+
ushort_td preAlloc; // pre alloc page seize
|
605
|
+
ushort_td fieldCount; // Number of field
|
606
|
+
uchar_td keyCount; // Number of key
|
607
|
+
|
608
|
+
private:
|
609
|
+
char m_fileName[FILE_NAME_SIZE];
|
610
|
+
char m_tableName[TABLE_NAME_SIZE];
|
611
|
+
|
612
|
+
public:
|
613
|
+
short version; // table version
|
614
|
+
uchar_td charsetIndex; // SCHARSET_INFO vector index;
|
615
|
+
uchar_td filler0[17]; // reserved
|
616
|
+
FLAGS flags; // file flags
|
617
|
+
uchar_td primaryKeyNum; // Primary key number. -1 is no primary.
|
618
|
+
uchar_td parentKeyNum; // ** Key number for listview. -1 is no use.
|
619
|
+
uchar_td replicaKeyNum; // ** Key number for repdata. -1 is no use.
|
620
|
+
FLAGS optionFlags; // ** optional flags
|
621
|
+
ushort_td convertFileNum; // ** not use
|
622
|
+
ushort_td maxRecordLen; // max record length of var size table.
|
623
|
+
uchar_td treeIndex; // ** View index for listview.
|
624
|
+
uchar_td iconIndex; // ** Icon index for listview.
|
625
|
+
ushort_td ddfid;
|
626
|
+
ushort_td fixedRecordLen; // Fixed record length for var size table.
|
627
|
+
int autoIncExSpace;
|
628
|
+
uchar_td iconIndex2;
|
629
|
+
uchar_td iconIndex3;
|
630
|
+
uint_td schemaCodePage; // Code page of this schema stirng data.
|
631
|
+
|
632
|
+
private:
|
633
|
+
char formatVersion;
|
634
|
+
|
635
|
+
public:
|
636
|
+
client::dbdef* parent;
|
637
|
+
uchar_td reserved[TABLEDEF_FILLER_SIZE]; // reserved
|
638
|
+
|
639
|
+
fielddef* fieldDefs; // Pointer cahche of first field.
|
640
|
+
keydef* keyDefs; // Pointer cahche of first key.
|
641
|
+
};
|
642
|
+
|
643
|
+
/* optionFlags BizStation internal use only.
|
644
|
+
Bit0 send windows messege.
|
645
|
+
Bit1 show tree view.
|
646
|
+
Bit2 is master table or not
|
647
|
+
Bit3 is replicate or not
|
648
|
+
Bit4 is backup target or not.
|
649
|
+
Bit5 is encript or not
|
650
|
+
Bit6 is this table destination of convert .
|
651
|
+
Bit7 is support short cut in listveiw.
|
652
|
+
Bit8 is call validate function at delete record.
|
653
|
+
Bit9 Can export this table.
|
654
|
+
BitA is this table include valiable fields (varchar or varbinary is used)
|
655
|
+
BitB is this table include blob field (Blob is used)
|
656
|
+
*/
|
657
|
+
|
658
|
+
struct PACKAGE btrVersion
|
659
|
+
{
|
660
|
+
ushort_td majorVersion;
|
661
|
+
ushort_td minorVersion;
|
662
|
+
unsigned char type;
|
663
|
+
|
664
|
+
const _TCHAR* moduleVersionShortString(_TCHAR* buf);
|
665
|
+
const _TCHAR* moduleTypeString();
|
666
|
+
};
|
667
|
+
|
668
|
+
struct btrVersions
|
669
|
+
{
|
670
|
+
btrVersion versions[4];
|
671
|
+
};
|
672
|
+
|
673
|
+
#pragma pack(pop)
|
674
|
+
pragma_pop;
|
675
|
+
|
676
|
+
/* filter cobine type */
|
677
|
+
enum combineType
|
678
|
+
{
|
679
|
+
eCend,
|
680
|
+
eCand,
|
681
|
+
eCor
|
682
|
+
};
|
683
|
+
|
684
|
+
/* compair types */
|
685
|
+
enum eCompType
|
686
|
+
{
|
687
|
+
eEqual = 1,
|
688
|
+
eGreater = 2,
|
689
|
+
eLess = 3,
|
690
|
+
eNotEq = 4,
|
691
|
+
eGreaterEq = 5,
|
692
|
+
eLessEq = 6
|
693
|
+
};
|
694
|
+
|
695
|
+
PACKAGE uchar_td getFilterLogicTypeCode(const _TCHAR* cmpstr);
|
696
|
+
|
697
|
+
} // namespace tdap
|
698
|
+
} // namespace protocol
|
699
|
+
} // namespace db
|
700
|
+
} // namespace bzs
|
701
|
+
|
702
|
+
#endif // BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_H
|