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,325 @@
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
+ #include <bzs/netsvc/server/serverCpt.h>
20
+ #include <bzs/netsvc/server/serverTpool.h>
21
+ #include <bzs/rtl/exception.h>
22
+ #include <bzs/rtl/debuglog.h>
23
+ #include <stdio.h>
24
+ #include <iostream>
25
+ #include <string>
26
+
27
+ #pragma warning(disable:4800)
28
+ #include <bzs/db/engine/mysql/mysqlInternal.h>
29
+ #pragma warning(default:4800)
30
+
31
+ #include <bzs/db/engine/mysql/mysqlThd.h>
32
+ #include "appBuilderImple.h"
33
+
34
+ /** tcp server type
35
+ */
36
+ #define TCP_CPT_SERVER 1
37
+ #define TCP_TPOOL_SERVER 2
38
+
39
+ using namespace bzs::netsvc::server;
40
+
41
+ /** system valiables
42
+ */
43
+ static char* g_listenAddress=NULL;
44
+ static char* g_listenPort = NULL;
45
+ static char* g_hostCheckUserName = NULL;
46
+
47
+ static unsigned int g_tcpServerType = TCP_CPT_SERVER;
48
+
49
+ static unsigned int g_maxTcpConnections = 200;
50
+ static unsigned int g_pool_threads = 20;
51
+ static unsigned int g_pipeCommSharememSize = 3145728;
52
+ int g_tableNmaeLower = 1; //defined in btrvProtocol.h
53
+ int g_useBtrvVariableTable = 1;
54
+ unsigned int g_lock_wait_timeout = 1;
55
+ char* g_transaction_isolation = NULL;
56
+
57
+ /** tcp server
58
+ */
59
+ boost::shared_ptr<iserver> srv;
60
+
61
+ /** pipe server
62
+ */
63
+ #ifdef WIN32
64
+ #define PIPE_SERVER
65
+ #include <bzs/netsvc/server/serverpipe.h>
66
+ static unsigned int g_maxPipeConnections = 50;
67
+ static int g_usePipedLocal = 1;
68
+ #define PIPE_NAME "Transactd" //this name is fixed.
69
+ boost::shared_ptr<iserver> srv_p;
70
+ #endif
71
+
72
+ #ifdef USE_HANDLERSOCKET
73
+ static char* g_hs_listenPort = NULL;
74
+ static int g_use_hs = 0;
75
+ #endif
76
+
77
+ class serveErrorHandler : public inotifyHandler
78
+ {
79
+ public:
80
+
81
+ void printError(const char* msg)
82
+ {
83
+ sql_print_error("%s%s","Transactd: ", msg);
84
+ }
85
+
86
+ void printInfo(const char* msg)
87
+ {
88
+ sql_print_information("%s%s","Transactd: ", msg);
89
+ }
90
+ };
91
+
92
+ serveErrorHandler srvErh;
93
+
94
+ /** entry point for plugin
95
+ */
96
+ static int transactd_plugin_init(void *p)
97
+ {
98
+ try
99
+ {
100
+ boost::shared_ptr<IAppModuleBuilder> app(new transctionalIF(PROTOCOL_TYPE_BTRV));
101
+ if (g_tcpServerType == TCP_CPT_SERVER)
102
+ {
103
+ cpt::server* p = new cpt::server(g_maxTcpConnections, g_hostCheckUserName);
104
+ p->addApplication(app, g_listenAddress, g_listenPort);
105
+ #ifdef USE_HANDLERSOCKET
106
+ if (g_use_hs)
107
+ {
108
+ boost::shared_ptr<IAppModuleBuilder> app_hs(new transctionalIF(PROTOCOL_TYPE_HS));
109
+ p->addApplication(app_hs, g_listenAddress, g_hs_listenPort);
110
+ }
111
+ #endif
112
+ srv.reset(p);
113
+
114
+ }
115
+ else if (g_tcpServerType == TCP_TPOOL_SERVER)
116
+ {
117
+ tpool::server* p = new tpool::server(g_pool_threads, g_hostCheckUserName);
118
+ p->addApplication(app, g_listenAddress, g_listenPort);
119
+ #ifdef USE_HANDLERSOCKET
120
+ if (g_use_hs)
121
+ {
122
+ boost::shared_ptr<IAppModuleBuilder> app_hs(new transctionalIF(PROTOCOL_TYPE_HS));
123
+ p->addApplication(app_hs, g_listenAddress, g_hs_listenPort);
124
+ }
125
+ #endif
126
+ srv.reset(p);
127
+ }
128
+ if (srv)
129
+ {
130
+ srv->registerErrorHandler(&srvErh);
131
+ srv->start();
132
+ }
133
+ #ifdef PIPE_SERVER
134
+ if (g_usePipedLocal)
135
+ {
136
+ srv_p.reset(new pipe::server(app, PIPE_NAME , g_maxPipeConnections, g_pipeCommSharememSize, g_hostCheckUserName));
137
+ srv_p->registerErrorHandler(&srvErh);
138
+ srv_p->start();
139
+ }
140
+ #endif
141
+ DEBUG_PROFILE_INIT()
142
+ return 0;
143
+ }
144
+ catch(boost::system::system_error &e)
145
+ {
146
+ char buf[1024];
147
+ sprintf_s(buf, 1024, "Transactd error at startup. :%s", e.what());
148
+ sql_print_error("%s", buf);
149
+ return 1;
150
+ }
151
+ catch(bzs::rtl::exception &e)
152
+ {
153
+ if(const std::string *msg = getMsg(e))
154
+ {
155
+ std::string s = "Transactd error at startup. :" + *msg;
156
+ sql_print_error("%s", s.c_str());
157
+ }else
158
+ sql_print_error("%s", boost::diagnostic_information(e).c_str());
159
+ return 1;
160
+ }
161
+ catch(...)
162
+ {
163
+ sql_print_error("%s", "Transactd unknown error at startup.");
164
+ }
165
+ return 1;
166
+ }
167
+
168
+ void shutdownSrv(boost::shared_ptr<iserver>& srv)
169
+ {
170
+ try
171
+ {
172
+ if (srv)
173
+ {
174
+ srv->stop();
175
+ srv.reset();
176
+ }
177
+ }
178
+ catch(boost::system::system_error &e)
179
+ {
180
+ sql_print_error("Transactd %s", e.what());
181
+ }
182
+ catch(bzs::rtl::exception &e)
183
+ {
184
+ if(const std::string *msg = getMsg(e))
185
+ {
186
+ std::string s = "Transactd. :" + *msg;
187
+ sql_print_error("%s", s.c_str());
188
+ }else
189
+ sql_print_error("%s", boost::diagnostic_information(e).c_str());
190
+ }
191
+ catch(...)
192
+ {
193
+ sql_print_error("%s", "Transactd Unknown");
194
+ }
195
+ }
196
+
197
+ /** called from mysql at shutdown plugin.
198
+ */
199
+ static int transactd_plugin_deinit(void *p)
200
+ {
201
+ #ifdef PIPE_SERVER
202
+ shutdownSrv(srv_p);
203
+ #endif
204
+ shutdownSrv(srv);
205
+ return 0;
206
+ }
207
+
208
+ static struct st_mysql_daemon transactd_info =
209
+ {
210
+ MYSQL_DAEMON_INTERFACE_VERSION
211
+ };
212
+
213
+ /** system valiable define
214
+ */
215
+ static MYSQL_SYSVAR_STR(address, g_listenAddress, PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC, "0::0|0.0.0.0", NULL, NULL, "0.0.0.0");
216
+ static MYSQL_SYSVAR_STR(port, g_listenPort, PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC, NULL, NULL, NULL, "8610");
217
+ static MYSQL_SYSVAR_STR(hostcheck_username, g_hostCheckUserName, PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC, NULL, NULL, NULL, "root");
218
+ static MYSQL_SYSVAR_UINT(max_tcp_connections, g_maxTcpConnections, PLUGIN_VAR_READONLY, "1..3000", 0, 0, 200, 1,3000, 0);
219
+ static MYSQL_SYSVAR_INT(table_name_lowercase, g_tableNmaeLower, PLUGIN_VAR_READONLY,"", 0, 0, 1, 0,1, 0);
220
+ static MYSQL_SYSVAR_INT(use_btrv_variable_table, g_useBtrvVariableTable, PLUGIN_VAR_READONLY,"", 0, 0, 1, 0,1, 0);
221
+ static MYSQL_SYSVAR_UINT(pool_threads, g_pool_threads, PLUGIN_VAR_READONLY,"1..1000", 0, 0, 20, 1,1000, 0);
222
+ static MYSQL_SYSVAR_UINT(tcp_server_type, g_tcpServerType, PLUGIN_VAR_READONLY,"1..2", 0, 0, TCP_CPT_SERVER, 1,2, 0);
223
+ static MYSQL_SYSVAR_UINT(lock_wait_timeout, g_lock_wait_timeout, PLUGIN_VAR_READONLY,"1..3600", 0, 0, 1, 1,3600, 0);
224
+ static MYSQL_SYSVAR_STR(transaction_isolation, g_transaction_isolation, PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC, NULL, NULL, NULL, "READ-COMMITTED");
225
+
226
+ #ifdef PIPE_SERVER
227
+ static MYSQL_SYSVAR_UINT(pipe_comm_sharemem_size, g_pipeCommSharememSize, PLUGIN_VAR_READONLY,"66000..52428800", 0, 0, 3145728, 66000,52428800, 0);
228
+ static MYSQL_SYSVAR_UINT(max_pipe_connections, g_maxPipeConnections, PLUGIN_VAR_READONLY, "1..100", 0, 0, 50, 1,100, 0);
229
+ static MYSQL_SYSVAR_INT(use_piped_local, g_usePipedLocal, PLUGIN_VAR_READONLY, "", 0, 0, 1, 0, 1,0);
230
+ #endif
231
+
232
+ #ifdef USE_HANDLERSOCKET
233
+ static MYSQL_SYSVAR_STR(hs_port, g_hs_listenPort, PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC, NULL, NULL, NULL, "9999");
234
+ static MYSQL_SYSVAR_INT(use_handlersocket, g_use_hs, PLUGIN_VAR_READONLY,"", 0, 0, 0, 0,1, 0);
235
+ #endif
236
+
237
+ /** system valiables struct.
238
+ */
239
+ static struct st_mysql_sys_var *g_systemVariables[] =
240
+ {
241
+ MYSQL_SYSVAR(address),
242
+ MYSQL_SYSVAR(port),
243
+ MYSQL_SYSVAR(max_tcp_connections),
244
+ MYSQL_SYSVAR(hostcheck_username),
245
+ MYSQL_SYSVAR(table_name_lowercase),
246
+ MYSQL_SYSVAR(use_btrv_variable_table),
247
+ MYSQL_SYSVAR(pool_threads),
248
+ MYSQL_SYSVAR(tcp_server_type),
249
+ MYSQL_SYSVAR(lock_wait_timeout),
250
+ MYSQL_SYSVAR(transaction_isolation),
251
+ #ifdef PIPE_SERVER
252
+ MYSQL_SYSVAR(pipe_comm_sharemem_size),
253
+ MYSQL_SYSVAR(max_pipe_connections),
254
+ MYSQL_SYSVAR(use_piped_local),
255
+ #endif
256
+ #ifdef USE_HANDLERSOCKET
257
+ MYSQL_SYSVAR(use_handlersocket),
258
+ MYSQL_SYSVAR(hs_port),
259
+ #endif
260
+ 0
261
+ };
262
+
263
+ /** show valiables struct.
264
+ */
265
+ static st_mysql_show_var g_showVariables[] =
266
+ {
267
+ {"trnsctd_tcp_connections", (char*)&cpt::g_connections, SHOW_INT},
268
+ {"trnsctd_tcp_wait_threads", (char*)&cpt::g_waitThread, SHOW_INT},
269
+ {"trnsctd_tpool_connections", (char*)&tpool::g_connections, SHOW_INT},
270
+ {"trnsctd_tpool_threads", (char*)&tpool::server::m_threadPoolSize, SHOW_INT},
271
+ #ifdef PIPE_SERVER
272
+ {"trnsctd_pipe_connections", (char*)&pipe::g_connections, SHOW_INT},
273
+ {"trnsctd_pipe_wait_threads", (char*)&pipe::g_waitThread, SHOW_INT},
274
+ #endif
275
+ {"trnsctd_cur_open_databases", (char*)&g_openDatabases, SHOW_INT},
276
+ {0, 0, (enum_mysql_show_type)0}
277
+ };
278
+
279
+ /** plugin struct.
280
+ */
281
+ mysql_declare_plugin(transactd)
282
+ {
283
+ MYSQL_DAEMON_PLUGIN,
284
+ &transactd_info,
285
+ "transactd",//this is plugin name for mysql.
286
+ "Hisashi Yaguchi at BizStation Corp",
287
+ "Transactional access demon for mysql",
288
+ PLUGIN_LICENSE_GPL,
289
+ transactd_plugin_init,
290
+ transactd_plugin_deinit,
291
+ 0x0100,
292
+ g_showVariables,
293
+ g_systemVariables,
294
+ NULL
295
+ }
296
+
297
+ mysql_declare_plugin_end;
298
+
299
+ #ifdef USETLS
300
+ extern DWORD g_tlsiID;
301
+
302
+ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
303
+ {
304
+ switch (fdwReason)
305
+ {
306
+ case DLL_PROCESS_ATTACH:
307
+ if ((g_tlsiID = TlsAlloc()) == TLS_OUT_OF_INDEXES)
308
+ return FALSE;
309
+ TlsSetValue(g_tlsiID, 0);
310
+ break;
311
+ case DLL_THREAD_ATTACH:
312
+ TlsSetValue(g_tlsiID, 0);
313
+ break;
314
+ case DLL_THREAD_DETACH:
315
+ break;
316
+ case DLL_PROCESS_DETACH:
317
+ TlsFree(g_tlsiID);
318
+ break;
319
+ default:
320
+ break;
321
+ }
322
+ return TRUE;
323
+ }
324
+
325
+ #endif
@@ -0,0 +1,135 @@
1
+ #ifndef BZS_ENV_COMPILER_H
2
+ #define BZS_ENV_COMPILER_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
+ #if (__BCPLUSPLUS__ && !defined(__clang__))
23
+ # define __THREAD __thread
24
+ # define __STDCALL __stdcall
25
+ #else
26
+ # define __THREAD __declspec(thread)
27
+ # if (_MSC_VER || (__BORLANDC__ && __clang__) || __MINGW32__)
28
+ # define __STDCALL __stdcall
29
+ # else
30
+ # define __STDCALL
31
+ # endif
32
+ #endif
33
+
34
+ #ifdef _WIN32
35
+ # ifdef _WIN64
36
+ # ifndef __x86_64__
37
+ # define __x86_64__
38
+ # endif
39
+ # else
40
+ # define __x86_32__
41
+ # endif
42
+ #endif
43
+
44
+
45
+ #undef PACKAGE
46
+
47
+ #ifndef __THREAD_BCB
48
+ # undef __THREAD
49
+ # if (__BCPLUSPLUS__ && !defined(__clang__))
50
+ # define __THREAD_BCB __thread
51
+ # define __THREAD
52
+ # else
53
+ # define __THREAD_BCB
54
+ # if (_MSC_VER || (__BORLANDC__ && __clang__))
55
+ # define __THREAD __declspec(thread)
56
+ # else
57
+ # define __THREAD __thread
58
+ # endif
59
+ # endif
60
+ #endif//__THREAD_BCB
61
+
62
+
63
+
64
+ #ifdef __BCPLUSPLUS__
65
+ # ifndef PACKAGE
66
+ # ifdef __x86_64__
67
+ # define PACKAGE __declspec(dllexport)
68
+ # else
69
+ # define PACKAGE __declspec(package)
70
+ # endif
71
+ # endif
72
+ #else
73
+ # if (_WIN32 && !defined(__MINGW32__))
74
+ # define PACKAGE __declspec(dllexport)
75
+ # else
76
+ # define PACKAGE
77
+ # endif
78
+ #endif
79
+
80
+
81
+ #ifdef PACKAGE_NO_EXPORT
82
+ # undef PACKAGE
83
+ # define PACKAGE
84
+ #endif
85
+
86
+ #define AGRPACK PACKAGE
87
+
88
+ // import
89
+ #if (LINUX || __MINGW32__)
90
+ # define PACKAGE_IMPORT
91
+ #else
92
+ # define PACKAGE_IMPORT __declspec(dllimport)
93
+ #endif
94
+
95
+
96
+
97
+
98
+ #if (_MSC_VER || (__BORLANDC__ && __clang__))
99
+ # define pragma_pack1 __pragma(pack(push, 1))
100
+ # define pragma_pop __pragma(pack(pop))
101
+ #else
102
+ # ifdef __BCPLUSPLUS__
103
+ # define pragma_pack1
104
+ # define pragma_pop
105
+ # else
106
+ # define pragma_pack1 _Pragma("pack(1)")
107
+ # define pragma_pop _Pragma("pack()")
108
+ # endif
109
+ #endif
110
+
111
+ #if (_MSC_VER == 1600)
112
+ # define COMPILER_VERSTR "vc100"
113
+ #endif
114
+
115
+ #if (_MSC_VER == 1700)
116
+ # define COMPILER_VERSTR "vc110"
117
+ #endif
118
+
119
+ #if (__BCPLUSPLUS__ >= 0x630 && (__BCPLUSPLUS__ < 0x640))
120
+ # define COMPILER_VERSTR "bcb"
121
+ #endif
122
+
123
+ #if (__BCPLUSPLUS__ >= 0x640 && (__BCPLUSPLUS__ < 0x650))
124
+ # define COMPILER_VERSTR "bcb"
125
+ #endif
126
+
127
+ #if (__BCPLUSPLUS__ >= 0x650 && (__BCPLUSPLUS__ < 0x660))
128
+ # define COMPILER_VERSTR "bcb"
129
+ #endif
130
+
131
+ #if (__BCPLUSPLUS__ >= 0x660 && (__BCPLUSPLUS__ < 0x670))
132
+ # define COMPILER_VERSTR "bcb"
133
+ #endif
134
+
135
+ #endif//BZS_ENV_COMPILER_H
@@ -0,0 +1,130 @@
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
+ #ifdef LINUX
20
+ #include "crosscompile.h"
21
+ #include <stdio.h>
22
+ #include <string.h>
23
+ #include <wctype.h>
24
+ #include <wchar.h>
25
+
26
+
27
+ char16_t* _strupr16(char16_t* s)
28
+ {
29
+ char16_t* p = s;
30
+ while (*s)
31
+ {
32
+ *s = towupper(*s);
33
+ ++s;
34
+ }
35
+ return p;
36
+ }
37
+
38
+ char16_t* _strlwr16(char16_t* s)
39
+ {
40
+ char16_t* p = s;
41
+ while (*s)
42
+ {
43
+ *s = towlower(*s);
44
+ ++s;
45
+ }
46
+ return p;
47
+ }
48
+
49
+ char* _strupr(char* s)
50
+ {
51
+ char* p = s;
52
+ while (*s)
53
+ {
54
+ *s = toupper(*s);
55
+ ++s;
56
+ }
57
+ return p;
58
+ }
59
+
60
+ char* _strlwr(char* s)
61
+ {
62
+ char* p = s;
63
+ while (*s)
64
+ {
65
+ *s = tolower(*s);
66
+ ++s;
67
+ }
68
+ return p;
69
+ }
70
+
71
+ char* _i64toa_s(__int64 v, char* tmp, unsigned long size, int radix)
72
+ {
73
+ snprintf(tmp,size, "%Ld", v);
74
+ return tmp;
75
+ }
76
+
77
+ char* _ltoa_s(int v, char* tmp, unsigned long size, int radix)
78
+ {
79
+ snprintf(tmp,size, "%d", v);
80
+ return tmp;
81
+ }
82
+
83
+ int wcsnicmp16(const char16_t *sl, const char16_t *sr, size_t n)
84
+ {
85
+ if (n == 0) return 0;
86
+ while (*sl)
87
+ {
88
+ wchar_t tmpl = towlower(*sl);
89
+ wchar_t tmpr = towlower(*sr);
90
+
91
+ if (tmpl != tmpr)
92
+ return (int)(tmpl - tmpr);
93
+ if (--n == 0) return 0;
94
+ ++sl;
95
+ ++sr;
96
+ }
97
+ return 0 - *sr;
98
+ }
99
+
100
+ int wcsncmp16(const char16_t *sl, const char16_t *sr, size_t n)
101
+ {
102
+ if (n == 0) return 0;
103
+ while (*sl)
104
+ {
105
+ if (*sl != *sr)
106
+ return (int)(*sl - *sr);
107
+ if (--n == 0) return 0;
108
+ ++sl;
109
+ ++sr;
110
+ }
111
+ return 0 - *sr;
112
+ }
113
+
114
+ char16_t* wmemset16(char16_t* p , char16_t c, size_t n)
115
+ {
116
+ char16_t* end = p + n;
117
+ for (char16_t* tmp = p; tmp < end; ++tmp)
118
+ *tmp = c;
119
+ return p;
120
+ }
121
+
122
+ char16_t* wmemcpy(char16_t* dest, const char16_t* src, size_t count)
123
+ {
124
+ return (char16_t*)memcpy(dest, src, count*sizeof(char16_t));
125
+ }
126
+
127
+
128
+ #endif //LINUX
129
+
130
+