transactd 1.2.0 → 2.0.0

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 (306) hide show
  1. checksums.yaml +4 -4
  2. data/BUILD_UNIX-JA +46 -67
  3. data/BUILD_WIN-JA +106 -63
  4. data/CMakeLists.txt +40 -15
  5. data/README +219 -75
  6. data/README-JA +207 -76
  7. data/README_ORMSRCGEN +118 -0
  8. data/README_ORMSRCGEN-JA +115 -0
  9. data/bin/common/tdclc_32_2_0.dll +0 -0
  10. data/bin/common/tdclc_64_2_0.dll +0 -0
  11. data/build/common/check_for_link_iconv.cmake +18 -14
  12. data/build/common/create_symlink.cmake.in +25 -0
  13. data/build/common/get_boost_libs.cmake +23 -23
  14. data/build/common/options.cmake +0 -66
  15. data/build/common/smart_install.cmake +3 -3
  16. data/build/common/transactd.rc.in +15 -5
  17. data/build/common/transactd_cl_common.cmake +37 -18
  18. data/build/common/transactd_cl_output.cmake +55 -13
  19. data/build/common/transactd_common.cmake +108 -31
  20. data/build/swig/php/generate.cmake.in +15 -17
  21. data/build/swig/php/generate.cmd.in +15 -9
  22. data/build/swig/php/php.swg +124 -82
  23. data/build/swig/php/transactd.no_yield.php +4494 -0
  24. data/build/swig/php/transactd.no_yield.php.git.patch +685 -0
  25. data/build/swig/php/transactd.no_yield.php.patch +685 -0
  26. data/build/swig/php/transactd.yield.php +4461 -0
  27. data/build/swig/php/transactd.yield.php.git.patch +652 -0
  28. data/build/swig/php/transactd.yield.php.patch +652 -0
  29. data/build/swig/referencecounter.h +79 -0
  30. data/build/swig/ruby/ruby.swg +226 -76
  31. data/build/swig/ruby/threadBlockRegionWrapper.h +71 -0
  32. data/build/swig/ruby/without_gvl.swg +87 -0
  33. data/build/swig/tdcl.i +659 -170
  34. data/build/swig/validatablepointer.h +91 -0
  35. data/build/tdclc/CMakeLists.txt +49 -34
  36. data/build/tdclc/{tdclc_64.cbproj → tdclc.cbproj} +65 -20
  37. data/build/tdclc/tdclc.rc +0 -0
  38. data/build/tdclcpp/CMakeLists.txt +84 -20
  39. data/build/tdclcpp/tdclcpp.rc +0 -0
  40. data/build/tdclcpp/{tdclcpp_bcb_64.cbproj → tdclcpp_bc.cbproj} +168 -44
  41. data/build/tdclrb/CMakeLists.txt +84 -66
  42. data/build/tdclrb/bldgem/extconf.rb +28 -3
  43. data/build/tdclrb/gem/helper.rb +11 -1
  44. data/build/tdclrb/gem_output.cmake +20 -16
  45. data/index_ja.html +15 -0
  46. data/source/bzs/db/IBlobBuffer.h +15 -17
  47. data/source/bzs/db/blobBuffer.h +186 -140
  48. data/source/bzs/db/blobStructs.h +37 -37
  49. data/source/bzs/db/engine/mysql/IReadRecords.h +34 -34
  50. data/source/bzs/db/engine/mysql/bookmark.h +150 -147
  51. data/source/bzs/db/engine/mysql/database.cpp +1721 -1526
  52. data/source/bzs/db/engine/mysql/database.h +608 -370
  53. data/source/bzs/db/engine/mysql/dbManager.cpp +213 -201
  54. data/source/bzs/db/engine/mysql/dbManager.h +115 -104
  55. data/source/bzs/db/engine/mysql/errorMessage.cpp +49 -50
  56. data/source/bzs/db/engine/mysql/errorMessage.h +25 -26
  57. data/source/bzs/db/engine/mysql/fieldAccess.h +55 -61
  58. data/source/bzs/db/engine/mysql/mydebuglog.cpp +326 -292
  59. data/source/bzs/db/engine/mysql/mydebuglog.h +63 -55
  60. data/source/bzs/db/engine/mysql/mysqlInternal.h +182 -125
  61. data/source/bzs/db/engine/mysql/mysqlThd.cpp +121 -121
  62. data/source/bzs/db/engine/mysql/mysqlThd.h +20 -20
  63. data/source/bzs/db/engine/mysql/percentageKey.h +241 -228
  64. data/source/bzs/db/protocol/ICommandExecuter.h +18 -17
  65. data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +543 -514
  66. data/source/bzs/db/protocol/hs/hsCommandExecuter.h +155 -158
  67. data/source/bzs/db/protocol/tdap/btrDate.cpp +213 -180
  68. data/source/bzs/db/protocol/tdap/btrDate.h +39 -37
  69. data/source/bzs/db/protocol/tdap/client/activeTable.cpp +173 -0
  70. data/source/bzs/db/protocol/tdap/client/activeTable.h +165 -0
  71. data/source/bzs/db/protocol/tdap/client/activeTableImple.h +370 -0
  72. data/source/bzs/db/protocol/tdap/client/bulkInsert.h +13 -23
  73. data/source/bzs/db/protocol/tdap/client/client.cpp +81 -68
  74. data/source/bzs/db/protocol/tdap/client/client.h +361 -320
  75. data/source/bzs/db/protocol/tdap/client/connMgr.cpp +17 -22
  76. data/source/bzs/db/protocol/tdap/client/connMgr.h +17 -19
  77. data/source/bzs/db/protocol/tdap/client/connectionPool.cpp +243 -0
  78. data/source/bzs/db/protocol/tdap/client/connectionPool.h +109 -0
  79. data/source/bzs/db/protocol/tdap/client/database.cpp +327 -219
  80. data/source/bzs/db/protocol/tdap/client/database.h +141 -118
  81. data/source/bzs/db/protocol/tdap/client/databaseFactory.cpp +60 -62
  82. data/source/bzs/db/protocol/tdap/client/databaseManager.h +255 -0
  83. data/source/bzs/db/protocol/tdap/client/dbDef.cpp +315 -202
  84. data/source/bzs/db/protocol/tdap/client/dbDef.h +40 -32
  85. data/source/bzs/db/protocol/tdap/client/dllmain.cpp +390 -371
  86. data/source/bzs/db/protocol/tdap/client/errorMessage.cpp +148 -56
  87. data/source/bzs/db/protocol/tdap/client/errorMessage_ja.cpp +149 -57
  88. data/source/bzs/db/protocol/tdap/client/export.h +35 -0
  89. data/source/bzs/db/protocol/tdap/client/field.cpp +1985 -0
  90. data/source/bzs/db/protocol/tdap/client/field.h +393 -0
  91. data/source/bzs/db/protocol/tdap/client/fieldDDF.cpp +14 -14
  92. data/source/bzs/db/protocol/tdap/client/fieldDDF.h +11 -14
  93. data/source/bzs/db/protocol/tdap/client/fieldNameAlias.cpp +123 -0
  94. data/source/bzs/db/protocol/tdap/client/fieldNameAlias.h +58 -0
  95. data/source/bzs/db/protocol/tdap/client/fields.h +178 -0
  96. data/source/bzs/db/protocol/tdap/client/fileDDF.cpp +13 -16
  97. data/source/bzs/db/protocol/tdap/client/fileDDF.h +11 -17
  98. data/source/bzs/db/protocol/tdap/client/filter.h +423 -259
  99. data/source/bzs/db/protocol/tdap/client/groupComp.h +117 -0
  100. data/source/bzs/db/protocol/tdap/client/groupQuery.cpp +818 -0
  101. data/source/bzs/db/protocol/tdap/client/groupQuery.h +281 -0
  102. data/source/bzs/db/protocol/tdap/client/indexDDF.cpp +14 -17
  103. data/source/bzs/db/protocol/tdap/client/indexDDF.h +11 -14
  104. data/source/bzs/db/protocol/tdap/client/memRecord.cpp +231 -0
  105. data/source/bzs/db/protocol/tdap/client/memRecord.h +145 -0
  106. data/source/bzs/db/protocol/tdap/client/memRecordset.cpp +448 -0
  107. data/source/bzs/db/protocol/tdap/client/memRecordset.h +159 -0
  108. data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +300 -173
  109. data/source/bzs/db/protocol/tdap/client/nsDatabase.h +53 -36
  110. data/source/bzs/db/protocol/tdap/client/nsTable.cpp +171 -128
  111. data/source/bzs/db/protocol/tdap/client/nsTable.h +121 -87
  112. data/source/bzs/db/protocol/tdap/client/pooledDatabaseManager.h +173 -0
  113. data/source/bzs/db/protocol/tdap/client/recordset.cpp +209 -0
  114. data/source/bzs/db/protocol/tdap/client/recordset.h +86 -0
  115. data/source/bzs/db/protocol/tdap/client/recordsetImple.h +596 -0
  116. data/source/bzs/db/protocol/tdap/client/request.h +227 -170
  117. data/source/bzs/db/protocol/tdap/client/serializer.cpp +1288 -0
  118. data/source/bzs/db/protocol/tdap/client/serializer.h +295 -0
  119. data/source/bzs/db/protocol/tdap/client/sharedData.cpp +9 -12
  120. data/source/bzs/db/protocol/tdap/client/sharedData.h +18 -16
  121. data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +494 -473
  122. data/source/bzs/db/protocol/tdap/client/sqlBuilder.h +51 -53
  123. data/source/bzs/db/protocol/tdap/client/stringConverter.h +214 -148
  124. data/source/bzs/db/protocol/tdap/client/table.cpp +929 -1665
  125. data/source/bzs/db/protocol/tdap/client/table.h +413 -87
  126. data/source/bzs/db/protocol/tdap/client/trdboostapi.h +642 -534
  127. data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +25 -40
  128. data/source/bzs/db/protocol/tdap/client/trdclcppautolink.h +11 -15
  129. data/source/bzs/db/protocol/tdap/client/trdormapi.h +378 -437
  130. data/source/bzs/db/protocol/tdap/client/trnsctcl.def +1 -1
  131. data/source/bzs/db/protocol/tdap/fieldComp.h +127 -0
  132. data/source/bzs/db/protocol/tdap/myDateTime.cpp +352 -345
  133. data/source/bzs/db/protocol/tdap/mysql/characterset.cpp +75 -78
  134. data/source/bzs/db/protocol/tdap/mysql/characterset.h +18 -19
  135. data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +216 -199
  136. data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +23 -14
  137. data/source/bzs/db/protocol/tdap/mysql/debuglog.cpp +354 -314
  138. data/source/bzs/db/protocol/tdap/mysql/debuglog.h +57 -47
  139. data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +905 -739
  140. data/source/bzs/db/protocol/tdap/mysql/request.h +152 -159
  141. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +1044 -879
  142. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +87 -81
  143. data/source/bzs/db/protocol/tdap/tdapRequest.h +162 -130
  144. data/source/bzs/db/protocol/tdap/tdapSchema.cpp +368 -166
  145. data/source/bzs/db/protocol/tdap/tdapSchema.h +702 -566
  146. data/source/bzs/db/protocol/tdap/tdapcapi.h +387 -353
  147. data/source/bzs/db/transactd/appBuilderImple.h +21 -20
  148. data/source/bzs/db/transactd/appModule.cpp +350 -98
  149. data/source/bzs/db/transactd/appModule.h +31 -37
  150. data/source/bzs/db/transactd/connManager.cpp +138 -135
  151. data/source/bzs/db/transactd/connManager.h +28 -21
  152. data/source/bzs/db/transactd/connectionRecord.h +39 -39
  153. data/source/bzs/db/transactd/transactd.cpp +217 -203
  154. data/source/bzs/env/boost_bcb_link.h +131 -0
  155. data/source/bzs/env/compiler.h +136 -79
  156. data/source/bzs/env/crosscompile.cpp +57 -57
  157. data/source/bzs/env/crosscompile.h +130 -115
  158. data/source/bzs/env/fileopen.h +7 -8
  159. data/source/bzs/env/mbcswchrLinux.cpp +4 -9
  160. data/source/bzs/env/mbcswchrLinux.h +37 -34
  161. data/source/bzs/env/tcharMinGW.h +59 -0
  162. data/source/bzs/env/tstring.h +90 -95
  163. data/source/bzs/example/changeSchema.cpp +22 -23
  164. data/source/bzs/example/changeSchema_c.cpp +22 -24
  165. data/source/bzs/example/connection_pool_c.cpp +49 -104
  166. data/source/bzs/example/createDatabase.cpp +40 -47
  167. data/source/bzs/example/createDatabase_c.cpp +38 -43
  168. data/source/bzs/example/deleteRecords.cpp +10 -15
  169. data/source/bzs/example/deleteRecords_c.cpp +10 -14
  170. data/source/bzs/example/dropDatabase.cpp +3 -9
  171. data/source/bzs/example/dropDatabase_c.cpp +5 -6
  172. data/source/bzs/example/insertRecords.cpp +37 -29
  173. data/source/bzs/example/insertRecords_c.cpp +19 -25
  174. data/source/bzs/example/ormap_c.cpp +621 -0
  175. data/source/bzs/example/queryData.cpp +371 -0
  176. data/source/bzs/example/queryData.h +16 -0
  177. data/source/bzs/example/query_c.cpp +109 -0
  178. data/source/bzs/example/readRecords.cpp +27 -27
  179. data/source/bzs/example/readRecords_c.cpp +25 -23
  180. data/source/bzs/example/updateRecords.cpp +16 -21
  181. data/source/bzs/example/updateRecords_c.cpp +8 -12
  182. data/source/bzs/example/update_with_transaction.cpp +21 -24
  183. data/source/bzs/example/update_with_transaction_c.cpp +12 -15
  184. data/source/bzs/example/useORMRecord.cpp +177 -0
  185. data/source/bzs/netsvc/client/tcpClient.cpp +167 -156
  186. data/source/bzs/netsvc/client/tcpClient.h +541 -489
  187. data/source/bzs/netsvc/server/IAppModule.h +119 -32
  188. data/source/bzs/netsvc/server/iserver.h +21 -23
  189. data/source/bzs/netsvc/server/serverCpt.cpp +421 -391
  190. data/source/bzs/netsvc/server/serverCpt.h +41 -43
  191. data/source/bzs/netsvc/server/serverPipe.cpp +580 -565
  192. data/source/bzs/netsvc/server/serverPipe.h +44 -45
  193. data/source/bzs/netsvc/server/serverTpool.cpp +333 -303
  194. data/source/bzs/netsvc/server/serverTpool.h +38 -43
  195. data/source/bzs/rtl/benchmark.cpp +91 -31
  196. data/source/bzs/rtl/benchmark.h +76 -22
  197. data/source/bzs/rtl/datetime.cpp +231 -233
  198. data/source/bzs/rtl/datetime.h +16 -16
  199. data/source/bzs/rtl/debuglog.cpp +48 -51
  200. data/source/bzs/rtl/debuglog.h +55 -44
  201. data/source/bzs/rtl/exception.h +55 -48
  202. data/source/bzs/rtl/stl_uty.cpp +27 -28
  203. data/source/bzs/rtl/stl_uty.h +28 -29
  204. data/source/bzs/rtl/stringBuffers.cpp +8 -6
  205. data/source/bzs/rtl/stringBuffers.h +16 -9
  206. data/source/bzs/rtl/strtrim.cpp +90 -91
  207. data/source/bzs/rtl/strtrim.h +14 -16
  208. data/source/bzs/test/tdclatl/bench_query_atl.js +647 -0
  209. data/source/bzs/test/tdclatl/bench_tdclatl.js +303 -303
  210. data/source/bzs/test/tdclatl/test_query_atl.js +669 -0
  211. data/source/bzs/test/tdclphp/bench.php +357 -0
  212. data/source/bzs/test/tdclphp/transactd_Test.php +907 -303
  213. data/source/bzs/test/tdclphp/transactd_blob_Test.php +21 -49
  214. data/source/bzs/test/tdclphp/transactd_datetime_Test.php +41 -75
  215. data/source/bzs/test/tdclphp/transactd_kanjischema_Test.php +23 -37
  216. data/source/bzs/test/tdclphp/transactd_pool_Test.php +120 -0
  217. data/source/bzs/test/tdclrb/bench_tdclcpp.rb +4 -6
  218. data/source/bzs/test/tdclrb/prepare.rb +15 -12
  219. data/source/bzs/test/tdclrb/transactd_blob_spec.rb +29 -32
  220. data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +0 -29
  221. data/source/bzs/test/tdclrb/transactd_kanjischema_spec.rb +18 -19
  222. data/source/bzs/test/tdclrb/transactd_pool_spec.rb +107 -0
  223. data/source/bzs/test/tdclrb/transactd_spec.rb +734 -142
  224. data/source/bzs/test/transactdBench/query_bench.cpp +156 -0
  225. data/source/bzs/test/transactdBench/scaling_bench.cpp +265 -0
  226. data/source/bzs/test/transactdBench/transactdBench.cpp +107 -83
  227. data/source/bzs/test/transactdBench/transactdBench2.cpp +122 -83
  228. data/source/bzs/test/transactdBench/workerBase.cpp +5 -0
  229. data/source/bzs/test/transactdBench/workerBase.h +88 -0
  230. data/source/bzs/test/transactdBench/workerMySQLImple.h +333 -0
  231. data/source/bzs/test/transactdBench/workerTransactdImple.h +201 -0
  232. data/source/bzs/test/trdclengn/test_blob.cpp +121 -73
  233. data/source/bzs/test/trdclengn/test_trdclengn.cpp +1244 -426
  234. data/source/global/ormsrcgen/confParam.h +80 -0
  235. data/source/global/ormsrcgen/fieldName.cpp +77 -0
  236. data/source/global/ormsrcgen/fieldName.h +43 -0
  237. data/source/global/ormsrcgen/main.cpp +196 -0
  238. data/source/global/ormsrcgen/srcgen.cpp +763 -0
  239. data/source/global/ormsrcgen/srcgen.h +72 -0
  240. data/source/global/ormsrcgen/template/fieldNameList_sample.txt +2 -0
  241. data/source/global/ormsrcgen/template/ormDataClass_template.cpp +48 -0
  242. data/source/global/ormsrcgen/template/ormDataClass_template.h +34 -0
  243. data/source/global/ormsrcgen/template/ormMapClass_template.cpp +51 -0
  244. data/source/global/ormsrcgen/template/ormMapClass_template.h +62 -0
  245. data/source/global/ormsrcgen/template/template.cnf +38 -0
  246. data/source/global/querystmts/querystmts.cpp +237 -0
  247. data/source/global/tdclatl/ConnectParams.cpp +77 -0
  248. data/source/global/tdclatl/ConnectParams.h +70 -0
  249. data/source/global/tdclatl/Database.cpp +132 -128
  250. data/source/global/tdclatl/Database.h +60 -49
  251. data/source/global/tdclatl/DbDef.cpp +68 -64
  252. data/source/global/tdclatl/DbDef.h +36 -36
  253. data/source/global/tdclatl/Field.cpp +12 -17
  254. data/source/global/tdclatl/Field.h +15 -12
  255. data/source/global/tdclatl/FieldDef.cpp +75 -36
  256. data/source/global/tdclatl/FieldDef.h +38 -19
  257. data/source/global/tdclatl/FieldDefs.cpp +74 -0
  258. data/source/global/tdclatl/FieldDefs.h +56 -0
  259. data/source/global/tdclatl/FieldNames.cpp +99 -0
  260. data/source/global/tdclatl/FieldNames.h +66 -0
  261. data/source/global/tdclatl/Flags.cpp +75 -37
  262. data/source/global/tdclatl/Flags.h +13 -12
  263. data/source/global/tdclatl/GroupQuery.cpp +119 -0
  264. data/source/global/tdclatl/GroupQuery.h +65 -0
  265. data/source/global/tdclatl/KeyDef.cpp +15 -14
  266. data/source/global/tdclatl/KeyDef.h +20 -17
  267. data/source/global/tdclatl/KeySegment.cpp +13 -12
  268. data/source/global/tdclatl/PooledDbManager.cpp +223 -0
  269. data/source/global/tdclatl/PooledDbManager.h +76 -0
  270. data/source/global/tdclatl/QueryBase.cpp +206 -127
  271. data/source/global/tdclatl/QueryBase.h +55 -59
  272. data/source/global/tdclatl/Record.cpp +214 -0
  273. data/source/global/tdclatl/Record.h +96 -0
  274. data/source/global/tdclatl/Recordset.cpp +278 -0
  275. data/source/global/tdclatl/Recordset.h +83 -0
  276. data/source/global/tdclatl/RecordsetQuery.cpp +118 -0
  277. data/source/global/tdclatl/RecordsetQuery.h +126 -0
  278. data/source/global/tdclatl/Table.cpp +57 -60
  279. data/source/global/tdclatl/Table.h +32 -29
  280. data/source/global/tdclatl/TableDef.cpp +63 -62
  281. data/source/global/tdclatl/TableDef.h +20 -22
  282. data/source/global/tdclatl/TdVersion.cpp +3 -3
  283. data/source/global/tdclatl/TdVersion.h +15 -11
  284. data/source/global/tdclatl/_IDatabaseEvents_CP.h +99 -92
  285. data/source/global/tdclatl/activeTable.cpp +355 -0
  286. data/source/global/tdclatl/activeTable.h +79 -0
  287. data/source/global/tdclatl/dllmain.cpp +4 -3
  288. data/source/global/tdclatl/dllmain.h +7 -6
  289. data/source/global/tdclatl/keySegment.h +22 -18
  290. data/source/global/tdclatl/resource.h +0 -0
  291. data/source/global/tdclatl/stdafx.h +6 -4
  292. data/source/global/tdclatl/targetver.h +0 -1
  293. data/source/global/tdclatl/tdclatl.cpp +10 -5
  294. data/source/global/tdclatl/tdclatl.idl +530 -14
  295. data/source/linux/charsetConvert.h +78 -79
  296. data/source/linux/linuxTypes.h +9 -12
  297. data/source/linux/tchar.h +168 -166
  298. data/transactd.gemspec +24 -16
  299. metadata +98 -12
  300. data/bin/common/tdclc_32_1_2.dll +0 -0
  301. data/bin/common/tdclc_64_1_2.dll +0 -0
  302. data/build/tdclc/tdclc_32.cbproj +0 -173
  303. data/build/tdclcpp/tdclcpp_bcb_32.cbproj +0 -232
  304. data/build/tdclrb/GEM_VERSION +0 -3
  305. data/source/bzs/db/protocol/tdap/client/filter.cpp +0 -43
  306. data/source/bzs/example/useORM.cpp +0 -585
@@ -12,8 +12,8 @@
12
12
  GNU General Public License for more details.
13
13
 
14
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
15
+ along with this program; if not, write to the Free Software
16
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17
17
  02111-1307, USA.
18
18
  =================================================================*/
19
19
 
@@ -28,7 +28,6 @@
28
28
 
29
29
  #define _CRT_SECURE_NO_WARNINGS
30
30
 
31
-
32
31
  static const char keynum_id = 0;
33
32
  static const short fn_id = 0;
34
33
  static const short fn_name = 1;
@@ -42,37 +41,40 @@ using namespace bzs::rtl;
42
41
  using namespace bzs::db::protocol::tdap;
43
42
  using namespace bzs::db::protocol::tdap::client;
44
43
 
45
-
46
- /* -------------------------------------------------------------------------------- */
44
+ /* --------------------------------------------------------------------------------
45
+ */
47
46
  void write(fields& fds, int start, int end)
48
47
  {
49
48
  for (int i = start; i < end; i++)
50
49
  {
51
- fds.clearValues();
50
+ fds.clear();
52
51
  fds[fn_id] = i;
53
52
  fds[fn_name] = i;
54
53
  insertRecord(fds);
55
54
  }
56
55
  }
57
56
 
58
- /* -------------------------------------------------------------------------------- */
57
+ /* --------------------------------------------------------------------------------
58
+ */
59
59
  bool deleteAll(database_ptr db, table_ptr tb, int start, int end)
60
60
  {
61
- transaction trn(db);
61
+ dbTransaction trn(db);
62
62
  trn.begin();
63
63
 
64
64
  for (int i = start; i < end; i++)
65
65
  {
66
66
  indexIterator it = readIndex_v(tb, eSeekEqual, keynum_id, i);
67
- if (it != indexIterator::eos)
67
+ if (!it.isEnd())
68
68
  deleteRecord(it);
69
69
  }
70
70
  trn.end();
71
71
  return true;
72
72
  }
73
73
 
74
- /* -------------------------------------------------------------------------------- */
75
- void inserts(database_ptr db, table_ptr tb, int start, int end, int mode, int unit)
74
+ /* --------------------------------------------------------------------------------
75
+ */
76
+ void inserts(database_ptr db, table_ptr tb, int start, int end, int mode,
77
+ int unit)
76
78
  {
77
79
  int total = end - start;
78
80
  int count = total / unit;
@@ -84,35 +86,39 @@ void inserts(database_ptr db, table_ptr tb, int start, int end, int mode, int un
84
86
  en = st + unit;
85
87
  if (mode == USE_TRANS)
86
88
  {
87
- transaction trn(db);
89
+ dbTransaction trn(db);
88
90
  trn.begin();
89
91
  write(fds, st, en);
90
92
  trn.end();
91
- }else if (mode == USE_BALKINS)
93
+ }
94
+ else if (mode == USE_BALKINS)
92
95
  {
93
96
  autoBulkinsert bi(tb);
94
97
  write(fds, st, en);
95
- }else
98
+ }
99
+ else
96
100
  write(fds, st, en);
97
101
  st = en;
98
102
  }
99
103
  }
100
104
 
101
- /* -------------------------------------------------------------------------------- */
102
- template <class T>
103
- void checkFldIdValue(T it, int value)
105
+ /* --------------------------------------------------------------------------------
106
+ */
107
+ template <class T> void checkFldIdValue(T it, int value)
104
108
  {
105
109
  const fields& fds = *it;
106
- if ((it == T::eos) || fds[fn_id] != value)
110
+ if (it.isEnd() || fds[fn_id] != value)
107
111
  {
108
112
  _TCHAR buf[256];
109
- _stprintf_s(buf, 256, _T("read error.Can not found value %d = %d\r\n"), value, fds[fn_id].i());
113
+ _stprintf_s(buf, 256, _T("read error.Can not found value %d = %d\r\n"),
114
+ value, fds[fn_id].i());
110
115
  THROW_BZS_ERROR_WITH_MSG(buf);
111
116
  }
112
117
  }
113
118
 
114
- /* -------------------------------------------------------------------------------- */
115
- void doRead( database_ptr db, table_ptr tb, int start, int end, int shapshot)
119
+ /* --------------------------------------------------------------------------------
120
+ */
121
+ void doRead(database_ptr db, table_ptr tb, int start, int end, int shapshot)
116
122
  {
117
123
  for (int i = start; i < end; i++)
118
124
  {
@@ -121,27 +127,32 @@ void doRead( database_ptr db, table_ptr tb, int start, int end, int shapshot)
121
127
  }
122
128
  }
123
129
 
124
- /* -------------------------------------------------------------------------------- */
125
- void read( database_ptr db, table_ptr tb, int start, int end, int shapshot)
130
+ /* --------------------------------------------------------------------------------
131
+ */
132
+ void read(database_ptr db, table_ptr tb, int start, int end, int shapshot)
126
133
  {
127
134
  if (shapshot == USE_SNAPSHOT)
128
135
  {
129
- autoSnapshot sn(db);
136
+ dbSnapshot sn(db);
130
137
  doRead(db, tb, start, end, shapshot);
131
- }else
138
+ }
139
+ else
132
140
  doRead(db, tb, start, end, shapshot);
133
141
  }
134
142
 
135
- /* -------------------------------------------------------------------------------- */
143
+ /* --------------------------------------------------------------------------------
144
+ */
136
145
  void doRreads(database_ptr db, table_ptr tb, int start, int end, int unit)
137
146
  {
138
147
  int total = end - start;
139
148
  int count = total / unit;
140
149
  int st = start;
141
150
  int en = st;
142
- filterParams fp( _T("*"), 1 , 20);
143
- findIterator itsf = find(tb, keynum_id, fp, st);
144
- while (en != end)
151
+ // filterParams fp( _T("*"), 1 , 20);
152
+ query q;
153
+ q.all().reject(2).limit(20);
154
+ findIterator itsf = find(tb, keynum_id, q, st);
155
+ while (en != end)
145
156
  {
146
157
  en = st + unit;
147
158
  for (int i = st; i < en; i++)
@@ -152,31 +163,37 @@ void doRreads(database_ptr db, table_ptr tb, int start, int end, int unit)
152
163
  st = en;
153
164
  }
154
165
  }
155
- /* -------------------------------------------------------------------------------- */
156
- void reads(database_ptr db, table_ptr tb, int start, int end, int unit, int shapshot)
166
+ /* --------------------------------------------------------------------------------
167
+ */
168
+ void reads(database_ptr db, table_ptr tb, int start, int end, int unit,
169
+ int shapshot)
157
170
  {
158
171
  if (shapshot == USE_SNAPSHOT)
159
172
  {
160
- autoSnapshot sn(db);
173
+ dbSnapshot sn(db);
161
174
  doRreads(db, tb, start, end, unit);
162
- }else
175
+ }
176
+ else
163
177
  doRreads(db, tb, start, end, unit);
164
178
  }
165
- /* -------------------------------------------------------------------------------- */
179
+ /* --------------------------------------------------------------------------------
180
+ */
166
181
  void doUupdates(table_ptr tb, int st, int en, int tran)
167
182
  {
168
183
  _TCHAR buf[256];
169
184
  for (int i = st; i < en; i++)
170
185
  {
171
186
  fields fd(tb);
172
- fd[fn_id] = i;
173
- _ltot_s(i + 1 + tran, buf, 30, 10);
174
- fd[fn_name] = buf;
175
- updateRecord(fd, keynum_id);
187
+ fd[fn_id] = i;
188
+ _ltot_s(i + 1 + tran, buf, 30, 10);
189
+ fd[fn_name] = buf;
190
+ updateRecord(fd, keynum_id);
176
191
  }
177
192
  }
178
- /* -------------------------------------------------------------------------------- */
179
- void updates(database_ptr db, table_ptr tb, int start, int end, int tran, int unit)
193
+ /* --------------------------------------------------------------------------------
194
+ */
195
+ void updates(database_ptr db, table_ptr tb, int start, int end, int tran,
196
+ int unit)
180
197
  {
181
198
  int total = end - start;
182
199
  int count = total / unit;
@@ -187,17 +204,19 @@ void updates(database_ptr db, table_ptr tb, int start, int end, int tran, int un
187
204
  en = st + unit;
188
205
  if (tran == USE_TRANS)
189
206
  {
190
- transaction trn(db);
207
+ dbTransaction trn(db);
191
208
  trn.begin();
192
209
  doUupdates(tb, st, en, 1);
193
210
  trn.end();
194
- }else
211
+ }
212
+ else
195
213
  doUupdates(tb, st, en, 0);
196
214
  st = en;
197
215
  }
198
216
  }
199
217
 
200
- /* -------------------------------------------------------------------------------- */
218
+ /* --------------------------------------------------------------------------------
219
+ */
201
220
  void createUserTableSchema(dbdef* def)
202
221
  {
203
222
  static const short tableid = 1;
@@ -215,10 +234,10 @@ void createUserTableSchema(dbdef* def)
215
234
  kd->segments[0].flags.bit1 = 1; // changeable
216
235
  kd->segmentCount = 1;
217
236
  updateTableDef(def, tableid);
218
-
219
237
  }
220
238
 
221
- /* -------------------------------------------------------------------------------- */
239
+ /* --------------------------------------------------------------------------------
240
+ */
222
241
  void createTestDataBase(database_ptr db, connectParams& params)
223
242
  {
224
243
  params.setMode(TD_OPEN_EXCLUSIVE);
@@ -227,50 +246,56 @@ void createTestDataBase(database_ptr db, connectParams& params)
227
246
  createUserTableSchema(db->dbDef());
228
247
  }
229
248
 
230
- /* -------------------------------------------------------------------------------- */
249
+ /* --------------------------------------------------------------------------------
250
+ */
231
251
  void printHeader(const _TCHAR* uri, int count)
232
252
  {
233
253
  printf("Start Bench mark Insert Items = %d\r\n", count);
234
254
  time_t timer;
235
255
  #ifdef LINUX
236
- time(&timer);
256
+ time(&timer);
237
257
  #else
238
258
  timer = time(NULL);
239
259
  #endif
240
- #pragma warning( disable : 4996 )
260
+ #pragma warning(disable : 4996)
241
261
  printf("%s", ctime(&timer));
242
- #pragma warning( default : 4996 )
262
+ #pragma warning(default : 4996)
243
263
 
244
264
  _tprintf(_T("%s\r\n"), uri);
245
- printf("BOOST_VERSION = %s\r\n", BOOST_LIB_VERSION );
265
+ printf("BOOST_VERSION = %s\r\n", BOOST_LIB_VERSION);
246
266
  printf("----------------------------------------\r\n");
247
267
  }
248
268
 
249
- /* -------------------------------------------------------------------------------- */
269
+ /* --------------------------------------------------------------------------------
270
+ */
250
271
  void printTail()
251
272
  {
252
273
  printf("----------------------------------------\r\n");
253
274
  }
254
275
 
255
- /* -------------------------------------------------------------------------------- */
276
+ /* --------------------------------------------------------------------------------
277
+ */
256
278
  void showUsage()
257
279
  {
258
- printf("usage: transactdBench databaseUri processNumber functionNumber\n "
259
- "\t --- Below is list of functionNumber ---\n"
260
- "\t-1: all function\n"
261
- "\t 0: Insert\n"
262
- "\t 1: Insert in transaction. 20rec x 1000times\n"
263
- "\t 2: Insert by bulkmode. 20rec x 1000times\n"
264
- "\t 3: read each record\n"
265
- "\t 4: read each record with snapshpot\n"
266
- "\t 5: read range. 20rec x 1000times\n"
267
- "\t 6: read range with snapshpot. 20rec x 1000times\n"
268
- "\t 7: update\n"
269
- "\t 8: update in transaction. 20rec x 1000times\n"
270
- "exsample : transactdBench \"tdap://localhost/test?dbfile=test.bdf\" 0 -1\n");
280
+ printf("usage: bench_tdclcpp_c_bcb32(64) databaseUri processNumber "
281
+ "functionNumber\n "
282
+ "\t --- Below is list of functionNumber ---\n"
283
+ "\t-1: all function\n"
284
+ "\t 0: Insert\n"
285
+ "\t 1: Insert in transaction. 20rec x 1000times\n"
286
+ "\t 2: Insert by bulkmode. 20rec x 1000times\n"
287
+ "\t 3: read each record\n"
288
+ "\t 4: read each record with snapshpot\n"
289
+ "\t 5: read range. 20rec x 1000times\n"
290
+ "\t 6: read range with snapshpot. 20rec x 1000times\n"
291
+ "\t 7: update\n"
292
+ "\t 8: update in transaction. 20rec x 1000times\n"
293
+ "exsample : bench_tdclcpp_c_bcb32(64) "
294
+ "\"tdap://localhost/test?dbfile=test.bdf\" 0 -1\n");
271
295
  }
272
296
 
273
- /* -------------------------------------------------------------------------------- */
297
+ /* --------------------------------------------------------------------------------
298
+ */
274
299
  #pragma argsused
275
300
  int _tmain(int argc, _TCHAR* argv[])
276
301
  {
@@ -283,14 +308,14 @@ int _tmain(int argc, _TCHAR* argv[])
283
308
  int count = 20000;
284
309
  int start = procID * count + 1;
285
310
  int end = start + count;
286
- int exeType = _ttol(argv[3]);// -1
311
+ int exeType = _ttol(argv[3]); // -1
287
312
  bool insertBeforeNoDelete = 0;
288
313
  if (argc > 4)
289
- insertBeforeNoDelete = (_ttol(argv[4])!=0);
314
+ insertBeforeNoDelete = (_ttol(argv[4]) != 0);
290
315
 
291
316
  try
292
317
  {
293
- database_ptr db = createDatadaseObject();
318
+ database_ptr db = createDatabaseObject();
294
319
  connectParams param(argv[1]);
295
320
 
296
321
  if (!db->open(param.uri(), param.type(), param.mode()))
@@ -299,44 +324,58 @@ int _tmain(int argc, _TCHAR* argv[])
299
324
  openDatabase(db, param);
300
325
  table_ptr tb = openTable(db, _T("user"));
301
326
 
302
-
303
327
  if ((exeType == -1) || (exeType == 0))
304
328
  {
305
329
  if (insertBeforeNoDelete || deleteAll(db, tb, start, end))
306
- benchmark::report2(boost::bind(inserts, db, tb, start, end, USE_NORMAL, 1), ": Insert");
330
+ benchmark::report2(
331
+ boost::bind(inserts, db, tb, start, end, USE_NORMAL, 1),
332
+ ": Insert");
307
333
  }
308
334
  if ((exeType == -1) || (exeType == 1))
309
335
  {
310
336
  if (insertBeforeNoDelete || deleteAll(db, tb, start, end))
311
- benchmark::report2(boost::bind(inserts, db, tb, start, end, USE_TRANS, 20)
312
- , ": Insert in transaction. 20rec x 1000times.");
337
+ benchmark::report2(
338
+ boost::bind(inserts, db, tb, start, end, USE_TRANS, 20),
339
+ ": Insert in transaction. 20rec x 1000times.");
313
340
  }
314
341
  if ((exeType == -1) || (exeType == 2))
315
342
  {
316
343
  if (insertBeforeNoDelete || deleteAll(db, tb, start, end))
317
- benchmark::report2(boost::bind(inserts, db, tb, start, end, USE_BALKINS, 20)
318
- , ": Insert by bulkmode. 20rec x 1000times.");
344
+ benchmark::report2(
345
+ boost::bind(inserts, db, tb, start, end, USE_BALKINS, 20),
346
+ ": Insert by bulkmode. 20rec x 1000times.");
319
347
  }
320
348
  if ((exeType == -1) || (exeType == 3))
321
- benchmark::report2(boost::bind( read, db, tb, start, end, USE_NORMAL), ": read each record.");
349
+ benchmark::report2(
350
+ boost::bind(read, db, tb, start, end, USE_NORMAL),
351
+ ": read each record.");
322
352
  if ((exeType == -1) || (exeType == 4))
323
- benchmark::report2(boost::bind( read, db, tb, start, end, USE_SNAPSHOT), ": read each record with snapshpot.");
353
+ benchmark::report2(
354
+ boost::bind(read, db, tb, start, end, USE_SNAPSHOT),
355
+ ": read each record with snapshpot.");
324
356
  if ((exeType == -1) || (exeType == 5))
325
- benchmark::report2(boost::bind( reads, db, tb, start, end, 20, USE_NORMAL), ": read range. 20rec x 1000times.");
357
+ benchmark::report2(
358
+ boost::bind(reads, db, tb, start, end, 20, USE_NORMAL),
359
+ ": read range. 20rec x 1000times.");
326
360
  if ((exeType == -1) || (exeType == 6))
327
- benchmark::report2(boost::bind( reads, db, tb, start, end, 20, USE_SNAPSHOT), ": read range with snapshot. 20rec x 1000times.");
361
+ benchmark::report2(
362
+ boost::bind(reads, db, tb, start, end, 20, USE_SNAPSHOT),
363
+ ": read range with snapshot. 20rec x 1000times.");
328
364
  if ((exeType == -1) || (exeType == 7))
329
- benchmark::report2(boost::bind( updates, db, tb, start, end, USE_NORMAL, 1), ": update.");
365
+ benchmark::report2(
366
+ boost::bind(updates, db, tb, start, end, USE_NORMAL, 1),
367
+ ": update.");
330
368
  if ((exeType == -1) || (exeType == 8))
331
- benchmark::report2(boost::bind( updates, db, tb, start, end, USE_TRANS, 20), ": update in transaction. 20rec x 1000times.");
369
+ benchmark::report2(
370
+ boost::bind(updates, db, tb, start, end, USE_TRANS, 20),
371
+ ": update in transaction. 20rec x 1000times.");
332
372
 
333
373
  printTail();
334
374
  return 0;
335
375
  }
336
- catch(bzs::rtl::exception &e)
376
+ catch (bzs::rtl::exception& e)
337
377
  {
338
378
  _tprintf(_T("Error ! %s\n"), getMsg(e)->c_str());
339
-
340
379
  }
341
380
  return 1;
342
381
  }
@@ -0,0 +1,5 @@
1
+ #include "workerBase.h"
2
+
3
+ boost::mutex bzs::test::worker::workerBase::m_mutex;
4
+
5
+ int bzs::test::worker::g_bench_signal = 0;
@@ -0,0 +1,88 @@
1
+ #ifndef BZS_TEST_BENCH_WORKERBASE_H
2
+ #define BZS_TEST_BENCH_WORKERBASE_H
3
+ /* =================================================================
4
+ Copyright (C) 20014 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/thread/barrier.hpp>
22
+ #include <boost/thread/mutex.hpp>
23
+ #include <bzs/rtl/benchmark.h>
24
+ #include <iostream>
25
+
26
+ namespace bzs
27
+ {
28
+ namespace test
29
+ {
30
+ namespace worker
31
+ {
32
+
33
+ extern int g_bench_signal;
34
+
35
+ #define BENCH_SIGNAL_BREAK 0
36
+ #define BENCH_SIGNAL_GO 1
37
+ #define BENCH_SIGNAL_GREEN 2
38
+ #define BENCH_SIGNAL_BLUE 3
39
+
40
+ class workerBase
41
+ {
42
+ protected:
43
+ int m_id;
44
+ int m_loopCount;
45
+ int m_functionNumber;
46
+ boost::barrier& m_sync;
47
+ static boost::mutex m_mutex;
48
+ int m_bresult;
49
+ virtual void doExecute() = 0;
50
+ virtual void endExecute(){};
51
+ virtual void initExecute(){};
52
+
53
+ public:
54
+ workerBase(int id, int loopCount, int functionNumber, boost::barrier& sync)
55
+ : m_id(id), m_loopCount(loopCount), m_functionNumber(functionNumber),
56
+ m_sync(sync){};
57
+ virtual ~workerBase() {}
58
+
59
+ void execute()
60
+ {
61
+ initExecute();
62
+ bzs::rtl::benchmarkMt bm;
63
+ m_sync.wait();
64
+
65
+ bm.start();
66
+ m_bresult = 0;
67
+ while (g_bench_signal)
68
+ {
69
+ doExecute();
70
+ if (g_bench_signal == BENCH_SIGNAL_GREEN)
71
+ ++m_bresult;
72
+ else if (g_bench_signal == BENCH_SIGNAL_BLUE)
73
+ {
74
+ m_bresult = bm.end();
75
+ break;
76
+ }
77
+ }
78
+
79
+ endExecute();
80
+ }
81
+ int total() const { return m_bresult; }
82
+ };
83
+
84
+ } // namespace worker
85
+ } // namespace test
86
+ } // namespace bzs
87
+
88
+ #endif // BZS_TEST_BENCH_WORKERBASE_H