transactd 1.0.1

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.
Files changed (218) hide show
  1. checksums.yaml +7 -0
  2. data/BUILD_UNIX-JA +174 -0
  3. data/BUILD_WIN-JA +256 -0
  4. data/CMakeLists.txt +96 -0
  5. data/COPYING +339 -0
  6. data/README +406 -0
  7. data/README-JA +424 -0
  8. data/bin/common/tdclc_32_1_0.dll +0 -0
  9. data/bin/common/tdclc_64_1_0.dll +0 -0
  10. data/build/common/check_for_link_iconv.cmake +73 -0
  11. data/build/common/copyifgreater.cmd +30 -0
  12. data/build/common/copyifgreater.js +290 -0
  13. data/build/common/get_boost_libs.cmake +106 -0
  14. data/build/common/get_ruby_path.cmake +115 -0
  15. data/build/common/options.cmake +127 -0
  16. data/build/common/smart_install.cmake +263 -0
  17. data/build/common/system.cmake +122 -0
  18. data/build/common/transactd.rc.in +52 -0
  19. data/build/common/transactd_cl_common.cmake +101 -0
  20. data/build/common/transactd_cl_output.cmake +93 -0
  21. data/build/common/transactd_common.cmake +237 -0
  22. data/build/common/transactd_required.cmake +28 -0
  23. data/build/swig/ruby/generate.cmake.in +35 -0
  24. data/build/swig/ruby/generate.cmd.in +19 -0
  25. data/build/swig/ruby/ruby.swg +101 -0
  26. data/build/swig/tdcl.i +188 -0
  27. data/build/tdclc/BUILDNUMBER.txt +1 -0
  28. data/build/tdclc/CMakeLists.txt +170 -0
  29. data/build/tdclc/tdclc_32.cbproj +181 -0
  30. data/build/tdclc/tdclc_64.cbproj +205 -0
  31. data/build/tdclcpp/BUILDNUMBER.txt +1 -0
  32. data/build/tdclcpp/CMakeLists.txt +142 -0
  33. data/build/tdclcpp/tdclcpp_bcb_32.cbproj +239 -0
  34. data/build/tdclcpp/tdclcpp_bcb_64.cbproj +304 -0
  35. data/build/tdclrb/BUILDNUMBER.txt +1 -0
  36. data/build/tdclrb/CMakeLists.txt +258 -0
  37. data/build/tdclrb/GEM_VERSION +3 -0
  38. data/build/tdclrb/bldgem/extconf.rb +123 -0
  39. data/build/tdclrb/gem/INSTALLLOG.win32 +9 -0
  40. data/build/tdclrb/gem/Makefile.win32-VS +65 -0
  41. data/build/tdclrb/gem/Makefile.win32-prebuilt +48 -0
  42. data/build/tdclrb/gem/detect.rb +31 -0
  43. data/build/tdclrb/gem/helper.rb +113 -0
  44. data/build/tdclrb/gem/transactd.rb +22 -0
  45. data/build/tdclrb/gem_output.cmake +44 -0
  46. data/source/bzs/db/IBlobBuffer.h +51 -0
  47. data/source/bzs/db/blobBuffer.h +177 -0
  48. data/source/bzs/db/blobStructs.h +85 -0
  49. data/source/bzs/db/engine/mysql/IReadRecords.h +52 -0
  50. data/source/bzs/db/engine/mysql/bookmark.h +195 -0
  51. data/source/bzs/db/engine/mysql/database.cpp +1882 -0
  52. data/source/bzs/db/engine/mysql/database.h +465 -0
  53. data/source/bzs/db/engine/mysql/dbManager.cpp +303 -0
  54. data/source/bzs/db/engine/mysql/dbManager.h +143 -0
  55. data/source/bzs/db/engine/mysql/errorMessage.cpp +75 -0
  56. data/source/bzs/db/engine/mysql/errorMessage.h +43 -0
  57. data/source/bzs/db/engine/mysql/fieldAccess.h +158 -0
  58. data/source/bzs/db/engine/mysql/mydebuglog.cpp +349 -0
  59. data/source/bzs/db/engine/mysql/mydebuglog.h +89 -0
  60. data/source/bzs/db/engine/mysql/mysqlInternal.h +171 -0
  61. data/source/bzs/db/engine/mysql/mysqlThd.cpp +169 -0
  62. data/source/bzs/db/engine/mysql/mysqlThd.h +35 -0
  63. data/source/bzs/db/engine/mysql/percentageKey.h +260 -0
  64. data/source/bzs/db/protocol/ICommandExecuter.h +49 -0
  65. data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +689 -0
  66. data/source/bzs/db/protocol/hs/hsCommandExecuter.h +228 -0
  67. data/source/bzs/db/protocol/tdap/btrDate.cpp +437 -0
  68. data/source/bzs/db/protocol/tdap/btrDate.h +227 -0
  69. data/source/bzs/db/protocol/tdap/client/bulkInsert.h +127 -0
  70. data/source/bzs/db/protocol/tdap/client/client.cpp +106 -0
  71. data/source/bzs/db/protocol/tdap/client/client.h +292 -0
  72. data/source/bzs/db/protocol/tdap/client/connMgr.cpp +144 -0
  73. data/source/bzs/db/protocol/tdap/client/connMgr.h +82 -0
  74. data/source/bzs/db/protocol/tdap/client/database.cpp +863 -0
  75. data/source/bzs/db/protocol/tdap/client/database.h +118 -0
  76. data/source/bzs/db/protocol/tdap/client/databaseFactory.cpp +100 -0
  77. data/source/bzs/db/protocol/tdap/client/dbDef.cpp +1640 -0
  78. data/source/bzs/db/protocol/tdap/client/dbDef.h +135 -0
  79. data/source/bzs/db/protocol/tdap/client/dllmain.cpp +434 -0
  80. data/source/bzs/db/protocol/tdap/client/errorMessage.cpp +92 -0
  81. data/source/bzs/db/protocol/tdap/client/errorMessage_ja.cpp +98 -0
  82. data/source/bzs/db/protocol/tdap/client/fieldDDF.cpp +174 -0
  83. data/source/bzs/db/protocol/tdap/client/fieldDDF.h +91 -0
  84. data/source/bzs/db/protocol/tdap/client/fileDDF.cpp +140 -0
  85. data/source/bzs/db/protocol/tdap/client/fileDDF.h +86 -0
  86. data/source/bzs/db/protocol/tdap/client/filter.cpp +527 -0
  87. data/source/bzs/db/protocol/tdap/client/filter.h +154 -0
  88. data/source/bzs/db/protocol/tdap/client/indexDDF.cpp +137 -0
  89. data/source/bzs/db/protocol/tdap/client/indexDDF.h +84 -0
  90. data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +724 -0
  91. data/source/bzs/db/protocol/tdap/client/nsDatabase.h +123 -0
  92. data/source/bzs/db/protocol/tdap/client/nsTable.cpp +899 -0
  93. data/source/bzs/db/protocol/tdap/client/nsTable.h +199 -0
  94. data/source/bzs/db/protocol/tdap/client/request.h +198 -0
  95. data/source/bzs/db/protocol/tdap/client/sharedData.cpp +58 -0
  96. data/source/bzs/db/protocol/tdap/client/sharedData.h +56 -0
  97. data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +574 -0
  98. data/source/bzs/db/protocol/tdap/client/sqlBuilder.h +53 -0
  99. data/source/bzs/db/protocol/tdap/client/stringConverter.h +627 -0
  100. data/source/bzs/db/protocol/tdap/client/table.cpp +2613 -0
  101. data/source/bzs/db/protocol/tdap/client/table.h +221 -0
  102. data/source/bzs/db/protocol/tdap/client/trdboostapi.h +1096 -0
  103. data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +179 -0
  104. data/source/bzs/db/protocol/tdap/client/trdclcppautolink.h +40 -0
  105. data/source/bzs/db/protocol/tdap/client/trnsctcl.def +11 -0
  106. data/source/bzs/db/protocol/tdap/myDateTime.cpp +500 -0
  107. data/source/bzs/db/protocol/tdap/mysql/characterset.cpp +184 -0
  108. data/source/bzs/db/protocol/tdap/mysql/characterset.h +60 -0
  109. data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +284 -0
  110. data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +53 -0
  111. data/source/bzs/db/protocol/tdap/mysql/debuglog.cpp +383 -0
  112. data/source/bzs/db/protocol/tdap/mysql/debuglog.h +106 -0
  113. data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +680 -0
  114. data/source/bzs/db/protocol/tdap/mysql/request.h +202 -0
  115. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +1020 -0
  116. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +141 -0
  117. data/source/bzs/db/protocol/tdap/tdapRequest.h +190 -0
  118. data/source/bzs/db/protocol/tdap/tdapSchema.cpp +295 -0
  119. data/source/bzs/db/protocol/tdap/tdapSchema.h +558 -0
  120. data/source/bzs/db/protocol/tdap/tdapcapi.h +423 -0
  121. data/source/bzs/db/transactd/appBuilderImple.h +55 -0
  122. data/source/bzs/db/transactd/appModule.cpp +183 -0
  123. data/source/bzs/db/transactd/appModule.h +80 -0
  124. data/source/bzs/db/transactd/connManager.cpp +201 -0
  125. data/source/bzs/db/transactd/connManager.h +60 -0
  126. data/source/bzs/db/transactd/connectionRecord.h +69 -0
  127. data/source/bzs/db/transactd/transactd.cpp +325 -0
  128. data/source/bzs/env/compiler.h +135 -0
  129. data/source/bzs/env/crosscompile.cpp +130 -0
  130. data/source/bzs/env/crosscompile.h +150 -0
  131. data/source/bzs/env/fileopen.h +36 -0
  132. data/source/bzs/env/mbcswchrLinux.cpp +40 -0
  133. data/source/bzs/env/mbcswchrLinux.h +88 -0
  134. data/source/bzs/env/tstring.h +183 -0
  135. data/source/bzs/example/changeSchema.cpp +117 -0
  136. data/source/bzs/example/changeSchema_c.cpp +78 -0
  137. data/source/bzs/example/connection_pool_c.cpp +171 -0
  138. data/source/bzs/example/createDatabase.cpp +305 -0
  139. data/source/bzs/example/createDatabase_c.cpp +202 -0
  140. data/source/bzs/example/deleteRecords.cpp +87 -0
  141. data/source/bzs/example/deleteRecords_c.cpp +57 -0
  142. data/source/bzs/example/dropDatabase.cpp +59 -0
  143. data/source/bzs/example/dropDatabase_c.cpp +34 -0
  144. data/source/bzs/example/insertRecords.cpp +212 -0
  145. data/source/bzs/example/insertRecords_c.cpp +153 -0
  146. data/source/bzs/example/readRecords.cpp +141 -0
  147. data/source/bzs/example/readRecords_c.cpp +107 -0
  148. data/source/bzs/example/updateRecords.cpp +99 -0
  149. data/source/bzs/example/updateRecords_c.cpp +71 -0
  150. data/source/bzs/example/update_with_transaction.cpp +104 -0
  151. data/source/bzs/example/update_with_transaction_c.cpp +80 -0
  152. data/source/bzs/netsvc/client/tcpClient.cpp +226 -0
  153. data/source/bzs/netsvc/client/tcpClient.h +489 -0
  154. data/source/bzs/netsvc/server/IAppModule.h +94 -0
  155. data/source/bzs/netsvc/server/iserver.h +65 -0
  156. data/source/bzs/netsvc/server/serverCpt.cpp +522 -0
  157. data/source/bzs/netsvc/server/serverCpt.h +88 -0
  158. data/source/bzs/netsvc/server/serverPipe.cpp +705 -0
  159. data/source/bzs/netsvc/server/serverPipe.h +96 -0
  160. data/source/bzs/netsvc/server/serverTpool.cpp +416 -0
  161. data/source/bzs/netsvc/server/serverTpool.h +84 -0
  162. data/source/bzs/rtl/benchmark.cpp +96 -0
  163. data/source/bzs/rtl/benchmark.h +65 -0
  164. data/source/bzs/rtl/datetime.cpp +375 -0
  165. data/source/bzs/rtl/datetime.h +53 -0
  166. data/source/bzs/rtl/debuglog.cpp +106 -0
  167. data/source/bzs/rtl/debuglog.h +97 -0
  168. data/source/bzs/rtl/exception.h +116 -0
  169. data/source/bzs/rtl/stl_uty.cpp +35 -0
  170. data/source/bzs/rtl/stl_uty.h +29 -0
  171. data/source/bzs/rtl/stringBuffers.cpp +101 -0
  172. data/source/bzs/rtl/stringBuffers.h +58 -0
  173. data/source/bzs/rtl/strtrim.cpp +135 -0
  174. data/source/bzs/rtl/strtrim.h +46 -0
  175. data/source/bzs/test/tdclatl/bench_tdclatl.js +445 -0
  176. data/source/bzs/test/tdclrb/bench_tdclcpp.rb +375 -0
  177. data/source/bzs/test/tdclrb/prepare.rb +226 -0
  178. data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +172 -0
  179. data/source/bzs/test/tdclrb/transactd_kanjischema_spec.rb +208 -0
  180. data/source/bzs/test/tdclrb/transactd_spec.rb +1536 -0
  181. data/source/bzs/test/transactdBench/transactdBench.cpp +430 -0
  182. data/source/bzs/test/transactdBench/transactdBench2.cpp +342 -0
  183. data/source/bzs/test/trdclengn/test_trdclengn.cpp +2030 -0
  184. data/source/global/tdclatl/Database.cpp +503 -0
  185. data/source/global/tdclatl/Database.h +139 -0
  186. data/source/global/tdclatl/DbDef.cpp +242 -0
  187. data/source/global/tdclatl/DbDef.h +79 -0
  188. data/source/global/tdclatl/Field.cpp +92 -0
  189. data/source/global/tdclatl/Field.h +59 -0
  190. data/source/global/tdclatl/FieldDef.cpp +238 -0
  191. data/source/global/tdclatl/FieldDef.h +87 -0
  192. data/source/global/tdclatl/Flags.cpp +111 -0
  193. data/source/global/tdclatl/Flags.h +55 -0
  194. data/source/global/tdclatl/KeyDef.cpp +51 -0
  195. data/source/global/tdclatl/KeyDef.h +55 -0
  196. data/source/global/tdclatl/KeySegment.cpp +55 -0
  197. data/source/global/tdclatl/Table.cpp +600 -0
  198. data/source/global/tdclatl/Table.h +144 -0
  199. data/source/global/tdclatl/TableDef.cpp +291 -0
  200. data/source/global/tdclatl/TableDef.h +86 -0
  201. data/source/global/tdclatl/TdVersion.cpp +74 -0
  202. data/source/global/tdclatl/TdVersion.h +54 -0
  203. data/source/global/tdclatl/_IDatabaseEvents_CP.h +113 -0
  204. data/source/global/tdclatl/dllmain.cpp +30 -0
  205. data/source/global/tdclatl/dllmain.h +27 -0
  206. data/source/global/tdclatl/keySegment.h +57 -0
  207. data/source/global/tdclatl/resource.h +0 -0
  208. data/source/global/tdclatl/stdafx.cpp +2 -0
  209. data/source/global/tdclatl/stdafx.h +25 -0
  210. data/source/global/tdclatl/targetver.h +4 -0
  211. data/source/global/tdclatl/tdclatl.cpp +68 -0
  212. data/source/global/tdclatl/tdclatl.def +10 -0
  213. data/source/global/tdclatl/tdclatl.idl +1035 -0
  214. data/source/linux/charsetConvert.h +112 -0
  215. data/source/linux/linuxTypes.h +33 -0
  216. data/source/linux/tchar.h +428 -0
  217. data/transactd.gemspec +97 -0
  218. metadata +267 -0
@@ -0,0 +1,558 @@
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{class dbdef;}
40
+
41
+ #pragma option -a1
42
+ pragma_pack1
43
+
44
+ using std::min;
45
+ using std::max;
46
+
47
+ #ifdef SWIG
48
+ /* For swig interface
49
+ Export names .
50
+ */
51
+ union FLAGS
52
+ {
53
+ unsigned short all;
54
+ unsigned short bit0 : 1;
55
+ unsigned short bit1 : 1;
56
+ unsigned short bit2 : 1;
57
+ unsigned short bit3 : 1;
58
+ unsigned short bit4 : 1;
59
+ unsigned short bit5 : 1;
60
+ unsigned short bit6 : 1;
61
+ unsigned short bit7 : 1;
62
+ unsigned short bit8 : 1;
63
+ unsigned short bit9 : 1;
64
+ unsigned short bitA : 1;
65
+ unsigned short bitB : 1;
66
+ unsigned short bitC : 1;
67
+ unsigned short bitD : 1;
68
+ unsigned short bitE : 1;
69
+ unsigned short bitF : 1;
70
+ };
71
+ #else
72
+ union FLAGS
73
+ {
74
+ unsigned short all;
75
+
76
+ struct
77
+ {
78
+ unsigned short bit0 : 1;
79
+ unsigned short bit1 : 1;
80
+ unsigned short bit2 : 1;
81
+ unsigned short bit3 : 1;
82
+ unsigned short bit4 : 1;
83
+ unsigned short bit5 : 1;
84
+ unsigned short bit6 : 1;
85
+ unsigned short bit7 : 1;
86
+ unsigned short bit8 : 1;
87
+ unsigned short bit9 : 1;
88
+ unsigned short bitA : 1;
89
+ unsigned short bitB : 1;
90
+ unsigned short bitC : 1;
91
+ unsigned short bitD : 1;
92
+ unsigned short bitE : 1;
93
+ unsigned short bitF : 1;
94
+ };
95
+ };
96
+ #endif
97
+ /* brief Key infomation for create table operation
98
+ */
99
+ struct keySpec
100
+ {
101
+ ushort_td keyPos; /* key position */
102
+ ushort_td keyLen; /* key length */
103
+ FLAGS keyFlag; /* key flag */
104
+ uint_td keyCount; /* key count */
105
+ uchar_td keyType; /* key type of extended */
106
+ uchar_td nullValue; /* value of null */
107
+ uchar_td reserve2[2]; /* reserved */
108
+ uchar_td keyNo; /* fixed key number */
109
+ uchar_td acsNo; /* no acs */
110
+ }; /* total 16 byte */
111
+
112
+ /* brief File infomation for create table operation
113
+ */
114
+ struct fileSpec
115
+ {
116
+ ushort_td recLen; /* record length */
117
+ ushort_td pageSize; /* page sise */
118
+ ushort_td indexCount; /* index count */
119
+ uint_td recCount; /* record count for stat */
120
+ FLAGS fileFlag; /* file flags */
121
+ uchar_td reserve1[2]; /* reserved */
122
+ ushort_td preAlloc; /* page allocation count */
123
+ keySpec keySpecs[1]; /* key specs */
124
+ }; /* total ? byte */
125
+
126
+ /* brief A key segment infomation
127
+ */
128
+ struct keySegment
129
+ {
130
+ uchar_td fieldNum; // Refarence field buymber
131
+ FLAGS flags; // key flags. 11 to 15bit is not use.
132
+
133
+ };
134
+
135
+ /* brief A key infomation
136
+ */
137
+ struct keydef
138
+ {
139
+ uchar_td segmentCount; // Number of segment
140
+ keySegment segments[8]; // key segments . max 8 segments
141
+ uchar_td keyNumber; // key number
142
+ };
143
+ // 26byte
144
+
145
+ static const int MYSQL_FDNAME_SIZE = 64;
146
+ static const int MYSQL_TBNAME_SIZE = 64;
147
+ static const int PERVASIVE_FDNAME_SIZE = 20;
148
+ static const int FIELD_NAME_SIZE = MYSQL_FDNAME_SIZE;
149
+ static const int TABLE_NAME_SIZE = 32;
150
+ static const int FILE_NAME_SIZE = 266;
151
+
152
+
153
+ #ifdef __x86_32__
154
+ static const int TABLEDEF_FILLER_SIZE = 21;//25-4;
155
+ #else
156
+ static const int TABLEDEF_FILLER_SIZE = 9;//17-8;
157
+ #endif
158
+
159
+ #ifndef MYSQL_DYNAMIC_PLUGIN
160
+
161
+ /* A field type name that specified by a type is returned.
162
+ */
163
+ PACKAGE const _TCHAR* getTypeName(short type);
164
+
165
+ /* A field alignment that specified by a type is returned.
166
+ */
167
+ PACKAGE int getTypeAlign(short type);
168
+
169
+ /* calcurate byts of char type by charctor number.
170
+ */
171
+ PACKAGE ushort_td lenByCharnum(uchar_td type, uchar_td charsetIndex
172
+ , ushort_td charnum);
173
+
174
+ #endif
175
+
176
+ /* Mark of ** that BizStation Corp internal use only.
177
+ */
178
+ template <int N>
179
+ struct fielddef_t
180
+ {
181
+ protected:
182
+ char m_name[N];
183
+
184
+ public:
185
+ uchar_td type; // type (zstring integer)
186
+ ushort_td len; // length
187
+ uchar_td decimals; // ** decimals
188
+ char viewNum; // ** An order of a list view column
189
+ ushort_td viewWidth; // ** view width pix
190
+ double max; // ** max value
191
+ double min; // ** min value
192
+ double defValue; // ** default value
193
+ uchar_td lookTable; // ** reference table number
194
+ uchar_td lookField; // ** field number of reference table
195
+ uchar_td lookFields[3]; // ** View fields of reference bit567
196
+ ushort_td pos; // Field offset position from record image
197
+ ushort_td defViewWidth; // ** default view wifth
198
+
199
+ protected:
200
+ char m_chainChar[2];
201
+
202
+ public:
203
+ ushort_td ddfid; // ddf field id
204
+ ushort_td filterId; // ** filter id for reference
205
+ uchar_td filterKeynum; // ** key number for reference
206
+ uchar_td nullValue; // null value
207
+ ushort_td userOption; // ** option
208
+ uchar_td lookDBNum; // ** database number of reference bitD
209
+ ushort_td keylen; // key length for mysql of part key
210
+
211
+ protected:
212
+ uchar_td m_charsetIndex; // charctor set index of this field data
213
+ uint_td m_schemaCodePage;
214
+
215
+ public:
216
+ FLAGS enableFlags; // ** enable flags. see below
217
+
218
+ private:
219
+ inline void setSchemaCodePage(uint_td v){m_schemaCodePage = v;};
220
+ friend class client::dbdef;
221
+ };
222
+
223
+ /* This is only for BizStation Corp internal.
224
+ enableFlags
225
+ bit0 show list view
226
+ bit1 enable max value
227
+ bit2 enable min value
228
+ bit3 enable default value
229
+ bit4 enable lookTable
230
+ bit5 enable lookFields[0]
231
+ bit6 enable lookFields[1]
232
+ bit7 enable lookFields[2]
233
+ bit8 It append to a front column.
234
+ bit9 enable reference filter
235
+ bitA call field name rename function.
236
+ bitB disbale export this field data.
237
+ bitC not show list view but add select field list
238
+ bitD enable lookDBNum
239
+ */
240
+
241
+ typedef fielddef_t<MYSQL_FDNAME_SIZE> fielddef_t_my;
242
+ typedef fielddef_t<PERVASIVE_FDNAME_SIZE> fielddef_t_pv;
243
+
244
+
245
+ #ifdef SWIG
246
+ %template(fielddef_t_my) fielddef_t<MYSQL_FDNAME_SIZE>;
247
+ #endif
248
+
249
+
250
+ struct PACKAGE fielddef : public fielddef_t_my
251
+ {
252
+ #ifdef _UNICODE
253
+ const wchar_t* name() const ; // Return a field name.
254
+ const wchar_t* name(wchar_t* buf) const ; // Return a field name to bufffer .
255
+ const wchar_t* chainChar() const ; // ** internal use only.
256
+ void setName(const wchar_t* s);
257
+ void setChainChar(const wchar_t* s); // ** internal use only.
258
+ #else
259
+
260
+ inline const char* name() const {return m_name;};
261
+
262
+ inline const char* chainChar() const {return m_chainChar;};
263
+
264
+ inline void setName(const char* s) {strncpy_s(m_name, FIELD_NAME_SIZE, s, sizeof(m_name) - 1);};
265
+
266
+ inline void setChainChar(const char* s) {strncpy_s(m_chainChar, 2, s, sizeof(m_chainChar) - 1);};
267
+ #endif
268
+
269
+ inline const char* nameA() const {return m_name;};
270
+
271
+ inline void setNameA(const char* s) {strncpy_s(m_name, FIELD_NAME_SIZE, s, sizeof(m_name) - 1);};
272
+ #ifndef MYSQL_DYNAMIC_PLUGIN
273
+
274
+ inline const _TCHAR* typeName() const {return getTypeName(type);};
275
+
276
+ inline int align() const {return getTypeAlign(type);};
277
+
278
+ inline void setLenByCharnum(ushort_td charnum)
279
+ {
280
+ len = lenByCharnum(type, m_charsetIndex, charnum);
281
+ }
282
+
283
+ #endif
284
+
285
+ private:
286
+
287
+ /* Is variable key type
288
+ */
289
+ inline bool isKeyVarType() const
290
+ {
291
+ return (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) || (type == ft_myblob) ||
292
+ (type == ft_mytext));
293
+ }
294
+
295
+ /* max key segment length. not include sizeBytes.
296
+ */
297
+ inline ushort_td maxKeylen() const {return keylen ? keylen : len;};
298
+
299
+ inline ushort_td keyFromVarlen() const
300
+ {
301
+ if ((type >= ft_myvarchar) && (type <= ft_mywvarbinary))
302
+ return len < 256 ? 1 : 2;
303
+ else if ((type == ft_myblob) || (type == ft_mytext))
304
+ return len - 8;
305
+ return 0;
306
+ }
307
+
308
+ public:
309
+
310
+ inline unsigned int codePage() const {return mysql::codePage((unsigned short)m_charsetIndex);}
311
+
312
+ /* data image for key
313
+ * param ptr address of record buffer
314
+ */
315
+ inline const uchar_td* keyData(const uchar_td* ptr) const
316
+ {
317
+ if ((type == ft_myblob) || (type == ft_mytext))
318
+ return blobDataPtr(ptr);
319
+ int sizeByte = varLenBytes();
320
+ return ptr + sizeByte;
321
+ }
322
+
323
+ inline uint_td keyDataLen(const uchar_td* ptr) const
324
+ {
325
+ if ((type == ft_myblob) || (type == ft_mytext))
326
+ return blobDataLen(ptr);
327
+ return dataLen(ptr);
328
+ }
329
+
330
+ /* copy key data for send to mysql
331
+ * return next copy address.
332
+ */
333
+ inline uchar_td* keyCopy(uchar_td* to, const uchar_td* from)
334
+ {
335
+
336
+ ushort_td kl = maxKeylen(); // size of max key segmnet for mysql
337
+ ushort_td copylen = kl;
338
+ memset(to, 0x00, kl);
339
+ ushort_td keyVarlen = keyFromVarlen(); // size of var sizeByte for record.
340
+ if (keyVarlen)
341
+ {
342
+ copylen = (ushort_td)std::min<uint_td>((uint_td)copylen, keyDataLen(from));
343
+ memcpy(to, &copylen, 2);
344
+ to += 2;
345
+ from = keyData(from);
346
+ }
347
+ memcpy(to, from, copylen);
348
+ return to + kl - keyVarlen;
349
+ }
350
+
351
+ /* length bytes of var field
352
+ */
353
+ inline int varLenBytes() const
354
+ {
355
+ if (((type >= ft_myvarchar) && (type <= ft_mywvarbinary)) || type == ft_lstring)
356
+ return len < 256 ? 1 : 2;
357
+ return 0;
358
+ }
359
+
360
+ inline uint_td blobLenBytes() const
361
+ {
362
+ if ((type == ft_myblob) || (type == ft_mytext))
363
+ return len - 8;
364
+ return 0;
365
+ }
366
+
367
+ /* data length
368
+ */
369
+ inline uint_td dataLen(const uchar_td* ptr) const
370
+ {
371
+ int blen = varLenBytes();
372
+ if (blen == 0)
373
+ return len;
374
+ else if (blen == 1)
375
+ return*((unsigned char*)ptr);
376
+ return *((unsigned short*)ptr);
377
+
378
+ }
379
+
380
+ inline uint_td blobDataLen(const uchar_td* ptr) const
381
+ {
382
+ int blen = blobLenBytes();
383
+ if (blen == 0)
384
+ return len;
385
+ uint_td v = 0;
386
+ memcpy(&v, ptr, blen);
387
+ return v;
388
+ }
389
+
390
+ inline const uchar_td* blobDataPtr(const uchar_td* ptr) const
391
+ {
392
+ int blen = blobLenBytes();
393
+ if (blen == 0)
394
+ return NULL;
395
+ const uchar_td** p = (const uchar_td * *)(ptr + blen);
396
+ return *p;
397
+ }
398
+
399
+ /* Is string type or not.
400
+ */
401
+ bool isStringType() const ;
402
+
403
+ /* Charctor numbers from charset.
404
+ */
405
+ unsigned int charNum() const ;
406
+
407
+ inline void setCharsetIndex(uchar_td index)
408
+ {
409
+ m_charsetIndex = index;
410
+ if ((type == ft_wstring) || (type == ft_wzstring) || (type == ft_mywvarchar) ||
411
+ (type == ft_mywvarbinary) || (type == ft_mywchar))
412
+ m_charsetIndex = CHARSET_UTF16LE;
413
+ }
414
+
415
+ inline uchar_td charsetIndex()const {return m_charsetIndex;};
416
+
417
+
418
+ };
419
+
420
+
421
+
422
+ namespace client{class dbdef;}
423
+
424
+ /* Mark of ** that BizStation Corp internal use only.
425
+ */
426
+ struct PACKAGE tabledef
427
+ {
428
+ friend class client::dbdef; //for formatVersion
429
+
430
+ tabledef()
431
+ {
432
+ cleanup();
433
+ }
434
+
435
+ void cleanup()
436
+ {
437
+ memset(this, 0, sizeof(tabledef));
438
+ formatVersion = 1;
439
+ primaryKeyNum = -1;
440
+ parentKeyNum = -1;
441
+ replicaKeyNum = -1;
442
+ pageSize = 2048;
443
+ }
444
+
445
+ #ifdef _UNICODE
446
+ const wchar_t* fileName() const ; // file name
447
+ const wchar_t* tableName() const ; // table name
448
+ void setFileName(const wchar_t* s);
449
+ void setTableName(const wchar_t* s);
450
+ const char* toChar(char* buf, const wchar_t* s, int size);
451
+
452
+ #else
453
+
454
+ const char* fileName() const {return m_fileName;};
455
+
456
+ const char* tableName() const {return m_tableName;};
457
+
458
+ inline void setFileName(const char* s) {setFileNameA(s);};
459
+
460
+ inline void setTableName(const char* s) {setTableNameA(s);};
461
+
462
+ inline const char* toChar(char* buf, const char* s, int size){strncpy_s(buf, size, s, size-1);return buf;};
463
+
464
+ #endif
465
+
466
+ const char* fileNameA() const {return m_fileName;};
467
+
468
+ const char* tableNameA() const {return m_tableName;};
469
+
470
+ inline void setFileNameA(const char* s)
471
+ {
472
+ strncpy_s(m_fileName, FILE_NAME_SIZE, s, FILE_NAME_SIZE - 1);
473
+ }
474
+
475
+ inline void setTableNameA(const char* s)
476
+ {
477
+ strncpy_s(m_tableName, TABLE_NAME_SIZE, s, sizeof(m_tableName) - 1);
478
+ }
479
+
480
+ ushort_td id; // table id
481
+ ushort_td pageSize; // page size
482
+ ushort_td preAlloc; // pre alloc page seize
483
+ ushort_td fieldCount; // Number of field
484
+ uchar_td keyCount; // Number of key
485
+
486
+ private:
487
+ char m_fileName[FILE_NAME_SIZE];
488
+ char m_tableName[TABLE_NAME_SIZE];
489
+
490
+ public:
491
+ short version; // table version
492
+ uchar_td charsetIndex; // SCHARSET_INFO vector index;
493
+ uchar_td filler0[17]; // reserved
494
+ FLAGS flags; // file flags
495
+ uchar_td primaryKeyNum; // Primary key number. -1 is no primary.
496
+ uchar_td parentKeyNum; // ** Key number for listview. -1 is no use.
497
+ uchar_td replicaKeyNum; // ** Key number for repdata. -1 is no use.
498
+ FLAGS optionFlags; // ** optional flags
499
+ ushort_td convertFileNum; // ** not use
500
+ ushort_td maxRecordLen; // max record length of var size table.
501
+ uchar_td treeIndex; // ** View index for listview.
502
+ uchar_td iconIndex; // ** Icon index for listview.
503
+ ushort_td ddfid;
504
+ ushort_td fixedRecordLen; // Fixed record length for var size table.
505
+ int autoIncExSpace; //
506
+ uchar_td iconIndex2; //
507
+ uchar_td iconIndex3; //
508
+ uint_td schemaCodePage; // Code page of this schema stirng data.
509
+ private:
510
+ char formatVersion; //
511
+ public:
512
+ client::dbdef* parent;
513
+ uchar_td reserved[TABLEDEF_FILLER_SIZE]; // reserved
514
+
515
+ fielddef* fieldDefs; // Pointer cahche of first field.
516
+ keydef* keyDefs; // Pointer cahche of first key.
517
+ };
518
+
519
+ /* optionFlags BizStation internal use only.
520
+
521
+ Bit0 send windows messege.
522
+ Bit1 show tree view.
523
+ Bit2 is master table or not
524
+ Bit3 is replicate or not
525
+ Bit4 is backup target or not.
526
+ Bit5 is encript or not
527
+ Bit6 is this table destination of convert .
528
+ Bit7 is support short cut in listveiw.
529
+ Bit8 is call validate function at delete record.
530
+ Bit9 Can export this table.
531
+ BitA is this table include valiable fields (varchar or varbinary is used)
532
+ BitB is this table include blob field (Blob is used)
533
+
534
+ */
535
+
536
+ struct PACKAGE btrVersion
537
+ {
538
+ ushort_td majorVersion;
539
+ ushort_td minorVersion;
540
+ unsigned char type;
541
+ const _TCHAR* moduleVersionShortString(_TCHAR* buf);
542
+ const _TCHAR* moduleTypeString();
543
+ };
544
+
545
+ struct btrVersions
546
+ {
547
+ btrVersion versions[4];
548
+ };
549
+
550
+ #pragma option -a.
551
+ pragma_pop
552
+
553
+
554
+ }// namespace tdap
555
+ }// namespace protocol
556
+ }// namespace db
557
+ }// namespace bzs
558
+ #endif //BZS_DB_PROTOCOL_TDAP_TDAPSCHEMA_H