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
@@ -0,0 +1,393 @@
1
+ #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_FIELD_H
2
+ #define BZS_DB_PROTOCOL_TDAP_CLIENT_FIELD_H
3
+ /*=================================================================
4
+ Copyright (C) 2014 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 "nsTable.h"
22
+ #include "fieldNameAlias.h"
23
+
24
+ class CField; // atl interface
25
+
26
+ namespace bzs
27
+ {
28
+ namespace rtl
29
+ {
30
+ class stringBuffer;
31
+ }
32
+ namespace db
33
+ {
34
+ namespace protocol
35
+ {
36
+ namespace tdap
37
+ {
38
+ namespace client
39
+ {
40
+
41
+ class stringConverter;
42
+ /** @cond INTERNAL */
43
+
44
+ /* non copyable */
45
+ class DLLLIB fieldShare
46
+ {
47
+ friend class field;
48
+ friend class table;
49
+ friend class recordCache;
50
+
51
+ private:
52
+ struct Imple* m_imple;
53
+ struct
54
+ {
55
+ unsigned char myDateTimeValueByBtrv : 1;
56
+ unsigned char trimPadChar : 1;
57
+ unsigned char usePadChar : 1;
58
+ unsigned char logicalToString : 1;
59
+ };
60
+ fieldShare(const fieldShare&); // no implememt
61
+ fieldShare& operator=(const fieldShare&); // no implememt
62
+
63
+ protected:
64
+ fieldShare();
65
+
66
+ virtual ~fieldShare();
67
+ stringConverter* cv();
68
+ bzs::rtl::stringBuffer* strBufs();
69
+ void blobPushBack(char* p);
70
+ void blobClear();
71
+ };
72
+
73
+ /** @endcond */
74
+
75
+ class DLLLIB fielddefs : public fieldShare
76
+ {
77
+ struct infoImple* m_imple;
78
+ void aliasing(fielddef* p) const;
79
+ fielddefs();
80
+ ~fielddefs();
81
+ fielddefs(const fielddefs& r);
82
+ fielddefs& operator=(const fielddefs& r);
83
+ friend class table;
84
+ friend class recordsetImple;
85
+ friend class writableRecord;
86
+ friend class memoryRecord;
87
+ friend class recordsetQuery;
88
+ friend struct recordsetQueryImple;
89
+ friend class fieldsBase;
90
+
91
+ void addAllFileds(tabledef* def);
92
+ void copyFrom(const class table* tb);
93
+ bool canUnion(const fielddefs& r) const;
94
+ size_t totalFieldLen() const;
95
+ void resetUpdateIndicator();
96
+ void setAliases(const aliasMap_type* p);
97
+ void push_back(const fielddef* p, bool rePosition = false);
98
+ void remove(int index);
99
+ void reserve(size_t size);
100
+ void clear();
101
+
102
+ public:
103
+ fielddefs* clone() const;
104
+ int indexByName(const std::_tstring& name) const;
105
+ const fielddef& operator[](int index) const;
106
+ const fielddef& operator[](const _TCHAR* name) const;
107
+ const fielddef& operator[](const std::_tstring& name) const;
108
+ bool checkIndex(int index) const;
109
+ size_t size() const;
110
+ void release();
111
+ static fielddefs* create();
112
+ };
113
+
114
+ /** @cond INTERNAL */
115
+
116
+ typedef int (*compFieldFunc)(const class field& l, const class field& r,
117
+ char logType);
118
+
119
+ /** @endcond */
120
+
121
+ class DLLLIB field
122
+ {
123
+ friend class table;
124
+ friend class fieldsBase;
125
+ friend class CField; // atl interface
126
+ /** @cond INTERNAL */
127
+ friend int compBlob(const field& l, const field& r, char logType);
128
+ /** @endcond */
129
+ fielddef* m_fd;
130
+ unsigned char* m_ptr;
131
+ class fielddefs* m_fds;
132
+
133
+ compFieldFunc getCompFunc(char logType) const;
134
+ int blobLenBytes() const { return m_fd->blobLenBytes(); }
135
+
136
+ private:
137
+ // ---- bigin regacy interfaces ---- //
138
+ unsigned char getFVbyt() const;
139
+ short getFVsht() const;
140
+ int getFVint() const;
141
+ int getFVlng() const;
142
+ __int64 getFV64() const;
143
+ float getFVflt() const;
144
+ double getFVdbl() const;
145
+ void* getFVbin(uint_td& size) const;
146
+ const char* getFVAstr() const;
147
+ #ifdef _WIN32
148
+ const wchar_t* getFVWstr() const;
149
+ void setFVW(const wchar_t* data);
150
+ #endif
151
+ void setFV(float data);
152
+ void setFV(double data);
153
+ void setFV(unsigned char data);
154
+ void setFV(short data);
155
+ void setFV(int data);
156
+ void setFV(__int64 data);
157
+ void setFVA(const char* data);
158
+ void setFV(const void* data, uint_td size);
159
+ #ifdef _UNICODE
160
+ inline const wchar_t* getFVstr() const { return getFVWstr(); };
161
+ inline void setFV(const wchar_t* data) { setFVW(data); };
162
+ #else
163
+ inline const char* getFVstr() const { return getFVAstr(); };
164
+ inline void setFV(const char* data) { setFVA(data); };
165
+ #endif
166
+ double getFVnumeric() const;
167
+ double getFVDecimal() const;
168
+ void setFVDecimal(double data);
169
+ void setFVNumeric(double data);
170
+ // ---- end regacy interfaces ---- //
171
+
172
+ inline field(unsigned char* ptr, const fielddef& fd, fielddefs* fds)
173
+ : m_fd((fielddef*)&fd), m_ptr(ptr), m_fds(fds){};
174
+
175
+ /** @cond INTERNAL */
176
+ #if defined(SWIG) || \
177
+ defined(SWIG_BUILDING) // SWIG Wrapper need public constructor
178
+ public:
179
+ #endif
180
+ inline field() : m_fd(NULL), m_ptr(NULL), m_fds(NULL){};
181
+ /** @endcond */
182
+
183
+ public:
184
+ // To inline
185
+ inline field(const field& r) : m_fd(r.m_fd), m_ptr(r.m_ptr), m_fds(r.m_fds)
186
+ {
187
+ }
188
+
189
+ inline field& operator=(const field& r)
190
+ {
191
+ m_fd = r.m_fd;
192
+ m_ptr = r.m_ptr;
193
+ m_fds = r.m_fds;
194
+ return *this;
195
+ }
196
+
197
+ void* ptr() const;
198
+
199
+ unsigned char type() const { return m_fd->type; }
200
+
201
+ unsigned short len() const { return m_fd->len; }
202
+
203
+ inline const _TCHAR* c_str() const { return getFVstr(); }
204
+
205
+ inline const char* a_str() const { return getFVAstr(); }
206
+
207
+ inline int i() const { return getFVint(); }
208
+
209
+ inline int i8() const { return getFVbyt(); }
210
+
211
+ inline short i16() const { return getFVsht(); }
212
+
213
+ inline __int64 i64() const { return getFV64(); }
214
+
215
+ inline float f() const { return getFVflt(); }
216
+
217
+ inline double d() const { return getFVdbl(); }
218
+
219
+ inline field& operator=(const _TCHAR* p)
220
+ {
221
+ setFV(p);
222
+ m_fd->enableFlags.bitE = true;
223
+ return *this;
224
+ }
225
+
226
+ inline field& operator=(const std::_tstring& p)
227
+ {
228
+ setFV(p.c_str());
229
+ m_fd->enableFlags.bitE = true;
230
+ return *this;
231
+ }
232
+
233
+ #ifdef _UNICODE
234
+ inline field& operator=(const char* p)
235
+ {
236
+ setFVA(p);
237
+ m_fd->enableFlags.bitE = true;
238
+ return *this;
239
+ }
240
+
241
+ inline field& operator=(const std::string& p)
242
+ {
243
+ setFVA(p.c_str());
244
+ m_fd->enableFlags.bitE = true;
245
+ return *this;
246
+ }
247
+
248
+ #endif
249
+
250
+ inline field& operator=(int v)
251
+ {
252
+ setFV(v);
253
+ m_fd->enableFlags.bitE = true;
254
+ return *this;
255
+ }
256
+
257
+ inline field& operator=(__int64 v)
258
+ {
259
+ setFV(v);
260
+ m_fd->enableFlags.bitE = true;
261
+ return *this;
262
+ }
263
+
264
+ inline field& operator=(float v)
265
+ {
266
+ setFV(v);
267
+ m_fd->enableFlags.bitE = true;
268
+ return *this;
269
+ }
270
+
271
+ inline field& operator=(double v)
272
+ {
273
+ setFV(v);
274
+ m_fd->enableFlags.bitE = true;
275
+ return *this;
276
+ }
277
+
278
+ inline bool operator!=(const _TCHAR* p)
279
+ {
280
+ return (_tcscmp(p, c_str()) != 0);
281
+ };
282
+ inline bool operator==(const _TCHAR* p)
283
+ {
284
+ return (_tcscmp(p, c_str()) == 0);
285
+ };
286
+
287
+ inline bool operator!=(int v) { return (v != i()); };
288
+ inline bool operator==(int v) { return (v == i()); };
289
+
290
+ inline bool operator!=(short v) { return (v != i16()); };
291
+ inline bool operator==(short v) { return (v == i16()); };
292
+
293
+ inline bool operator!=(__int64 v) { return (v != i64()); };
294
+ inline bool operator==(__int64 v) { return (v == i64()); };
295
+
296
+ inline bool operator!=(float v) { return (v != f()); };
297
+ inline bool operator==(float v) { return (v == f()); };
298
+
299
+ inline bool operator!=(double v) { return (v != d()); };
300
+ inline bool operator==(double v) { return (v == d()); };
301
+
302
+ inline void setBin(const void* data, uint_td size)
303
+ {
304
+ setFV(data, size);
305
+ m_fd->enableFlags.bitE = true;
306
+ }
307
+ inline void* getBin(uint_td& size) { return getFVbin(size); };
308
+
309
+ int comp(const field& r, char logType = CMPLOGICAL_VAR_COMP_ALL) const;
310
+
311
+ /** @cond INTERNAL */
312
+ bool isCompPartAndMakeValue();
313
+ /** @endcond */
314
+ };
315
+
316
+ /** @cond INTERNAL */
317
+ /* For template tget type num by type.*/
318
+
319
+ inline int getFieldType(int)
320
+ {
321
+ return ft_integer;
322
+ }
323
+
324
+ inline int getFieldType(__int64)
325
+ {
326
+ return ft_integer;
327
+ }
328
+
329
+ inline int getFieldType(short)
330
+ {
331
+ return ft_integer;
332
+ }
333
+
334
+ inline int getFieldType(char)
335
+ {
336
+ return ft_integer;
337
+ }
338
+
339
+ inline int getFieldType(double)
340
+ {
341
+ return ft_float;
342
+ }
343
+
344
+ inline int getFieldType(float)
345
+ {
346
+ return ft_float;
347
+ }
348
+
349
+ inline __int64 fieldValue(const field& fd, __int64)
350
+ {
351
+ return fd.i64();
352
+ }
353
+
354
+ inline int fieldValue(const field& fd, int)
355
+ {
356
+ return fd.i();
357
+ }
358
+
359
+ inline short fieldValue(const field& fd, short)
360
+ {
361
+ return (short)fd.i();
362
+ }
363
+
364
+ inline char fieldValue(const field& fd, char)
365
+ {
366
+ return (char)fd.i();
367
+ }
368
+
369
+ inline double fieldValue(const field& fd, double)
370
+ {
371
+ return fd.d();
372
+ }
373
+
374
+ inline float fieldValue(const field& fd, float)
375
+ {
376
+ return fd.f();
377
+ }
378
+
379
+ inline const _TCHAR* fieldValue(const field& fd, const _TCHAR*)
380
+ {
381
+ return fd.c_str();
382
+ }
383
+
384
+ DLLLIB const fielddef& dummyFd();
385
+
386
+ /** @endcond */
387
+
388
+ } // namespace client
389
+ } // namespace tdap
390
+ } // namespace protocol
391
+ } // namespace db
392
+ } // namespace bzs
393
+ #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_FIELD_H
@@ -16,9 +16,6 @@
16
16
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17
17
  02111-1307, USA.
18
18
  ================================================================= */
19
- #include <bzs/env/tstring.h>
20
- #pragma hdrstop
21
-
22
19
  #include "fieldDDF.h"
23
20
  #include "nsDatabase.h"
24
21
  #pragma package(smart_init)
@@ -34,7 +31,10 @@ namespace tdap
34
31
  namespace client
35
32
  {
36
33
 
37
- fieldDDF::fieldDDF(nsdatabase *pbe) : nstable(pbe) {m_keybuflen = 128;}
34
+ fieldDDF::fieldDDF(nsdatabase* pbe) : nstable(pbe)
35
+ {
36
+ m_keybuflen = 128;
37
+ }
38
38
 
39
39
  void fieldDDF::doOpen(const _TCHAR* Dir, char_td mode, const _TCHAR* OwnerName)
40
40
  {
@@ -58,9 +58,11 @@ keylen_td fieldDDF::writeKeyData()
58
58
  keylen_td len = 2;
59
59
  switch (m_keynum)
60
60
  {
61
- case 0: memcpy(&keybuf[0], &fieldid, len);
61
+ case 0:
62
+ memcpy(&keybuf[0], &fieldid, len);
62
63
  break;
63
- case 1: memcpy(&keybuf[0], &fileid, len);
64
+ case 1:
65
+ memcpy(&keybuf[0], &fileid, len);
64
66
  break;
65
67
  case 2:
66
68
  len = 20;
@@ -89,7 +91,6 @@ void fieldDDF::writeRecordData()
89
91
  datbuf.dec = dec;
90
92
 
91
93
  datbuf.flag = flag;
92
-
93
94
  }
94
95
 
95
96
  void fieldDDF::onReadAfter()
@@ -104,12 +105,11 @@ void fieldDDF::onReadAfter()
104
105
  len = datbuf.len;
105
106
  dec = datbuf.dec;
106
107
  flag = datbuf.flag;
107
-
108
108
  }
109
109
 
110
110
  void fieldDDF::createTable(const _TCHAR* fullpath)
111
111
  {
112
- fileSpec *fs;
112
+ fileSpec* fs;
113
113
  fs = (fileSpec*)malloc(512);
114
114
  memset(fs, 512, 0x00);
115
115
  fs->recLen = 32;
@@ -162,8 +162,8 @@ void fieldDDF::createTable(const _TCHAR* fullpath)
162
162
  m_stat = nsdb()->stat();
163
163
  }
164
164
 
165
- }// namespace client
166
- }// namespace tdap
167
- }// namespace protocol
168
- }// namespace db
169
- }// namespace bzs
165
+ } // namespace client
166
+ } // namespace tdap
167
+ } // namespace protocol
168
+ } // namespace db
169
+ } // namespace bzs
@@ -31,8 +31,8 @@ namespace tdap
31
31
  namespace client
32
32
  {
33
33
 
34
- #pragma option -a1
35
- pragma_pack1
34
+ #pragma pack(push, 1)
35
+ pragma_pack1;
36
36
 
37
37
  struct SFIELDDDF
38
38
  {
@@ -46,10 +46,8 @@ struct SFIELDDDF
46
46
  short flag;
47
47
  };
48
48
 
49
- #pragma option -a
50
- pragma_pop
51
-
52
-
49
+ #pragma pack(pop)
50
+ pragma_pop;
53
51
 
54
52
  class fieldDDF : public nstable
55
53
  {
@@ -77,15 +75,14 @@ public:
77
75
 
78
76
  char keybuf[128];
79
77
 
80
- explicit fieldDDF(nsdatabase *pbe);
78
+ explicit fieldDDF(nsdatabase* pbe);
81
79
  void createTable(const _TCHAR* fullpath);
82
80
  using nstable::open;
83
-
84
81
  };
85
82
 
86
- }// namespace client
87
- }// namespace tdap
88
- }// namespace protocol
89
- }// namespace db
90
- }// namespace bzs
91
- #endif//BZS_DB_PROTOCOL_TDAP_CLIENT_FIELDDDF_H
83
+ } // namespace client
84
+ } // namespace tdap
85
+ } // namespace protocol
86
+ } // namespace db
87
+ } // namespace bzs
88
+ #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_FIELDDDF_H
@@ -0,0 +1,123 @@
1
+ /*=================================================================
2
+ Copyright (C) 2014 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
+ #pragma hdrstop
20
+ #include "fieldNameAlias.h"
21
+
22
+ #ifdef BCB_32
23
+ #pragma option push
24
+ #pragma option -O1
25
+ #include <boost/unordered_map.hpp>
26
+ #pragma option pop
27
+ #else
28
+ #include <boost/unordered_map.hpp>
29
+ #endif
30
+
31
+ #pragma package(smart_init)
32
+
33
+ namespace bzs
34
+ {
35
+ namespace db
36
+ {
37
+ namespace protocol
38
+ {
39
+ namespace tdap
40
+ {
41
+ namespace client
42
+ {
43
+
44
+ typedef boost::unordered_map<std::_tstring, std::_tstring> map_type;
45
+
46
+ struct fdnImple
47
+ {
48
+ map_type map;
49
+ };
50
+
51
+ fdNmaeAlias::fdNmaeAlias() : m_imple(new fdnImple)
52
+ {
53
+ }
54
+
55
+ fdNmaeAlias::fdNmaeAlias(const fdNmaeAlias& r)
56
+ : m_imple(new fdnImple(*r.m_imple))
57
+ {
58
+ }
59
+
60
+ fdNmaeAlias& fdNmaeAlias::operator=(const fdNmaeAlias& r)
61
+ {
62
+ if (this != &r)
63
+ *this->m_imple = *r.m_imple;
64
+ return *this;
65
+ }
66
+
67
+ fdNmaeAlias::~fdNmaeAlias()
68
+ {
69
+ delete m_imple;
70
+ }
71
+
72
+ void fdNmaeAlias::set(const _TCHAR* src, const _TCHAR* dst)
73
+ {
74
+ m_imple->map[src] = dst;
75
+ }
76
+
77
+ const _TCHAR* fdNmaeAlias::get(const _TCHAR* src) const
78
+ {
79
+ try
80
+ {
81
+ if (m_imple && m_imple->map.count(src))
82
+ return m_imple->map.at(src).c_str();
83
+ return _T("");
84
+ }
85
+ catch (...)
86
+ {
87
+ return _T("");
88
+ }
89
+ return _T("");
90
+ }
91
+
92
+ const _TCHAR* fdNmaeAlias::resolv(const _TCHAR* dst) const
93
+ {
94
+ map_type::const_iterator it = m_imple->map.begin();
95
+ while (it != m_imple->map.end())
96
+ {
97
+ if ((*it).second == dst)
98
+ return (*it).first.c_str();
99
+ ++it;
100
+ }
101
+ return _T("");
102
+ }
103
+
104
+ void fdNmaeAlias::clear()
105
+ {
106
+ m_imple->map.clear();
107
+ }
108
+
109
+ void fdNmaeAlias::reverseAliasNamesQuery(queryBase& q) const
110
+ {
111
+ map_type::const_iterator it = m_imple->map.begin();
112
+ while (it != m_imple->map.end())
113
+ {
114
+ q.reverseAliasName((*it).second.c_str(), (*it).first.c_str());
115
+ ++it;
116
+ }
117
+ }
118
+
119
+ } // namespace client
120
+ } // namespace tdap
121
+ } // namespace protocol
122
+ } // namespace db
123
+ } // namespace bzs
@@ -0,0 +1,58 @@
1
+ #ifndef BZS_DB_PROTOCOL_TDAP_CLIENT_FIELDNAMEALIAS_H
2
+ #define BZS_DB_PROTOCOL_TDAP_CLIENT_FIELDNAMEALIAS_H
3
+ /*=================================================================
4
+ Copyright (C) 2014 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 "table.h"
22
+
23
+ namespace bzs
24
+ {
25
+ namespace db
26
+ {
27
+ namespace protocol
28
+ {
29
+ namespace tdap
30
+ {
31
+ namespace client
32
+ {
33
+
34
+ class DLLLIB fdNmaeAlias
35
+ {
36
+ struct fdnImple* m_imple;
37
+
38
+ public:
39
+ fdNmaeAlias();
40
+ fdNmaeAlias(const fdNmaeAlias& r);
41
+ fdNmaeAlias& operator=(const fdNmaeAlias& r);
42
+ ~fdNmaeAlias();
43
+ void set(const _TCHAR* src, const _TCHAR* dst);
44
+ const _TCHAR* get(const _TCHAR* src) const;
45
+ const _TCHAR* resolv(const _TCHAR* dst) const;
46
+ void clear();
47
+ void reverseAliasNamesQuery(queryBase& q) const;
48
+ };
49
+
50
+ typedef fdNmaeAlias aliasMap_type;
51
+
52
+ } // namespace client
53
+ } // namespace tdap
54
+ } // namespace protocol
55
+ } // namespace db
56
+ } // namespace bzs
57
+
58
+ #endif // BZS_DB_PROTOCOL_TDAP_CLIENT_FIELDNAMEALIAS_H