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,123 @@
1
+ # coding : utf-8
2
+ =begin =============================================================
3
+ Copyright (C) 2013 BizStation Corp All rights reserved.
4
+
5
+ This program is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU General Public License
7
+ as published by the Free Software Foundation; either version 2
8
+ of the License, or (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18
+ 02111-1307, USA.
19
+ ===================================================================
20
+ =end
21
+
22
+ transactd_gem_root_relative = '../../../'
23
+
24
+ require File.expand_path(File.join(transactd_gem_root_relative, 'build/tdclrb/gem/detect.rb'))
25
+ require File.expand_path(File.join(transactd_gem_root_relative, 'build/tdclrb/gem/helper.rb'))
26
+ require 'rbconfig'
27
+
28
+ transactd_gem_root = File.expand_path(File.join(File.dirname(__FILE__), transactd_gem_root_relative))
29
+ ruby_bin_path = RbConfig::CONFIG['bindir']
30
+ ruby_exe_path = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
31
+
32
+ #
33
+ # use prebuilt binary
34
+ #
35
+ if has_binary(transactd_gem_root)
36
+ make_makefile_prebuilt_win32(ruby_bin_path, transactd_gem_root) if RUBY_PLATFORM =~ /mswin/
37
+ exit
38
+ end
39
+
40
+ #
41
+ # build binary
42
+ #
43
+
44
+ require 'mkmf'
45
+ require 'open3'
46
+
47
+ # need cmake and swig
48
+ find_executable('cmake')
49
+ find_executable('swig')
50
+
51
+ # options
52
+ boost = arg_config('--boost', '').gsub(/"\n/, '')
53
+ generator = arg_config('--generator', '').gsub(/"\n/, '')
54
+ ruby_include_dirs = arg_config('--ruby_include_dirs', '').gsub(/"\n/, '')
55
+ ruby_library_path = arg_config('--ruby_library_path', '').gsub(/"\n/, '')
56
+ install_prefix = arg_config('--install_prefix', '').gsub(/"\n/, '')
57
+
58
+ # boost
59
+ if boost != '' && boost !=~ /^\-DBOOST_ROOT/
60
+ boost = '-DBOOST_ROOT="' + to_slash_path(boost) + '"'
61
+ end
62
+
63
+ # detect generator
64
+ if generator == ''
65
+ if RUBY_PLATFORM =~ /mswin/
66
+ bit = (get_ruby_bitness() == 64) ? ' Win64' : ''
67
+ generator = '-G "Visual Studio 10' + bit + '"'
68
+ elsif RUBY_PLATFORM =~ /mingw/
69
+ generator = '-G "MSYS Makefiles"'
70
+ end
71
+ else
72
+ if generator !=~ /^\-G /
73
+ generator = '-G "' + generator + '"'
74
+ end
75
+ end
76
+
77
+ # ruby_include_dirs
78
+ if ruby_include_dirs != '' && ruby_include_dirs !=~ /^\-DRUBY_SWIG_INCLUDE_PATH/
79
+ ruby_include_dirs = '-DTRANSACTD_RUBY_INCLUDE_PATH="' + to_slash_path(ruby_include_dirs) + '"'
80
+ end
81
+
82
+ # ruby_library_path
83
+ if ruby_library_path != '' && ruby_library_path !=~ /^\-DRUBY_SWIG_LIBRARY_PATH/
84
+ ruby_library_path = '-DTRANSACTD_RUBY_LIBRARY_PATH="' + to_slash_path(ruby_library_path) + '"'
85
+ end
86
+
87
+ # install_prefix
88
+ if install_prefix != '' && install_prefix !=~ /^\-DCMAKE_INSTALL_PREFIX/
89
+ install_prefix = '-DTRANSACTD_CLIENTS_PREFIX="' + to_slash_path(install_prefix) + '"'
90
+ end
91
+
92
+ # ruby executable path
93
+ ruby_executable = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
94
+ ruby_executable = '-DTRANSACTD_RUBY_EXECUTABLE_PATH="' + to_slash_path(ruby_executable) + '"'
95
+
96
+ # output dir
97
+ gem_root = '-DTRANSACTD_RUBY_GEM_ROOT_PATH="' + to_slash_path(transactd_gem_root) + '"'
98
+
99
+ # cmake
100
+ cmake_cmd = ['cmake', to_native_path(transactd_gem_root_relative), '-DTRANSACTD_RUBY_GEM=ON',
101
+ generator, boost, ruby_executable, ruby_library_path, ruby_include_dirs,
102
+ install_prefix, gem_root, '>> cmake_generate.log'].join(' ')
103
+ begin
104
+ f = open('cmake_generate.log', 'w')
105
+ f.puts cmake_cmd
106
+ ensure
107
+ f.close
108
+ end
109
+ stdout, stderr, status = Open3.capture3(cmake_cmd)
110
+ succeed = (status == 0)
111
+ STDERR.puts stderr if !succeed
112
+
113
+ # crete dummy Makefile for Visual Studio .sln
114
+ if /Visual Studio/ =~ generator
115
+ FileUtils.copy('../gem/Makefile.win32-VS', './nmake.cmd')
116
+ begin
117
+ mkfile_dummy = open('Makefile', 'w')
118
+ ensure
119
+ mkfile_dummy.close
120
+ end
121
+ end
122
+
123
+ $makefile_created = true if succeed
@@ -0,0 +1,9 @@
1
+ Transactd client for ruby gem
2
+
3
+ To uninstall run : gem uninstall transactd
4
+
5
+ Some files are installed on System32 or SysWOW64 or ruby-bin directory.
6
+ In most cases you DON'T have to remove these files.
7
+
8
+ install log:
9
+
@@ -0,0 +1,65 @@
1
+ @echo off
2
+ @REM ===============================================================
3
+ @REM Copyright (C) 2013 BizStation Corp All rights reserved.
4
+ @REM
5
+ @REM This program is free software; you can redistribute it and/or
6
+ @REM modify it under the terms of the GNU General Public License
7
+ @REM as published by the Free Software Foundation; either version 2
8
+ @REM of the License, or (at your option) any later version.
9
+ @REM
10
+ @REM This program is distributed in the hope that it will be useful,
11
+ @REM but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ @REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ @REM GNU General Public License for more details.
14
+ @REM
15
+ @REM You should have received a copy of the GNU General Public License
16
+ @REM along with this program; if not, write to the Free Software
17
+ @REM Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18
+ @REM 02111-1307, USA.
19
+ @REM ===============================================================
20
+
21
+ setlocal enabledelayedexpansion
22
+ cd "%~dp0"
23
+
24
+ set BLDMSG=buildmsg.log
25
+ set INSMSG=..\..\..\install.log
26
+ set ERRMSG=errormsg.log
27
+
28
+ @REM BUILD
29
+ echo BUILD tdcl.sln %date% %time% >> "%BLDMSG%"
30
+ msbuild tdcl.sln /p:Configuration=Release /m:2 >> "%BLDMSG%" 2>&1
31
+ if ERRORLEVEL 1 (
32
+ echo ************************************************************** 1>&2
33
+ echo EROOR MESSAGE 1>&2
34
+ echo Failed to Build. Please check log. 1>&2
35
+ echo %~dp0%BLDMSG%
36
+ echo %~dp0cmake_generate.log
37
+ echo ************************************************************** 1>&2
38
+ exit /b 1
39
+ )
40
+
41
+ if "%~1" == "install" goto :INSTALLCMD
42
+ if "%~1" == "site-install" goto :INSTALLCMD
43
+ exit /b 0
44
+
45
+ :INSTALLCMD
46
+ echo Install %date% %time% >> "%INSMSG%"
47
+ cmake -P cmake_install.cmake >> "%INSMSG%" 2>> "%ERRMSG%"
48
+ call :getsize "%ERRMSG%"
49
+ if !getsize_ret! GTR 0 (
50
+ type "%ERRMSG%" >> "%INSMSG%"
51
+ findstr /C:"Failed to Install." "%ERRMSG%" > "%ERRMSG%.tmp"
52
+ call :getsize "%ERRMSG%.tmp"
53
+ del "%ERRMSG%.tmp"
54
+ if !getsize_ret! GTR 0 (
55
+ type "%ERRMSG%" 1>&2
56
+ exit /b 1
57
+ )
58
+ )
59
+ exit /b 0
60
+
61
+ :getsize
62
+ set /a getsize_ret=%~z1
63
+ exit /b 0
64
+
65
+ endlocal
@@ -0,0 +1,48 @@
1
+ @echo off
2
+ @REM ===============================================================
3
+ @REM Copyright (C) 2013 BizStation Corp All rights reserved.
4
+ @REM
5
+ @REM This program is free software; you can redistribute it and/or
6
+ @REM modify it under the terms of the GNU General Public License
7
+ @REM as published by the Free Software Foundation; either version 2
8
+ @REM of the License, or (at your option) any later version.
9
+ @REM
10
+ @REM This program is distributed in the hope that it will be useful,
11
+ @REM but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ @REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ @REM GNU General Public License for more details.
14
+ @REM
15
+ @REM You should have received a copy of the GNU General Public License
16
+ @REM along with this program; if not, write to the Free Software
17
+ @REM Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18
+ @REM 02111-1307, USA.
19
+ @REM ===============================================================
20
+
21
+ setlocal enabledelayedexpansion
22
+
23
+ if "%~1" == "install" goto :EOF
24
+ if "%~1" == "site-install" goto :EOF
25
+
26
+ set INSTALLLOG=%TRANSACTD_GEM_ROOT%\install.log
27
+ set ERRMSG=errmsg.txt
28
+
29
+ goto startpoint
30
+
31
+ :getsize
32
+ set /a getsize_ret=%~z1
33
+ exit /b 0
34
+
35
+ :startpoint
36
+ @REM UNINSTALL log
37
+ copy "%TRANSACTD_GEM_ROOT%\build\tdclrb\gem\INSTALLLOG.win32" "%INSTALLLOG%"
38
+ echo Installing transactd ruby gem >> "%INSTALLLOG%"
39
+
40
+ @REM Copy ruby files
41
+ echo *** Copy rb scripts *** >> "%INSTALLLOG%"
42
+ if not exist "%TRANSACTD_GEM_ROOT%\lib" (mkdir "%TRANSACTD_GEM_ROOT%\lib")
43
+ copy "%TRANSACTD_GEM_ROOT%\build\tdclrb\gem\*.rb" "%TRANSACTD_GEM_ROOT%\lib" >> "%INSTALLLOG%" 2>> "%ERRMSG%"
44
+ if not exist "%TRANSACTD_GEM_ROOT%\test" (mkdir "%TRANSACTD_GEM_ROOT%\test")
45
+ copy "%TRANSACTD_GEM_ROOT%\source\bzs\test\tdclrb\*.rb" "%TRANSACTD_GEM_ROOT%\test" >> "%INSTALLLOG%" 2>> "%ERRMSG%"
46
+
47
+ @REM Copy binary files
48
+ echo *** Copy common dlls to system directories *** >> "%INSTALLLOG%"
@@ -0,0 +1,31 @@
1
+ # coding : utf-8
2
+ =begin =============================================================
3
+ Copyright (C) 2013 BizStation Corp All rights reserved.
4
+
5
+ This program is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU General Public License
7
+ as published by the Free Software Foundation; either version 2
8
+ of the License, or (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18
+ 02111-1307, USA.
19
+ ===================================================================
20
+ =end
21
+ require 'rbconfig'
22
+
23
+ def get_binary_path
24
+ return File.join(RUBY_VERSION.match(/\d+\.\d+/)[0], 'transactd')
25
+ end
26
+
27
+ def has_binary(transactd_gem_root)
28
+ prebuilt_path = File.join(transactd_gem_root, 'bin', get_binary_path() + '.so')
29
+ common_path = File.join(transactd_gem_root, 'bin/common')
30
+ return File.exist?(prebuilt_path) && File.exist?(common_path)
31
+ end
@@ -0,0 +1,113 @@
1
+ # coding : utf-8
2
+ =begin =============================================================
3
+ Copyright (C) 2013 BizStation Corp All rights reserved.
4
+
5
+ This program is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU General Public License
7
+ as published by the Free Software Foundation; either version 2
8
+ of the License, or (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18
+ 02111-1307, USA.
19
+ ===================================================================
20
+ =end
21
+ def to_native_path(path)
22
+ return File::ALT_SEPARATOR ? path.gsub('/', File::ALT_SEPARATOR) : path
23
+ end
24
+
25
+ def to_slash_path(path)
26
+ return File::ALT_SEPARATOR ? path.gsub(File::ALT_SEPARATOR, '/') : path
27
+ end
28
+
29
+ def get_ruby_bitness
30
+ return ['a'].pack('P').length > 4 ? 64 : 32
31
+ end
32
+
33
+ def get_windows_bitness
34
+ return ENV.has_key?('ProgramFiles(x86)') ? 64 : 32
35
+ end
36
+
37
+ def get_windows_sysdir()
38
+ ruby_bitness = get_ruby_bitness()
39
+ windows_bitness = get_windows_bitness()
40
+ if windows_bitness == 32
41
+ return to_native_path(File.join(ENV['Systemroot'], 'System32/'))
42
+ else
43
+ if ruby_bitness == 32
44
+ return to_native_path(File.join(ENV['Systemroot'], 'SysWOW64/'))
45
+ else
46
+ return to_native_path(File.join(ENV['Systemroot'], 'System32/'))
47
+ end
48
+ end
49
+ end
50
+
51
+ def get_common_binary_files(transactd_gem_root)
52
+ ruby_bitness = get_ruby_bitness()
53
+ windows_bitness = get_windows_bitness()
54
+ ruby_bitness = 32 if windows_bitness == 32
55
+ bin_files = Dir.glob(File.join(transactd_gem_root, 'bin/common/tdclc_' + ruby_bitness.to_s + '_*.dll'))
56
+ bin_files += Dir.glob(File.join(transactd_gem_root, 'bin/common/tdclcpp_*_' + ruby_bitness.to_s + 'm_*.dll'))
57
+ sysdir = get_windows_sysdir()
58
+ bin_files = bin_files.map{ |i| '"' + to_native_path(i) + '" "' + sysdir + '"' }
59
+ return bin_files
60
+ end
61
+
62
+ def make_makefile_prebuilt_win32(ruby_bin_path, transactd_gem_root)
63
+ bin_files = get_common_binary_files(transactd_gem_root)
64
+ begin
65
+ mkfile_dummy = open('Makefile', 'w')
66
+ mkfile = open('nmake.cmd', 'w')
67
+ srcpath = File.join(transactd_gem_root, 'build/tdclrb/gem/Makefile.win32-prebuilt')
68
+ copycmd = File.join(transactd_gem_root, 'build/common/copyifgreater.cmd')
69
+ source = open(srcpath, 'r')
70
+ mkfile.puts '@echo off'
71
+ mkfile.puts 'set TRANSACTD_GEM_ROOT=' + to_native_path(transactd_gem_root)
72
+ mkfile.puts 'set RUBY_BIN_PATH=' + to_native_path(ruby_bin_path)
73
+ mkfile.puts 'set COPYCMD=' + to_native_path(copycmd)
74
+ mkfile.puts source.read
75
+ mkfile.puts ''
76
+ bin_files.each{ |i|
77
+ files = i.split(' ').map{ |i| i.strip.gsub!(/(^(\s|\"|)+)|((\s|\")+$)/, '')}
78
+ srcfile = (files.length > 0) ? files[0] : 'unknown error'
79
+ dstfile = (files.length > 1) ? files[1] : 'unknown error'
80
+ mkfile.puts <<EOS
81
+ call "%COPYCMD%" #{i} >> "%INSTALLLOG%" 2>> "%ERRMSG%"
82
+ call :getsize "%ERRMSG%"
83
+ if !getsize_ret! GTR 0 (
84
+ if ERRORLEVEL 1 (
85
+ echo ************************************************************** 1>&2
86
+ echo EROOR MESSAGE 1>&2
87
+ echo Failed to Install. 1>&2
88
+ echo Perhaps it require to run as Administrator, or file is in use. 1>&2
89
+ type "%ERRMSG%" 1>&2
90
+ echo ************************************************************** 1>&2
91
+ exit /b 1
92
+ ) else (
93
+ echo ************************************************************** >> "%INSTALLLOG%"
94
+ echo WARNING MESSAGE >> "%INSTALLLOG%"
95
+ echo Files not copied because it could not read the version from the binary. >> "%INSTALLLOG%"
96
+ echo There is a possibility that the program does not work properly. >> "%INSTALLLOG%"
97
+ echo Please check the compatibility of following binaries. >> "%INSTALLLOG%"
98
+ type "%ERRMSG%" >> "%INSTALLLOG%"
99
+ echo ************************************************************** >> "%INSTALLLOG%"
100
+ del "%ERRMSG%"
101
+ )
102
+ )
103
+ EOS
104
+ }
105
+ mkfile.puts 'exit /b 0'
106
+ mkfile.puts 'endlocal'
107
+ $makefile_created = true
108
+ ensure
109
+ source.close
110
+ mkfile.close
111
+ mkfile_dummy.close
112
+ end
113
+ end
@@ -0,0 +1,22 @@
1
+ # coding : utf-8
2
+ =begin =============================================================
3
+ Copyright (C) 2013 BizStation Corp All rights reserved.
4
+
5
+ This program is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU General Public License
7
+ as published by the Free Software Foundation; either version 2
8
+ of the License, or (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18
+ 02111-1307, USA.
19
+ ===================================================================
20
+ =end
21
+ require File.expand_path(File.join(File.dirname(__FILE__), 'detect.rb'))
22
+ require File.expand_path(File.join(File.dirname(__FILE__), '../bin', get_binary_path()))
@@ -0,0 +1,44 @@
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
+ # set install drectory
21
+ # ==========================================================
22
+ if(NOT COMMAND tdcl_set_output)
23
+ macro(tdcl_set_output TRANSACTD_BINARY_ROOT prefix)
24
+ ## install to gem/common
25
+ install(TARGETS ${this_target}
26
+ LIBRARY DESTINATION "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common"
27
+ RUNTIME DESTINATION "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common"
28
+ ARCHIVE DESTINATION "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common"
29
+ )
30
+ ## install to system dir (copy file if greater)
31
+ if(WIN32)
32
+ get_target_property(tmp_var "${this_target}" LOCATION)
33
+ get_filename_component(tmp_var "${tmp_var}" NAME)
34
+ file(TO_CMAKE_PATH "${TRANSACTD_RUBY_GEM_ROOT_PATH}/bin/common/${tmp_var}" tmp_var)
35
+ bz_smart_install(SOURCES "${tmp_var}" TO_WIN_SYSTEMDIR)
36
+ else()
37
+ if("${prefix}" STREQUAL "")
38
+ install(TARGETS ${this_target} LIBRARY DESTINATION /usr/lib)
39
+ else()
40
+ install(TARGETS ${this_target} LIBRARY DESTINATION "${prefix}")
41
+ endif()
42
+ endif()
43
+ endmacro()
44
+ endif()
@@ -0,0 +1,51 @@
1
+ #ifndef BZS_DB_IBLOBBUFFER_H
2
+ #define BZS_DB_IBLOBBUFFER_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 <boost/asio/buffer.hpp>
22
+ #include <vector>
23
+ #include "blobStructs.h"
24
+
25
+
26
+
27
+
28
+ namespace bzs
29
+ {
30
+ namespace db
31
+ {
32
+
33
+ class IblobBuffer
34
+ {
35
+
36
+ public:
37
+ virtual ~IblobBuffer(){};
38
+ virtual void clear()=0;
39
+ virtual void addBlob(unsigned int bloblen, unsigned short fieldNum, const unsigned char* dataPtr)=0;
40
+ virtual void setFieldCount(unsigned int v)=0;
41
+ virtual unsigned int fieldCount()=0;
42
+ virtual unsigned int makeMultiBuffer(std::vector<boost::asio::const_buffer>& mbuffer)=0;
43
+ virtual unsigned int writeBuffer(unsigned char* buffer, unsigned int maxsize, int& stat)=0;
44
+
45
+
46
+ };
47
+
48
+ }//namespace db
49
+ }//namespace bzs
50
+
51
+ #endif //BZS_DB_IBLOBBUFFER_H
@@ -0,0 +1,177 @@
1
+ #ifndef BZS_DB_BLOBBUFFER_H
2
+ #define BZS_DB_BLOBBUFFER_H
3
+ /*=================================================================
4
+ Copyright (C) 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 <boost/noncopyable.hpp>
22
+ #include "IBlobBuffer.h"
23
+ #include <assert.h>
24
+ #include <boost/shared_array.hpp>
25
+
26
+ #define FILE_MAP_SIZE 3145728-1024//3M
27
+
28
+ namespace bzs
29
+ {
30
+ namespace db
31
+ {
32
+
33
+
34
+ static const char nullbyte[2] = {0x00};
35
+
36
+ /** holds blob ptr and make boost multiplebuffer
37
+ */
38
+ class blobBuffer : public IblobBuffer, private boost::noncopyable
39
+ {
40
+ std::vector<blob> m_blobs;
41
+ blobHeader m_bh;
42
+ std::vector<boost::shared_array<unsigned char> > m_strings;
43
+ public:
44
+ blobBuffer(){m_bh.fieldCount = 0;}
45
+ const blobHeader* getHeader()const {return &m_bh;};
46
+
47
+ void clear()
48
+ {
49
+ m_blobs.clear();
50
+ m_bh.fieldCount = 0;
51
+ m_bh.rows=0;
52
+ m_strings.clear();
53
+ }
54
+
55
+ size_t blobs(){return m_blobs.size();};
56
+ /**
57
+ * @param dataPtr blob data body pointer in result record image.
58
+ */
59
+ void addBlob(unsigned int bloblen, unsigned short fieldNum, const unsigned char* dataPtr)
60
+ {
61
+ unsigned char* p = new unsigned char[bloblen];
62
+ m_strings.push_back(boost::shared_array<unsigned char>(p));
63
+ memcpy(p, dataPtr, bloblen);
64
+ m_blobs.push_back(blob(bloblen, fieldNum, p));
65
+
66
+ }
67
+
68
+ void addBlob(const blob& b)
69
+ {
70
+ m_blobs.push_back(b);
71
+ }
72
+
73
+ void setFieldCount(unsigned int v){m_bh.fieldCount=v;};
74
+ unsigned int fieldCount(){return m_bh.fieldCount;}
75
+
76
+
77
+ /** Make boost::asio::multibuffer<const_buffer> from added blob.
78
+ * and write offset to record image of blob fields.
79
+ * @image pointer of normal result image.
80
+ * @size bytes of normal result image length.
81
+ * @return
82
+ * result buffer image
83
+ * ---------------------------
84
+ * n record image
85
+ * 2 fieldNum
86
+ * 4 dataLength
87
+ * n(dataLength) data
88
+ * 2 null terminate
89
+ * 2 fieldNum ...
90
+ * ----------------------------
91
+ */
92
+
93
+ unsigned int makeMultiBuffer(std::vector<boost::asio::const_buffer>& mbuffer)
94
+ {
95
+ unsigned int size = 0;
96
+ if (m_bh.fieldCount)
97
+ {
98
+ //write buffer header
99
+ m_bh.rows = (unsigned short)(m_blobs.size()/m_bh.fieldCount);
100
+ mbuffer.push_back(boost::asio::buffer((char*)&m_bh, sizeof(blobHeader)));
101
+ size += sizeof(blobHeader);
102
+
103
+ for (size_t i=0;i<m_blobs.size();i++)
104
+ {
105
+ const blob& b = m_blobs[i];
106
+ //add field desc
107
+ mbuffer.push_back(boost::asio::buffer((char*)&b.bf, sizeof(blobField)));
108
+ size += sizeof(blobField);
109
+
110
+ //add field body
111
+ mbuffer.push_back(boost::asio::buffer(b.ptr, b.bf.size));
112
+
113
+ //add null terminate
114
+ mbuffer.push_back(boost::asio::buffer(nullbyte, 2));
115
+
116
+ //update record image pointer to offset from record start
117
+ size += b.bf.size + 2;
118
+ }
119
+ }
120
+ return size;
121
+ }
122
+
123
+ /** Copy to single buffer.
124
+ * this is use for pipe server only.
125
+ * @param stat [out] return additional status. ex. STATUS_BUFFERTOOSMALL
126
+ * @return length of written by this function.
127
+ * result buffer image
128
+ * ---------------------------
129
+ * n record image
130
+ * 2 fieldNum
131
+ * 4 dataLength
132
+ * n(dataLength) data
133
+ * 2 null terminate
134
+ * 2 fieldNum ...
135
+ * ----------------------------
136
+ */
137
+ unsigned int writeBuffer(unsigned char* buffer, unsigned int maxsize, int& stat)
138
+ {
139
+ stat = 0;
140
+ unsigned char* p = buffer;// + offset ;
141
+ if (m_bh.fieldCount)
142
+ {
143
+ //write buffer header
144
+ m_bh.rows = (unsigned short)(m_blobs.size()/m_bh.fieldCount);
145
+ memcpy(p, &m_bh, sizeof(blobHeader));
146
+ p += sizeof(blobHeader);
147
+
148
+ for (size_t i=0;i<m_blobs.size();i++)
149
+ {
150
+ const blob& b = m_blobs[i];
151
+ if (maxsize > (p - buffer) + b.bf.size + 2)
152
+ {
153
+ //write field desc
154
+ memcpy(p, &b.bf, sizeof(blobField));
155
+ p += sizeof(blobField);
156
+ //write field body
157
+ memcpy(p, b.ptr, b.bf.size);
158
+
159
+ //write null terminate
160
+ p += b.bf.size;
161
+ memcpy(p, nullbyte, 2);
162
+ p += 2;
163
+ }else
164
+ {
165
+ stat = STATUS_BUFFERTOOSMALL;
166
+ break;
167
+ }
168
+ }
169
+ }
170
+ return(unsigned int)(p - buffer);
171
+ }
172
+ };
173
+
174
+ }//namespace db
175
+ }//namespace bzs
176
+ #endif //BZS_DB_BLOBBUFFER_H
177
+