transactd 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/BUILD_UNIX-JA +174 -0
- data/BUILD_WIN-JA +256 -0
- data/CMakeLists.txt +96 -0
- data/COPYING +339 -0
- data/README +406 -0
- data/README-JA +424 -0
- data/bin/common/tdclc_32_1_0.dll +0 -0
- data/bin/common/tdclc_64_1_0.dll +0 -0
- data/build/common/check_for_link_iconv.cmake +73 -0
- data/build/common/copyifgreater.cmd +30 -0
- data/build/common/copyifgreater.js +290 -0
- data/build/common/get_boost_libs.cmake +106 -0
- data/build/common/get_ruby_path.cmake +115 -0
- data/build/common/options.cmake +127 -0
- data/build/common/smart_install.cmake +263 -0
- data/build/common/system.cmake +122 -0
- data/build/common/transactd.rc.in +52 -0
- data/build/common/transactd_cl_common.cmake +101 -0
- data/build/common/transactd_cl_output.cmake +93 -0
- data/build/common/transactd_common.cmake +237 -0
- data/build/common/transactd_required.cmake +28 -0
- data/build/swig/ruby/generate.cmake.in +35 -0
- data/build/swig/ruby/generate.cmd.in +19 -0
- data/build/swig/ruby/ruby.swg +101 -0
- data/build/swig/tdcl.i +188 -0
- data/build/tdclc/BUILDNUMBER.txt +1 -0
- data/build/tdclc/CMakeLists.txt +170 -0
- data/build/tdclc/tdclc_32.cbproj +181 -0
- data/build/tdclc/tdclc_64.cbproj +205 -0
- data/build/tdclcpp/BUILDNUMBER.txt +1 -0
- data/build/tdclcpp/CMakeLists.txt +142 -0
- data/build/tdclcpp/tdclcpp_bcb_32.cbproj +239 -0
- data/build/tdclcpp/tdclcpp_bcb_64.cbproj +304 -0
- data/build/tdclrb/BUILDNUMBER.txt +1 -0
- data/build/tdclrb/CMakeLists.txt +258 -0
- data/build/tdclrb/GEM_VERSION +3 -0
- data/build/tdclrb/bldgem/extconf.rb +123 -0
- data/build/tdclrb/gem/INSTALLLOG.win32 +9 -0
- data/build/tdclrb/gem/Makefile.win32-VS +65 -0
- data/build/tdclrb/gem/Makefile.win32-prebuilt +48 -0
- data/build/tdclrb/gem/detect.rb +31 -0
- data/build/tdclrb/gem/helper.rb +113 -0
- data/build/tdclrb/gem/transactd.rb +22 -0
- data/build/tdclrb/gem_output.cmake +44 -0
- data/source/bzs/db/IBlobBuffer.h +51 -0
- data/source/bzs/db/blobBuffer.h +177 -0
- data/source/bzs/db/blobStructs.h +85 -0
- data/source/bzs/db/engine/mysql/IReadRecords.h +52 -0
- data/source/bzs/db/engine/mysql/bookmark.h +195 -0
- data/source/bzs/db/engine/mysql/database.cpp +1882 -0
- data/source/bzs/db/engine/mysql/database.h +465 -0
- data/source/bzs/db/engine/mysql/dbManager.cpp +303 -0
- data/source/bzs/db/engine/mysql/dbManager.h +143 -0
- data/source/bzs/db/engine/mysql/errorMessage.cpp +75 -0
- data/source/bzs/db/engine/mysql/errorMessage.h +43 -0
- data/source/bzs/db/engine/mysql/fieldAccess.h +158 -0
- data/source/bzs/db/engine/mysql/mydebuglog.cpp +349 -0
- data/source/bzs/db/engine/mysql/mydebuglog.h +89 -0
- data/source/bzs/db/engine/mysql/mysqlInternal.h +171 -0
- data/source/bzs/db/engine/mysql/mysqlThd.cpp +169 -0
- data/source/bzs/db/engine/mysql/mysqlThd.h +35 -0
- data/source/bzs/db/engine/mysql/percentageKey.h +260 -0
- data/source/bzs/db/protocol/ICommandExecuter.h +49 -0
- data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +689 -0
- data/source/bzs/db/protocol/hs/hsCommandExecuter.h +228 -0
- data/source/bzs/db/protocol/tdap/btrDate.cpp +437 -0
- data/source/bzs/db/protocol/tdap/btrDate.h +227 -0
- data/source/bzs/db/protocol/tdap/client/bulkInsert.h +127 -0
- data/source/bzs/db/protocol/tdap/client/client.cpp +106 -0
- data/source/bzs/db/protocol/tdap/client/client.h +292 -0
- data/source/bzs/db/protocol/tdap/client/connMgr.cpp +144 -0
- data/source/bzs/db/protocol/tdap/client/connMgr.h +82 -0
- data/source/bzs/db/protocol/tdap/client/database.cpp +863 -0
- data/source/bzs/db/protocol/tdap/client/database.h +118 -0
- data/source/bzs/db/protocol/tdap/client/databaseFactory.cpp +100 -0
- data/source/bzs/db/protocol/tdap/client/dbDef.cpp +1640 -0
- data/source/bzs/db/protocol/tdap/client/dbDef.h +135 -0
- data/source/bzs/db/protocol/tdap/client/dllmain.cpp +434 -0
- data/source/bzs/db/protocol/tdap/client/errorMessage.cpp +92 -0
- data/source/bzs/db/protocol/tdap/client/errorMessage_ja.cpp +98 -0
- data/source/bzs/db/protocol/tdap/client/fieldDDF.cpp +174 -0
- data/source/bzs/db/protocol/tdap/client/fieldDDF.h +91 -0
- data/source/bzs/db/protocol/tdap/client/fileDDF.cpp +140 -0
- data/source/bzs/db/protocol/tdap/client/fileDDF.h +86 -0
- data/source/bzs/db/protocol/tdap/client/filter.cpp +527 -0
- data/source/bzs/db/protocol/tdap/client/filter.h +154 -0
- data/source/bzs/db/protocol/tdap/client/indexDDF.cpp +137 -0
- data/source/bzs/db/protocol/tdap/client/indexDDF.h +84 -0
- data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +724 -0
- data/source/bzs/db/protocol/tdap/client/nsDatabase.h +123 -0
- data/source/bzs/db/protocol/tdap/client/nsTable.cpp +899 -0
- data/source/bzs/db/protocol/tdap/client/nsTable.h +199 -0
- data/source/bzs/db/protocol/tdap/client/request.h +198 -0
- data/source/bzs/db/protocol/tdap/client/sharedData.cpp +58 -0
- data/source/bzs/db/protocol/tdap/client/sharedData.h +56 -0
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +574 -0
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.h +53 -0
- data/source/bzs/db/protocol/tdap/client/stringConverter.h +627 -0
- data/source/bzs/db/protocol/tdap/client/table.cpp +2613 -0
- data/source/bzs/db/protocol/tdap/client/table.h +221 -0
- data/source/bzs/db/protocol/tdap/client/trdboostapi.h +1096 -0
- data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +179 -0
- data/source/bzs/db/protocol/tdap/client/trdclcppautolink.h +40 -0
- data/source/bzs/db/protocol/tdap/client/trnsctcl.def +11 -0
- data/source/bzs/db/protocol/tdap/myDateTime.cpp +500 -0
- data/source/bzs/db/protocol/tdap/mysql/characterset.cpp +184 -0
- data/source/bzs/db/protocol/tdap/mysql/characterset.h +60 -0
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +284 -0
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +53 -0
- data/source/bzs/db/protocol/tdap/mysql/debuglog.cpp +383 -0
- data/source/bzs/db/protocol/tdap/mysql/debuglog.h +106 -0
- data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +680 -0
- data/source/bzs/db/protocol/tdap/mysql/request.h +202 -0
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +1020 -0
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +141 -0
- data/source/bzs/db/protocol/tdap/tdapRequest.h +190 -0
- data/source/bzs/db/protocol/tdap/tdapSchema.cpp +295 -0
- data/source/bzs/db/protocol/tdap/tdapSchema.h +558 -0
- data/source/bzs/db/protocol/tdap/tdapcapi.h +423 -0
- data/source/bzs/db/transactd/appBuilderImple.h +55 -0
- data/source/bzs/db/transactd/appModule.cpp +183 -0
- data/source/bzs/db/transactd/appModule.h +80 -0
- data/source/bzs/db/transactd/connManager.cpp +201 -0
- data/source/bzs/db/transactd/connManager.h +60 -0
- data/source/bzs/db/transactd/connectionRecord.h +69 -0
- data/source/bzs/db/transactd/transactd.cpp +325 -0
- data/source/bzs/env/compiler.h +135 -0
- data/source/bzs/env/crosscompile.cpp +130 -0
- data/source/bzs/env/crosscompile.h +150 -0
- data/source/bzs/env/fileopen.h +36 -0
- data/source/bzs/env/mbcswchrLinux.cpp +40 -0
- data/source/bzs/env/mbcswchrLinux.h +88 -0
- data/source/bzs/env/tstring.h +183 -0
- data/source/bzs/example/changeSchema.cpp +117 -0
- data/source/bzs/example/changeSchema_c.cpp +78 -0
- data/source/bzs/example/connection_pool_c.cpp +171 -0
- data/source/bzs/example/createDatabase.cpp +305 -0
- data/source/bzs/example/createDatabase_c.cpp +202 -0
- data/source/bzs/example/deleteRecords.cpp +87 -0
- data/source/bzs/example/deleteRecords_c.cpp +57 -0
- data/source/bzs/example/dropDatabase.cpp +59 -0
- data/source/bzs/example/dropDatabase_c.cpp +34 -0
- data/source/bzs/example/insertRecords.cpp +212 -0
- data/source/bzs/example/insertRecords_c.cpp +153 -0
- data/source/bzs/example/readRecords.cpp +141 -0
- data/source/bzs/example/readRecords_c.cpp +107 -0
- data/source/bzs/example/updateRecords.cpp +99 -0
- data/source/bzs/example/updateRecords_c.cpp +71 -0
- data/source/bzs/example/update_with_transaction.cpp +104 -0
- data/source/bzs/example/update_with_transaction_c.cpp +80 -0
- data/source/bzs/netsvc/client/tcpClient.cpp +226 -0
- data/source/bzs/netsvc/client/tcpClient.h +489 -0
- data/source/bzs/netsvc/server/IAppModule.h +94 -0
- data/source/bzs/netsvc/server/iserver.h +65 -0
- data/source/bzs/netsvc/server/serverCpt.cpp +522 -0
- data/source/bzs/netsvc/server/serverCpt.h +88 -0
- data/source/bzs/netsvc/server/serverPipe.cpp +705 -0
- data/source/bzs/netsvc/server/serverPipe.h +96 -0
- data/source/bzs/netsvc/server/serverTpool.cpp +416 -0
- data/source/bzs/netsvc/server/serverTpool.h +84 -0
- data/source/bzs/rtl/benchmark.cpp +96 -0
- data/source/bzs/rtl/benchmark.h +65 -0
- data/source/bzs/rtl/datetime.cpp +375 -0
- data/source/bzs/rtl/datetime.h +53 -0
- data/source/bzs/rtl/debuglog.cpp +106 -0
- data/source/bzs/rtl/debuglog.h +97 -0
- data/source/bzs/rtl/exception.h +116 -0
- data/source/bzs/rtl/stl_uty.cpp +35 -0
- data/source/bzs/rtl/stl_uty.h +29 -0
- data/source/bzs/rtl/stringBuffers.cpp +101 -0
- data/source/bzs/rtl/stringBuffers.h +58 -0
- data/source/bzs/rtl/strtrim.cpp +135 -0
- data/source/bzs/rtl/strtrim.h +46 -0
- data/source/bzs/test/tdclatl/bench_tdclatl.js +445 -0
- data/source/bzs/test/tdclrb/bench_tdclcpp.rb +375 -0
- data/source/bzs/test/tdclrb/prepare.rb +226 -0
- data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +172 -0
- data/source/bzs/test/tdclrb/transactd_kanjischema_spec.rb +208 -0
- data/source/bzs/test/tdclrb/transactd_spec.rb +1536 -0
- data/source/bzs/test/transactdBench/transactdBench.cpp +430 -0
- data/source/bzs/test/transactdBench/transactdBench2.cpp +342 -0
- data/source/bzs/test/trdclengn/test_trdclengn.cpp +2030 -0
- data/source/global/tdclatl/Database.cpp +503 -0
- data/source/global/tdclatl/Database.h +139 -0
- data/source/global/tdclatl/DbDef.cpp +242 -0
- data/source/global/tdclatl/DbDef.h +79 -0
- data/source/global/tdclatl/Field.cpp +92 -0
- data/source/global/tdclatl/Field.h +59 -0
- data/source/global/tdclatl/FieldDef.cpp +238 -0
- data/source/global/tdclatl/FieldDef.h +87 -0
- data/source/global/tdclatl/Flags.cpp +111 -0
- data/source/global/tdclatl/Flags.h +55 -0
- data/source/global/tdclatl/KeyDef.cpp +51 -0
- data/source/global/tdclatl/KeyDef.h +55 -0
- data/source/global/tdclatl/KeySegment.cpp +55 -0
- data/source/global/tdclatl/Table.cpp +600 -0
- data/source/global/tdclatl/Table.h +144 -0
- data/source/global/tdclatl/TableDef.cpp +291 -0
- data/source/global/tdclatl/TableDef.h +86 -0
- data/source/global/tdclatl/TdVersion.cpp +74 -0
- data/source/global/tdclatl/TdVersion.h +54 -0
- data/source/global/tdclatl/_IDatabaseEvents_CP.h +113 -0
- data/source/global/tdclatl/dllmain.cpp +30 -0
- data/source/global/tdclatl/dllmain.h +27 -0
- data/source/global/tdclatl/keySegment.h +57 -0
- data/source/global/tdclatl/resource.h +0 -0
- data/source/global/tdclatl/stdafx.cpp +2 -0
- data/source/global/tdclatl/stdafx.h +25 -0
- data/source/global/tdclatl/targetver.h +4 -0
- data/source/global/tdclatl/tdclatl.cpp +68 -0
- data/source/global/tdclatl/tdclatl.def +10 -0
- data/source/global/tdclatl/tdclatl.idl +1035 -0
- data/source/linux/charsetConvert.h +112 -0
- data/source/linux/linuxTypes.h +33 -0
- data/source/linux/tchar.h +428 -0
- data/transactd.gemspec +97 -0
- 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
|
+
|