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,423 @@
1
+ #ifndef BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H
2
+ #define BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H
3
+ /*=================================================================
4
+ Copyright (C) 2012 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
+ #include <bzs/env/compiler.h>
22
+ #include <tchar.h>
23
+
24
+
25
+ /** data types
26
+ */
27
+ typedef unsigned int uint_td;
28
+ typedef unsigned short ushort_td;
29
+ typedef void void_td;
30
+ typedef short short_td;
31
+ typedef unsigned char uchar_td;
32
+ typedef char char_td;
33
+ typedef uint_td bookmark_td;
34
+ typedef int percentage_td;
35
+
36
+ typedef ushort_td keylen_td;
37
+
38
+ /** tdap c interface
39
+ */
40
+ #ifdef ARBTREGN_PKG
41
+ extern __declspec(dllimport)
42
+ short_td __stdcall BTRCALLID(ushort_td op, void* posb, void* data, uint_td* datalen
43
+ , void* keybuf, keylen_td keylen, char_td keyNum, uchar_td* clientID);
44
+ #endif
45
+
46
+
47
+ typedef short_td (__STDCALL *BTRCALLID_PTR)(ushort_td,void*,void*, uint_td*
48
+ ,void*,keylen_td,char_td,uchar_td*);
49
+
50
+ /** buffer size
51
+ */
52
+ #define POS_BLOCK_SIZE 128
53
+ #ifndef MAX_KEYLEN
54
+ #define MAX_KEYLEN 0X3FF //1023
55
+ #endif
56
+
57
+
58
+ /** operation type
59
+ *
60
+ */
61
+ #define TD_OPENTABLE 0
62
+ #define TD_CLOSETABLE 1
63
+ #define TD_REC_INSERT 2
64
+ #define TD_REC_UPDATE 3
65
+ #define TD_REC_DELETE 4
66
+ #define TD_KEY_SEEK 5
67
+ #define TD_KEY_NEXT 6
68
+ #define TD_KEY_PREV 7
69
+ #define TD_KEY_AFTER 8
70
+ #define TD_KEY_OR_AFTER 9
71
+ #define TD_KEY_BEFORE 10
72
+ #define TD_KEY_OR_BEFORE 11
73
+ #define TD_KEY_FIRST 12
74
+ #define TD_KEY_LAST 13
75
+ #define TD_CREATETABLE 14
76
+ #define TD_TABLE_INFO 15
77
+ #define TD_SETDIRECTORY 17
78
+ #define TD_GETDIRECTORY 18
79
+ #define TD_BEGIN_TRANSACTION 19
80
+ #define TD_END_TRANSACTION 20
81
+ #define TD_ABORT_TRANSACTION 21
82
+ #define TD_BOOKMARK 22
83
+ #define TD_MOVE_BOOKMARK 23
84
+ #define TD_POS_NEXT 24
85
+ #define TD_STOP_ENGINE 25
86
+ #define TD_VERSION 26
87
+ #define TD_UNLOCK 27
88
+ #define TD_RESET_CLIENT 28
89
+ #define TD_SET_OWNERNAME 29
90
+ #define TD_CLEAR_OWNERNAME 30
91
+ #define TD_BUILD_INDEX 31
92
+ #define TD_DROP_INDEX 32
93
+ #define TD_POS_FIRST 33
94
+ #define TD_POS_LAST 34
95
+ #define TD_POS_PREV 35
96
+ #define TD_KEY_NEXT_MULTI 36
97
+ #define TD_KEY_PREV_MULTI 37
98
+ #define TD_POS_NEXT_MULTI 38
99
+ #define TD_POS_PREV_MULTI 39
100
+ #define TD_INSERT_BULK 40
101
+ #define TD_BACKUPMODE 42
102
+ #define TD_MOVE_PER 44
103
+ #define TD_GET_PER 45
104
+ #define TD_UPDATE_PART 53
105
+ #define TD_KEY_EQUAL_KO 55
106
+ #define TD_KEY_NEXT_KO 56
107
+ #define TD_KEY_PREV_KO 57
108
+ #define TD_KEY_GT_KO 58
109
+ #define TD_KEY_GE_KO 59
110
+ #define TD_KEY_LT_KO 60
111
+ #define TD_KEY_LE_KO 61
112
+ #define TD_KEY_FIRST_KO 62
113
+ #define TD_KEY_LAST_KO 63
114
+ #define TD_CREATE_TEMP 64
115
+ #define TD_TABLE_INFO_EX 65
116
+ #define TD_REC_UPDATEATKEY 70
117
+ #define TD_REC_DELLETEATKEY 71
118
+ #define TD_KEY_GE_NEXT_MULTI 72
119
+ #define TD_KEY_LE_PREV_MULTI 73
120
+ #define TD_CONNECT 78
121
+ #define TD_BEGIN_SHAPSHOT 88
122
+ #define TD_END_SNAPSHOT 89
123
+ #define TD_AUTOMEKE_SCHEMA 90
124
+ #define TD_GETSERVER_CHARSET 91
125
+ #define TD_ADD_SENDBLOB 92
126
+ #define TD_GET_BLOB_BUF 93
127
+ #define TD_STASTISTICS 94
128
+
129
+
130
+
131
+
132
+
133
+ /** create sub operations
134
+ */
135
+ #define CR_SUBOP_DROP -128
136
+ #define CR_SUBOP_RENAME -127
137
+ #define CR_SUBOP_SWAPNAME -126
138
+ #define CR_SUBOP_BY_FILESPEC -1
139
+ #define CR_SUBOP_BY_FILESPEC_NOCKECK 0
140
+ #define CR_SUBOP_BY_TABLEDEF 1
141
+ #define CR_SUBOP_BY_TABLEDEF_NOCKECK 2
142
+
143
+ #define CR_SUB_FLAG_EXISTCHECK -1
144
+
145
+
146
+ /** TD_ADD_SENDBLOB sub operations
147
+ */
148
+ #define TD_ASBLOB_ENDROW -125
149
+
150
+ /** TD_GET_STASTISTICS sub operations
151
+ */
152
+ #define TD_STSTCS_READ 0
153
+ #define TD_STSTCS_DISCONNECT_ONE 1
154
+ #define TD_STSTCS_DISCONNECT_ALL 2
155
+
156
+
157
+
158
+ /** connect sub operation
159
+ */
160
+
161
+ #define LG_SUBOP_CONNECT 0
162
+ #define LG_SUBOP_DISCONNECT 1
163
+ #define LG_SUBOP_NEWCONNECT 3
164
+
165
+
166
+ /** field types
167
+ */
168
+ #define ft_string 0
169
+ #define ft_integer 1
170
+ #define ft_float 2
171
+ #define ft_date 3
172
+ #define ft_time 4
173
+ #define ft_decimal 5
174
+ #define ft_money 6
175
+ #define ft_logical 7
176
+ #define ft_numeric 8
177
+ #define ft_bfloat 9
178
+ #define ft_lstring 10
179
+ #define ft_zstring 11
180
+ #define ft_note 12
181
+ #define ft_lvar 13
182
+ #define ft_uinteger 14
183
+ #define ft_autoinc 15
184
+ #define ft_bit 16
185
+ #define ft_numericsts 17
186
+ #define ft_numericsa 18
187
+ #define ft_currency 19
188
+ #define ft_timestamp 20
189
+ #define ft_blob 21
190
+ #define ft_reserve22 22
191
+ #define ft_reserve23 23
192
+ #define ft_reserve24 24
193
+ #define ft_wstring 25
194
+ #define ft_wzstring 26
195
+ #define ft_guid 27
196
+ #define ft_datatime 30
197
+ #define ft_myvarchar 40
198
+ #define ft_myvarbinary 41
199
+ #define ft_mywvarchar 42
200
+ #define ft_mywvarbinary 43
201
+ #define ft_mychar 44
202
+ #define ft_mywchar 45
203
+ #define ft_mydate 46
204
+ #define ft_mytime 47
205
+ #define ft_mydatetime 48
206
+ #define ft_mytimestamp 49
207
+ #define ft_mytext 50
208
+ #define ft_myblob 51
209
+ #define ft_nullindicator 255
210
+
211
+
212
+
213
+ /** charset type number
214
+ */
215
+ #define charset_none 0
216
+ #define charset_latin1 1
217
+ #define charset_ascii 2
218
+ #define charset_sjis 3
219
+ #define charset_cp932 4
220
+
221
+
222
+ #define charset_utf8 100
223
+ #define charset_utf8mb4 101
224
+ #define charset_usc2 102
225
+
226
+
227
+ /** extruct row comp bias
228
+ */
229
+ #define CMPLOGICAL_VAR_COMP_ALL 16 //< In the case of a var type, it is copare as whole length.
230
+ #define CMPLOGICAL_CMPACS 32 //< no support
231
+ #define CMPLOGICAL_FIELD 64 //< The field for comparison shows not a value but a field number.
232
+ #define CMPLOGICAL_CASEINSENSITIVE 128 //< not case-sensitive
233
+
234
+
235
+
236
+ /** btrv transaction lock options
237
+ */
238
+ #define LOCK_SINGLE_WAIT 100
239
+ #define LOCK_SINGLE_NOWAIT 200
240
+ #define LOCK_MULTI_WAIT 300
241
+ #define LOCK_MULTI_NOWAIT 400
242
+
243
+ #define NOWAIT_WRITE 500
244
+ #define PARALLEL_TRN 1000
245
+
246
+ /** open mode
247
+ */
248
+ #define TD_OPEN_NORMAL 0
249
+ #define TD_OPEN_READONLY -2
250
+ #define TD_OPEN_EXCLUSIVE -4
251
+
252
+
253
+ /** filed algin
254
+ */
255
+ #define BT_AL_LEFT 0
256
+ #define BT_AL_CENTER 2
257
+ #define BT_AL_RIGHT 1
258
+
259
+
260
+ /** error code
261
+ */
262
+ #define STATUS_TABLE_YET_OPEN -3
263
+ #define STATUS_DURING_TRANSACTION -4
264
+ #define STATUS_NO_ACR_UPDATE_DELETE -5
265
+ #define STATUS_NO_ACR_INSERT -6
266
+ #define STATUS_NO_ACR_READ -7
267
+ #define STATUS_CANT_ALLOC_MEMORY -8
268
+ #define STATUS_USE_KEYFIELD -9
269
+ #define STATUS_TOO_MANY_TABLES -10
270
+ #define STATUS_INVARID_PRM_KEY_NUM -11
271
+ #define STATUS_INVARID_PNT_KEY_NUM -12
272
+ #define STATUS_INVARID_REP_KEY_NUM -13
273
+ #define STATUS_INVARID_FIELD_IDX -14
274
+ #define STATUS_ALREADY_DELETED -15
275
+ #define STATUS_LMITS_MAX_TABLES -16
276
+ #define STATUS_DB_YET_OPEN -17
277
+ #define STATUS_TABLENAME_NOTFOUND -18
278
+ #define STATUS_DIFFERENT_DBVERSION -19
279
+ #define STATUS_DUPLICATE_FIELDNAME -20
280
+ #define STATUS_INVALID_TABLE_IDX -21
281
+ #define STATUS_AUTH_DENIED -22
282
+ #define STATUS_TOO_MANY_FIELDS -23
283
+ #define STATUS_FILTERSTRING_ERROR -24
284
+ #define STATUS_INVALID_FIELDLENGTH -25
285
+ #define STATUS_INVALID_KEYTYPE -26
286
+ #define STATUS_LVAR_NOTE_NOT_LAST -27
287
+ #define STATUS_NODEF_FOR_CONVERT -28
288
+ //#define STATUS_CANT_OPEN_TMPFILE -29
289
+ //#define STATUS_CANT_SWAP_TMPFILE -30
290
+ #define STATUS_AUTOINC_SPACE_ERROR -31
291
+ #define STATUS_TOO_LONG_OWNERNAME -32
292
+ #define STATUS_CANT_DEL_FOR_REL -33
293
+ #define STATUS_NO_AUTOINC_SPACE -34
294
+ #define STATUS_INVALID_RECLEN -35
295
+ #define STATUS_INVALID_FIELDVALUE -36
296
+ #define STATUS_INVALID_VALLEN -37
297
+ #define STATUS_FIELDTYPE_NOTSUPPORT -42
298
+
299
+ #define STATUS_SUCCESS 0
300
+ #define STATUS_PROGRAM_ERROR 1
301
+ #define STATUS_IO_ERROR 2
302
+ #define STATUS_FILE_NOT_OPENED 3
303
+ #define STATUS_NOT_FOUND_TI 4
304
+ #define STATUS_DUPPLICATE_KEYVALUE 5
305
+ #define STATUS_INVALID_KEYNUM 6
306
+ #define STATUS_NO_CURRENT 8
307
+ #define STATUS_EOF 9
308
+ #define STATUS_TABLE_NOTOPEN 12
309
+ #define STATUS_REQUESTER_DEACTIVE 20
310
+ #define STATUS_KEYBUFFERTOOSMALL 21
311
+ #define STATUS_BUFFERTOOSMALL 22
312
+ #define STATUS_CANT_CREATE 25
313
+ #define STATUS_NOSUPPORT_OP 41
314
+ #define STATUS_INVALID_BOOKMARK 43
315
+ #define STATUS_ACCESS_DENIED 46
316
+ #define STATUS_INVALID_OWNERNAME 51
317
+ #define STATUS_TABLE_EXISTS_ERROR 59
318
+ #define STATUS_LIMMIT_OF_REJECT 60
319
+ #define STATUS_REACHED_FILTER_COND 64
320
+ #define STATUS_INVALID_FIELD_OFFSET 65
321
+ #define STATUS_CHANGE_CONFLICT 80
322
+ #define STATUS_INVALID_LOCKTYPE 83
323
+ #define STATUS_LOCK_ERROR 84
324
+ #define STATUS_FILE_LOCKED 85
325
+ #define STATUS_CANNOT_LOCK_TABLE 88
326
+ #define STATUS_INVALID_KEYNAME STATUS_INVALID_KEYNUM
327
+ #define STATUS_INVALID_DATASIZE STATUS_BUFFERTOOSMALL
328
+ #define STATUS_INVALID_FIELDNAME STATUS_INVALID_FIELD_OFFSET
329
+ #define ERROR_TD_INVALID_CLINETHOST 171
330
+ #define ERROR_NOSPECIFY_TABLE 176
331
+ #define NET_BAD_SRB_FORMAT 3021
332
+ #define ERROR_TD_HOSTNAME_NOT_FOUND 3103
333
+ #define ERROR_TD_CONNECTION_FAILURE 3106
334
+ #define ERROR_TD_NOT_CONNECTED 3110
335
+
336
+
337
+ #define STATUS_BUFFERTOOSMALL 22
338
+ #define STATUS_KEYBUFFERTOOSMALL 21
339
+
340
+ #define TRANSACTD_SCHEMANAME _T("transactd_schema")
341
+ #define TYPE_SCHEMA_BDF (short)0
342
+ #define TYPE_SCHEMA_DDF (short)1
343
+
344
+
345
+
346
+ #define NIS_FILED_NAME "$nf"
347
+
348
+ /** max ownwr name size + 1 */
349
+ #define OWNERNAME_SIZE 12
350
+
351
+
352
+ #define TD_BACKUP_START (char_td)0
353
+ #define TD_BACKUP_END (char_td)2
354
+ #define TD_BACKUP_MODE_OK STATUS_SUCCESS
355
+ #define TD_BACKUP_MODE_NOT_SUPPORT STATUS_PROGRAM_ERROR
356
+ #define TD_BACKUP_MODE_BUSY STATUS_CANNOT_LOCK_TABLE
357
+ #define TD_BACKUP_MODE_NOT_PERMIT (short)41
358
+ #define TD_BACKUP_MODE_SERVER_ERROR (short)91
359
+
360
+
361
+
362
+ /* In the case of "tdclcppxxx" library of msvc, The ($TargetName) is not changed automatically.
363
+ If you change this version then you need change The ($TargetName) project options too.
364
+ */
365
+ #define C_INTERFACE_VER_MAJOR "1"//##1 Build marker! Don't remove
366
+ #define C_INTERFACE_VER_MINOR "0"//##2 Build marker! Don't remove
367
+ #define C_INTERFACE_VER_RELEASE "1"//##3 Build marker! Don't remove
368
+
369
+ #ifdef LINUX
370
+ #define C_INTERFACE_VERSTR ".so." C_INTERFACE_VER_MAJOR "." C_INTERFACE_VER_MINOR//use loadlibrary
371
+ #else
372
+ #define C_INTERFACE_VERSTR "_" C_INTERFACE_VER_MAJOR "_" C_INTERFACE_VER_MINOR ".dll"//use loadlibrary
373
+ #endif
374
+
375
+
376
+ #if (defined( __x86_64__) || defined(LINUX))
377
+ #define TDCLC_LIBNAME "tdclc_64" C_INTERFACE_VERSTR //use loadlibrary
378
+ #else
379
+ #define TDCLC_LIBNAME "tdclc_32" C_INTERFACE_VERSTR //use loadlibrary
380
+ #endif
381
+
382
+ /* Cpp library name prefix */
383
+ #define TD_CPP_LIB_PRE "tdclcpp"
384
+
385
+ /* Cpp library name middle part */
386
+ #if (defined( __x86_64__) || defined(LINUX))
387
+ #ifdef UNICODE
388
+ #define TD_LIB_PART "64u"
389
+ #else
390
+ #define TD_LIB_PART "64m"
391
+ #endif
392
+ #else //__x86_32__
393
+ #ifdef UNICODE
394
+ #define TD_LIB_PART "32u"
395
+ #else
396
+ #define TD_LIB_PART "32m"
397
+ #endif
398
+ #endif
399
+
400
+
401
+ /* Cpp library name version part
402
+ In the case of "tdclcppxxx" library of msvc , The ($TargetName) is not changed automatically.
403
+ If you change this version then you need change The ($TargetName) project options too.
404
+
405
+ In the case of "tdclcppxxx" library of gcc , The -soname option is not changed automatically.
406
+ If you change this version then you need change The -soname option project options too.
407
+
408
+ */
409
+
410
+
411
+ #define CPP_INTERFACE_VER_MAJOR "1"//##4 Build marker! Don't remove
412
+ #define CPP_INTERFACE_VER_MINOR "1"//##5 Build marker! Don't remove
413
+ #define CPP_INTERFACE_VER_RELEASE "0"//##6 Build marker! Don't remove
414
+
415
+ #ifdef _WIN32
416
+ #define CPP_INTERFACE_VERSTR "_" COMPILER_VERSTR "_" TD_LIB_PART "_" CPP_INTERFACE_VER_MAJOR "_" CPP_INTERFACE_VER_MINOR //use autolink
417
+ #endif
418
+
419
+ #define TRANSACTD_VER_MAJOR 1//##7 Build marker! Don't remove
420
+ #define TRANSACTD_VER_MINOR 1//##8 Build marker! Don't remove
421
+ #define TRANSACTD_VER_RELEASE 0//##9 Build marker! Don't remove
422
+
423
+ #endif //BZS_DB_PROTOCOL_TDAP_TDAPCAPI_H
@@ -0,0 +1,55 @@
1
+ #ifndef BZS_DB_TRANSACTD_APPBUILDERIMPLE_H
2
+ #define BZS_DB_TRANSACTD_APPBUILDERIMPLE_H
3
+ /*=================================================================
4
+ Copyright (C) 2012 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/netsvc/server/IAppModule.h>
23
+
24
+ #define PROTOCOL_TYPE_BTRV 0
25
+ #define PROTOCOL_TYPE_HS 1
26
+
27
+ /** IAppModule factry
28
+ * Implements IAppModule and Implements IMyPluginModule::create too.
29
+ */
30
+ class IMyPluginModule : public bzs::netsvc::server::IAppModule
31
+ {
32
+ public:
33
+ static bzs::netsvc::server::IAppModule* create(
34
+ const boost::asio::ip::tcp::endpoint& endpoint
35
+ , bzs::netsvc::server::iconnection* connection
36
+ , bool tpool, int type);
37
+ };
38
+
39
+ class transctionalIF : public bzs::netsvc::server::IAppModuleBuilder
40
+ {
41
+ bzs::netsvc::server::IAppModule* createSessionModule(
42
+ const boost::asio::ip::tcp::endpoint& endpoint
43
+ , bzs::netsvc::server::iconnection* connection
44
+ , bool tpool)
45
+ {
46
+ return IMyPluginModule::create(endpoint, connection, tpool, m_type);
47
+ }
48
+
49
+ int m_type;
50
+ public:
51
+
52
+ transctionalIF(int type):m_type(type){};
53
+ };
54
+
55
+ #endif //BZS_DB_TRANSACTD_APPLICATIONIMPLE_H
@@ -0,0 +1,183 @@
1
+ /*=================================================================
2
+ Copyright (C) 2012 2013 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
+
20
+ #include "appModule.h"
21
+ #include "appBuilderImple.h"
22
+ #include <bzs/db/engine/mysql/dbManager.h>
23
+ #include <bzs/db/engine/mysql/mysqlThd.h>
24
+ #include <bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h>
25
+ #include <bzs/netsvc/server/iserver.h>
26
+ #include <stdlib.h>
27
+ #include <boost/asio/ip/address_v4.hpp>
28
+ #ifdef USE_HANDLERSOCKET
29
+ #include <bzs/db/protocol/hs/hsCommandExecuter.h>
30
+ #endif
31
+
32
+
33
+
34
+ using namespace bzs::netsvc::server;
35
+
36
+ IAppModule* IMyPluginModule::create(const boost::asio::ip::tcp::endpoint& endpoint
37
+ , iconnection* connection
38
+ , bool tpool, int type)
39
+ {
40
+ return new bzs::db::transactd::module(endpoint, connection, tpool, type);
41
+ }
42
+
43
+ namespace bzs
44
+ {
45
+ namespace netsvc
46
+ {
47
+ namespace server
48
+ {
49
+
50
+ boost::mutex modulesMutex;
51
+ std::vector<IAppModule*> modules;
52
+ using namespace bzs::netsvc::server;
53
+
54
+ }//namespace server
55
+ }//namespace netsvc
56
+
57
+ namespace db
58
+ {
59
+ using namespace protocol;
60
+ namespace transactd
61
+ {
62
+
63
+ /** The module created for every connection
64
+ * In the case of a thread pool, thread termination processing is not performed by a destructor.
65
+ */
66
+ module::module(const boost::asio::ip::tcp::endpoint& endpoint
67
+ , iconnection* connection, bool tpool, int type)
68
+ :m_endpoint(endpoint), m_connection(connection), m_useThreadPool(tpool)
69
+ {
70
+ if (type == PROTOCOL_TYPE_BTRV)
71
+ m_commandExecuter.reset(new protocol::tdap::mysql::commandExecuter((unsigned __int64)this));
72
+ #ifdef USE_HANDLERSOCKET
73
+ else if(type == PROTOCOL_TYPE_HS)
74
+ m_commandExecuter.reset(new protocol::hs::commandExecuter((unsigned __int64)this));
75
+ #endif
76
+ boost::mutex::scoped_lock lck(modulesMutex);
77
+ modules.push_back(this);
78
+ }
79
+
80
+ module::~module(void)
81
+ {
82
+ boost::mutex::scoped_lock lck(modulesMutex);
83
+ modules.erase( find(modules.begin(), modules.end(), this));
84
+ m_commandExecuter.reset();
85
+ if (m_useThreadPool==false)
86
+ {
87
+ my_thread_end();
88
+ endThread();
89
+ }
90
+ }
91
+
92
+ void module::reset()
93
+ {
94
+ }
95
+
96
+ /** It is called from the handler of async_read.
97
+ * A value is analyzed and it is answered whether a lead is completion.
98
+ * @return Size required for a lead buffer is returned on the occasion of reading by addition.
99
+ * When zero are returned, it is shown that it is not necessary to enlarge a buffer further.
100
+ */
101
+ size_t module::onRead(const char* data, size_t size, bool& complete)
102
+ {
103
+ m_readBuf = data;
104
+ m_readSize = size;
105
+ return m_commandExecuter->perseRequestEnd(data, size, complete);
106
+ }
107
+
108
+ size_t module::onAccept(char* message, size_t bufsize)
109
+ {
110
+ return m_commandExecuter->getAcceptMessage(message, bufsize);
111
+ }
112
+
113
+ static const char* addressMasks[3] = {".0.0.0/255.0.0.0", ".0.0/255.255.0.0", ".0/255.255.255.0" };
114
+
115
+ char* addressClass(char* buf,int bufsize, const char *host, int type)
116
+ {
117
+ strcpy_s(buf, bufsize, host);
118
+ for (int i = 3; i >= type; i--)
119
+ {
120
+ char* p = strrchr(buf, '.');
121
+ if (p == NULL) return buf;
122
+ *p = 0x00;
123
+ }
124
+ strcat_s(buf, bufsize, addressMasks[type-1]);
125
+ return buf;
126
+ }
127
+
128
+ bool isAclUser(const char *host, const char *user)
129
+ {
130
+ bool ret = is_acl_user(host, user);
131
+ if (ret)return true;
132
+ for (int i = 1; i <= 3; i++)
133
+ {
134
+ char buf[256];
135
+ ret = is_acl_user( addressClass(buf, 256, host, i), user);
136
+ if (ret)return true;
137
+ }
138
+ return false;
139
+
140
+ }
141
+
142
+ bool module::checkHost( const char* hostCheckname)
143
+ {
144
+ std::string addr = m_endpoint.address().to_string();
145
+ size_t pos = addr.find_last_of(":");
146
+ if (pos != std::string::npos)
147
+ addr = addr.substr(pos + 1);
148
+
149
+ bool ret = true;
150
+ if (!isAclUser(addr.c_str(), hostCheckname))
151
+ {
152
+ ret = isAclUser(m_endpoint.address().to_string().c_str(), hostCheckname);
153
+ if (!ret && m_endpoint.address().is_v4())
154
+ {
155
+ if (addr == std::string("127.0.0.1"))
156
+ ret = isAclUser("localhost", hostCheckname);
157
+ }
158
+ }
159
+ return ret;
160
+ }
161
+
162
+ int module::execute(char* result, size_t& size, netsvc::server::buffers* optionalData)
163
+ {
164
+ m_commandExecuter->parse(m_readBuf, m_readSize);
165
+ boost::mutex::scoped_lock lck(m_mutex);
166
+ if (m_useThreadPool)
167
+ {
168
+ int ret = m_commandExecuter->execute(result, size, optionalData);
169
+ cleanup();
170
+ return ret;
171
+ }
172
+ return m_commandExecuter->execute(result, size, optionalData);
173
+ }
174
+
175
+ void module::disconnect()
176
+ {
177
+ m_connection->close();
178
+ }
179
+
180
+
181
+ }//namespace transactd
182
+ }//namespace db
183
+ }//namespace bzs