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
@@ -1,23 +1,23 @@
1
- /*=================================================================
2
- Copyright (C) 2012 2013 BizStation Corp All rights reserved.
1
+ #ifndef BZS_DB_ENGINE_MYSQL_PERCENTAGEKEY_H
2
+ #define BZS_DB_ENGINE_MYSQL_PERCENTAGEKEY_H
3
+ /* =================================================================
4
+ Copyright (C) 2012 2013 BizStation Corp All rights reserved.
3
5
 
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.
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.
8
10
 
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.
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.
13
15
 
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
- #ifndef PERCENTAGEKEY_H
20
- #define PERCENTAGEKEY_H
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
21
 
22
22
  #include "mysqlInternal.h"
23
23
 
@@ -30,231 +30,244 @@ namespace engine
30
30
  namespace mysql
31
31
  {
32
32
 
33
-
34
33
  /** return value of setKeyValueByPer function
35
34
  *
36
35
  */
37
- #define KEY_COPY_SUCCESS 0
38
- #define KEY_ALL_SGMENTS_SAME 1
39
- #define KEY_NEED_SGMENT_COPY 2
36
+ #define KEY_COPY_SUCCESS 0
37
+ #define KEY_ALL_SGMENTS_SAME 1
38
+ #define KEY_NEED_SGMENT_COPY 2
40
39
 
41
40
  class percentageKey
42
41
  {
43
- uchar* m_first;
44
- uchar* m_last;
45
- uchar* m_current;
46
- const KEY& m_key;
47
- double m_period;
48
- int m_lastCompSize;
49
- int m_lastCompPos;
50
- unsigned short* m_varlenPtr;
51
- const KEY_PART_INFO* m_curseg;
52
-
53
- const unsigned char* rev(const unsigned char* p, unsigned char* buf, int size)
54
- {
55
- for (int i=0;i<size;i++)
56
- buf[i] = p[size - i - 1];
57
- return buf;
58
- }
59
-
60
- template <typename T>
61
- bool setKeyValueByPerPos(unsigned short per)
62
- {
63
- m_lastCompSize = sizeof(T);
64
- double k = (*((T*)m_last) - *((T*)m_first))/(double)10000;
65
- T v = (T)((per * k) + *((T*)m_first) + m_period);
66
-
67
- memcpy(m_current, (unsigned char*)&v, m_lastCompSize);
68
- return ((*((T*)m_last) - *((T*)m_first)) == 1);
69
- }
70
-
71
- template <class T>
72
- bool setKeyValueByPerPosRev(unsigned short per)
73
- {
74
- uchar buf1[10];
75
- uchar buf2[10];
76
- m_lastCompSize = sizeof(T);
77
- const unsigned char* fr = rev(m_first, buf1, m_lastCompSize);
78
- const unsigned char* lr = rev(m_last, buf2, m_lastCompSize);
79
- double k = (*((T*)lr) - *((T*)fr))/(double)10000;
80
- T v = (T)((per * k) + *((T*)fr) + m_period);
81
-
82
- memcpy(m_current, rev((const unsigned char*)&v, buf1, m_lastCompSize), m_lastCompSize);
83
-
84
- return ((*((T*)fr) - *((T*)lr))==1);
85
- }
86
-
87
- void movePosition(int size)
88
- {
89
- m_first += size;
90
- m_last += size;
91
- m_current += size;
92
- m_lastCompPos += size;
93
- }
94
-
95
- /** if all segment is same return false
96
- *
97
- */
98
- bool seekDifferentKey()
99
- {
100
- int pos = 0;
101
- for (int i=0;i<(int)m_key.user_defined_key_parts;i++)
102
- {
103
- m_curseg = &m_key.key_part[i];
104
- if (memcmp(m_first + pos, m_last + pos, m_curseg->store_length))
105
- break;
106
- pos += m_curseg->store_length;
107
- }
108
- if (pos)
109
- {
110
- memcpy(m_current, m_first, pos); //A key value is the same value so far.
111
- movePosition(pos);
112
- }
113
- return (pos != m_key.key_length);
114
- }
115
-
42
+ uchar* m_first;
43
+ uchar* m_last;
44
+ uchar* m_current;
45
+ const KEY& m_key;
46
+ double m_period;
47
+ int m_lastCompSize;
48
+ int m_lastCompPos;
49
+ unsigned short* m_varlenPtr;
50
+ const KEY_PART_INFO* m_curseg;
51
+
52
+ const unsigned char* rev(const unsigned char* p, unsigned char* buf,
53
+ int size)
54
+ {
55
+ for (int i = 0; i < size; i++)
56
+ buf[i] = p[size - i - 1];
57
+ return buf;
58
+ }
59
+
60
+ template <typename T> bool setKeyValueByPerPos(unsigned short per)
61
+ {
62
+ m_lastCompSize = sizeof(T);
63
+ double k = (*((T*)m_last) - *((T*)m_first)) / (double)10000;
64
+ T v = (T)((per * k) + *((T*)m_first) + m_period);
65
+
66
+ memcpy(m_current, (unsigned char*)&v, m_lastCompSize);
67
+ return ((*((T*)m_last) - *((T*)m_first)) == 1);
68
+ }
69
+
70
+ template <class T> bool setKeyValueByPerPosRev(unsigned short per)
71
+ {
72
+ uchar buf1[10];
73
+ uchar buf2[10];
74
+ m_lastCompSize = sizeof(T);
75
+ const unsigned char* fr = rev(m_first, buf1, m_lastCompSize);
76
+ const unsigned char* lr = rev(m_last, buf2, m_lastCompSize);
77
+ double k = (*((T*)lr) - *((T*)fr)) / (double)10000;
78
+ T v = (T)((per * k) + *((T*)fr) + m_period);
79
+
80
+ memcpy(m_current, rev((const unsigned char*)&v, buf1, m_lastCompSize),
81
+ m_lastCompSize);
82
+
83
+ return ((*((T*)fr) - *((T*)lr)) == 1);
84
+ }
85
+
86
+ void movePosition(int size)
87
+ {
88
+ m_first += size;
89
+ m_last += size;
90
+ m_current += size;
91
+ m_lastCompPos += size;
92
+ }
93
+
94
+ /** if all segment is same return false
95
+ *
96
+ */
97
+ bool seekDifferentKey()
98
+ {
99
+ int pos = 0;
100
+ for (int i = 0; i < (int)m_key.user_defined_key_parts; i++)
101
+ {
102
+ m_curseg = &m_key.key_part[i];
103
+ if (memcmp(m_first + pos, m_last + pos, m_curseg->store_length))
104
+ break;
105
+ pos += m_curseg->store_length;
106
+ }
107
+ if (pos)
108
+ {
109
+ memcpy(m_current, m_first,
110
+ pos); // A key value is the same value so far.
111
+ movePosition(pos);
112
+ }
113
+ return (pos != (int)m_key.key_length);
114
+ }
115
+
116
116
  public:
117
- percentageKey(const KEY& key, uchar* first, uchar* last, uchar* current)
118
- :m_key(key),m_first(first),m_last(last),m_current(current),m_curseg(&key.key_part[0])
119
- {
117
+ percentageKey(const KEY& key, uchar* first, uchar* last, uchar* current)
118
+ : m_first(first), m_last(last), m_current(current), m_key(key),
119
+ m_curseg(&key.key_part[0])
120
+ {
121
+ }
120
122
 
121
- }
122
-
123
- void reset(uchar* first, uchar* last, uchar* current)
124
- {
125
- m_first = first;
126
- m_last = last;
127
- m_current = current;
128
- m_curseg = &m_key.key_part[0];
129
- m_lastCompPos = 0;
130
- }
123
+ void reset(uchar* first, uchar* last, uchar* current)
124
+ {
125
+ m_first = first;
126
+ m_last = last;
127
+ m_current = current;
128
+ m_curseg = &m_key.key_part[0];
129
+ m_lastCompPos = 0;
130
+ }
131
131
 
132
- /**
133
- * @return 0 succes, 1 allsegmnet are same, 2 need segment copy
134
- */
135
- int setKeyValueByPer(unsigned short per, bool forwoard)
136
- {
137
- m_period = (forwoard) ? 0.5f:-0.5f;
138
- if(!seekDifferentKey())
139
- return KEY_ALL_SGMENTS_SAME;
132
+ /**
133
+ * @return 0 succes, 1 allsegmnet are same, 2 need segment copy
134
+ */
135
+ int setKeyValueByPer(unsigned short per, bool forwoard)
136
+ {
137
+ m_period = (forwoard) ? 0.5f : -0.5f;
138
+ if (!seekDifferentKey())
139
+ return KEY_ALL_SGMENTS_SAME;
140
140
 
141
- int varSize = 0;
142
- int len = m_curseg->store_length;
143
- if (m_curseg->null_bit)
144
- {
145
- --len;
146
- movePosition(1);
147
- }
148
-
149
- bool needCopy;
150
- switch(m_curseg->field->key_type())
151
- {
152
- case HA_KEYTYPE_FLOAT:
153
- case HA_KEYTYPE_DOUBLE:
154
- {
155
- if (len ==4)
156
- needCopy = setKeyValueByPerPos<float>(per);
157
- else if (len ==8)
158
- needCopy = setKeyValueByPerPos<double>(per);
159
- break;
160
- }
161
- case HA_KEYTYPE_USHORT_INT:
162
- case HA_KEYTYPE_ULONG_INT:
163
- case HA_KEYTYPE_ULONGLONG:
164
- {
165
- switch(len)
166
- {
167
- case 1:needCopy = setKeyValueByPerPos<unsigned char>(per);break;
168
- case 2:needCopy = setKeyValueByPerPos<unsigned short>(per);break;
169
- case 4:needCopy = setKeyValueByPerPos<unsigned int>(per);break;
170
- case 8:needCopy = setKeyValueByPerPos<unsigned __int64>(per);break;
171
- }
172
- break;
173
- }
174
- case HA_KEYTYPE_INT8:
175
- case HA_KEYTYPE_SHORT_INT:
176
- case HA_KEYTYPE_LONG_INT:
177
- case HA_KEYTYPE_LONGLONG:
178
- {
179
- switch(len)
180
- {
181
- case 1:needCopy = setKeyValueByPerPos<char>(per);break;
182
- case 2:needCopy = setKeyValueByPerPos<short>(per);break;
183
- case 4:needCopy = setKeyValueByPerPos<int>(per);break;
184
- case 8:needCopy = setKeyValueByPerPos<__int64>(per);break;
185
- }
186
- break;
187
- }
188
- case HA_KEYTYPE_VARTEXT1:
189
- case HA_KEYTYPE_VARBINARY1:
190
- case HA_KEYTYPE_VARTEXT2:
191
- case HA_KEYTYPE_VARBINARY2:
192
-
193
- len = m_curseg->length;
194
- m_varlenPtr = (unsigned short*)m_current;
195
- *m_varlenPtr = len;
196
- movePosition(2);
197
- case HA_KEYTYPE_TEXT:
198
- case HA_KEYTYPE_BIT:
199
- case HA_KEYTYPE_BINARY:
200
- {
201
-
202
- //It copies until every 1 byte of values differ,
203
- //and the following 2 bytes are made into the order of reverse,
204
- //and it processes as unsigned short.
205
- for (int i=0;i<len;i++)
206
- {
207
- if (*m_first == *m_last)
208
- {
209
- *m_current = *m_first;
210
- movePosition(sizeof(char));
211
-
212
- }
213
- else
214
- {
215
- int size = (len - i);
216
-
217
- if (size >= 8)
218
- needCopy = setKeyValueByPerPosRev<unsigned __int64>(per);
219
- else if (size >= 4)
220
- needCopy = setKeyValueByPerPosRev<unsigned int>(per);
221
- else if (size >= 2)
222
- needCopy = setKeyValueByPerPosRev<unsigned short>(per);
223
- else
224
- needCopy = setKeyValueByPerPos<unsigned char>(per);
225
- break;
226
- }
227
- }
228
-
229
- break;
230
- }
231
- case HA_KEYTYPE_INT24:
232
- case HA_KEYTYPE_UINT24:
233
- case HA_KEYTYPE_NUM:
234
- //no support
235
- break;
236
- }
237
- if (!forwoard && needCopy)
238
- return KEY_NEED_SGMENT_COPY;
239
- return KEY_COPY_SUCCESS;
240
- }
141
+ int len = m_curseg->store_length;
142
+ if (m_curseg->null_bit)
143
+ {
144
+ --len;
145
+ movePosition(1);
146
+ }
241
147
 
242
- void copyFirstDeferentSegment()
243
- {
244
-
245
- memcpy(m_last, m_first, m_lastCompSize);
246
- //After area that pad by ff;
247
- memset(m_last + m_lastCompSize, 0xff, m_key.key_length - m_lastCompSize - m_lastCompPos);
148
+ bool needCopy = false;
149
+ switch (m_curseg->field->key_type())
150
+ {
151
+ case HA_KEYTYPE_FLOAT:
152
+ case HA_KEYTYPE_DOUBLE:
153
+ {
154
+ if (len == 4)
155
+ needCopy = setKeyValueByPerPos<float>(per);
156
+ else if (len == 8)
157
+ needCopy = setKeyValueByPerPos<double>(per);
158
+ break;
159
+ }
160
+ case HA_KEYTYPE_USHORT_INT:
161
+ case HA_KEYTYPE_ULONG_INT:
162
+ case HA_KEYTYPE_ULONGLONG:
163
+ {
164
+ switch (len)
165
+ {
166
+ case 1:
167
+ needCopy = setKeyValueByPerPos<unsigned char>(per);
168
+ break;
169
+ case 2:
170
+ needCopy = setKeyValueByPerPos<unsigned short>(per);
171
+ break;
172
+ case 4:
173
+ needCopy = setKeyValueByPerPos<unsigned int>(per);
174
+ break;
175
+ case 8:
176
+ needCopy = setKeyValueByPerPos<unsigned __int64>(per);
177
+ break;
178
+ }
179
+ break;
180
+ }
181
+ case HA_KEYTYPE_INT8:
182
+ case HA_KEYTYPE_SHORT_INT:
183
+ case HA_KEYTYPE_LONG_INT:
184
+ case HA_KEYTYPE_LONGLONG:
185
+ {
186
+ switch (len)
187
+ {
188
+ case 1:
189
+ needCopy = setKeyValueByPerPos<char>(per);
190
+ break;
191
+ case 2:
192
+ needCopy = setKeyValueByPerPos<short>(per);
193
+ break;
194
+ case 4:
195
+ needCopy = setKeyValueByPerPos<int>(per);
196
+ break;
197
+ case 8:
198
+ needCopy = setKeyValueByPerPos<__int64>(per);
199
+ break;
200
+ }
201
+ break;
202
+ }
203
+ case HA_KEYTYPE_VARTEXT1:
204
+ case HA_KEYTYPE_VARBINARY1:
205
+ case HA_KEYTYPE_VARTEXT2:
206
+ case HA_KEYTYPE_VARBINARY2:
248
207
 
249
- }
208
+ len = m_curseg->length;
209
+ m_varlenPtr = (unsigned short*)m_current;
210
+ *m_varlenPtr = len;
211
+ movePosition(2);
212
+ case HA_KEYTYPE_TEXT:
213
+ case HA_KEYTYPE_BIT:
214
+ case HA_KEYTYPE_BINARY:
215
+ {
250
216
 
251
- };
217
+ // It copies until every 1 byte of values differ,
218
+ // and the following 2 bytes are made into the order of reverse,
219
+ // and it processes as unsigned short.
220
+ for (int i = 0; i < len; i++)
221
+ {
222
+ if (*m_first == *m_last)
223
+ {
224
+ *m_current = *m_first;
225
+ movePosition(sizeof(char));
226
+ }
227
+ else
228
+ {
229
+ int size = (len - i);
252
230
 
253
- }//namespace mysql
254
- }//namespace engine
255
- }//namespace db
256
- }//namespace bzs
231
+ if (size >= 8)
232
+ needCopy =
233
+ setKeyValueByPerPosRev<unsigned __int64>(per);
234
+ else if (size >= 4)
235
+ needCopy = setKeyValueByPerPosRev<unsigned int>(per);
236
+ else if (size >= 2)
237
+ needCopy = setKeyValueByPerPosRev<unsigned short>(per);
238
+ else
239
+ needCopy = setKeyValueByPerPos<unsigned char>(per);
240
+ break;
241
+ }
242
+ }
257
243
 
244
+ break;
245
+ }
246
+ case HA_KEYTYPE_INT24:
247
+ case HA_KEYTYPE_UINT24:
248
+ case HA_KEYTYPE_NUM:
249
+ case HA_KEYTYPE_END:
250
+ // no support
251
+ break;
252
+ }
253
+ if (!forwoard && needCopy)
254
+ return KEY_NEED_SGMENT_COPY;
255
+ return KEY_COPY_SUCCESS;
256
+ }
257
+
258
+ void copyFirstDeferentSegment()
259
+ {
260
+
261
+ memcpy(m_last, m_first, m_lastCompSize);
262
+ // After area that pad by ff;
263
+ memset(m_last + m_lastCompSize, 0xff,
264
+ m_key.key_length - m_lastCompSize - m_lastCompPos);
265
+ }
266
+ };
258
267
 
259
- #endif //PERCENTAGEKEY_H
268
+ } // namespace mysql
269
+ } // namespace engine
270
+ } // namespace db
271
+ } // namespace bzs
260
272
 
273
+ #endif // BZS_DB_ENGINE_MYSQL_PERCENTAGEKEY_H
@@ -14,8 +14,8 @@
14
14
  GNU General Public License for more details.
15
15
 
16
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
17
+ along with this program; if not, write to the Free Software
18
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
19
  02111-1307, USA.
20
20
  =================================================================*/
21
21
  #include <bzs/netsvc/server/IAppModule.h>
@@ -26,24 +26,25 @@ namespace db
26
26
  {
27
27
  namespace protocol
28
28
  {
29
-
29
+
30
30
  class ICommandExecuter
31
31
  {
32
-
32
+
33
33
  public:
34
- virtual ~ICommandExecuter(){};
35
- virtual size_t perseRequestEnd(const char* p, size_t size, bool& comp)const=0;
36
- virtual size_t getAcceptMessage(char* message, size_t bufsize)=0;
37
- virtual bool parse(const char* p, size_t size)=0;
38
- virtual int execute(char* resultBuffer, size_t& size, netsvc::server::buffers* optionalData) = 0;
39
- virtual bool isShutDown() = 0;
40
- virtual void cleanup() = 0;
34
+ virtual ~ICommandExecuter(){};
35
+ virtual size_t perseRequestEnd(const char* p, size_t size,
36
+ bool& comp) const = 0;
37
+ virtual size_t getAcceptMessage(char* message, size_t bufsize) = 0;
38
+ virtual bool parse(const char* p, size_t size) = 0;
39
+ // virtual int execute(netsvc::server::IResultBuffer& resultBuffer, size_t&
40
+ // size, netsvc::server::buffers* optionalData) = 0;
41
+ virtual int execute(netsvc::server::netWriter* nw) = 0;
42
+ virtual bool isShutDown() = 0;
43
+ virtual void cleanup() = 0;
41
44
  };
42
45
 
46
+ } // namespace protocol
47
+ } // namespace db
48
+ } // namespace bzs
43
49
 
44
- }//namespace protocol
45
- }//namespace db
46
- }//namespace bzs
47
-
48
- #endif //BZS_DB_PROTOCOL_ICOMMANDEXECUTER_H
49
-
50
+ #endif // BZS_DB_PROTOCOL_ICOMMANDEXECUTER_H