transactd 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/BUILD_UNIX-JA +46 -67
- data/BUILD_WIN-JA +106 -63
- data/CMakeLists.txt +40 -15
- data/README +219 -75
- data/README-JA +207 -76
- data/README_ORMSRCGEN +118 -0
- data/README_ORMSRCGEN-JA +115 -0
- data/bin/common/tdclc_32_2_0.dll +0 -0
- data/bin/common/tdclc_64_2_0.dll +0 -0
- data/build/common/check_for_link_iconv.cmake +18 -14
- data/build/common/create_symlink.cmake.in +25 -0
- data/build/common/get_boost_libs.cmake +23 -23
- data/build/common/options.cmake +0 -66
- data/build/common/smart_install.cmake +3 -3
- data/build/common/transactd.rc.in +15 -5
- data/build/common/transactd_cl_common.cmake +37 -18
- data/build/common/transactd_cl_output.cmake +55 -13
- data/build/common/transactd_common.cmake +108 -31
- data/build/swig/php/generate.cmake.in +15 -17
- data/build/swig/php/generate.cmd.in +15 -9
- data/build/swig/php/php.swg +124 -82
- data/build/swig/php/transactd.no_yield.php +4494 -0
- data/build/swig/php/transactd.no_yield.php.git.patch +685 -0
- data/build/swig/php/transactd.no_yield.php.patch +685 -0
- data/build/swig/php/transactd.yield.php +4461 -0
- data/build/swig/php/transactd.yield.php.git.patch +652 -0
- data/build/swig/php/transactd.yield.php.patch +652 -0
- data/build/swig/referencecounter.h +79 -0
- data/build/swig/ruby/ruby.swg +226 -76
- data/build/swig/ruby/threadBlockRegionWrapper.h +71 -0
- data/build/swig/ruby/without_gvl.swg +87 -0
- data/build/swig/tdcl.i +659 -170
- data/build/swig/validatablepointer.h +91 -0
- data/build/tdclc/CMakeLists.txt +49 -34
- data/build/tdclc/{tdclc_64.cbproj → tdclc.cbproj} +65 -20
- data/build/tdclc/tdclc.rc +0 -0
- data/build/tdclcpp/CMakeLists.txt +84 -20
- data/build/tdclcpp/tdclcpp.rc +0 -0
- data/build/tdclcpp/{tdclcpp_bcb_64.cbproj → tdclcpp_bc.cbproj} +168 -44
- data/build/tdclrb/CMakeLists.txt +84 -66
- data/build/tdclrb/bldgem/extconf.rb +28 -3
- data/build/tdclrb/gem/helper.rb +11 -1
- data/build/tdclrb/gem_output.cmake +20 -16
- data/index_ja.html +15 -0
- data/source/bzs/db/IBlobBuffer.h +15 -17
- data/source/bzs/db/blobBuffer.h +186 -140
- data/source/bzs/db/blobStructs.h +37 -37
- data/source/bzs/db/engine/mysql/IReadRecords.h +34 -34
- data/source/bzs/db/engine/mysql/bookmark.h +150 -147
- data/source/bzs/db/engine/mysql/database.cpp +1721 -1526
- data/source/bzs/db/engine/mysql/database.h +608 -370
- data/source/bzs/db/engine/mysql/dbManager.cpp +213 -201
- data/source/bzs/db/engine/mysql/dbManager.h +115 -104
- data/source/bzs/db/engine/mysql/errorMessage.cpp +49 -50
- data/source/bzs/db/engine/mysql/errorMessage.h +25 -26
- data/source/bzs/db/engine/mysql/fieldAccess.h +55 -61
- data/source/bzs/db/engine/mysql/mydebuglog.cpp +326 -292
- data/source/bzs/db/engine/mysql/mydebuglog.h +63 -55
- data/source/bzs/db/engine/mysql/mysqlInternal.h +182 -125
- data/source/bzs/db/engine/mysql/mysqlThd.cpp +121 -121
- data/source/bzs/db/engine/mysql/mysqlThd.h +20 -20
- data/source/bzs/db/engine/mysql/percentageKey.h +241 -228
- data/source/bzs/db/protocol/ICommandExecuter.h +18 -17
- data/source/bzs/db/protocol/hs/hsCommandExecuter.cpp +543 -514
- data/source/bzs/db/protocol/hs/hsCommandExecuter.h +155 -158
- data/source/bzs/db/protocol/tdap/btrDate.cpp +213 -180
- data/source/bzs/db/protocol/tdap/btrDate.h +39 -37
- data/source/bzs/db/protocol/tdap/client/activeTable.cpp +173 -0
- data/source/bzs/db/protocol/tdap/client/activeTable.h +165 -0
- data/source/bzs/db/protocol/tdap/client/activeTableImple.h +370 -0
- data/source/bzs/db/protocol/tdap/client/bulkInsert.h +13 -23
- data/source/bzs/db/protocol/tdap/client/client.cpp +81 -68
- data/source/bzs/db/protocol/tdap/client/client.h +361 -320
- data/source/bzs/db/protocol/tdap/client/connMgr.cpp +17 -22
- data/source/bzs/db/protocol/tdap/client/connMgr.h +17 -19
- data/source/bzs/db/protocol/tdap/client/connectionPool.cpp +243 -0
- data/source/bzs/db/protocol/tdap/client/connectionPool.h +109 -0
- data/source/bzs/db/protocol/tdap/client/database.cpp +327 -219
- data/source/bzs/db/protocol/tdap/client/database.h +141 -118
- data/source/bzs/db/protocol/tdap/client/databaseFactory.cpp +60 -62
- data/source/bzs/db/protocol/tdap/client/databaseManager.h +255 -0
- data/source/bzs/db/protocol/tdap/client/dbDef.cpp +315 -202
- data/source/bzs/db/protocol/tdap/client/dbDef.h +40 -32
- data/source/bzs/db/protocol/tdap/client/dllmain.cpp +390 -371
- data/source/bzs/db/protocol/tdap/client/errorMessage.cpp +148 -56
- data/source/bzs/db/protocol/tdap/client/errorMessage_ja.cpp +149 -57
- data/source/bzs/db/protocol/tdap/client/export.h +35 -0
- data/source/bzs/db/protocol/tdap/client/field.cpp +1985 -0
- data/source/bzs/db/protocol/tdap/client/field.h +393 -0
- data/source/bzs/db/protocol/tdap/client/fieldDDF.cpp +14 -14
- data/source/bzs/db/protocol/tdap/client/fieldDDF.h +11 -14
- data/source/bzs/db/protocol/tdap/client/fieldNameAlias.cpp +123 -0
- data/source/bzs/db/protocol/tdap/client/fieldNameAlias.h +58 -0
- data/source/bzs/db/protocol/tdap/client/fields.h +178 -0
- data/source/bzs/db/protocol/tdap/client/fileDDF.cpp +13 -16
- data/source/bzs/db/protocol/tdap/client/fileDDF.h +11 -17
- data/source/bzs/db/protocol/tdap/client/filter.h +423 -259
- data/source/bzs/db/protocol/tdap/client/groupComp.h +117 -0
- data/source/bzs/db/protocol/tdap/client/groupQuery.cpp +818 -0
- data/source/bzs/db/protocol/tdap/client/groupQuery.h +281 -0
- data/source/bzs/db/protocol/tdap/client/indexDDF.cpp +14 -17
- data/source/bzs/db/protocol/tdap/client/indexDDF.h +11 -14
- data/source/bzs/db/protocol/tdap/client/memRecord.cpp +231 -0
- data/source/bzs/db/protocol/tdap/client/memRecord.h +145 -0
- data/source/bzs/db/protocol/tdap/client/memRecordset.cpp +448 -0
- data/source/bzs/db/protocol/tdap/client/memRecordset.h +159 -0
- data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +300 -173
- data/source/bzs/db/protocol/tdap/client/nsDatabase.h +53 -36
- data/source/bzs/db/protocol/tdap/client/nsTable.cpp +171 -128
- data/source/bzs/db/protocol/tdap/client/nsTable.h +121 -87
- data/source/bzs/db/protocol/tdap/client/pooledDatabaseManager.h +173 -0
- data/source/bzs/db/protocol/tdap/client/recordset.cpp +209 -0
- data/source/bzs/db/protocol/tdap/client/recordset.h +86 -0
- data/source/bzs/db/protocol/tdap/client/recordsetImple.h +596 -0
- data/source/bzs/db/protocol/tdap/client/request.h +227 -170
- data/source/bzs/db/protocol/tdap/client/serializer.cpp +1288 -0
- data/source/bzs/db/protocol/tdap/client/serializer.h +295 -0
- data/source/bzs/db/protocol/tdap/client/sharedData.cpp +9 -12
- data/source/bzs/db/protocol/tdap/client/sharedData.h +18 -16
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.cpp +494 -473
- data/source/bzs/db/protocol/tdap/client/sqlBuilder.h +51 -53
- data/source/bzs/db/protocol/tdap/client/stringConverter.h +214 -148
- data/source/bzs/db/protocol/tdap/client/table.cpp +929 -1665
- data/source/bzs/db/protocol/tdap/client/table.h +413 -87
- data/source/bzs/db/protocol/tdap/client/trdboostapi.h +642 -534
- data/source/bzs/db/protocol/tdap/client/trdboostapiInternal.h +25 -40
- data/source/bzs/db/protocol/tdap/client/trdclcppautolink.h +11 -15
- data/source/bzs/db/protocol/tdap/client/trdormapi.h +378 -437
- data/source/bzs/db/protocol/tdap/client/trnsctcl.def +1 -1
- data/source/bzs/db/protocol/tdap/fieldComp.h +127 -0
- data/source/bzs/db/protocol/tdap/myDateTime.cpp +352 -345
- data/source/bzs/db/protocol/tdap/mysql/characterset.cpp +75 -78
- data/source/bzs/db/protocol/tdap/mysql/characterset.h +18 -19
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.cpp +216 -199
- data/source/bzs/db/protocol/tdap/mysql/databaseSchema.h +23 -14
- data/source/bzs/db/protocol/tdap/mysql/debuglog.cpp +354 -314
- data/source/bzs/db/protocol/tdap/mysql/debuglog.h +57 -47
- data/source/bzs/db/protocol/tdap/mysql/recordsetReader.h +905 -739
- data/source/bzs/db/protocol/tdap/mysql/request.h +152 -159
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +1044 -879
- data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.h +87 -81
- data/source/bzs/db/protocol/tdap/tdapRequest.h +162 -130
- data/source/bzs/db/protocol/tdap/tdapSchema.cpp +368 -166
- data/source/bzs/db/protocol/tdap/tdapSchema.h +702 -566
- data/source/bzs/db/protocol/tdap/tdapcapi.h +387 -353
- data/source/bzs/db/transactd/appBuilderImple.h +21 -20
- data/source/bzs/db/transactd/appModule.cpp +350 -98
- data/source/bzs/db/transactd/appModule.h +31 -37
- data/source/bzs/db/transactd/connManager.cpp +138 -135
- data/source/bzs/db/transactd/connManager.h +28 -21
- data/source/bzs/db/transactd/connectionRecord.h +39 -39
- data/source/bzs/db/transactd/transactd.cpp +217 -203
- data/source/bzs/env/boost_bcb_link.h +131 -0
- data/source/bzs/env/compiler.h +136 -79
- data/source/bzs/env/crosscompile.cpp +57 -57
- data/source/bzs/env/crosscompile.h +130 -115
- data/source/bzs/env/fileopen.h +7 -8
- data/source/bzs/env/mbcswchrLinux.cpp +4 -9
- data/source/bzs/env/mbcswchrLinux.h +37 -34
- data/source/bzs/env/tcharMinGW.h +59 -0
- data/source/bzs/env/tstring.h +90 -95
- data/source/bzs/example/changeSchema.cpp +22 -23
- data/source/bzs/example/changeSchema_c.cpp +22 -24
- data/source/bzs/example/connection_pool_c.cpp +49 -104
- data/source/bzs/example/createDatabase.cpp +40 -47
- data/source/bzs/example/createDatabase_c.cpp +38 -43
- data/source/bzs/example/deleteRecords.cpp +10 -15
- data/source/bzs/example/deleteRecords_c.cpp +10 -14
- data/source/bzs/example/dropDatabase.cpp +3 -9
- data/source/bzs/example/dropDatabase_c.cpp +5 -6
- data/source/bzs/example/insertRecords.cpp +37 -29
- data/source/bzs/example/insertRecords_c.cpp +19 -25
- data/source/bzs/example/ormap_c.cpp +621 -0
- data/source/bzs/example/queryData.cpp +371 -0
- data/source/bzs/example/queryData.h +16 -0
- data/source/bzs/example/query_c.cpp +109 -0
- data/source/bzs/example/readRecords.cpp +27 -27
- data/source/bzs/example/readRecords_c.cpp +25 -23
- data/source/bzs/example/updateRecords.cpp +16 -21
- data/source/bzs/example/updateRecords_c.cpp +8 -12
- data/source/bzs/example/update_with_transaction.cpp +21 -24
- data/source/bzs/example/update_with_transaction_c.cpp +12 -15
- data/source/bzs/example/useORMRecord.cpp +177 -0
- data/source/bzs/netsvc/client/tcpClient.cpp +167 -156
- data/source/bzs/netsvc/client/tcpClient.h +541 -489
- data/source/bzs/netsvc/server/IAppModule.h +119 -32
- data/source/bzs/netsvc/server/iserver.h +21 -23
- data/source/bzs/netsvc/server/serverCpt.cpp +421 -391
- data/source/bzs/netsvc/server/serverCpt.h +41 -43
- data/source/bzs/netsvc/server/serverPipe.cpp +580 -565
- data/source/bzs/netsvc/server/serverPipe.h +44 -45
- data/source/bzs/netsvc/server/serverTpool.cpp +333 -303
- data/source/bzs/netsvc/server/serverTpool.h +38 -43
- data/source/bzs/rtl/benchmark.cpp +91 -31
- data/source/bzs/rtl/benchmark.h +76 -22
- data/source/bzs/rtl/datetime.cpp +231 -233
- data/source/bzs/rtl/datetime.h +16 -16
- data/source/bzs/rtl/debuglog.cpp +48 -51
- data/source/bzs/rtl/debuglog.h +55 -44
- data/source/bzs/rtl/exception.h +55 -48
- data/source/bzs/rtl/stl_uty.cpp +27 -28
- data/source/bzs/rtl/stl_uty.h +28 -29
- data/source/bzs/rtl/stringBuffers.cpp +8 -6
- data/source/bzs/rtl/stringBuffers.h +16 -9
- data/source/bzs/rtl/strtrim.cpp +90 -91
- data/source/bzs/rtl/strtrim.h +14 -16
- data/source/bzs/test/tdclatl/bench_query_atl.js +647 -0
- data/source/bzs/test/tdclatl/bench_tdclatl.js +303 -303
- data/source/bzs/test/tdclatl/test_query_atl.js +669 -0
- data/source/bzs/test/tdclphp/bench.php +357 -0
- data/source/bzs/test/tdclphp/transactd_Test.php +907 -303
- data/source/bzs/test/tdclphp/transactd_blob_Test.php +21 -49
- data/source/bzs/test/tdclphp/transactd_datetime_Test.php +41 -75
- data/source/bzs/test/tdclphp/transactd_kanjischema_Test.php +23 -37
- data/source/bzs/test/tdclphp/transactd_pool_Test.php +120 -0
- data/source/bzs/test/tdclrb/bench_tdclcpp.rb +4 -6
- data/source/bzs/test/tdclrb/prepare.rb +15 -12
- data/source/bzs/test/tdclrb/transactd_blob_spec.rb +29 -32
- data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +0 -29
- data/source/bzs/test/tdclrb/transactd_kanjischema_spec.rb +18 -19
- data/source/bzs/test/tdclrb/transactd_pool_spec.rb +107 -0
- data/source/bzs/test/tdclrb/transactd_spec.rb +734 -142
- data/source/bzs/test/transactdBench/query_bench.cpp +156 -0
- data/source/bzs/test/transactdBench/scaling_bench.cpp +265 -0
- data/source/bzs/test/transactdBench/transactdBench.cpp +107 -83
- data/source/bzs/test/transactdBench/transactdBench2.cpp +122 -83
- data/source/bzs/test/transactdBench/workerBase.cpp +5 -0
- data/source/bzs/test/transactdBench/workerBase.h +88 -0
- data/source/bzs/test/transactdBench/workerMySQLImple.h +333 -0
- data/source/bzs/test/transactdBench/workerTransactdImple.h +201 -0
- data/source/bzs/test/trdclengn/test_blob.cpp +121 -73
- data/source/bzs/test/trdclengn/test_trdclengn.cpp +1244 -426
- data/source/global/ormsrcgen/confParam.h +80 -0
- data/source/global/ormsrcgen/fieldName.cpp +77 -0
- data/source/global/ormsrcgen/fieldName.h +43 -0
- data/source/global/ormsrcgen/main.cpp +196 -0
- data/source/global/ormsrcgen/srcgen.cpp +763 -0
- data/source/global/ormsrcgen/srcgen.h +72 -0
- data/source/global/ormsrcgen/template/fieldNameList_sample.txt +2 -0
- data/source/global/ormsrcgen/template/ormDataClass_template.cpp +48 -0
- data/source/global/ormsrcgen/template/ormDataClass_template.h +34 -0
- data/source/global/ormsrcgen/template/ormMapClass_template.cpp +51 -0
- data/source/global/ormsrcgen/template/ormMapClass_template.h +62 -0
- data/source/global/ormsrcgen/template/template.cnf +38 -0
- data/source/global/querystmts/querystmts.cpp +237 -0
- data/source/global/tdclatl/ConnectParams.cpp +77 -0
- data/source/global/tdclatl/ConnectParams.h +70 -0
- data/source/global/tdclatl/Database.cpp +132 -128
- data/source/global/tdclatl/Database.h +60 -49
- data/source/global/tdclatl/DbDef.cpp +68 -64
- data/source/global/tdclatl/DbDef.h +36 -36
- data/source/global/tdclatl/Field.cpp +12 -17
- data/source/global/tdclatl/Field.h +15 -12
- data/source/global/tdclatl/FieldDef.cpp +75 -36
- data/source/global/tdclatl/FieldDef.h +38 -19
- data/source/global/tdclatl/FieldDefs.cpp +74 -0
- data/source/global/tdclatl/FieldDefs.h +56 -0
- data/source/global/tdclatl/FieldNames.cpp +99 -0
- data/source/global/tdclatl/FieldNames.h +66 -0
- data/source/global/tdclatl/Flags.cpp +75 -37
- data/source/global/tdclatl/Flags.h +13 -12
- data/source/global/tdclatl/GroupQuery.cpp +119 -0
- data/source/global/tdclatl/GroupQuery.h +65 -0
- data/source/global/tdclatl/KeyDef.cpp +15 -14
- data/source/global/tdclatl/KeyDef.h +20 -17
- data/source/global/tdclatl/KeySegment.cpp +13 -12
- data/source/global/tdclatl/PooledDbManager.cpp +223 -0
- data/source/global/tdclatl/PooledDbManager.h +76 -0
- data/source/global/tdclatl/QueryBase.cpp +206 -127
- data/source/global/tdclatl/QueryBase.h +55 -59
- data/source/global/tdclatl/Record.cpp +214 -0
- data/source/global/tdclatl/Record.h +96 -0
- data/source/global/tdclatl/Recordset.cpp +278 -0
- data/source/global/tdclatl/Recordset.h +83 -0
- data/source/global/tdclatl/RecordsetQuery.cpp +118 -0
- data/source/global/tdclatl/RecordsetQuery.h +126 -0
- data/source/global/tdclatl/Table.cpp +57 -60
- data/source/global/tdclatl/Table.h +32 -29
- data/source/global/tdclatl/TableDef.cpp +63 -62
- data/source/global/tdclatl/TableDef.h +20 -22
- data/source/global/tdclatl/TdVersion.cpp +3 -3
- data/source/global/tdclatl/TdVersion.h +15 -11
- data/source/global/tdclatl/_IDatabaseEvents_CP.h +99 -92
- data/source/global/tdclatl/activeTable.cpp +355 -0
- data/source/global/tdclatl/activeTable.h +79 -0
- data/source/global/tdclatl/dllmain.cpp +4 -3
- data/source/global/tdclatl/dllmain.h +7 -6
- data/source/global/tdclatl/keySegment.h +22 -18
- data/source/global/tdclatl/resource.h +0 -0
- data/source/global/tdclatl/stdafx.h +6 -4
- data/source/global/tdclatl/targetver.h +0 -1
- data/source/global/tdclatl/tdclatl.cpp +10 -5
- data/source/global/tdclatl/tdclatl.idl +530 -14
- data/source/linux/charsetConvert.h +78 -79
- data/source/linux/linuxTypes.h +9 -12
- data/source/linux/tchar.h +168 -166
- data/transactd.gemspec +24 -16
- metadata +98 -12
- data/bin/common/tdclc_32_1_2.dll +0 -0
- data/bin/common/tdclc_64_1_2.dll +0 -0
- data/build/tdclc/tdclc_32.cbproj +0 -173
- data/build/tdclcpp/tdclcpp_bcb_32.cbproj +0 -232
- data/build/tdclrb/GEM_VERSION +0 -3
- data/source/bzs/db/protocol/tdap/client/filter.cpp +0 -43
- data/source/bzs/example/useORM.cpp +0 -585
@@ -0,0 +1,652 @@
|
|
1
|
+
diff --git transactd.yield.php transactd.yield.php
|
2
|
+
index 080159f..212ef62 100644
|
3
|
+
--- transactd.yield.php
|
4
|
+
+++ transactd.yield.php
|
5
|
+
@@ -1,4 +1,9 @@
|
6
|
+
<?php
|
7
|
+
+//
|
8
|
+
+// Transactd Client for PHP
|
9
|
+
+// ( YIELD-VERSION : for PHP 5.5.x or later )
|
10
|
+
+//
|
11
|
+
+namespace BizStation\Transactd;
|
12
|
+
|
13
|
+
/* ----------------------------------------------------------------------------
|
14
|
+
* This file was automatically generated by SWIG (http://www.swig.org).
|
15
|
+
@@ -2342,12 +2347,7 @@ class database extends nsdatabase {
|
16
|
+
|
17
|
+
function __clone() {
|
18
|
+
$r=database___clone($this->_cPtr);
|
19
|
+
- if (is_resource($r)) {
|
20
|
+
- $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
21
|
+
- if (class_exists($c)) return new $c($r);
|
22
|
+
- return new database($r);
|
23
|
+
- }
|
24
|
+
- return $r;
|
25
|
+
+ $this->__construct($r);
|
26
|
+
}
|
27
|
+
|
28
|
+
function create($uri,$type=0) {
|
29
|
+
@@ -2619,10 +2619,111 @@ class btrTimeStamp {
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
-class fielddefs {
|
34
|
+
+abstract class RangeIterator implements \Iterator {
|
35
|
+
+ protected $_position = 0;
|
36
|
+
+ protected $_start = -1;
|
37
|
+
+ protected $_end = -1;
|
38
|
+
+
|
39
|
+
+ function __construct($start, $end) {
|
40
|
+
+ $this->_position = 0;
|
41
|
+
+ $this->_start = $start;
|
42
|
+
+ $this->_end = $end;
|
43
|
+
+ }
|
44
|
+
+
|
45
|
+
+ public function rewind() {
|
46
|
+
+ $this->_position = $this->_start;
|
47
|
+
+ }
|
48
|
+
+
|
49
|
+
+ public function valid() {
|
50
|
+
+ return $this->_position <= $this->_end;
|
51
|
+
+ }
|
52
|
+
+
|
53
|
+
+ abstract public function current();
|
54
|
+
+
|
55
|
+
+ public function key() {
|
56
|
+
+ return $this->_position;
|
57
|
+
+ }
|
58
|
+
+
|
59
|
+
+ public function next() {
|
60
|
+
+ $this->_position++;
|
61
|
+
+ }
|
62
|
+
+}
|
63
|
+
+
|
64
|
+
+class fielddefsIterator extends RangeIterator {
|
65
|
+
+ private $_fielddefs_ptr = NULL;
|
66
|
+
+
|
67
|
+
+ function __construct($fielddefs_ptr, $start, $end) {
|
68
|
+
+ $this->_fielddefs_ptr = $fielddefs_ptr;
|
69
|
+
+ parent::__construct($start, $end);
|
70
|
+
+ }
|
71
|
+
+
|
72
|
+
+ public function current() {
|
73
|
+
+ $r = fielddefs_getFielddef($this->_fielddefs_ptr,$this->_position);
|
74
|
+
+ if (is_resource($r))
|
75
|
+
+ return new fielddef($r);
|
76
|
+
+ return $r;
|
77
|
+
+ }
|
78
|
+
+}
|
79
|
+
+
|
80
|
+
+class fielddefs implements \ArrayAccess, \Countable, \IteratorAggregate {
|
81
|
+
public $_cPtr=null;
|
82
|
+
protected $_pData=array();
|
83
|
+
|
84
|
+
+ // IteratorAggregate
|
85
|
+
+ public function getIterator() {
|
86
|
+
+ return new fielddefsIterator($this->_cPtr, 0, (fielddefs_size($this->_cPtr) - 1));
|
87
|
+
+ }
|
88
|
+
+
|
89
|
+
+ // ArrayAccess
|
90
|
+
+ public function offsetExists($offset) {
|
91
|
+
+ return (\gettype($offset) === "integer" &&
|
92
|
+
+ $offset >= 0 && $offset < fielddefs_size($this->_cPtr));
|
93
|
+
+ }
|
94
|
+
+
|
95
|
+
+ public function offsetGet($offset) {
|
96
|
+
+ if (\gettype($offset) !== "integer" ||
|
97
|
+
+ $offset < 0 || $offset >= fielddefs_size($this->_cPtr))
|
98
|
+
+ throw new \OutOfRangeException();
|
99
|
+
+ $r = fielddefs_getFielddef($this->_cPtr,$offset);
|
100
|
+
+ if (is_resource($r))
|
101
|
+
+ return new fielddef($r);
|
102
|
+
+ return $r;
|
103
|
+
+ }
|
104
|
+
+
|
105
|
+
+ public function offsetSet($offset, $value) {
|
106
|
+
+ throw new \BadMethodCallException();
|
107
|
+
+ }
|
108
|
+
+
|
109
|
+
+ public function offsetUnset($offset) {
|
110
|
+
+ throw new \BadMethodCallException();
|
111
|
+
+ }
|
112
|
+
+
|
113
|
+
+ // Countable
|
114
|
+
+ public function count() {
|
115
|
+
+ return fielddefs_size($this->_cPtr);
|
116
|
+
+ }
|
117
|
+
+
|
118
|
+
+ // Generator
|
119
|
+
+ function range($start = null, $end = null) {
|
120
|
+
+ $count = fielddefs_size($this->_cPtr);
|
121
|
+
+ if (\gettype($start) !== 'integer' || $start < 0) {
|
122
|
+
+ $i = 0;
|
123
|
+
+ } else {
|
124
|
+
+ $i = $start;
|
125
|
+
+ }
|
126
|
+
+ if (\gettype($end) !== 'integer' || $end < 0 || $end >= $count) {
|
127
|
+
+ $end = $count - 1;
|
128
|
+
+ }
|
129
|
+
+ while ($i <= $end) {
|
130
|
+
+ $r = fielddefs_getFielddef($this->_cPtr, $i);
|
131
|
+
+ if (is_resource($r))
|
132
|
+
+ yield new fielddef($r);
|
133
|
+
+ else
|
134
|
+
+ yield $r;
|
135
|
+
+ $i++;
|
136
|
+
+ }
|
137
|
+
+ }
|
138
|
+
+
|
139
|
+
function __set($var,$value) {
|
140
|
+
if ($var === 'thisown') return swig_transactd_alter_newobject($this->_cPtr,$value);
|
141
|
+
$this->_pData[$var] = $value;
|
142
|
+
@@ -2640,12 +2741,7 @@ class fielddefs {
|
143
|
+
|
144
|
+
function __clone() {
|
145
|
+
$r=fielddefs___clone($this->_cPtr);
|
146
|
+
- if (is_resource($r)) {
|
147
|
+
- $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
148
|
+
- if (class_exists($c)) return new $c($r);
|
149
|
+
- return new fielddefs($r);
|
150
|
+
- }
|
151
|
+
- return $r;
|
152
|
+
+ $this->__construct($r);
|
153
|
+
}
|
154
|
+
|
155
|
+
function indexByName($name) {
|
156
|
+
@@ -2680,6 +2776,51 @@ class fielddefs {
|
157
|
+
}
|
158
|
+
|
159
|
+
class field {
|
160
|
+
+ public function getFV() {
|
161
|
+
+ switch ($this->type()) {
|
162
|
+
+ case transactd::ft_integer:
|
163
|
+
+ case transactd::ft_uinteger:
|
164
|
+
+ case transactd::ft_autoinc:
|
165
|
+
+ case transactd::ft_autoIncUnsigned:
|
166
|
+
+ case transactd::ft_logical:
|
167
|
+
+ case transactd::ft_bit:
|
168
|
+
+ return $this->i64();
|
169
|
+
+ case transactd::ft_float:
|
170
|
+
+ case transactd::ft_decimal:
|
171
|
+
+ case transactd::ft_money:
|
172
|
+
+ case transactd::ft_numeric:
|
173
|
+
+ case transactd::ft_bfloat:
|
174
|
+
+ case transactd::ft_numericsts:
|
175
|
+
+ case transactd::ft_numericsa:
|
176
|
+
+ case transactd::ft_currency:
|
177
|
+
+ return $this->d();
|
178
|
+
+ case transactd::ft_mychar:
|
179
|
+
+ case transactd::ft_myvarchar:
|
180
|
+
+ case transactd::ft_mywchar:
|
181
|
+
+ case transactd::ft_mywvarchar:
|
182
|
+
+ case transactd::ft_mytext:
|
183
|
+
+ case transactd::ft_mydate:
|
184
|
+
+ case transactd::ft_mytime:
|
185
|
+
+ case transactd::ft_mydatetime:
|
186
|
+
+ case transactd::ft_mytimestamp:
|
187
|
+
+ case transactd::ft_date:
|
188
|
+
+ case transactd::ft_time:
|
189
|
+
+ case transactd::ft_datetime:
|
190
|
+
+ case transactd::ft_timestamp:
|
191
|
+
+ case transactd::ft_note:
|
192
|
+
+ case transactd::ft_zstring:
|
193
|
+
+ return $this->c_str();
|
194
|
+
+ case transactd::ft_string:
|
195
|
+
+ case transactd::ft_myvarbinary:
|
196
|
+
+ case transactd::ft_mywvarbinary:
|
197
|
+
+ case transactd::ft_myblob:
|
198
|
+
+ return $this->getBin();
|
199
|
+
+ default:
|
200
|
+
+ return $this->c_str();
|
201
|
+
+ }
|
202
|
+
+ return null;
|
203
|
+
+ }
|
204
|
+
+
|
205
|
+
public $_cPtr=null;
|
206
|
+
protected $_pData=array();
|
207
|
+
|
208
|
+
@@ -2766,7 +2907,141 @@ class field {
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
-abstract class Record {
|
213
|
+
+class RecordIterator implements \Iterator {
|
214
|
+
+ private $_record_cPtr = null;
|
215
|
+
+ private $_position = 0;
|
216
|
+
+ private $_count = -1;
|
217
|
+
+ private $_field = null;
|
218
|
+
+ private $_fielddefs = null;
|
219
|
+
+
|
220
|
+
+ function __construct($record_cPtr, $fielddefs) {
|
221
|
+
+ $this->_record_cPtr = $record_cPtr;
|
222
|
+
+ $this->_position = 0;
|
223
|
+
+ $this->_count = Record_size($record_cPtr);
|
224
|
+
+ $this->_fielddefs = $fielddefs;
|
225
|
+
+ $this->_field = new field();
|
226
|
+
+ }
|
227
|
+
+
|
228
|
+
+ public function rewind() {
|
229
|
+
+ $this->_position = 0;
|
230
|
+
+ }
|
231
|
+
+
|
232
|
+
+ public function valid() {
|
233
|
+
+ return $this->_position < $this->_count;
|
234
|
+
+ }
|
235
|
+
+
|
236
|
+
+ public function current() {
|
237
|
+
+ Record_getFieldByIndexRef($this->_record_cPtr, $this->_position, $this->_field);
|
238
|
+
+ return $this->_field->getFV();
|
239
|
+
+ }
|
240
|
+
+
|
241
|
+
+ public function key() {
|
242
|
+
+ return $this->_fielddefs->getFielddef($this->_position)->name();
|
243
|
+
+ }
|
244
|
+
+
|
245
|
+
+ public function next() {
|
246
|
+
+ $this->_position++;
|
247
|
+
+ }
|
248
|
+
+}
|
249
|
+
+
|
250
|
+
+class Record implements \ArrayAccess, \Countable, \IteratorAggregate {
|
251
|
+
+ protected $_field = null;
|
252
|
+
+ protected $_fielddefs = null;
|
253
|
+
+
|
254
|
+
+ function __clone() {
|
255
|
+
+ $this->_field = new field();
|
256
|
+
+ }
|
257
|
+
+
|
258
|
+
+ // IteratorAggregate
|
259
|
+
+ public function getIterator() {
|
260
|
+
+ return new RecordIterator($this->_cPtr, $this->_fielddefs);
|
261
|
+
+ }
|
262
|
+
+
|
263
|
+
+ // ArrayAccess
|
264
|
+
+ public function offsetExists($offset) {
|
265
|
+
+ switch (\gettype($offset)) {
|
266
|
+
+ case "integer":
|
267
|
+
+ return $offset >= 0 && $offset < $this->count();
|
268
|
+
+ case "string":
|
269
|
+
+ return Record_indexByName($this->_cPtr, $offset) >= 0;
|
270
|
+
+ default:
|
271
|
+
+ return false;
|
272
|
+
+ }
|
273
|
+
+ }
|
274
|
+
+
|
275
|
+
+ public function offsetGet($offset) {
|
276
|
+
+ switch (\gettype($offset)) {
|
277
|
+
+ case "integer":
|
278
|
+
+ Record_getFieldByIndexRef($this->_cPtr, $offset, $this->_field);
|
279
|
+
+ break;
|
280
|
+
+ case "string":
|
281
|
+
+ Record_getFieldByNameRef($this->_cPtr, $offset, $this->_field);
|
282
|
+
+ break;
|
283
|
+
+ default:
|
284
|
+
+ throw new \OutOfRangeException();
|
285
|
+
+ }
|
286
|
+
+ return $this->_field->getFV();
|
287
|
+
+ }
|
288
|
+
+
|
289
|
+
+ public function offsetSet($offset, $value) {
|
290
|
+
+ throw new \BadMethodCallException();
|
291
|
+
+ }
|
292
|
+
+
|
293
|
+
+ public function offsetUnset($offset) {
|
294
|
+
+ throw new \BadMethodCallException();
|
295
|
+
+ }
|
296
|
+
+
|
297
|
+
+ // Countable
|
298
|
+
+ public function count() {
|
299
|
+
+ return Record_size($this->_cPtr);
|
300
|
+
+ }
|
301
|
+
+
|
302
|
+
+ // Generator
|
303
|
+
+ function keys() {
|
304
|
+
+ $count = Record_size($this->_cPtr);
|
305
|
+
+ for ($i = 0; $i < $count; $i++) {
|
306
|
+
+ yield $this->_fielddefs->getFielddef($i)->name();
|
307
|
+
+ }
|
308
|
+
+ }
|
309
|
+
+
|
310
|
+
+ function values() {
|
311
|
+
+ $count = Record_size($this->_cPtr);
|
312
|
+
+ for ($i = 0; $i < $count; $i++) {
|
313
|
+
+ Record_getFieldByIndexRef($this->_cPtr, $i, $this->_field);
|
314
|
+
+ yield $this->_field->getFV();
|
315
|
+
+ }
|
316
|
+
+ }
|
317
|
+
+
|
318
|
+
+ // toArray
|
319
|
+
+ function keysArray() {
|
320
|
+
+ $ret = array();
|
321
|
+
+ $count = Record_size($this->_cPtr);
|
322
|
+
+ for ($i = 0; $i < $count; $i++) {
|
323
|
+
+ $ret[] = $this->_fielddefs->getFielddef($i)->name();
|
324
|
+
+ }
|
325
|
+
+ return $ret;
|
326
|
+
+ }
|
327
|
+
+
|
328
|
+
+ function valuesArray() {
|
329
|
+
+ $ret = array();
|
330
|
+
+ $count = Record_size($this->_cPtr);
|
331
|
+
+ for ($i = 0; $i < $count; $i++) {
|
332
|
+
+ Record_getFieldByIndexRef($this->_cPtr, $i, $this->_field);
|
333
|
+
+ $ret[] = $this->_field->getFV();
|
334
|
+
+ }
|
335
|
+
+ return $ret;
|
336
|
+
+ }
|
337
|
+
+
|
338
|
+
+ function toArray() {
|
339
|
+
+ $ret = array();
|
340
|
+
+ $count = Record_size($this->_cPtr);
|
341
|
+
+ for ($i = 0; $i < $count; $i++) {
|
342
|
+
+ Record_getFieldByIndexRef($this->_cPtr, $i, $this->_field);
|
343
|
+
+ $ret[$this->_fielddefs->getFielddef($i)->name()] = $this->_field->getFV();
|
344
|
+
+ }
|
345
|
+
+ return $ret;
|
346
|
+
+ }
|
347
|
+
+
|
348
|
+
public $_cPtr=null;
|
349
|
+
protected $_pData=array();
|
350
|
+
|
351
|
+
@@ -2786,6 +3061,8 @@ abstract class Record {
|
352
|
+
}
|
353
|
+
function __construct($h) {
|
354
|
+
$this->_cPtr=$h;
|
355
|
+
+ $this->_fielddefs = $this->fieldDefs();
|
356
|
+
+ $this->_field = new field();
|
357
|
+
}
|
358
|
+
|
359
|
+
function isInvalidRecord() {
|
360
|
+
@@ -2863,14 +3140,31 @@ class memoryRecord extends Record {
|
361
|
+
|
362
|
+
function __construct($fds) {
|
363
|
+
if (is_resource($fds) && get_resource_type($fds) === '_p_bzs__db__protocol__tdap__client__memoryRecord') {
|
364
|
+
+ parent::__construct($fds);
|
365
|
+
$this->_cPtr=$fds;
|
366
|
+
return;
|
367
|
+
}
|
368
|
+
$this->_cPtr=new_memoryRecord($fds);
|
369
|
+
+ parent::__construct($this->_cPtr);
|
370
|
+
}
|
371
|
+
}
|
372
|
+
|
373
|
+
class writableRecord extends memoryRecord {
|
374
|
+
+ // override ArrayAccess method (set value).
|
375
|
+
+ public function offsetSet($offset, $value) {
|
376
|
+
+ $this->offsetGet($offset);
|
377
|
+
+ switch ($this->_field->type()) {
|
378
|
+
+ case transactd::ft_string:
|
379
|
+
+ case transactd::ft_myvarbinary:
|
380
|
+
+ case transactd::ft_mywvarbinary:
|
381
|
+
+ case transactd::ft_myblob:
|
382
|
+
+ $this->_field->setFV($value, strlen($value));
|
383
|
+
+ break;
|
384
|
+
+ default:
|
385
|
+
+ $this->_field->setFV($value);
|
386
|
+
+ }
|
387
|
+
+ }
|
388
|
+
+
|
389
|
+
public $_cPtr=null;
|
390
|
+
|
391
|
+
function __set($var,$value) {
|
392
|
+
@@ -2889,6 +3183,8 @@ class writableRecord extends memoryRecord {
|
393
|
+
}
|
394
|
+
function __construct($h) {
|
395
|
+
$this->_cPtr=$h;
|
396
|
+
+ $this->_fielddefs = $this->fieldDefs();
|
397
|
+
+ $this->_field = new field();
|
398
|
+
}
|
399
|
+
|
400
|
+
function read($KeysetAlrady=false) {
|
401
|
+
@@ -3225,6 +3521,7 @@ class recordsetQuery {
|
402
|
+
|
403
|
+
abstract class groupFuncBase extends recordsetQuery {
|
404
|
+
public $_cPtr=null;
|
405
|
+
+ protected $resultName = '';
|
406
|
+
|
407
|
+
function __set($var,$value) {
|
408
|
+
if ($var === 'thisown') return swig_transactd_alter_newobject($this->_cPtr,$value);
|
409
|
+
@@ -3259,7 +3556,8 @@ abstract class groupFuncBase extends recordsetQuery {
|
410
|
+
}
|
411
|
+
|
412
|
+
function setResultName($v) {
|
413
|
+
- groupFuncBase_setResultName($this->_cPtr,$v);
|
414
|
+
+ $this->resultName = $v;
|
415
|
+
+ groupFuncBase_setResultName($this->_cPtr,$this->resultName);
|
416
|
+
}
|
417
|
+
|
418
|
+
function resultKey() {
|
419
|
+
@@ -3372,6 +3670,7 @@ class groupQuery {
|
420
|
+
|
421
|
+
class sum extends groupFuncBase {
|
422
|
+
public $_cPtr=null;
|
423
|
+
+ protected $targetNames = null;
|
424
|
+
|
425
|
+
function __set($var,$value) {
|
426
|
+
if ($var === 'thisown') return swig_transactd_alter_newobject($this->_cPtr,$value);
|
427
|
+
@@ -3399,9 +3698,11 @@ class sum extends groupFuncBase {
|
428
|
+
$this->_cPtr=$targetNames;
|
429
|
+
return;
|
430
|
+
}
|
431
|
+
+ $this->targetNames = $targetNames;
|
432
|
+
+ $this->resultName = $resultName;
|
433
|
+
switch (func_num_args()) {
|
434
|
+
- case 1: $this->_cPtr=new_sum($targetNames); break;
|
435
|
+
- default: $this->_cPtr=new_sum($targetNames,$resultName);
|
436
|
+
+ case 1: $this->_cPtr=new_sum($this->targetNames); break;
|
437
|
+
+ default: $this->_cPtr=new_sum($this->targetNames,$this->resultName);
|
438
|
+
}
|
439
|
+
}
|
440
|
+
}
|
441
|
+
@@ -3435,7 +3736,8 @@ class count extends groupFuncBase {
|
442
|
+
$this->_cPtr=$resultName;
|
443
|
+
return;
|
444
|
+
}
|
445
|
+
- $this->_cPtr=new_count($resultName);
|
446
|
+
+ $this->resultName = $resultName;
|
447
|
+
+ $this->_cPtr=new_count($this->resultName);
|
448
|
+
}
|
449
|
+
}
|
450
|
+
|
451
|
+
@@ -3468,9 +3770,11 @@ class avg extends sum {
|
452
|
+
$this->_cPtr=$targetNames;
|
453
|
+
return;
|
454
|
+
}
|
455
|
+
+ $this->targetNames = $targetNames;
|
456
|
+
+ $this->resultName = $resultName;
|
457
|
+
switch (func_num_args()) {
|
458
|
+
- case 1: $this->_cPtr=new_avg($targetNames); break;
|
459
|
+
- default: $this->_cPtr=new_avg($targetNames,$resultName);
|
460
|
+
+ case 1: $this->_cPtr=new_avg($this->targetNames); break;
|
461
|
+
+ default: $this->_cPtr=new_avg($this->targetNames,$this->resultName);
|
462
|
+
}
|
463
|
+
}
|
464
|
+
}
|
465
|
+
@@ -3504,9 +3808,11 @@ class min extends sum {
|
466
|
+
$this->_cPtr=$targetNames;
|
467
|
+
return;
|
468
|
+
}
|
469
|
+
+ $this->targetNames = $targetNames;
|
470
|
+
+ $this->resultName = $resultName;
|
471
|
+
switch (func_num_args()) {
|
472
|
+
- case 1: $this->_cPtr=new_min($targetNames); break;
|
473
|
+
- default: $this->_cPtr=new_min($targetNames,$resultName);
|
474
|
+
+ case 1: $this->_cPtr=new_min($this->targetNames); break;
|
475
|
+
+ default: $this->_cPtr=new_min($this->targetNames,$this->resultName);
|
476
|
+
}
|
477
|
+
}
|
478
|
+
}
|
479
|
+
@@ -3540,14 +3846,130 @@ class max extends sum {
|
480
|
+
$this->_cPtr=$targetNames;
|
481
|
+
return;
|
482
|
+
}
|
483
|
+
+ $this->targetNames = $targetNames;
|
484
|
+
+ $this->resultName = $resultName;
|
485
|
+
switch (func_num_args()) {
|
486
|
+
- case 1: $this->_cPtr=new_max($targetNames); break;
|
487
|
+
- default: $this->_cPtr=new_max($targetNames,$resultName);
|
488
|
+
+ case 1: $this->_cPtr=new_max($this->targetNames); break;
|
489
|
+
+ default: $this->_cPtr=new_max($this->targetNames,$this->resultName);
|
490
|
+
+ }
|
491
|
+
+ }
|
492
|
+
+}
|
493
|
+
+
|
494
|
+
+class RecordsetIterator implements \SeekableIterator {
|
495
|
+
+ private $_recordset_cPtr = null;
|
496
|
+
+ private $_position = 0;
|
497
|
+
+ private $_fieldsBase_p_p = null;
|
498
|
+
+ private $_record = null;
|
499
|
+
+ private $_count = -1;
|
500
|
+
+
|
501
|
+
+ function __construct($recordset_cPtr, $fielddefs) {
|
502
|
+
+ $this->_recordset_cPtr = $recordset_cPtr;
|
503
|
+
+ $this->_position = 0;
|
504
|
+
+ $this->_fieldsBase_p_p = new_fieldsBase_p_p();
|
505
|
+
+ $this->_count = Recordset_count($recordset_cPtr);
|
506
|
+
+ $this->_record = new Record(memoryRecord::createRecord($fielddefs));
|
507
|
+
+ }
|
508
|
+
+
|
509
|
+
+ function __destruct() {
|
510
|
+
+ delete_fieldsBase_p_p($this->_fieldsBase_p_p);
|
511
|
+
+ }
|
512
|
+
+
|
513
|
+
+ public function rewind() {
|
514
|
+
+ $this->_position = 0;
|
515
|
+
+ }
|
516
|
+
+
|
517
|
+
+ public function valid() {
|
518
|
+
+ return $this->_position < $this->_count;
|
519
|
+
+ }
|
520
|
+
+
|
521
|
+
+ public function current() {
|
522
|
+
+ Recordset_getRow($this->_recordset_cPtr, $this->_position, $this->_fieldsBase_p_p);
|
523
|
+
+ $this->_record->_cPtr = fieldsBase_p_p_value($this->_fieldsBase_p_p);
|
524
|
+
+ return $this->_record;
|
525
|
+
+ }
|
526
|
+
+
|
527
|
+
+ public function key() {
|
528
|
+
+ return $this->_position;
|
529
|
+
+ }
|
530
|
+
+
|
531
|
+
+ public function next() {
|
532
|
+
+ $this->_position++;
|
533
|
+
+ }
|
534
|
+
+
|
535
|
+
+ public function seek($position) {
|
536
|
+
+ if ($position < 0 || $position >= $this->_count) {
|
537
|
+
+ throw new \OutOfBoundsException("invalid seek position ($position)");
|
538
|
+
}
|
539
|
+
+ $this->_position = $position;
|
540
|
+
}
|
541
|
+
}
|
542
|
+
|
543
|
+
-class Recordset {
|
544
|
+
+class Recordset implements \ArrayAccess, \Countable, \IteratorAggregate {
|
545
|
+
+ private $_fieldsBase_p_p = null;
|
546
|
+
+ private $_record = null;
|
547
|
+
+
|
548
|
+
+ function __destruct() {
|
549
|
+
+ transactd::delete_fieldsBase_p_p($this->_fieldsBase_p_p);
|
550
|
+
+ }
|
551
|
+
+
|
552
|
+
+ // IteratorAggregate
|
553
|
+
+ public function getIterator() {
|
554
|
+
+ return new RecordsetIterator($this->_cPtr, $this->fieldDefs());
|
555
|
+
+ }
|
556
|
+
+
|
557
|
+
+ // ArrayAccess
|
558
|
+
+ public function offsetExists($offset) {
|
559
|
+
+ return \gettype($offset) !== 'integer' && $offset >= 0 && $offset < $this->count();
|
560
|
+
+ }
|
561
|
+
+
|
562
|
+
+ public function offsetGet($offset) {
|
563
|
+
+ Recordset_getRow($this->_cPtr, $offset, $this->_fieldsBase_p_p);
|
564
|
+
+ $this->_record->_cPtr = fieldsBase_p_p_value($this->_fieldsBase_p_p);
|
565
|
+
+ return $this->_record;
|
566
|
+
+ }
|
567
|
+
+
|
568
|
+
+ public function offsetSet($offset, $value) {
|
569
|
+
+ throw new \BadMethodCallException();
|
570
|
+
+ }
|
571
|
+
+
|
572
|
+
+ public function offsetUnset($offset) {
|
573
|
+
+ throw new \BadMethodCallException();
|
574
|
+
+ }
|
575
|
+
+
|
576
|
+
+ // random access
|
577
|
+
+ function first() {
|
578
|
+
+ if ($this->count() <= 0) {
|
579
|
+
+ throw new \OutOfBoundsException('no records in recordset');
|
580
|
+
+ }
|
581
|
+
+ return $this->offsetGet(0);
|
582
|
+
+ }
|
583
|
+
+
|
584
|
+
+ function last() {
|
585
|
+
+ if ($this->count() <= 0) {
|
586
|
+
+ throw new \OutOfBoundsException('no records in recordset');
|
587
|
+
+ }
|
588
|
+
+ return $this->offsetGet($this->count() - 1);
|
589
|
+
+ }
|
590
|
+
+
|
591
|
+
+ // Generator
|
592
|
+
+ function range($start = null, $end = null) {
|
593
|
+
+ $count = $this->count();
|
594
|
+
+ if (\gettype($start) !== 'integer' || $start < 0) {
|
595
|
+
+ $i = 0;
|
596
|
+
+ } else {
|
597
|
+
+ $i = $start;
|
598
|
+
+ }
|
599
|
+
+ if (\gettype($end) !== 'integer' || $end < 0 || $end >= $count) {
|
600
|
+
+ $end = $count - 1;
|
601
|
+
+ }
|
602
|
+
+ while ($i <= $end) {
|
603
|
+
+ Recordset_getRow($this->_cPtr, $i, $this->_fieldsBase_p_p);
|
604
|
+
+ $this->_record->_cPtr = fieldsBase_p_p_value($this->_fieldsBase_p_p);
|
605
|
+
+ yield $this->_record;
|
606
|
+
+ $i++;
|
607
|
+
+ }
|
608
|
+
+ }
|
609
|
+
+
|
610
|
+
public $_cPtr=null;
|
611
|
+
protected $_pData=array();
|
612
|
+
|
613
|
+
@@ -3569,11 +3991,12 @@ class Recordset {
|
614
|
+
function __clone() {
|
615
|
+
$r=Recordset___clone($this->_cPtr);
|
616
|
+
if (is_resource($r)) {
|
617
|
+
- $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
618
|
+
- if (class_exists($c)) return new $c($r);
|
619
|
+
- return new Recordset($r);
|
620
|
+
+ $this->_cPtr = $r;
|
621
|
+
+ } else {
|
622
|
+
+ $this->_cPtr = $r->_cPtr;
|
623
|
+
}
|
624
|
+
- return $r;
|
625
|
+
+ $this->_fieldsBase_p_p = new_fieldsBase_p_p();
|
626
|
+
+ $this->_record = new Record(memoryRecord::createRecord($this->fieldDefs()));
|
627
|
+
}
|
628
|
+
|
629
|
+
function size() {
|
630
|
+
@@ -3697,9 +4120,13 @@ class Recordset {
|
631
|
+
function __construct($res=null) {
|
632
|
+
if (is_resource($res) && get_resource_type($res) === '_p_bzs__db__protocol__tdap__client__recordset') {
|
633
|
+
$this->_cPtr=$res;
|
634
|
+
+ $this->_fieldsBase_p_p = new_fieldsBase_p_p();
|
635
|
+
+ $this->_record = new Record(memoryRecord::createRecord($this->fieldDefs()));
|
636
|
+
return;
|
637
|
+
}
|
638
|
+
$this->_cPtr=new_Recordset();
|
639
|
+
+ $this->_fieldsBase_p_p = new_fieldsBase_p_p();
|
640
|
+
+ $this->_record = new Record(memoryRecord::createRecord($this->fieldDefs()));
|
641
|
+
}
|
642
|
+
}
|
643
|
+
|
644
|
+
@@ -3831,7 +4258,7 @@ class activeTable {
|
645
|
+
}
|
646
|
+
}
|
647
|
+
|
648
|
+
- function __construct($mgr_or_db,$tableName) {
|
649
|
+
+ function __construct($mgr_or_db,$tableName=null) {
|
650
|
+
if (is_resource($mgr_or_db) && get_resource_type($mgr_or_db) === '_p_bzs__db__protocol__tdap__client__activeTable') {
|
651
|
+
$this->_cPtr=$mgr_or_db;
|
652
|
+
return;
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#ifndef TRANSACTD_SWIG_REFERENCECOUNTER_H
|
2
|
+
#define TRANSACTD_SWIG_REFERENCECOUNTER_H
|
3
|
+
/* =================================================================
|
4
|
+
Copyright (C) 2000-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 <vector>
|
22
|
+
#include <boost/thread/mutex.hpp>
|
23
|
+
|
24
|
+
struct referencePtrPair
|
25
|
+
{
|
26
|
+
void* referer;
|
27
|
+
void* referred_ptr;
|
28
|
+
};
|
29
|
+
|
30
|
+
class referenceCounter
|
31
|
+
{
|
32
|
+
boost::mutex m_mutex;
|
33
|
+
|
34
|
+
public:
|
35
|
+
std::vector<referencePtrPair> ptrs;
|
36
|
+
|
37
|
+
inline void add(void* referer, void* referred_ptr)
|
38
|
+
{
|
39
|
+
boost::mutex::scoped_lock lck(m_mutex);
|
40
|
+
referencePtrPair v = {referer, referred_ptr};
|
41
|
+
ptrs.push_back(v);
|
42
|
+
}
|
43
|
+
|
44
|
+
inline void remove(void* referer)
|
45
|
+
{
|
46
|
+
boost::mutex::scoped_lock lck(m_mutex);
|
47
|
+
for (size_t i = 0; i < ptrs.size(); ++i)
|
48
|
+
{
|
49
|
+
if (ptrs[i].referer == referer)
|
50
|
+
ptrs.erase(ptrs.begin()+i);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
inline int getReferenceCount(void* referred_ptr)
|
55
|
+
{
|
56
|
+
boost::mutex::scoped_lock lck(m_mutex);
|
57
|
+
int cnt = 0;
|
58
|
+
for (size_t i = 0; i < ptrs.size(); ++i)
|
59
|
+
{
|
60
|
+
if (ptrs[i].referred_ptr == referred_ptr)
|
61
|
+
cnt++;
|
62
|
+
}
|
63
|
+
return cnt;
|
64
|
+
}
|
65
|
+
|
66
|
+
#ifdef SWIGRUBY
|
67
|
+
inline void mark()
|
68
|
+
{
|
69
|
+
boost::mutex::scoped_lock lck(m_mutex);
|
70
|
+
for (size_t i = 0; i < ptrs.size(); ++i)
|
71
|
+
{
|
72
|
+
VALUE object = SWIG_RubyInstanceFor(ptrs[i].referred_ptr);
|
73
|
+
if (object != Qnil)
|
74
|
+
rb_gc_mark(object);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
#endif
|
78
|
+
};
|
79
|
+
#endif //not TRANSACTD_SWIG_REFERENCECOUNTER_H
|