transactd 1.2.0-x86-mswin32-100 → 2.0.0-x86-mswin32-100
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.
- 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/1.9/transactd.so +0 -0
 - data/bin/2.0/transactd.so +0 -0
 - data/bin/common/tdclc_32_2_0.dll +0 -0
 - data/bin/common/tdclcpp_vc100_32mr_2_0.dll +0 -0
 - data/build/tdclrb/bldgem/extconf.rb +28 -3
 - data/build/tdclrb/gem/helper.rb +11 -1
 - data/index_ja.html +15 -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/transactd.gemspec +24 -16
 - metadata +9 -5
 - data/bin/common/tdclc_32_1_2.dll +0 -0
 - data/bin/common/tdclcpp_vc100_32m_1_2.dll +0 -0
 
| 
         @@ -36,12 +36,14 @@ HOSTNAME = getHost() 
     | 
|
| 
       36 
36 
     | 
    
         
             
            DBNAME = 'test'
         
     | 
| 
       37 
37 
     | 
    
         
             
            DBNAME_VAR = 'testvar'
         
     | 
| 
       38 
38 
     | 
    
         
             
            DBNAME_SF = 'testString'
         
     | 
| 
      
 39 
     | 
    
         
            +
            DBNAME_QT = 'querytest'
         
     | 
| 
       39 
40 
     | 
    
         
             
            TABLENAME = 'user'
         
     | 
| 
       40 
41 
     | 
    
         
             
            PROTOCOL = 'tdap://'
         
     | 
| 
       41 
42 
     | 
    
         
             
            BDFNAME = '?dbfile=test.bdf'
         
     | 
| 
       42 
43 
     | 
    
         
             
            URL = PROTOCOL + HOSTNAME + DBNAME + BDFNAME
         
     | 
| 
       43 
44 
     | 
    
         
             
            URL_VAR = PROTOCOL + HOSTNAME + DBNAME_VAR + BDFNAME
         
     | 
| 
       44 
45 
     | 
    
         
             
            URL_SF = PROTOCOL + HOSTNAME + DBNAME_SF + BDFNAME
         
     | 
| 
      
 46 
     | 
    
         
            +
            URL_QT = PROTOCOL + HOSTNAME + DBNAME_QT + BDFNAME
         
     | 
| 
       45 
47 
     | 
    
         
             
            FDI_ID = 0
         
     | 
| 
       46 
48 
     | 
    
         
             
            FDI_NAME = 1
         
     | 
| 
       47 
49 
     | 
    
         
             
            FDI_GROUP = 2
         
     | 
| 
         @@ -50,8 +52,7 @@ FDI_NAMEW = 2 
     | 
|
| 
       50 
52 
     | 
    
         
             
            BULKBUFSIZE = 65535 - 1000
         
     | 
| 
       51 
53 
     | 
    
         
             
            TEST_COUNT = 20000
         
     | 
| 
       52 
54 
     | 
    
         
             
            FIVE_PERCENT_OF_TEST_COUNT = TEST_COUNT / 20
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
            TYPE_SCHEMA_BDF = 0
         
     | 
| 
      
 55 
     | 
    
         
            +
            ALLOWABLE_ERROR_DISTANCE_IN_ESTIMATE_COUNT = TEST_COUNT / 4
         
     | 
| 
       55 
56 
     | 
    
         | 
| 
       56 
57 
     | 
    
         
             
            ISOLATION_READ_COMMITTED = true
         
     | 
| 
       57 
58 
     | 
    
         
             
            ISOLATION_REPEATABLE_READ = false
         
     | 
| 
         @@ -73,7 +74,7 @@ def testCreateDatabase(db) 
     | 
|
| 
       73 
74 
     | 
    
         
             
            end
         
     | 
| 
       74 
75 
     | 
    
         | 
| 
       75 
76 
     | 
    
         
             
            def testOpenDatabase(db)
         
     | 
| 
       76 
     | 
    
         
            -
              db.open(URL, TYPE_SCHEMA_BDF, Transactd::TD_OPEN_NORMAL)
         
     | 
| 
      
 77 
     | 
    
         
            +
              db.open(URL, Transactd::TYPE_SCHEMA_BDF, Transactd::TD_OPEN_NORMAL)
         
     | 
| 
       77 
78 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       78 
79 
     | 
    
         
             
            end
         
     | 
| 
       79 
80 
     | 
    
         | 
| 
         @@ -131,7 +132,25 @@ def testOpenTable(db) 
     | 
|
| 
       131 
132 
     | 
    
         
             
              return tb
         
     | 
| 
       132 
133 
     | 
    
         
             
            end
         
     | 
| 
       133 
134 
     | 
    
         | 
| 
       134 
     | 
    
         
            -
            def  
     | 
| 
      
 135 
     | 
    
         
            +
            def testClone()
         
     | 
| 
      
 136 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 137 
     | 
    
         
            +
              db.open(URL)
         
     | 
| 
      
 138 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 139 
     | 
    
         
            +
              expect(db.isOpened()).to eq true
         
     | 
| 
      
 140 
     | 
    
         
            +
              db2 = db.clone
         
     | 
| 
      
 141 
     | 
    
         
            +
              expect(db2.stat).to eq 0
         
     | 
| 
      
 142 
     | 
    
         
            +
              expect(db2.isOpened()).to eq true
         
     | 
| 
      
 143 
     | 
    
         
            +
              db2.close
         
     | 
| 
      
 144 
     | 
    
         
            +
              expect(db2.stat).to eq 0
         
     | 
| 
      
 145 
     | 
    
         
            +
              expect(db2.isOpened()).to eq false
         
     | 
| 
      
 146 
     | 
    
         
            +
              db2 = nil
         
     | 
| 
      
 147 
     | 
    
         
            +
              expect(db.stat).to eq 0
         
     | 
| 
      
 148 
     | 
    
         
            +
              expect(db.isOpened()).to eq true
         
     | 
| 
      
 149 
     | 
    
         
            +
              db.close
         
     | 
| 
      
 150 
     | 
    
         
            +
            end
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
            def testVersion()
         
     | 
| 
      
 153 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       135 
154 
     | 
    
         
             
              db.connect(PROTOCOL + HOSTNAME)
         
     | 
| 
       136 
155 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       137 
156 
     | 
    
         
             
              vv = Transactd::BtrVersions.new()
         
     | 
| 
         @@ -149,9 +168,11 @@ def testVersion(db) 
     | 
|
| 
       149 
168 
     | 
    
         
             
              expect(engine_ver.majorVersion.to_s).to eq Transactd::TRANSACTD_VER_MAJOR.to_s
         
     | 
| 
       150 
169 
     | 
    
         
             
              expect(engine_ver.minorVersion.to_s).to eq Transactd::TRANSACTD_VER_MINOR.to_s
         
     | 
| 
       151 
170 
     | 
    
         
             
              expect(engine_ver.type.chr).to eq 'T'
         
     | 
| 
      
 171 
     | 
    
         
            +
              db.close()
         
     | 
| 
       152 
172 
     | 
    
         
             
            end
         
     | 
| 
       153 
173 
     | 
    
         | 
| 
       154 
     | 
    
         
            -
            def testInsert( 
     | 
| 
      
 174 
     | 
    
         
            +
            def testInsert()
         
     | 
| 
      
 175 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       155 
176 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       156 
177 
     | 
    
         
             
              expect(tb).not_to be nil
         
     | 
| 
       157 
178 
     | 
    
         
             
              if tb.recordCount() == 0
         
     | 
| 
         @@ -176,9 +197,11 @@ def testInsert(db) 
     | 
|
| 
       176 
197 
     | 
    
         
             
              db.endTrn()
         
     | 
| 
       177 
198 
     | 
    
         
             
              expect(tb.stat()).to eq 0
         
     | 
| 
       178 
199 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 200 
     | 
    
         
            +
              db.close()
         
     | 
| 
       179 
201 
     | 
    
         
             
            end
         
     | 
| 
       180 
202 
     | 
    
         | 
| 
       181 
     | 
    
         
            -
            def testFind( 
     | 
| 
      
 203 
     | 
    
         
            +
            def testFind()
         
     | 
| 
      
 204 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       182 
205 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       183 
206 
     | 
    
         
             
              tb.setKeyNum(0)
         
     | 
| 
       184 
207 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
         @@ -212,9 +235,11 @@ def testFind(db) 
     | 
|
| 
       212 
235 
     | 
    
         
             
              tb.find(Transactd::Table::FindForword)
         
     | 
| 
       213 
236 
     | 
    
         
             
              expect(tb.stat()).to eq Transactd::STATUS_EOF
         
     | 
| 
       214 
237 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 238 
     | 
    
         
            +
              db.close()
         
     | 
| 
       215 
239 
     | 
    
         
             
            end
         
     | 
| 
       216 
240 
     | 
    
         | 
| 
       217 
     | 
    
         
            -
            def testFindNext( 
     | 
| 
      
 241 
     | 
    
         
            +
            def testFindNext()
         
     | 
| 
      
 242 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       218 
243 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       219 
244 
     | 
    
         
             
              tb.setKeyNum(0)
         
     | 
| 
       220 
245 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
         @@ -229,19 +254,21 @@ def testFindNext(db) 
     | 
|
| 
       229 
254 
     | 
    
         
             
                expect(tb.getFVint(FDI_ID)).to eq i
         
     | 
| 
       230 
255 
     | 
    
         
             
              end
         
     | 
| 
       231 
256 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 257 
     | 
    
         
            +
              db.close()
         
     | 
| 
       232 
258 
     | 
    
         
             
            end
         
     | 
| 
       233 
259 
     | 
    
         | 
| 
       234 
     | 
    
         
            -
            def testFindIn( 
     | 
| 
      
 260 
     | 
    
         
            +
            def testFindIn()
         
     | 
| 
      
 261 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       235 
262 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       236 
263 
     | 
    
         
             
              tb.setKeyNum(0)
         
     | 
| 
       237 
264 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
       238 
     | 
    
         
            -
              q = Transactd:: 
     | 
| 
       239 
     | 
    
         
            -
              q. 
     | 
| 
       240 
     | 
    
         
            -
              q. 
     | 
| 
       241 
     | 
    
         
            -
              q. 
     | 
| 
       242 
     | 
    
         
            -
              q. 
     | 
| 
       243 
     | 
    
         
            -
              q. 
     | 
| 
       244 
     | 
    
         
            -
              q. 
     | 
| 
      
 265 
     | 
    
         
            +
              q = Transactd::Query.new()
         
     | 
| 
      
 266 
     | 
    
         
            +
              q.addSeekKeyValue('10', true)
         
     | 
| 
      
 267 
     | 
    
         
            +
              q.addSeekKeyValue('300000')
         
     | 
| 
      
 268 
     | 
    
         
            +
              q.addSeekKeyValue('50')
         
     | 
| 
      
 269 
     | 
    
         
            +
              q.addSeekKeyValue('-1')
         
     | 
| 
      
 270 
     | 
    
         
            +
              q.addSeekKeyValue('80')
         
     | 
| 
      
 271 
     | 
    
         
            +
              q.addSeekKeyValue('5000')
         
     | 
| 
       245 
272 
     | 
    
         | 
| 
       246 
273 
     | 
    
         
             
              tb.setQuery(q)
         
     | 
| 
       247 
274 
     | 
    
         
             
              expect(tb.stat()).to eq 0
         
     | 
| 
         @@ -270,9 +297,9 @@ def testFindIn(db) 
     | 
|
| 
       270 
297 
     | 
    
         
             
              expect(tb.stat()).to eq Transactd::STATUS_EOF
         
     | 
| 
       271 
298 
     | 
    
         | 
| 
       272 
299 
     | 
    
         
             
              # Many params
         
     | 
| 
       273 
     | 
    
         
            -
              q. 
     | 
| 
      
 300 
     | 
    
         
            +
              q.addSeekKeyValue('1', true)
         
     | 
| 
       274 
301 
     | 
    
         
             
              2.upto(10000) do |i|
         
     | 
| 
       275 
     | 
    
         
            -
                q. 
     | 
| 
      
 302 
     | 
    
         
            +
                q.addSeekKeyValue(i.to_s)
         
     | 
| 
       276 
303 
     | 
    
         
             
              end
         
     | 
| 
       277 
304 
     | 
    
         
             
              tb.setQuery(q)
         
     | 
| 
       278 
305 
     | 
    
         
             
              expect(tb.stat()).to eq 0
         
     | 
| 
         @@ -302,9 +329,11 @@ def testFindIn(db) 
     | 
|
| 
       302 
329 
     | 
    
         
             
              expect(i).to eq 10000
         
     | 
| 
       303 
330 
     | 
    
         | 
| 
       304 
331 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 332 
     | 
    
         
            +
              db.close()
         
     | 
| 
       305 
333 
     | 
    
         
             
            end
         
     | 
| 
       306 
334 
     | 
    
         | 
| 
       307 
     | 
    
         
            -
            def testGetPercentage( 
     | 
| 
      
 335 
     | 
    
         
            +
            def testGetPercentage()
         
     | 
| 
      
 336 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       308 
337 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       309 
338 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
       310 
339 
     | 
    
         
             
              vv = TEST_COUNT / 2 + 1
         
     | 
| 
         @@ -314,9 +343,11 @@ def testGetPercentage(db) 
     | 
|
| 
       314 
343 
     | 
    
         
             
              per = tb.getPercentage()
         
     | 
| 
       315 
344 
     | 
    
         
             
              expect((5000 - per).abs).to be < 500 # 500 = 5%
         
     | 
| 
       316 
345 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 346 
     | 
    
         
            +
              db.close()
         
     | 
| 
       317 
347 
     | 
    
         
             
            end
         
     | 
| 
       318 
348 
     | 
    
         | 
| 
       319 
     | 
    
         
            -
            def testMovePercentage( 
     | 
| 
      
 349 
     | 
    
         
            +
            def testMovePercentage()
         
     | 
| 
      
 350 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       320 
351 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       321 
352 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
       322 
353 
     | 
    
         
             
              tb.seekByPercentage(5000) # 50%
         
     | 
| 
         @@ -325,9 +356,11 @@ def testMovePercentage(db) 
     | 
|
| 
       325 
356 
     | 
    
         
             
              expect(tb.stat()).to eq 0
         
     | 
| 
       326 
357 
     | 
    
         
             
              expect((TEST_COUNT / 2 + 1 - v).abs).to be < FIVE_PERCENT_OF_TEST_COUNT
         
     | 
| 
       327 
358 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 359 
     | 
    
         
            +
              db.close()
         
     | 
| 
       328 
360 
     | 
    
         
             
            end
         
     | 
| 
       329 
361 
     | 
    
         | 
| 
       330 
     | 
    
         
            -
            def testGetEqual( 
     | 
| 
      
 362 
     | 
    
         
            +
            def testGetEqual()
         
     | 
| 
      
 363 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       331 
364 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       332 
365 
     | 
    
         
             
              db.beginSnapshot()
         
     | 
| 
       333 
366 
     | 
    
         
             
              vv = 1
         
     | 
| 
         @@ -339,9 +372,11 @@ def testGetEqual(db) 
     | 
|
| 
       339 
372 
     | 
    
         
             
              end
         
     | 
| 
       340 
373 
     | 
    
         
             
              db.endSnapshot()
         
     | 
| 
       341 
374 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 375 
     | 
    
         
            +
              db.close()
         
     | 
| 
       342 
376 
     | 
    
         
             
            end
         
     | 
| 
       343 
377 
     | 
    
         | 
| 
       344 
     | 
    
         
            -
            def testGetNext( 
     | 
| 
      
 378 
     | 
    
         
            +
            def testGetNext()
         
     | 
| 
      
 379 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       345 
380 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       346 
381 
     | 
    
         
             
              db.beginSnapshot()
         
     | 
| 
       347 
382 
     | 
    
         
             
              vv = 2
         
     | 
| 
         @@ -355,9 +390,11 @@ def testGetNext(db) 
     | 
|
| 
       355 
390 
     | 
    
         
             
              end
         
     | 
| 
       356 
391 
     | 
    
         
             
              db.endSnapshot()
         
     | 
| 
       357 
392 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 393 
     | 
    
         
            +
              db.close()
         
     | 
| 
       358 
394 
     | 
    
         
             
            end
         
     | 
| 
       359 
395 
     | 
    
         | 
| 
       360 
     | 
    
         
            -
            def testGetPrevious( 
     | 
| 
      
 396 
     | 
    
         
            +
            def testGetPrevious()
         
     | 
| 
      
 397 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       361 
398 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       362 
399 
     | 
    
         
             
              db.beginSnapshot()
         
     | 
| 
       363 
400 
     | 
    
         
             
              vv = TEST_COUNT + 1
         
     | 
| 
         @@ -373,9 +410,11 @@ def testGetPrevious(db) 
     | 
|
| 
       373 
410 
     | 
    
         
             
              expect(tb.getFVstr(FDI_NAME)).to eq 'kosaka'
         
     | 
| 
       374 
411 
     | 
    
         
             
              db.endSnapshot()
         
     | 
| 
       375 
412 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 413 
     | 
    
         
            +
              db.close()
         
     | 
| 
       376 
414 
     | 
    
         
             
            end
         
     | 
| 
       377 
415 
     | 
    
         | 
| 
       378 
     | 
    
         
            -
            def testGetGreater( 
     | 
| 
      
 416 
     | 
    
         
            +
            def testGetGreater()
         
     | 
| 
      
 417 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       379 
418 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       380 
419 
     | 
    
         
             
              vv = TEST_COUNT * 3 / 4
         
     | 
| 
       381 
420 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
         @@ -392,9 +431,11 @@ def testGetGreater(db) 
     | 
|
| 
       392 
431 
     | 
    
         
             
              tb.seekPrev()
         
     | 
| 
       393 
432 
     | 
    
         
             
              expect(tb.getFVint(FDI_ID)).to eq vv
         
     | 
| 
       394 
433 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 434 
     | 
    
         
            +
              db.close()
         
     | 
| 
       395 
435 
     | 
    
         
             
            end
         
     | 
| 
       396 
436 
     | 
    
         | 
| 
       397 
     | 
    
         
            -
            def testGetLessThan( 
     | 
| 
      
 437 
     | 
    
         
            +
            def testGetLessThan()
         
     | 
| 
      
 438 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       398 
439 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       399 
440 
     | 
    
         
             
              vv = TEST_COUNT * 3 / 4
         
     | 
| 
       400 
441 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
         @@ -411,25 +452,31 @@ def testGetLessThan(db) 
     | 
|
| 
       411 
452 
     | 
    
         
             
              tb.seekPrev()
         
     | 
| 
       412 
453 
     | 
    
         
             
              expect(tb.getFVint(FDI_ID)).to eq vv - 2
         
     | 
| 
       413 
454 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 455 
     | 
    
         
            +
              db.close()
         
     | 
| 
       414 
456 
     | 
    
         
             
            end
         
     | 
| 
       415 
457 
     | 
    
         | 
| 
       416 
     | 
    
         
            -
            def testGetFirst( 
     | 
| 
      
 458 
     | 
    
         
            +
            def testGetFirst()
         
     | 
| 
      
 459 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       417 
460 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       418 
461 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
       419 
462 
     | 
    
         
             
              tb.seekFirst()
         
     | 
| 
       420 
463 
     | 
    
         
             
              expect(tb.getFVstr(FDI_NAME)).to eq 'kosaka'
         
     | 
| 
       421 
464 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 465 
     | 
    
         
            +
              db.close()
         
     | 
| 
       422 
466 
     | 
    
         
             
            end
         
     | 
| 
       423 
467 
     | 
    
         | 
| 
       424 
     | 
    
         
            -
            def testGetLast( 
     | 
| 
      
 468 
     | 
    
         
            +
            def testGetLast()
         
     | 
| 
      
 469 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       425 
470 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       426 
471 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
       427 
472 
     | 
    
         
             
              tb.seekLast()
         
     | 
| 
       428 
473 
     | 
    
         
             
              expect(tb.getFVint(FDI_ID)).to eq TEST_COUNT + 2
         
     | 
| 
       429 
474 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 475 
     | 
    
         
            +
              db.close()
         
     | 
| 
       430 
476 
     | 
    
         
             
            end
         
     | 
| 
       431 
477 
     | 
    
         | 
| 
       432 
     | 
    
         
            -
            def testMovePosition( 
     | 
| 
      
 478 
     | 
    
         
            +
            def testMovePosition()
         
     | 
| 
      
 479 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       433 
480 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       434 
481 
     | 
    
         
             
              tb.clearBuffer()
         
     | 
| 
       435 
482 
     | 
    
         
             
              vv = TEST_COUNT * 3 / 4
         
     | 
| 
         @@ -450,9 +497,11 @@ def testMovePosition(db) 
     | 
|
| 
       450 
497 
     | 
    
         
             
              tb.seekByBookmark(pos)
         
     | 
| 
       451 
498 
     | 
    
         
             
              expect(tb.getFVint(FDI_ID)).to eq pos_vv
         
     | 
| 
       452 
499 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 500 
     | 
    
         
            +
              db.close()
         
     | 
| 
       453 
501 
     | 
    
         
             
            end
         
     | 
| 
       454 
502 
     | 
    
         | 
| 
       455 
     | 
    
         
            -
            def testUpdate( 
     | 
| 
      
 503 
     | 
    
         
            +
            def testUpdate()
         
     | 
| 
      
 504 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       456 
505 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       457 
506 
     | 
    
         
             
              db.beginTrn()
         
     | 
| 
       458 
507 
     | 
    
         
             
              # test of ncc
         
     | 
| 
         @@ -512,10 +561,12 @@ def testUpdate(db) 
     | 
|
| 
       512 
561 
     | 
    
         
             
              tb.seek()
         
     | 
| 
       513 
562 
     | 
    
         
             
              expect(tb.getFVstr(FDI_NAME)).to eq 'ABC'
         
     | 
| 
       514 
563 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 564 
     | 
    
         
            +
              db.close()
         
     | 
| 
       515 
565 
     | 
    
         
             
            end
         
     | 
| 
       516 
566 
     | 
    
         | 
| 
       517 
     | 
    
         
            -
            def testSnapShot( 
     | 
| 
       518 
     | 
    
         
            -
               
     | 
| 
      
 567 
     | 
    
         
            +
            def testSnapShot()
         
     | 
| 
      
 568 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 569 
     | 
    
         
            +
              db2 = Transactd::Database.new()
         
     | 
| 
       519 
570 
     | 
    
         
             
              db2.connect(PROTOCOL + HOSTNAME + DBNAME , true)
         
     | 
| 
       520 
571 
     | 
    
         
             
              expect(db2.stat()).to eq 0
         
     | 
| 
       521 
572 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
         @@ -551,13 +602,15 @@ def testSnapShot(db) 
     | 
|
| 
       551 
602 
     | 
    
         
             
                expect(secondValue).to eq firstValue
         
     | 
| 
       552 
603 
     | 
    
         
             
              end
         
     | 
| 
       553 
604 
     | 
    
         
             
              # ----------------------------------------------------
         
     | 
| 
       554 
     | 
    
         
            -
              tb.close()
         
     | 
| 
       555 
605 
     | 
    
         
             
              tb2.close()
         
     | 
| 
      
 606 
     | 
    
         
            +
              tb.close()
         
     | 
| 
       556 
607 
     | 
    
         
             
              db2.close()
         
     | 
| 
      
 608 
     | 
    
         
            +
              db.close()
         
     | 
| 
       557 
609 
     | 
    
         
             
            end
         
     | 
| 
       558 
610 
     | 
    
         | 
| 
       559 
     | 
    
         
            -
            def testTransactionLock( 
     | 
| 
       560 
     | 
    
         
            -
               
     | 
| 
      
 611 
     | 
    
         
            +
            def testTransactionLock()
         
     | 
| 
      
 612 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 613 
     | 
    
         
            +
              db2 = Transactd::Database.new()
         
     | 
| 
       561 
614 
     | 
    
         
             
              db2.connect(PROTOCOL + HOSTNAME + DBNAME, true)
         
     | 
| 
       562 
615 
     | 
    
         
             
              expect(db2.stat()).to eq 0
         
     | 
| 
       563 
616 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
         @@ -634,13 +687,15 @@ def testTransactionLock(db) 
     | 
|
| 
       634 
687 
     | 
    
         
             
              tb2.setKeyNum(0)
         
     | 
| 
       635 
688 
     | 
    
         
             
              tb2.seekFirst()
         
     | 
| 
       636 
689 
     | 
    
         
             
              expect(tb2.getFVstr(FDI_NAME)).to eq 'ABC'
         
     | 
| 
       637 
     | 
    
         
            -
              tb.close()
         
     | 
| 
       638 
690 
     | 
    
         
             
              tb2.close()
         
     | 
| 
      
 691 
     | 
    
         
            +
              tb.close()
         
     | 
| 
       639 
692 
     | 
    
         
             
              db2.close()
         
     | 
| 
      
 693 
     | 
    
         
            +
              db.close()
         
     | 
| 
       640 
694 
     | 
    
         
             
            end
         
     | 
| 
       641 
695 
     | 
    
         | 
| 
       642 
     | 
    
         
            -
            def testConflict( 
     | 
| 
       643 
     | 
    
         
            -
               
     | 
| 
      
 696 
     | 
    
         
            +
            def testConflict()
         
     | 
| 
      
 697 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 698 
     | 
    
         
            +
              db2 = Transactd::Database.new()
         
     | 
| 
       644 
699 
     | 
    
         
             
              db2.connect(PROTOCOL + HOSTNAME + DBNAME , true)
         
     | 
| 
       645 
700 
     | 
    
         
             
              expect(db2.stat()).to eq 0
         
     | 
| 
       646 
701 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
         @@ -680,12 +735,98 @@ def testConflict(db) 
     | 
|
| 
       680 
735 
     | 
    
         
             
              tb.update()
         
     | 
| 
       681 
736 
     | 
    
         
             
              expect(tb.stat()).to eq Transactd::STATUS_CHANGE_CONFLICT
         
     | 
| 
       682 
737 
     | 
    
         
             
              # ----------------------------------------------------
         
     | 
| 
      
 738 
     | 
    
         
            +
              tb2.close()
         
     | 
| 
       683 
739 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 740 
     | 
    
         
            +
              db2.close()
         
     | 
| 
      
 741 
     | 
    
         
            +
              db.close()
         
     | 
| 
      
 742 
     | 
    
         
            +
            end
         
     | 
| 
      
 743 
     | 
    
         
            +
             
     | 
| 
      
 744 
     | 
    
         
            +
            def testExclusive()
         
     | 
| 
      
 745 
     | 
    
         
            +
              # db mode exclusive
         
     | 
| 
      
 746 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 747 
     | 
    
         
            +
              db.open(URL, Transactd::TYPE_SCHEMA_BDF, Transactd::TD_OPEN_EXCLUSIVE)
         
     | 
| 
      
 748 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 749 
     | 
    
         
            +
              tb = db.openTable(TABLENAME)
         
     | 
| 
      
 750 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 751 
     | 
    
         
            +
              
         
     | 
| 
      
 752 
     | 
    
         
            +
              # Can not open database from other connections.
         
     | 
| 
      
 753 
     | 
    
         
            +
              db2 = Transactd::Database.new()
         
     | 
| 
      
 754 
     | 
    
         
            +
              db2.connect(PROTOCOL + HOSTNAME + DBNAME, true)
         
     | 
| 
      
 755 
     | 
    
         
            +
              expect(db2.stat()).to eq 0
         
     | 
| 
      
 756 
     | 
    
         
            +
              db2.open(URL, Transactd::TYPE_SCHEMA_BDF)
         
     | 
| 
      
 757 
     | 
    
         
            +
              expect(db2.stat()).to eq Transactd::STATUS_CANNOT_LOCK_TABLE
         
     | 
| 
      
 758 
     | 
    
         
            +
              
         
     | 
| 
      
 759 
     | 
    
         
            +
              tb2 = db.openTable(TABLENAME)
         
     | 
| 
      
 760 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 761 
     | 
    
         
            +
              
         
     | 
| 
      
 762 
     | 
    
         
            +
              tb.setKeyNum(0)
         
     | 
| 
      
 763 
     | 
    
         
            +
              tb.seekFirst()
         
     | 
| 
      
 764 
     | 
    
         
            +
              expect(tb.stat()).to eq 0
         
     | 
| 
      
 765 
     | 
    
         
            +
              
         
     | 
| 
      
 766 
     | 
    
         
            +
              tb.setFV(FDI_NAME, 'ABC123')
         
     | 
| 
      
 767 
     | 
    
         
            +
              tb.update()
         
     | 
| 
      
 768 
     | 
    
         
            +
              expect(tb.stat()).to eq 0
         
     | 
| 
      
 769 
     | 
    
         
            +
              
         
     | 
| 
      
 770 
     | 
    
         
            +
              tb2.setKeyNum(0)
         
     | 
| 
      
 771 
     | 
    
         
            +
              tb2.seekFirst()
         
     | 
| 
      
 772 
     | 
    
         
            +
              expect(tb2.stat()).to eq 0
         
     | 
| 
      
 773 
     | 
    
         
            +
              tb2.setFV(FDI_NAME, 'ABC124')
         
     | 
| 
      
 774 
     | 
    
         
            +
              tb2.update()
         
     | 
| 
      
 775 
     | 
    
         
            +
              expect(tb2.stat()).to eq 0
         
     | 
| 
      
 776 
     | 
    
         
            +
              
         
     | 
| 
       684 
777 
     | 
    
         
             
              tb2.close()
         
     | 
| 
      
 778 
     | 
    
         
            +
              tb.close()
         
     | 
| 
       685 
779 
     | 
    
         
             
              db2.close()
         
     | 
| 
      
 780 
     | 
    
         
            +
              db.close()
         
     | 
| 
      
 781 
     | 
    
         
            +
              
         
     | 
| 
      
 782 
     | 
    
         
            +
              # table mode exclusive
         
     | 
| 
      
 783 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 784 
     | 
    
         
            +
              db.open(URL, Transactd::TYPE_SCHEMA_BDF, Transactd::TD_OPEN_READONLY)
         
     | 
| 
      
 785 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 786 
     | 
    
         
            +
              tb = db.openTable(TABLENAME, Transactd::TD_OPEN_EXCLUSIVE)
         
     | 
| 
      
 787 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 788 
     | 
    
         
            +
              
         
     | 
| 
      
 789 
     | 
    
         
            +
              db2 = Transactd::Database.new()
         
     | 
| 
      
 790 
     | 
    
         
            +
              db2.connect(PROTOCOL + HOSTNAME + DBNAME, true)
         
     | 
| 
      
 791 
     | 
    
         
            +
              expect(db2.stat()).to eq 0
         
     | 
| 
      
 792 
     | 
    
         
            +
              db2.open(URL, Transactd::TYPE_SCHEMA_BDF)
         
     | 
| 
      
 793 
     | 
    
         
            +
              expect(db2.stat()).to eq 0
         
     | 
| 
      
 794 
     | 
    
         
            +
              
         
     | 
| 
      
 795 
     | 
    
         
            +
              # Can not open table from other connections.
         
     | 
| 
      
 796 
     | 
    
         
            +
              tb2 = db2.openTable(TABLENAME)
         
     | 
| 
      
 797 
     | 
    
         
            +
              expect(db2.stat()).to eq Transactd::STATUS_CANNOT_LOCK_TABLE
         
     | 
| 
      
 798 
     | 
    
         
            +
              
         
     | 
| 
      
 799 
     | 
    
         
            +
              # Can open table from the same connection.
         
     | 
| 
      
 800 
     | 
    
         
            +
              tb3 = db.openTable(TABLENAME)
         
     | 
| 
      
 801 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 802 
     | 
    
         
            +
              
         
     | 
| 
      
 803 
     | 
    
         
            +
              tb3.close()
         
     | 
| 
      
 804 
     | 
    
         
            +
              tb2.close() if tb2 != nil
         
     | 
| 
      
 805 
     | 
    
         
            +
              tb.close()
         
     | 
| 
      
 806 
     | 
    
         
            +
              db2.close()
         
     | 
| 
      
 807 
     | 
    
         
            +
              db.close()
         
     | 
| 
      
 808 
     | 
    
         
            +
              
         
     | 
| 
      
 809 
     | 
    
         
            +
              # reopen and update
         
     | 
| 
      
 810 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 811 
     | 
    
         
            +
              db.open(URL)
         
     | 
| 
      
 812 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 813 
     | 
    
         
            +
              tb = db.openTable(TABLENAME)
         
     | 
| 
      
 814 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 815 
     | 
    
         
            +
              
         
     | 
| 
      
 816 
     | 
    
         
            +
              tb.setKeyNum(0)
         
     | 
| 
      
 817 
     | 
    
         
            +
              tb.seekFirst()
         
     | 
| 
      
 818 
     | 
    
         
            +
              expect(tb.stat()).to eq 0
         
     | 
| 
      
 819 
     | 
    
         
            +
              
         
     | 
| 
      
 820 
     | 
    
         
            +
              tb.setFV(FDI_NAME, 'ABC123')
         
     | 
| 
      
 821 
     | 
    
         
            +
              tb.update()
         
     | 
| 
      
 822 
     | 
    
         
            +
              expect(tb.stat()).to eq 0
         
     | 
| 
      
 823 
     | 
    
         
            +
              
         
     | 
| 
      
 824 
     | 
    
         
            +
              tb.close()
         
     | 
| 
      
 825 
     | 
    
         
            +
              db.close()
         
     | 
| 
       686 
826 
     | 
    
         
             
            end
         
     | 
| 
       687 
827 
     | 
    
         | 
| 
       688 
     | 
    
         
            -
            def testInsert2( 
     | 
| 
      
 828 
     | 
    
         
            +
            def testInsert2()
         
     | 
| 
      
 829 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       689 
830 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       690 
831 
     | 
    
         
             
              v = TEST_COUNT * 2
         
     | 
| 
       691 
832 
     | 
    
         
             
              db.beginTrn()
         
     | 
| 
         @@ -702,13 +843,15 @@ def testInsert2(db) 
     | 
|
| 
       702 
843 
     | 
    
         
             
              expect(tb.getFVint(FDI_ID)).to eq 11
         
     | 
| 
       703 
844 
     | 
    
         
             
              db.endTrn()
         
     | 
| 
       704 
845 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 846 
     | 
    
         
            +
              db.close()
         
     | 
| 
       705 
847 
     | 
    
         
             
            end
         
     | 
| 
       706 
848 
     | 
    
         | 
| 
       707 
     | 
    
         
            -
            def testDelete( 
     | 
| 
      
 849 
     | 
    
         
            +
            def testDelete()
         
     | 
| 
      
 850 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       708 
851 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       709 
852 
     | 
    
         
             
              # estimate count
         
     | 
| 
       710 
853 
     | 
    
         
             
              count = tb.recordCount(true)
         
     | 
| 
       711 
     | 
    
         
            -
              is_valid_count = ((count - TEST_COUNT 
     | 
| 
      
 854 
     | 
    
         
            +
              is_valid_count = ((count - TEST_COUNT).abs < ALLOWABLE_ERROR_DISTANCE_IN_ESTIMATE_COUNT)
         
     | 
| 
       712 
855 
     | 
    
         
             
              expect(is_valid_count).to be true
         
     | 
| 
       713 
856 
     | 
    
         
             
              if !is_valid_count
         
     | 
| 
       714 
857 
     | 
    
         
             
                puts "true record count = #{(TEST_COUNT + 3).to_s} and estimate recordCount count = #{count.to_s}"
         
     | 
| 
         @@ -744,30 +887,36 @@ def testDelete(db) 
     | 
|
| 
       744 
887 
     | 
    
         
             
              db.endTrn()
         
     | 
| 
       745 
888 
     | 
    
         
             
              expect(tb.recordCount(false)).to eq 0
         
     | 
| 
       746 
889 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 890 
     | 
    
         
            +
              db.close()
         
     | 
| 
       747 
891 
     | 
    
         
             
            end
         
     | 
| 
       748 
892 
     | 
    
         | 
| 
       749 
     | 
    
         
            -
            def testSetOwner( 
     | 
| 
      
 893 
     | 
    
         
            +
            def testSetOwner()
         
     | 
| 
      
 894 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       750 
895 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       751 
896 
     | 
    
         
             
              tb.setOwnerName('ABCDEFG')
         
     | 
| 
       752 
897 
     | 
    
         
             
              expect(tb.stat()).to eq 0
         
     | 
| 
       753 
898 
     | 
    
         
             
              tb.clearOwnerName()
         
     | 
| 
       754 
899 
     | 
    
         
             
              expect(tb.stat()).to eq 0
         
     | 
| 
       755 
900 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 901 
     | 
    
         
            +
              db.close()
         
     | 
| 
       756 
902 
     | 
    
         
             
            end
         
     | 
| 
       757 
903 
     | 
    
         | 
| 
       758 
     | 
    
         
            -
            def testDropIndex( 
     | 
| 
      
 904 
     | 
    
         
            +
            def testDropIndex()
         
     | 
| 
      
 905 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       759 
906 
     | 
    
         
             
              tb = testOpenTable(db)
         
     | 
| 
       760 
907 
     | 
    
         
             
              tb.dropIndex(false)
         
     | 
| 
       761 
908 
     | 
    
         
             
              expect(tb.stat()).to eq 0
         
     | 
| 
       762 
909 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 910 
     | 
    
         
            +
              db.close()
         
     | 
| 
       763 
911 
     | 
    
         
             
            end
         
     | 
| 
       764 
912 
     | 
    
         | 
| 
       765 
     | 
    
         
            -
            def testLogin( 
     | 
| 
      
 913 
     | 
    
         
            +
            def testLogin()
         
     | 
| 
      
 914 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       766 
915 
     | 
    
         
             
              db.connect(PROTOCOL + HOSTNAME)
         
     | 
| 
       767 
916 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       768 
917 
     | 
    
         
             
              if db.stat() == 0
         
     | 
| 
       769 
918 
     | 
    
         
             
                # second connection
         
     | 
| 
       770 
     | 
    
         
            -
                db2 = Transactd::Database 
     | 
| 
      
 919 
     | 
    
         
            +
                db2 = Transactd::Database.new()
         
     | 
| 
       771 
920 
     | 
    
         
             
                db2.connect(PROTOCOL + HOSTNAME + DBNAME, true)
         
     | 
| 
       772 
921 
     | 
    
         
             
                expect(db.stat()).to eq 0
         
     | 
| 
       773 
922 
     | 
    
         
             
                db2.close()
         
     | 
| 
         @@ -802,6 +951,7 @@ def testLogin(db) 
     | 
|
| 
       802 
951 
     | 
    
         
             
              expect(db.stat()).to eq (25000 + 1049)
         
     | 
| 
       803 
952 
     | 
    
         
             
              db.disconnect(PROTOCOL + HOSTNAME + DBNAME)
         
     | 
| 
       804 
953 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
      
 954 
     | 
    
         
            +
              db.close()
         
     | 
| 
       805 
955 
     | 
    
         
             
            end
         
     | 
| 
       806 
956 
     | 
    
         | 
| 
       807 
957 
     | 
    
         
             
            def isUtf16leSupport(db)
         
     | 
| 
         @@ -896,7 +1046,8 @@ def testCreateVarTable(db, id, name, fieldType, charset) 
     | 
|
| 
       896 
1046 
     | 
    
         
             
              tb.close() if tb != nil
         
     | 
| 
       897 
1047 
     | 
    
         
             
            end
         
     | 
| 
       898 
1048 
     | 
    
         | 
| 
       899 
     | 
    
         
            -
            def testCreateDatabaseVar( 
     | 
| 
      
 1049 
     | 
    
         
            +
            def testCreateDatabaseVar()
         
     | 
| 
      
 1050 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       900 
1051 
     | 
    
         
             
              db.create(URL_VAR)
         
     | 
| 
       901 
1052 
     | 
    
         
             
              if db.stat() == Transactd::STATUS_TABLE_EXISTS_ERROR
         
     | 
| 
       902 
1053 
     | 
    
         
             
                testDropDatabaseVar(db)
         
     | 
| 
         @@ -904,7 +1055,7 @@ def testCreateDatabaseVar(db) 
     | 
|
| 
       904 
1055 
     | 
    
         
             
              end
         
     | 
| 
       905 
1056 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       906 
1057 
     | 
    
         
             
              if (0 == db.stat())
         
     | 
| 
       907 
     | 
    
         
            -
                db.open(URL_VAR,  
     | 
| 
      
 1058 
     | 
    
         
            +
                db.open(URL_VAR, Transactd::TYPE_SCHEMA_BDF, Transactd::TD_OPEN_NORMAL)
         
     | 
| 
       908 
1059 
     | 
    
         
             
                expect(db.stat()).to eq 0
         
     | 
| 
       909 
1060 
     | 
    
         
             
              end
         
     | 
| 
       910 
1061 
     | 
    
         
             
              if (0 == db.stat())
         
     | 
| 
         @@ -916,9 +1067,10 @@ def testCreateDatabaseVar(db) 
     | 
|
| 
       916 
1067 
     | 
    
         
             
                testCreateVarTable(db, 4, 'user4', Transactd::Ft_mywvarbinary,  Transactd::CHARSET_CP932)
         
     | 
| 
       917 
1068 
     | 
    
         
             
                testCreateVarTable(db, 5, 'user5', Transactd::Ft_myvarchar,     Transactd::CHARSET_UTF8B4)
         
     | 
| 
       918 
1069 
     | 
    
         
             
                db.close()
         
     | 
| 
       919 
     | 
    
         
            -
                db.open(PROTOCOL + HOSTNAME + DBNAME_VAR + '?dbfile=transactd_schemaname' 
     | 
| 
      
 1070 
     | 
    
         
            +
                db.open(PROTOCOL + HOSTNAME + DBNAME_VAR + '?dbfile=transactd_schemaname')
         
     | 
| 
       920 
1071 
     | 
    
         
             
                expect(db.stat()).to eq 0
         
     | 
| 
       921 
1072 
     | 
    
         
             
              end
         
     | 
| 
      
 1073 
     | 
    
         
            +
              db.close()
         
     | 
| 
       922 
1074 
     | 
    
         
             
            end
         
     | 
| 
       923 
1075 
     | 
    
         | 
| 
       924 
1076 
     | 
    
         
             
            def testDropDatabaseVar(db)
         
     | 
| 
         @@ -1067,7 +1219,8 @@ def testSetGetVar(tb, unicodeField, varCharField) 
     | 
|
| 
       1067 
1219 
     | 
    
         
             
              expect(tb.getFVAstr(FDI_GROUP)).to eq '68'
         
     | 
| 
       1068 
1220 
     | 
    
         
             
            end
         
     | 
| 
       1069 
1221 
     | 
    
         | 
| 
       1070 
     | 
    
         
            -
            def testVarField( 
     | 
| 
      
 1222 
     | 
    
         
            +
            def testVarField()
         
     | 
| 
      
 1223 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       1071 
1224 
     | 
    
         
             
              db.open(URL_VAR)
         
     | 
| 
       1072 
1225 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       1073 
1226 
     | 
    
         
             
              tb = db.openTable('user1')
         
     | 
| 
         @@ -1097,6 +1250,7 @@ def testVarField(db) 
     | 
|
| 
       1097 
1250 
     | 
    
         
             
              # utf8 varchar
         
     | 
| 
       1098 
1251 
     | 
    
         
             
              testSetGetVar(tb, true, true)
         
     | 
| 
       1099 
1252 
     | 
    
         
             
              tb.close()
         
     | 
| 
      
 1253 
     | 
    
         
            +
              db.close()
         
     | 
| 
       1100 
1254 
     | 
    
         
             
            end
         
     | 
| 
       1101 
1255 
     | 
    
         | 
| 
       1102 
1256 
     | 
    
         
             
            def doVarInsert(db, name, codePage, str, startid, endid, bulk)
         
     | 
| 
         @@ -1114,11 +1268,12 @@ def doVarInsert(db, name, codePage, str, startid, endid, bulk) 
     | 
|
| 
       1114 
1268 
     | 
    
         
             
              tb.close()
         
     | 
| 
       1115 
1269 
     | 
    
         
             
            end
         
     | 
| 
       1116 
1270 
     | 
    
         | 
| 
       1117 
     | 
    
         
            -
            def testVarInsert( 
     | 
| 
      
 1271 
     | 
    
         
            +
            def testVarInsert()
         
     | 
| 
       1118 
1272 
     | 
    
         
             
              startid = 1
         
     | 
| 
       1119 
1273 
     | 
    
         
             
              bulk = false
         
     | 
| 
       1120 
1274 
     | 
    
         
             
              str = '漢字文字のテスト' # too long kanji
         
     | 
| 
       1121 
1275 
     | 
    
         
             
              str2 = '123'
         
     | 
| 
      
 1276 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       1122 
1277 
     | 
    
         
             
              db.open(URL_VAR)
         
     | 
| 
       1123 
1278 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       1124 
1279 
     | 
    
         
             
              if (0 == db.stat())
         
     | 
| 
         @@ -1143,6 +1298,7 @@ def testVarInsert(db) 
     | 
|
| 
       1143 
1298 
     | 
    
         
             
                doVarInsert(db, 'user4', Transactd::CP_ACP,   '', startid, endid, bulk)
         
     | 
| 
       1144 
1299 
     | 
    
         
             
                doVarInsert(db, 'user5', Transactd::CP_UTF8,  '', startid, endid, bulk)
         
     | 
| 
       1145 
1300 
     | 
    
         
             
              end
         
     | 
| 
      
 1301 
     | 
    
         
            +
              db.close()
         
     | 
| 
       1146 
1302 
     | 
    
         
             
            end
         
     | 
| 
       1147 
1303 
     | 
    
         | 
| 
       1148 
1304 
     | 
    
         
             
            def doVarRead(db, name, codePage, str, num, key)
         
     | 
| 
         @@ -1167,11 +1323,12 @@ def doVarRead(db, name, codePage, str, num, key) 
     | 
|
| 
       1167 
1323 
     | 
    
         
             
              tb.close()
         
     | 
| 
       1168 
1324 
     | 
    
         
             
            end
         
     | 
| 
       1169 
1325 
     | 
    
         | 
| 
       1170 
     | 
    
         
            -
            def testVarRead( 
     | 
| 
      
 1326 
     | 
    
         
            +
            def testVarRead()
         
     | 
| 
       1171 
1327 
     | 
    
         
             
              str = '漢字文'
         
     | 
| 
       1172 
1328 
     | 
    
         
             
              str3 = '漢字文字のテ'
         
     | 
| 
       1173 
1329 
     | 
    
         
             
              str2 ='123'
         
     | 
| 
       1174 
1330 
     | 
    
         
             
              str4 ='1232'
         
     | 
| 
      
 1331 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       1175 
1332 
     | 
    
         
             
              db.open(URL_VAR)
         
     | 
| 
       1176 
1333 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       1177 
1334 
     | 
    
         
             
              if (0 == db.stat())
         
     | 
| 
         @@ -1198,6 +1355,7 @@ def testVarRead(db) 
     | 
|
| 
       1198 
1355 
     | 
    
         
             
                doVarRead(db, 'user4', Transactd::CP_ACP,   '120', 120, key)
         
     | 
| 
       1199 
1356 
     | 
    
         
             
                doVarRead(db, 'user5', Transactd::CP_UTF8,  '120', 120, key)
         
     | 
| 
       1200 
1357 
     | 
    
         
             
              end
         
     | 
| 
      
 1358 
     | 
    
         
            +
              db.close()
         
     | 
| 
       1201 
1359 
     | 
    
         
             
            end
         
     | 
| 
       1202 
1360 
     | 
    
         | 
| 
       1203 
1361 
     | 
    
         
             
            def doVarFilter(db, name, codePage, str, num, key)
         
     | 
| 
         @@ -1245,7 +1403,8 @@ def doVarFilter(db, name, codePage, str, num, key) 
     | 
|
| 
       1245 
1403 
     | 
    
         
             
              tb.close()
         
     | 
| 
       1246 
1404 
     | 
    
         
             
            end
         
     | 
| 
       1247 
1405 
     | 
    
         | 
| 
       1248 
     | 
    
         
            -
            def testFilterVar( 
     | 
| 
      
 1406 
     | 
    
         
            +
            def testFilterVar()
         
     | 
| 
      
 1407 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       1249 
1408 
     | 
    
         
             
              db.open(URL_VAR)
         
     | 
| 
       1250 
1409 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       1251 
1410 
     | 
    
         
             
              if (0 == db.stat())
         
     | 
| 
         @@ -1277,9 +1436,9 @@ def testFilterVar(db) 
     | 
|
| 
       1277 
1436 
     | 
    
         
             
                doVarFilter(db, 'user4', Transactd::CP_ACP,   '120', 120, key)
         
     | 
| 
       1278 
1437 
     | 
    
         
             
                doVarFilter(db, 'user5', Transactd::CP_UTF8,  '120', 120, key)
         
     | 
| 
       1279 
1438 
     | 
    
         
             
              end
         
     | 
| 
      
 1439 
     | 
    
         
            +
              db.close()
         
     | 
| 
       1280 
1440 
     | 
    
         
             
            end
         
     | 
| 
       1281 
1441 
     | 
    
         | 
| 
       1282 
     | 
    
         
            -
             
     | 
| 
       1283 
1442 
     | 
    
         
             
            def testCreateTableStringFilter(db, id, name, type, type2)
         
     | 
| 
       1284 
1443 
     | 
    
         
             
              # create table
         
     | 
| 
       1285 
1444 
     | 
    
         
             
              dbdef = db.dbDef()
         
     | 
| 
         @@ -1514,14 +1673,15 @@ def doTestStringFilter(db, id, name, type, type2) 
     | 
|
| 
       1514 
1673 
     | 
    
         
             
              tb.close()
         
     | 
| 
       1515 
1674 
     | 
    
         
             
            end
         
     | 
| 
       1516 
1675 
     | 
    
         | 
| 
       1517 
     | 
    
         
            -
            def testStringFilter( 
     | 
| 
      
 1676 
     | 
    
         
            +
            def testStringFilter()
         
     | 
| 
      
 1677 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
       1518 
1678 
     | 
    
         
             
              db.create(URL_SF)
         
     | 
| 
       1519 
1679 
     | 
    
         
             
              if db.stat() == Transactd::STATUS_TABLE_EXISTS_ERROR
         
     | 
| 
       1520 
1680 
     | 
    
         
             
                testDropDatabaseStringFilter(db)
         
     | 
| 
       1521 
1681 
     | 
    
         
             
                db.create(URL_SF)
         
     | 
| 
       1522 
1682 
     | 
    
         
             
              end
         
     | 
| 
       1523 
1683 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       1524 
     | 
    
         
            -
              db.open(URL_SF,  
     | 
| 
      
 1684 
     | 
    
         
            +
              db.open(URL_SF, Transactd::TYPE_SCHEMA_BDF, Transactd::TD_OPEN_NORMAL)
         
     | 
| 
       1525 
1685 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       1526 
1686 
     | 
    
         
             
              doTestStringFilter(   db, 1, 'zstring',    Transactd::Ft_zstring,    Transactd::Ft_wzstring)
         
     | 
| 
       1527 
1687 
     | 
    
         
             
              if (isUtf16leSupport(db))
         
     | 
| 
         @@ -1530,41 +1690,43 @@ def testStringFilter(db) 
     | 
|
| 
       1530 
1690 
     | 
    
         
             
                doTestStringFilter( db, 2, 'myvarchar',  Transactd::Ft_myvarchar,  Transactd::Ft_myvarchar)
         
     | 
| 
       1531 
1691 
     | 
    
         
             
              end
         
     | 
| 
       1532 
1692 
     | 
    
         
             
              doTestStringFilter(   db, 3, 'mytext',     Transactd::Ft_mytext,     Transactd::Ft_myblob)
         
     | 
| 
      
 1693 
     | 
    
         
            +
              db.close()
         
     | 
| 
       1533 
1694 
     | 
    
         
             
            end
         
     | 
| 
       1534 
1695 
     | 
    
         | 
| 
       1535 
1696 
     | 
    
         
             
            def testDropDatabaseStringFilter(db)
         
     | 
| 
       1536 
     | 
    
         
            -
              db.open(URL_SF 
     | 
| 
      
 1697 
     | 
    
         
            +
              db.open(URL_SF)
         
     | 
| 
       1537 
1698 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       1538 
1699 
     | 
    
         
             
              db.drop()
         
     | 
| 
       1539 
1700 
     | 
    
         
             
              expect(db.stat()).to eq 0
         
     | 
| 
       1540 
1701 
     | 
    
         
             
            end
         
     | 
| 
       1541 
1702 
     | 
    
         | 
| 
       1542 
1703 
     | 
    
         
             
            def testQuery()
         
     | 
| 
       1543 
     | 
    
         
            -
              q = Transactd:: 
     | 
| 
      
 1704 
     | 
    
         
            +
              q = Transactd::Query.new()
         
     | 
| 
       1544 
1705 
     | 
    
         
             
              q.queryString("id = 0 and name = 'Abc efg'")
         
     | 
| 
       1545 
1706 
     | 
    
         
             
              expect(q.toString()).to eq "id = '0' and name = 'Abc efg'"
         
     | 
| 
       1546 
1707 
     | 
    
         | 
| 
       1547 
1708 
     | 
    
         
             
              q.queryString('')
         
     | 
| 
       1548 
     | 
    
         
            -
              q.where('id', '=', '0'). 
     | 
| 
      
 1709 
     | 
    
         
            +
              q.where('id', '=', '0').and_('name', '=', 'Abc efg')
         
     | 
| 
       1549 
1710 
     | 
    
         
             
              expect(q.toString()).to eq "id = '0' and name = 'Abc efg'"
         
     | 
| 
       1550 
1711 
     | 
    
         | 
| 
       1551 
1712 
     | 
    
         
             
              q.queryString("select id,name id = 0 AND name = 'Abc&' efg'")
         
     | 
| 
       1552 
1713 
     | 
    
         
             
              expect(q.toString()).to eq "select id,name id = '0' AND name = 'Abc&' efg'"
         
     | 
| 
       1553 
1714 
     | 
    
         | 
| 
       1554 
1715 
     | 
    
         
             
              q.queryString('')
         
     | 
| 
       1555 
     | 
    
         
            -
              q.select('id', 'name').where('id', '=', '0'). 
     | 
| 
      
 1716 
     | 
    
         
            +
              q.select('id', 'name').where('id', '=', '0').and_('name', '=', "Abc' efg")
         
     | 
| 
       1556 
1717 
     | 
    
         
             
              expect(q.toString()).to eq "select id,name id = '0' and name = 'Abc&' efg'"
         
     | 
| 
       1557 
1718 
     | 
    
         | 
| 
       1558 
1719 
     | 
    
         
             
              q.queryString("select id,name id = 0 AND name = 'Abc&& efg'")
         
     | 
| 
       1559 
1720 
     | 
    
         
             
              expect(q.toString()).to eq "select id,name id = '0' AND name = 'Abc&& efg'"
         
     | 
| 
       1560 
1721 
     | 
    
         | 
| 
       1561 
1722 
     | 
    
         
             
              q.queryString('')
         
     | 
| 
       1562 
     | 
    
         
            -
              q.select('id', 'name').where('id', '=', '0'). 
     | 
| 
      
 1723 
     | 
    
         
            +
              q.select('id', 'name').where('id', '=', '0').and_('name', '=', 'Abc& efg')
         
     | 
| 
       1563 
1724 
     | 
    
         
             
              expect(q.toString()).to eq "select id,name id = '0' and name = 'Abc&& efg'"
         
     | 
| 
       1564 
1725 
     | 
    
         | 
| 
       1565 
1726 
     | 
    
         
             
              q.queryString('*')
         
     | 
| 
       1566 
1727 
     | 
    
         
             
              expect(q.toString()).to eq '*'
         
     | 
| 
       1567 
1728 
     | 
    
         | 
| 
      
 1729 
     | 
    
         
            +
              q.queryString('')
         
     | 
| 
       1568 
1730 
     | 
    
         
             
              q.all()
         
     | 
| 
       1569 
1731 
     | 
    
         
             
              expect(q.toString()).to eq '*'
         
     | 
| 
       1570 
1732 
     | 
    
         | 
| 
         @@ -1586,7 +1748,7 @@ def testQuery() 
     | 
|
| 
       1586 
1748 
     | 
    
         
             
              expect(q.toString()).to eq "select id,name,fc id = '2' and name = '3'"
         
     | 
| 
       1587 
1749 
     | 
    
         | 
| 
       1588 
1750 
     | 
    
         
             
              q.queryString('')
         
     | 
| 
       1589 
     | 
    
         
            -
              q.select('id', 'name', 'fc').where('id', '=', '2'). 
     | 
| 
      
 1751 
     | 
    
         
            +
              q.select('id', 'name', 'fc').where('id', '=', '2').and_('name', '=', '3')
         
     | 
| 
       1590 
1752 
     | 
    
         
             
              expect(q.toString()).to eq "select id,name,fc id = '2' and name = '3'"
         
     | 
| 
       1591 
1753 
     | 
    
         | 
| 
       1592 
1754 
     | 
    
         
             
              #  IN include
         
     | 
| 
         @@ -1594,7 +1756,7 @@ def testQuery() 
     | 
|
| 
       1594 
1756 
     | 
    
         
             
              expect(q.toString()).to eq "select id,name,fc in '1','2','3'"
         
     | 
| 
       1595 
1757 
     | 
    
         | 
| 
       1596 
1758 
     | 
    
         
             
              q.queryString('')
         
     | 
| 
       1597 
     | 
    
         
            -
              q.select('id', 'name', 'fc'). 
     | 
| 
      
 1759 
     | 
    
         
            +
              q.select('id', 'name', 'fc').in('1', '2', '3')
         
     | 
| 
       1598 
1760 
     | 
    
         
             
              expect(q.toString()).to eq "select id,name,fc in '1','2','3'"
         
     | 
| 
       1599 
1761 
     | 
    
         | 
| 
       1600 
1762 
     | 
    
         
             
              q.queryString("IN '1','2','3'")
         
     | 
| 
         @@ -1604,7 +1766,7 @@ def testQuery() 
     | 
|
| 
       1604 
1766 
     | 
    
         
             
              expect(q.toString()).to eq "in '1','2','3'"
         
     | 
| 
       1605 
1767 
     | 
    
         | 
| 
       1606 
1768 
     | 
    
         
             
              q.queryString('')
         
     | 
| 
       1607 
     | 
    
         
            -
              q. 
     | 
| 
      
 1769 
     | 
    
         
            +
              q.in('1', '2', '3')
         
     | 
| 
       1608 
1770 
     | 
    
         
             
              expect(q.toString()).to eq "in '1','2','3'"
         
     | 
| 
       1609 
1771 
     | 
    
         | 
| 
       1610 
1772 
     | 
    
         
             
              # special field name
         
     | 
| 
         @@ -1621,171 +1783,601 @@ def testQuery() 
     | 
|
| 
       1621 
1783 
     | 
    
         
             
              q.queryString('')
         
     | 
| 
       1622 
1784 
     | 
    
         
             
              q.where('in', '<>', '1')
         
     | 
| 
       1623 
1785 
     | 
    
         
             
              expect(q.toString()).to eq "in <> '1'"
         
     | 
| 
      
 1786 
     | 
    
         
            +
              
         
     | 
| 
      
 1787 
     | 
    
         
            +
              # test auto_escape
         
     | 
| 
      
 1788 
     | 
    
         
            +
              q.queryString("code = ab'c", true)
         
     | 
| 
      
 1789 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'ab&'c'"
         
     | 
| 
      
 1790 
     | 
    
         
            +
              
         
     | 
| 
      
 1791 
     | 
    
         
            +
              q.queryString("code = ab&c", true)
         
     | 
| 
      
 1792 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'ab&&c'"
         
     | 
| 
      
 1793 
     | 
    
         
            +
              
         
     | 
| 
      
 1794 
     | 
    
         
            +
              q.queryString("code = abc&", true)
         
     | 
| 
      
 1795 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'abc&&'"
         
     | 
| 
      
 1796 
     | 
    
         
            +
              q.queryString("code = abc&&", true)
         
     | 
| 
      
 1797 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'abc&&&&'"
         
     | 
| 
      
 1798 
     | 
    
         
            +
              
         
     | 
| 
      
 1799 
     | 
    
         
            +
              q.queryString("code = 'abc&'", true)
         
     | 
| 
      
 1800 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'abc&&'"
         
     | 
| 
      
 1801 
     | 
    
         
            +
              q.queryString("code = 'abc&&'", true)
         
     | 
| 
      
 1802 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'abc&&&&'"
         
     | 
| 
      
 1803 
     | 
    
         
            +
              
         
     | 
| 
      
 1804 
     | 
    
         
            +
              q.queryString("code = 'ab'c'", true)
         
     | 
| 
      
 1805 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'ab&'c'"
         
     | 
| 
      
 1806 
     | 
    
         
            +
              
         
     | 
| 
      
 1807 
     | 
    
         
            +
              q.queryString("code = 'abc''", true)
         
     | 
| 
      
 1808 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'abc&''"
         
     | 
| 
      
 1809 
     | 
    
         
            +
              
         
     | 
| 
      
 1810 
     | 
    
         
            +
              q.queryString("code = abc'", true)
         
     | 
| 
      
 1811 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'abc&''"
         
     | 
| 
      
 1812 
     | 
    
         
            +
              
         
     | 
| 
      
 1813 
     | 
    
         
            +
              # Invalid single quote (') on the end of statement
         
     | 
| 
      
 1814 
     | 
    
         
            +
              q.queryString("code = 'abc", true)
         
     | 
| 
      
 1815 
     | 
    
         
            +
              expect(q.toString()).to eq "code = 'abc'"
         
     | 
| 
      
 1816 
     | 
    
         
            +
              
         
     | 
| 
      
 1817 
     | 
    
         
            +
              q.queryString("code = &abc", true)
         
     | 
| 
      
 1818 
     | 
    
         
            +
              expect(q.toString()).to eq "code = '&&abc'"
         
     | 
| 
       1624 
1819 
     | 
    
         
             
            end
         
     | 
| 
       1625 
1820 
     | 
    
         | 
| 
      
 1821 
     | 
    
         
            +
            def createQTuser(db)
         
     | 
| 
      
 1822 
     | 
    
         
            +
              dbdef = db.dbDef()
         
     | 
| 
      
 1823 
     | 
    
         
            +
              td = Transactd::Tabledef.new()
         
     | 
| 
      
 1824 
     | 
    
         
            +
              td.setTableName('user')
         
     | 
| 
      
 1825 
     | 
    
         
            +
              td.setFileName('user.dat')
         
     | 
| 
      
 1826 
     | 
    
         
            +
              id = 1
         
     | 
| 
      
 1827 
     | 
    
         
            +
              td.id = id
         
     | 
| 
      
 1828 
     | 
    
         
            +
              td.pageSize = 2048
         
     | 
| 
      
 1829 
     | 
    
         
            +
              td.schemaCodePage = Transactd::CP_UTF8
         
     | 
| 
      
 1830 
     | 
    
         
            +
              td.charsetIndex = Transactd::CHARSET_UTF8B4
         
     | 
| 
      
 1831 
     | 
    
         
            +
              dbdef.insertTable(td)
         
     | 
| 
      
 1832 
     | 
    
         
            +
              expect(dbdef.stat()).to eq 0
         
     | 
| 
      
 1833 
     | 
    
         
            +
              # id field
         
     | 
| 
      
 1834 
     | 
    
         
            +
              fd = dbdef.insertField(id, 0)
         
     | 
| 
      
 1835 
     | 
    
         
            +
              fd.setName('id')
         
     | 
| 
      
 1836 
     | 
    
         
            +
              fd.type = Transactd::Ft_autoinc
         
     | 
| 
      
 1837 
     | 
    
         
            +
              fd.len = 4
         
     | 
| 
      
 1838 
     | 
    
         
            +
              # 名前 field
         
     | 
| 
      
 1839 
     | 
    
         
            +
              fd = dbdef.insertField(id, 1)
         
     | 
| 
      
 1840 
     | 
    
         
            +
              fd.setName('名前')
         
     | 
| 
      
 1841 
     | 
    
         
            +
              fd.type = Transactd::Ft_myvarchar
         
     | 
| 
      
 1842 
     | 
    
         
            +
              fd.setLenByCharnum(20)
         
     | 
| 
      
 1843 
     | 
    
         
            +
              # group field
         
     | 
| 
      
 1844 
     | 
    
         
            +
              fd = dbdef.insertField(id, 2)
         
     | 
| 
      
 1845 
     | 
    
         
            +
              fd.setName('group')
         
     | 
| 
      
 1846 
     | 
    
         
            +
              fd.type = Transactd::Ft_integer
         
     | 
| 
      
 1847 
     | 
    
         
            +
              fd.len = 4
         
     | 
| 
      
 1848 
     | 
    
         
            +
              # tel field
         
     | 
| 
      
 1849 
     | 
    
         
            +
              fd = dbdef.insertField(id, 3)
         
     | 
| 
      
 1850 
     | 
    
         
            +
              fd.setName('tel')
         
     | 
| 
      
 1851 
     | 
    
         
            +
              fd.type = Transactd::Ft_myvarchar
         
     | 
| 
      
 1852 
     | 
    
         
            +
              fd.setLenByCharnum(20)
         
     | 
| 
      
 1853 
     | 
    
         
            +
              # key 0 (primary) id
         
     | 
| 
      
 1854 
     | 
    
         
            +
              kd = dbdef.insertKey(id, 0)
         
     | 
| 
      
 1855 
     | 
    
         
            +
              kd.segment(0).fieldNum = 0
         
     | 
| 
      
 1856 
     | 
    
         
            +
              kd.segment(0).flags.bit8 = 1 # extended key type
         
     | 
| 
      
 1857 
     | 
    
         
            +
              kd.segment(0).flags.bit1 = 1 # changeable
         
     | 
| 
      
 1858 
     | 
    
         
            +
              kd.segmentCount = 1
         
     | 
| 
      
 1859 
     | 
    
         
            +
              td = dbdef.tableDefs(id)
         
     | 
| 
      
 1860 
     | 
    
         
            +
              td.primaryKeyNum = 0
         
     | 
| 
      
 1861 
     | 
    
         
            +
              # key 1 group
         
     | 
| 
      
 1862 
     | 
    
         
            +
              kd = dbdef.insertKey(id, 1)
         
     | 
| 
      
 1863 
     | 
    
         
            +
              kd.segment(0).fieldNum = 2
         
     | 
| 
      
 1864 
     | 
    
         
            +
              kd.segment(0).flags.bit8 = 1 # extended key type
         
     | 
| 
      
 1865 
     | 
    
         
            +
              kd.segment(0).flags.bit1 = 1 # changeable
         
     | 
| 
      
 1866 
     | 
    
         
            +
              kd.segment(0).flags.bit0 = 1 # duplicatable
         
     | 
| 
      
 1867 
     | 
    
         
            +
              kd.segmentCount = 1
         
     | 
| 
      
 1868 
     | 
    
         
            +
              # update
         
     | 
| 
      
 1869 
     | 
    
         
            +
              dbdef.updateTableDef(id)
         
     | 
| 
      
 1870 
     | 
    
         
            +
              expect(dbdef.stat()).to eq 0
         
     | 
| 
      
 1871 
     | 
    
         
            +
              # open test
         
     | 
| 
      
 1872 
     | 
    
         
            +
              tb = db.openTable(id)
         
     | 
| 
      
 1873 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 1874 
     | 
    
         
            +
              tb.close() if tb != nil
         
     | 
| 
      
 1875 
     | 
    
         
            +
              return true
         
     | 
| 
      
 1876 
     | 
    
         
            +
            end
         
     | 
| 
       1626 
1877 
     | 
    
         | 
| 
       1627 
     | 
    
         
            -
             
     | 
| 
       1628 
     | 
    
         
            -
               
     | 
| 
       1629 
     | 
    
         
            -
             
     | 
| 
      
 1878 
     | 
    
         
            +
            def createQTgroups(db)
         
     | 
| 
      
 1879 
     | 
    
         
            +
              dbdef = db.dbDef()
         
     | 
| 
      
 1880 
     | 
    
         
            +
              td = Transactd::Tabledef.new()
         
     | 
| 
      
 1881 
     | 
    
         
            +
              td.setTableName('groups')
         
     | 
| 
      
 1882 
     | 
    
         
            +
              td.setFileName('groups.dat')
         
     | 
| 
      
 1883 
     | 
    
         
            +
              id = 2
         
     | 
| 
      
 1884 
     | 
    
         
            +
              td.id = id
         
     | 
| 
      
 1885 
     | 
    
         
            +
              td.pageSize = 2048
         
     | 
| 
      
 1886 
     | 
    
         
            +
              td.schemaCodePage = Transactd::CP_UTF8
         
     | 
| 
      
 1887 
     | 
    
         
            +
              td.charsetIndex = Transactd::CHARSET_UTF8B4
         
     | 
| 
      
 1888 
     | 
    
         
            +
              dbdef.insertTable(td)
         
     | 
| 
      
 1889 
     | 
    
         
            +
              expect(dbdef.stat()).to eq 0
         
     | 
| 
      
 1890 
     | 
    
         
            +
              # code field
         
     | 
| 
      
 1891 
     | 
    
         
            +
              fd = dbdef.insertField(id, 0)
         
     | 
| 
      
 1892 
     | 
    
         
            +
              fd.setName('code')
         
     | 
| 
      
 1893 
     | 
    
         
            +
              fd.type = Transactd::Ft_integer
         
     | 
| 
      
 1894 
     | 
    
         
            +
              fd.len = 4
         
     | 
| 
      
 1895 
     | 
    
         
            +
              # name field
         
     | 
| 
      
 1896 
     | 
    
         
            +
              fd = dbdef.insertField(id, 1)
         
     | 
| 
      
 1897 
     | 
    
         
            +
              fd.setName('name')
         
     | 
| 
      
 1898 
     | 
    
         
            +
              fd.type = Transactd::Ft_myvarbinary
         
     | 
| 
      
 1899 
     | 
    
         
            +
              fd.len = 33
         
     | 
| 
      
 1900 
     | 
    
         
            +
              # key 0 (primary) code
         
     | 
| 
      
 1901 
     | 
    
         
            +
              kd = dbdef.insertKey(id, 0)
         
     | 
| 
      
 1902 
     | 
    
         
            +
              kd.segment(0).fieldNum = 0
         
     | 
| 
      
 1903 
     | 
    
         
            +
              kd.segment(0).flags.bit8 = 1  # extended key type
         
     | 
| 
      
 1904 
     | 
    
         
            +
              kd.segment(0).flags.bit1 = 1  # changeable
         
     | 
| 
      
 1905 
     | 
    
         
            +
              kd.segmentCount = 1
         
     | 
| 
      
 1906 
     | 
    
         
            +
              td = dbdef.tableDefs(id)
         
     | 
| 
      
 1907 
     | 
    
         
            +
              td.primaryKeyNum = 0
         
     | 
| 
      
 1908 
     | 
    
         
            +
              # update
         
     | 
| 
      
 1909 
     | 
    
         
            +
              dbdef.updateTableDef(id)
         
     | 
| 
      
 1910 
     | 
    
         
            +
              expect(dbdef.stat()).to eq 0
         
     | 
| 
      
 1911 
     | 
    
         
            +
              # open test
         
     | 
| 
      
 1912 
     | 
    
         
            +
              tb = db.openTable(id)
         
     | 
| 
      
 1913 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 1914 
     | 
    
         
            +
              tb.close() if tb != nil
         
     | 
| 
      
 1915 
     | 
    
         
            +
              return true
         
     | 
| 
      
 1916 
     | 
    
         
            +
            end
         
     | 
| 
      
 1917 
     | 
    
         
            +
             
     | 
| 
      
 1918 
     | 
    
         
            +
            def createQTextention(db)
         
     | 
| 
      
 1919 
     | 
    
         
            +
              dbdef = db.dbDef()
         
     | 
| 
      
 1920 
     | 
    
         
            +
              td = Transactd::Tabledef.new()
         
     | 
| 
      
 1921 
     | 
    
         
            +
              td.setTableName('extention')
         
     | 
| 
      
 1922 
     | 
    
         
            +
              td.setFileName('extention.dat')
         
     | 
| 
      
 1923 
     | 
    
         
            +
              id = 3
         
     | 
| 
      
 1924 
     | 
    
         
            +
              td.id = id
         
     | 
| 
      
 1925 
     | 
    
         
            +
              td.pageSize = 2048
         
     | 
| 
      
 1926 
     | 
    
         
            +
              td.schemaCodePage = Transactd::CP_UTF8
         
     | 
| 
      
 1927 
     | 
    
         
            +
              td.charsetIndex = Transactd::CHARSET_UTF8B4
         
     | 
| 
      
 1928 
     | 
    
         
            +
              dbdef.insertTable(td)
         
     | 
| 
      
 1929 
     | 
    
         
            +
              expect(dbdef.stat()).to eq 0
         
     | 
| 
      
 1930 
     | 
    
         
            +
              # id field
         
     | 
| 
      
 1931 
     | 
    
         
            +
              fd = dbdef.insertField(id, 0)
         
     | 
| 
      
 1932 
     | 
    
         
            +
              fd.setName('id')
         
     | 
| 
      
 1933 
     | 
    
         
            +
              fd.type = Transactd::Ft_integer
         
     | 
| 
      
 1934 
     | 
    
         
            +
              fd.len = 4
         
     | 
| 
      
 1935 
     | 
    
         
            +
              # comment field
         
     | 
| 
      
 1936 
     | 
    
         
            +
              fd = dbdef.insertField(id, 1)
         
     | 
| 
      
 1937 
     | 
    
         
            +
              fd.setName('comment')
         
     | 
| 
      
 1938 
     | 
    
         
            +
              fd.type = Transactd::Ft_myvarchar
         
     | 
| 
      
 1939 
     | 
    
         
            +
              fd.setLenByCharnum(60)
         
     | 
| 
      
 1940 
     | 
    
         
            +
              # key 0 (primary) id
         
     | 
| 
      
 1941 
     | 
    
         
            +
              kd = dbdef.insertKey(id, 0)
         
     | 
| 
      
 1942 
     | 
    
         
            +
              kd.segment(0).fieldNum = 0
         
     | 
| 
      
 1943 
     | 
    
         
            +
              kd.segment(0).flags.bit8 = 1  # extended key type
         
     | 
| 
      
 1944 
     | 
    
         
            +
              kd.segment(0).flags.bit1 = 1  # changeable
         
     | 
| 
      
 1945 
     | 
    
         
            +
              kd.segmentCount = 1
         
     | 
| 
      
 1946 
     | 
    
         
            +
              td = dbdef.tableDefs(id)
         
     | 
| 
      
 1947 
     | 
    
         
            +
              td.primaryKeyNum = 0
         
     | 
| 
      
 1948 
     | 
    
         
            +
              # update
         
     | 
| 
      
 1949 
     | 
    
         
            +
              dbdef.updateTableDef(id)
         
     | 
| 
      
 1950 
     | 
    
         
            +
              expect(dbdef.stat()).to eq 0
         
     | 
| 
      
 1951 
     | 
    
         
            +
              # open test
         
     | 
| 
      
 1952 
     | 
    
         
            +
              tb = db.openTable(id)
         
     | 
| 
      
 1953 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 1954 
     | 
    
         
            +
              tb.close() if tb != nil
         
     | 
| 
      
 1955 
     | 
    
         
            +
              return true
         
     | 
| 
      
 1956 
     | 
    
         
            +
            end
         
     | 
| 
      
 1957 
     | 
    
         
            +
             
     | 
| 
      
 1958 
     | 
    
         
            +
            def insertQT(db, maxId)
         
     | 
| 
      
 1959 
     | 
    
         
            +
              db.beginTrn()
         
     | 
| 
      
 1960 
     | 
    
         
            +
              # insert user data
         
     | 
| 
      
 1961 
     | 
    
         
            +
              tb = db.openTable('user', Transactd::TD_OPEN_NORMAL)
         
     | 
| 
      
 1962 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 1963 
     | 
    
         
            +
              tb.clearBuffer()
         
     | 
| 
      
 1964 
     | 
    
         
            +
              for i in 1..maxId
         
     | 
| 
      
 1965 
     | 
    
         
            +
                tb.setFV(0, i)
         
     | 
| 
      
 1966 
     | 
    
         
            +
                tb.setFV(1, "#{i} user")
         
     | 
| 
      
 1967 
     | 
    
         
            +
                tb.setFV('group', ((i - 1) % 5) + 1)
         
     | 
| 
      
 1968 
     | 
    
         
            +
                tb.insert()
         
     | 
| 
      
 1969 
     | 
    
         
            +
                expect(tb.stat()).to eq 0
         
     | 
| 
       1630 
1970 
     | 
    
         
             
              end
         
     | 
| 
       1631 
     | 
    
         
            -
               
     | 
| 
       1632 
     | 
    
         
            -
             
     | 
| 
       1633 
     | 
    
         
            -
             
     | 
| 
      
 1971 
     | 
    
         
            +
              tb.close()
         
     | 
| 
      
 1972 
     | 
    
         
            +
              # insert groups data
         
     | 
| 
      
 1973 
     | 
    
         
            +
              tb = db.openTable('groups', Transactd::TD_OPEN_NORMAL)
         
     | 
| 
      
 1974 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 1975 
     | 
    
         
            +
              tb.clearBuffer()
         
     | 
| 
      
 1976 
     | 
    
         
            +
              for i in 1..100
         
     | 
| 
      
 1977 
     | 
    
         
            +
                tb.setFV(0, i)
         
     | 
| 
      
 1978 
     | 
    
         
            +
                tb.setFV(1, "#{i} group")
         
     | 
| 
      
 1979 
     | 
    
         
            +
                tb.insert()
         
     | 
| 
      
 1980 
     | 
    
         
            +
                expect(tb.stat()).to eq 0
         
     | 
| 
      
 1981 
     | 
    
         
            +
              end
         
     | 
| 
      
 1982 
     | 
    
         
            +
              tb.close()
         
     | 
| 
      
 1983 
     | 
    
         
            +
              # insert extention data
         
     | 
| 
      
 1984 
     | 
    
         
            +
              tb = db.openTable('extention', Transactd::TD_OPEN_NORMAL)
         
     | 
| 
      
 1985 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 1986 
     | 
    
         
            +
              tb.clearBuffer()
         
     | 
| 
      
 1987 
     | 
    
         
            +
              for i in 1..maxId
         
     | 
| 
      
 1988 
     | 
    
         
            +
                tb.setFV(0, i)
         
     | 
| 
      
 1989 
     | 
    
         
            +
                tb.setFV(1, "#{i} comment")
         
     | 
| 
      
 1990 
     | 
    
         
            +
                tb.insert()
         
     | 
| 
      
 1991 
     | 
    
         
            +
                expect(tb.stat()).to eq 0
         
     | 
| 
       1634 
1992 
     | 
    
         
             
              end
         
     | 
| 
      
 1993 
     | 
    
         
            +
              tb.close()
         
     | 
| 
      
 1994 
     | 
    
         
            +
              db.endTrn()
         
     | 
| 
      
 1995 
     | 
    
         
            +
            end
         
     | 
| 
      
 1996 
     | 
    
         
            +
             
     | 
| 
      
 1997 
     | 
    
         
            +
            def testCreateQueryTest()
         
     | 
| 
      
 1998 
     | 
    
         
            +
              # check database existence
         
     | 
| 
      
 1999 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 2000 
     | 
    
         
            +
              db.open(URL_QT, Transactd::TYPE_SCHEMA_BDF, Transactd::TD_OPEN_NORMAL)
         
     | 
| 
      
 2001 
     | 
    
         
            +
              if (db.stat() === 0)
         
     | 
| 
      
 2002 
     | 
    
         
            +
                  db.close()
         
     | 
| 
      
 2003 
     | 
    
         
            +
                  return
         
     | 
| 
      
 2004 
     | 
    
         
            +
              end
         
     | 
| 
      
 2005 
     | 
    
         
            +
              puts "\nDatabase " + DBNAME_QT + " not found\n"
         
     | 
| 
      
 2006 
     | 
    
         
            +
              db.create(URL_QT)
         
     | 
| 
      
 2007 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 2008 
     | 
    
         
            +
              db.open(URL_QT, Transactd::TYPE_SCHEMA_BDF, Transactd::TD_OPEN_NORMAL)
         
     | 
| 
      
 2009 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 2010 
     | 
    
         
            +
              # create tables
         
     | 
| 
      
 2011 
     | 
    
         
            +
              createQTuser(db)
         
     | 
| 
      
 2012 
     | 
    
         
            +
              createQTgroups(db)
         
     | 
| 
      
 2013 
     | 
    
         
            +
              createQTextention(db)
         
     | 
| 
      
 2014 
     | 
    
         
            +
              # insert data
         
     | 
| 
      
 2015 
     | 
    
         
            +
              insertQT(db, 20000)
         
     | 
| 
      
 2016 
     | 
    
         
            +
              db.close()
         
     | 
| 
      
 2017 
     | 
    
         
            +
            end
         
     | 
| 
      
 2018 
     | 
    
         
            +
             
     | 
| 
      
 2019 
     | 
    
         
            +
            def testNewDelete()
         
     | 
| 
      
 2020 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 2021 
     | 
    
         
            +
              db.open(URL_QT)
         
     | 
| 
      
 2022 
     | 
    
         
            +
              for i in 0..499
         
     | 
| 
      
 2023 
     | 
    
         
            +
                q  = Transactd::Query.new()
         
     | 
| 
      
 2024 
     | 
    
         
            +
                rq = Transactd::RecordsetQuery.new()
         
     | 
| 
      
 2025 
     | 
    
         
            +
                gq = Transactd::GroupQuery.new()
         
     | 
| 
      
 2026 
     | 
    
         
            +
                f  = Transactd::FieldNames.new()
         
     | 
| 
      
 2027 
     | 
    
         
            +
                f.addValue('abc')
         
     | 
| 
      
 2028 
     | 
    
         
            +
                atu = Transactd::ActiveTable.new(db, 'user')
         
     | 
| 
      
 2029 
     | 
    
         
            +
                atu.index(0)
         
     | 
| 
      
 2030 
     | 
    
         
            +
                atg = Transactd::ActiveTable.new(db, 'groups')
         
     | 
| 
      
 2031 
     | 
    
         
            +
                atg.index(0)
         
     | 
| 
      
 2032 
     | 
    
         
            +
                fns = Transactd::FieldNames.new()
         
     | 
| 
      
 2033 
     | 
    
         
            +
                fns.keyField('a')
         
     | 
| 
      
 2034 
     | 
    
         
            +
                s = Transactd::Sum.new(fns)
         
     | 
| 
      
 2035 
     | 
    
         
            +
                c = Transactd::Count.new('a')
         
     | 
| 
      
 2036 
     | 
    
         
            +
                a = Transactd::Avg.new(fns)
         
     | 
| 
      
 2037 
     | 
    
         
            +
                mi = Transactd::Min.new(fns)
         
     | 
| 
      
 2038 
     | 
    
         
            +
                ma = Transactd::Max.new(fns)
         
     | 
| 
      
 2039 
     | 
    
         
            +
                rs = Transactd::Recordset.new()
         
     | 
| 
      
 2040 
     | 
    
         
            +
                # have to explicitly release
         
     | 
| 
      
 2041 
     | 
    
         
            +
                atu.release()
         
     | 
| 
      
 2042 
     | 
    
         
            +
                atg.release()
         
     | 
| 
      
 2043 
     | 
    
         
            +
              end
         
     | 
| 
      
 2044 
     | 
    
         
            +
              db.close()
         
     | 
| 
      
 2045 
     | 
    
         
            +
            end
         
     | 
| 
      
 2046 
     | 
    
         
            +
             
     | 
| 
      
 2047 
     | 
    
         
            +
            def testJoin()
         
     | 
| 
      
 2048 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 2049 
     | 
    
         
            +
              db.open(URL_QT)
         
     | 
| 
      
 2050 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 2051 
     | 
    
         
            +
              atu = Transactd::ActiveTable.new(db, 'user')
         
     | 
| 
      
 2052 
     | 
    
         
            +
              atg = Transactd::ActiveTable.new(db, 'groups')
         
     | 
| 
      
 2053 
     | 
    
         
            +
              ate = Transactd::ActiveTable.new(db, 'extention')
         
     | 
| 
      
 2054 
     | 
    
         
            +
              q = Transactd::Query.new()
         
     | 
| 
      
 2055 
     | 
    
         
            +
              
         
     | 
| 
      
 2056 
     | 
    
         
            +
              atu.alias('名前', 'name')
         
     | 
| 
      
 2057 
     | 
    
         
            +
              q.select('id', 'name', 'group').where('id', '<=', '15000')
         
     | 
| 
      
 2058 
     | 
    
         
            +
              rs = atu.index(0).keyValue('1').read(q)
         
     | 
| 
      
 2059 
     | 
    
         
            +
              expect(rs.size()).to eq 15000
         
     | 
| 
      
 2060 
     | 
    
         
            +
              
         
     | 
| 
      
 2061 
     | 
    
         
            +
              # Join extention::comment
         
     | 
| 
      
 2062 
     | 
    
         
            +
              q.reset()
         
     | 
| 
      
 2063 
     | 
    
         
            +
              ate.index(0).join(rs,
         
     | 
| 
      
 2064 
     | 
    
         
            +
                q.select('comment').optimize(Transactd::QueryBase::JoinHasOneOrHasMany), 'id')
         
     | 
| 
      
 2065 
     | 
    
         
            +
              expect(rs.size()).to eq 15000
         
     | 
| 
      
 2066 
     | 
    
         
            +
              
         
     | 
| 
      
 2067 
     | 
    
         
            +
              # reverse and get first (so it means 'get last')
         
     | 
| 
      
 2068 
     | 
    
         
            +
              last = rs.reverse().first()
         
     | 
| 
      
 2069 
     | 
    
         
            +
              expect(last['id']).to eq 15000
         
     | 
| 
      
 2070 
     | 
    
         
            +
              expect(last['comment']).to eq '15000 comment'
         
     | 
| 
      
 2071 
     | 
    
         
            +
              
         
     | 
| 
      
 2072 
     | 
    
         
            +
              # Join group::name
         
     | 
| 
      
 2073 
     | 
    
         
            +
              q.reset()
         
     | 
| 
      
 2074 
     | 
    
         
            +
              atg.alias('name', 'group_name')
         
     | 
| 
      
 2075 
     | 
    
         
            +
              atg.index(0).join(rs, q.select('group_name'), 'group')
         
     | 
| 
      
 2076 
     | 
    
         
            +
              expect(rs.size()).to eq 15000
         
     | 
| 
      
 2077 
     | 
    
         
            +
              
         
     | 
| 
      
 2078 
     | 
    
         
            +
              # get last (the rs is reversed, so it means 'get first')
         
     | 
| 
      
 2079 
     | 
    
         
            +
              first = rs.last()
         
     | 
| 
      
 2080 
     | 
    
         
            +
              expect(first['id']).to eq 1
         
     | 
| 
      
 2081 
     | 
    
         
            +
              expect(first['comment']).to eq '1 comment'
         
     | 
| 
      
 2082 
     | 
    
         
            +
              expect(first['group_name']).to eq '1 group'
         
     | 
| 
      
 2083 
     | 
    
         
            +
              
         
     | 
| 
      
 2084 
     | 
    
         
            +
              # row in rs[15000 - 9]
         
     | 
| 
      
 2085 
     | 
    
         
            +
              rec = rs[15000 - 9]
         
     | 
| 
      
 2086 
     | 
    
         
            +
              expect(rec['group_name']).to eq '4 group'
         
     | 
| 
      
 2087 
     | 
    
         
            +
              
         
     | 
| 
      
 2088 
     | 
    
         
            +
              # orderby
         
     | 
| 
      
 2089 
     | 
    
         
            +
              rs.orderBy('group_name')
         
     | 
| 
      
 2090 
     | 
    
         
            +
              for i in 0..(15000 / 5 - 1)
         
     | 
| 
      
 2091 
     | 
    
         
            +
                expect(rs[i]['group_name']).to eq '1 group'
         
     | 
| 
      
 2092 
     | 
    
         
            +
              end
         
     | 
| 
      
 2093 
     | 
    
         
            +
              expect(rs[15000 / 5]['group_name']).to eq '2 group'
         
     | 
| 
      
 2094 
     | 
    
         
            +
              expect(rs[(15000 / 5) * 2]['group_name']).to eq '3 group'
         
     | 
| 
      
 2095 
     | 
    
         
            +
              expect(rs[(15000 / 5) * 3]['group_name']).to eq '4 group'
         
     | 
| 
      
 2096 
     | 
    
         
            +
              expect(rs[(15000 / 5) * 4]['group_name']).to eq '5 group'
         
     | 
| 
      
 2097 
     | 
    
         
            +
              
         
     | 
| 
      
 2098 
     | 
    
         
            +
              # union
         
     | 
| 
      
 2099 
     | 
    
         
            +
              q.reset()
         
     | 
| 
      
 2100 
     | 
    
         
            +
              q.select('id', 'name', 'group').where('id', '<=', '16000')
         
     | 
| 
      
 2101 
     | 
    
         
            +
              rs2 = atu.index(0).keyValue('15001').read(q)
         
     | 
| 
      
 2102 
     | 
    
         
            +
              expect(rs2.size()).to eq 1000
         
     | 
| 
      
 2103 
     | 
    
         
            +
              q.reset()
         
     | 
| 
      
 2104 
     | 
    
         
            +
              ate.index(0).join(rs2,
         
     | 
| 
      
 2105 
     | 
    
         
            +
                q.select('comment').optimize(Transactd::QueryBase::JoinHasOneOrHasMany), 'id')
         
     | 
| 
      
 2106 
     | 
    
         
            +
              expect(rs2.size()).to eq 1000
         
     | 
| 
      
 2107 
     | 
    
         
            +
              q.reset()
         
     | 
| 
      
 2108 
     | 
    
         
            +
              atg.index(0).join(rs2, q.select('group_name'), 'group')
         
     | 
| 
      
 2109 
     | 
    
         
            +
              expect(rs2.size()).to eq 1000
         
     | 
| 
      
 2110 
     | 
    
         
            +
              rs.unionRecordset(rs2)
         
     | 
| 
      
 2111 
     | 
    
         
            +
              expect(rs.size()).to eq 16000
         
     | 
| 
      
 2112 
     | 
    
         
            +
              # row in rs[15000]
         
     | 
| 
      
 2113 
     | 
    
         
            +
              expect(rs[15000]['id']).to eq 15001
         
     | 
| 
      
 2114 
     | 
    
         
            +
              # last
         
     | 
| 
      
 2115 
     | 
    
         
            +
              expect(rs.last()['id']).to eq 16000
         
     | 
| 
      
 2116 
     | 
    
         
            +
              
         
     | 
| 
      
 2117 
     | 
    
         
            +
              # group by
         
     | 
| 
      
 2118 
     | 
    
         
            +
              gq = Transactd::GroupQuery.new()
         
     | 
| 
      
 2119 
     | 
    
         
            +
              gq.keyField('group', 'id')
         
     | 
| 
      
 2120 
     | 
    
         
            +
              count1 = Transactd::Count.new('count')
         
     | 
| 
      
 2121 
     | 
    
         
            +
              gq.addFunction(count1)
         
     | 
| 
      
 2122 
     | 
    
         
            +
              
         
     | 
| 
      
 2123 
     | 
    
         
            +
              count2 = Transactd::Count.new('group1_count')
         
     | 
| 
      
 2124 
     | 
    
         
            +
              count2.when('group', '=', '1')
         
     | 
| 
      
 2125 
     | 
    
         
            +
              gq.addFunction(count2)
         
     | 
| 
      
 2126 
     | 
    
         
            +
              
         
     | 
| 
      
 2127 
     | 
    
         
            +
              rs.groupBy(gq)
         
     | 
| 
      
 2128 
     | 
    
         
            +
              expect(rs.size()).to eq 16000
         
     | 
| 
      
 2129 
     | 
    
         
            +
              expect(rs[0]['group1_count']).to eq 1
         
     | 
| 
      
 2130 
     | 
    
         
            +
              
         
     | 
| 
      
 2131 
     | 
    
         
            +
              # clone
         
     | 
| 
      
 2132 
     | 
    
         
            +
              rsv = rs.clone
         
     | 
| 
      
 2133 
     | 
    
         
            +
              gq.reset()
         
     | 
| 
      
 2134 
     | 
    
         
            +
              count3 = Transactd::Count.new('count')
         
     | 
| 
      
 2135 
     | 
    
         
            +
              gq.addFunction(count3).keyField('group')
         
     | 
| 
      
 2136 
     | 
    
         
            +
              rs.groupBy(gq)
         
     | 
| 
      
 2137 
     | 
    
         
            +
              expect(rs.size()).to eq 5
         
     | 
| 
      
 2138 
     | 
    
         
            +
              expect(rsv.size()).to eq 16000
         
     | 
| 
      
 2139 
     | 
    
         
            +
              
         
     | 
| 
      
 2140 
     | 
    
         
            +
              # having
         
     | 
| 
      
 2141 
     | 
    
         
            +
              rq = Transactd::RecordsetQuery.new()
         
     | 
| 
      
 2142 
     | 
    
         
            +
              rq.when('group1_count', '=', '1').or_('group1_count', '=', '2')
         
     | 
| 
      
 2143 
     | 
    
         
            +
              rsv.matchBy(rq)
         
     | 
| 
      
 2144 
     | 
    
         
            +
              expect(rsv.size()).to eq 3200
         
     | 
| 
      
 2145 
     | 
    
         
            +
              expect(rsv).not_to be nil
         
     | 
| 
      
 2146 
     | 
    
         
            +
              rsv = nil
         
     | 
| 
      
 2147 
     | 
    
         
            +
              expect(rsv).to be nil
         
     | 
| 
      
 2148 
     | 
    
         
            +
              
         
     | 
| 
      
 2149 
     | 
    
         
            +
              # top
         
     | 
| 
      
 2150 
     | 
    
         
            +
              rs3 = Transactd::Recordset.new()
         
     | 
| 
      
 2151 
     | 
    
         
            +
              rs.top(rs3, 10)
         
     | 
| 
      
 2152 
     | 
    
         
            +
              expect(rs3.size()).to eq 5
         
     | 
| 
      
 2153 
     | 
    
         
            +
              rs.top(rs3, 3)
         
     | 
| 
      
 2154 
     | 
    
         
            +
              expect(rs3.size()).to eq 3
         
     | 
| 
      
 2155 
     | 
    
         
            +
              expect(rs.size()).to eq 5
         
     | 
| 
      
 2156 
     | 
    
         
            +
              
         
     | 
| 
      
 2157 
     | 
    
         
            +
              # query new / delete
         
     | 
| 
      
 2158 
     | 
    
         
            +
              q1 = Transactd::RecordsetQuery.new()
         
     | 
| 
      
 2159 
     | 
    
         
            +
              q1.when('group1_count', '=', '1').or_('group1_count', '=', '2')
         
     | 
| 
      
 2160 
     | 
    
         
            +
              q1 = nil
         
     | 
| 
      
 2161 
     | 
    
         
            +
              
         
     | 
| 
      
 2162 
     | 
    
         
            +
              q2 = Transactd::Query.new()
         
     | 
| 
      
 2163 
     | 
    
         
            +
              q2.where('group1_count', '=', '1').or_('group1_count', '=', '2')
         
     | 
| 
      
 2164 
     | 
    
         
            +
              q2 = nil
         
     | 
| 
      
 2165 
     | 
    
         
            +
              
         
     | 
| 
      
 2166 
     | 
    
         
            +
              q3 = Transactd::GroupQuery.new()
         
     | 
| 
      
 2167 
     | 
    
         
            +
              q3.keyField('group', 'id')
         
     | 
| 
      
 2168 
     | 
    
         
            +
              q3 = nil
         
     | 
| 
      
 2169 
     | 
    
         
            +
              
         
     | 
| 
      
 2170 
     | 
    
         
            +
              atu.release()
         
     | 
| 
      
 2171 
     | 
    
         
            +
              atg.release()
         
     | 
| 
      
 2172 
     | 
    
         
            +
              ate.release()
         
     | 
| 
      
 2173 
     | 
    
         
            +
              db.close()
         
     | 
| 
      
 2174 
     | 
    
         
            +
            end
         
     | 
| 
      
 2175 
     | 
    
         
            +
             
     | 
| 
      
 2176 
     | 
    
         
            +
            def testWirtableRecord()
         
     | 
| 
      
 2177 
     | 
    
         
            +
              db = Transactd::Database.new()
         
     | 
| 
      
 2178 
     | 
    
         
            +
              db.open(URL_QT)
         
     | 
| 
      
 2179 
     | 
    
         
            +
              expect(db.stat()).to eq 0
         
     | 
| 
      
 2180 
     | 
    
         
            +
              atu = Transactd::ActiveTable.new(db, 'user')
         
     | 
| 
      
 2181 
     | 
    
         
            +
              
         
     | 
| 
      
 2182 
     | 
    
         
            +
              rec = atu.index(0).getWritableRecord()
         
     | 
| 
      
 2183 
     | 
    
         
            +
              rec['id'] = 120000
         
     | 
| 
      
 2184 
     | 
    
         
            +
              rec['名前'] = 'aiba'
         
     | 
| 
      
 2185 
     | 
    
         
            +
              rec.save()
         
     | 
| 
      
 2186 
     | 
    
         
            +
              
         
     | 
| 
      
 2187 
     | 
    
         
            +
              rec.clear()
         
     | 
| 
      
 2188 
     | 
    
         
            +
              expect(rec['id']).not_to eq 120000
         
     | 
| 
      
 2189 
     | 
    
         
            +
              expect(rec['名前']).not_to eq 'aiba'
         
     | 
| 
      
 2190 
     | 
    
         
            +
              rec['id'] = 120000
         
     | 
| 
      
 2191 
     | 
    
         
            +
              rec.read()
         
     | 
| 
      
 2192 
     | 
    
         
            +
              expect(rec['id']).to eq 120000
         
     | 
| 
      
 2193 
     | 
    
         
            +
              expect(rec['名前']).to eq 'aiba'
         
     | 
| 
      
 2194 
     | 
    
         
            +
              
         
     | 
| 
      
 2195 
     | 
    
         
            +
              rec.clear()
         
     | 
| 
      
 2196 
     | 
    
         
            +
              rec['id'] = 120001
         
     | 
| 
      
 2197 
     | 
    
         
            +
              rec['名前'] = 'oono'
         
     | 
| 
      
 2198 
     | 
    
         
            +
              rec.insert() unless rec.read()
         
     | 
| 
      
 2199 
     | 
    
         
            +
              
         
     | 
| 
      
 2200 
     | 
    
         
            +
              rec.clear()
         
     | 
| 
      
 2201 
     | 
    
         
            +
              rec['id'] = 120001
         
     | 
| 
      
 2202 
     | 
    
         
            +
              rec.read()
         
     | 
| 
      
 2203 
     | 
    
         
            +
              expect(rec['id']).to eq 120001
         
     | 
| 
      
 2204 
     | 
    
         
            +
              expect(rec['名前']).to eq 'oono'
         
     | 
| 
      
 2205 
     | 
    
         
            +
              
         
     | 
| 
      
 2206 
     | 
    
         
            +
              # update only changed filed
         
     | 
| 
      
 2207 
     | 
    
         
            +
              rec.clear()
         
     | 
| 
      
 2208 
     | 
    
         
            +
              rec['id'] = 120001
         
     | 
| 
      
 2209 
     | 
    
         
            +
              rec['名前'] = 'matsumoto'
         
     | 
| 
      
 2210 
     | 
    
         
            +
              rec.update()
         
     | 
| 
      
 2211 
     | 
    
         
            +
              
         
     | 
| 
      
 2212 
     | 
    
         
            +
              rec.clear()
         
     | 
| 
      
 2213 
     | 
    
         
            +
              rec['id'] = 120001
         
     | 
| 
      
 2214 
     | 
    
         
            +
              rec.read()
         
     | 
| 
      
 2215 
     | 
    
         
            +
              expect(rec['id']).to eq 120001
         
     | 
| 
      
 2216 
     | 
    
         
            +
              expect(rec['名前']).to eq 'matsumoto'
         
     | 
| 
      
 2217 
     | 
    
         
            +
              
         
     | 
| 
      
 2218 
     | 
    
         
            +
              rec.del()
         
     | 
| 
      
 2219 
     | 
    
         
            +
              rec['id'] = 120000
         
     | 
| 
      
 2220 
     | 
    
         
            +
              rec.del()
         
     | 
| 
      
 2221 
     | 
    
         
            +
              
         
     | 
| 
      
 2222 
     | 
    
         
            +
              rec.clear()
         
     | 
| 
      
 2223 
     | 
    
         
            +
              rec['id'] = 120001
         
     | 
| 
      
 2224 
     | 
    
         
            +
              ret = rec.read()
         
     | 
| 
      
 2225 
     | 
    
         
            +
              expect(ret).to eq false
         
     | 
| 
      
 2226 
     | 
    
         
            +
              
         
     | 
| 
      
 2227 
     | 
    
         
            +
              rec.clear()
         
     | 
| 
      
 2228 
     | 
    
         
            +
              rec['id'] = 120000
         
     | 
| 
      
 2229 
     | 
    
         
            +
              ret = rec.read()
         
     | 
| 
      
 2230 
     | 
    
         
            +
              expect(ret).to eq false
         
     | 
| 
      
 2231 
     | 
    
         
            +
              
         
     | 
| 
      
 2232 
     | 
    
         
            +
              atu.release()
         
     | 
| 
      
 2233 
     | 
    
         
            +
              db.close()
         
     | 
| 
      
 2234 
     | 
    
         
            +
            end
         
     | 
| 
      
 2235 
     | 
    
         
            +
             
     | 
| 
      
 2236 
     | 
    
         
            +
            describe Transactd do
         
     | 
| 
       1635 
2237 
     | 
    
         
             
              it 'create database' do
         
     | 
| 
       1636 
     | 
    
         
            -
                 
     | 
| 
      
 2238 
     | 
    
         
            +
                db = Transactd::Database.new()
         
     | 
| 
      
 2239 
     | 
    
         
            +
                testCreateDatabase(db)
         
     | 
| 
      
 2240 
     | 
    
         
            +
                db.close()
         
     | 
| 
       1637 
2241 
     | 
    
         
             
              end
         
     | 
| 
       1638 
2242 
     | 
    
         
             
              it 'create table' do
         
     | 
| 
       1639 
     | 
    
         
            -
                 
     | 
| 
       1640 
     | 
    
         
            -
                 
     | 
| 
      
 2243 
     | 
    
         
            +
                db = Transactd::Database.new()
         
     | 
| 
      
 2244 
     | 
    
         
            +
                testCreateDatabase(db)
         
     | 
| 
      
 2245 
     | 
    
         
            +
                testCreateTable(db)
         
     | 
| 
      
 2246 
     | 
    
         
            +
                db.close()
         
     | 
| 
       1641 
2247 
     | 
    
         
             
              end
         
     | 
| 
       1642 
2248 
     | 
    
         
             
              it 'open table' do
         
     | 
| 
       1643 
     | 
    
         
            -
                 
     | 
| 
      
 2249 
     | 
    
         
            +
                db = Transactd::Database.new()
         
     | 
| 
      
 2250 
     | 
    
         
            +
                testOpenTable(db)
         
     | 
| 
      
 2251 
     | 
    
         
            +
                db.close()
         
     | 
| 
      
 2252 
     | 
    
         
            +
              end
         
     | 
| 
      
 2253 
     | 
    
         
            +
              it 'clone db object' do
         
     | 
| 
      
 2254 
     | 
    
         
            +
                testClone()
         
     | 
| 
       1644 
2255 
     | 
    
         
             
              end
         
     | 
| 
       1645 
2256 
     | 
    
         
             
              it 'version' do
         
     | 
| 
       1646 
     | 
    
         
            -
                testVersion( 
     | 
| 
      
 2257 
     | 
    
         
            +
                testVersion()
         
     | 
| 
       1647 
2258 
     | 
    
         
             
              end
         
     | 
| 
       1648 
2259 
     | 
    
         
             
              it 'insert' do
         
     | 
| 
       1649 
     | 
    
         
            -
                testInsert( 
     | 
| 
      
 2260 
     | 
    
         
            +
                testInsert()
         
     | 
| 
       1650 
2261 
     | 
    
         
             
              end
         
     | 
| 
       1651 
2262 
     | 
    
         
             
              it 'find' do
         
     | 
| 
       1652 
     | 
    
         
            -
                testFind( 
     | 
| 
      
 2263 
     | 
    
         
            +
                testFind()
         
     | 
| 
       1653 
2264 
     | 
    
         
             
              end
         
     | 
| 
       1654 
2265 
     | 
    
         
             
              it 'findNext' do
         
     | 
| 
       1655 
     | 
    
         
            -
                testFindNext( 
     | 
| 
      
 2266 
     | 
    
         
            +
                testFindNext()
         
     | 
| 
       1656 
2267 
     | 
    
         
             
              end
         
     | 
| 
       1657 
2268 
     | 
    
         
             
              it 'findIn' do
         
     | 
| 
       1658 
     | 
    
         
            -
                testFindIn( 
     | 
| 
      
 2269 
     | 
    
         
            +
                testFindIn()
         
     | 
| 
       1659 
2270 
     | 
    
         
             
              end
         
     | 
| 
       1660 
2271 
     | 
    
         
             
              it 'get percentage' do
         
     | 
| 
       1661 
     | 
    
         
            -
                testGetPercentage( 
     | 
| 
      
 2272 
     | 
    
         
            +
                testGetPercentage()
         
     | 
| 
       1662 
2273 
     | 
    
         
             
              end
         
     | 
| 
       1663 
2274 
     | 
    
         
             
              it 'move percentage' do
         
     | 
| 
       1664 
     | 
    
         
            -
                testMovePercentage( 
     | 
| 
      
 2275 
     | 
    
         
            +
                testMovePercentage()
         
     | 
| 
       1665 
2276 
     | 
    
         
             
              end
         
     | 
| 
       1666 
2277 
     | 
    
         
             
              it 'get equal' do
         
     | 
| 
       1667 
     | 
    
         
            -
                testGetEqual( 
     | 
| 
      
 2278 
     | 
    
         
            +
                testGetEqual()
         
     | 
| 
       1668 
2279 
     | 
    
         
             
              end
         
     | 
| 
       1669 
2280 
     | 
    
         
             
              it 'get next' do
         
     | 
| 
       1670 
     | 
    
         
            -
                testGetNext( 
     | 
| 
      
 2281 
     | 
    
         
            +
                testGetNext()
         
     | 
| 
       1671 
2282 
     | 
    
         
             
              end
         
     | 
| 
       1672 
2283 
     | 
    
         
             
              it 'get previous' do
         
     | 
| 
       1673 
     | 
    
         
            -
                testGetPrevious( 
     | 
| 
      
 2284 
     | 
    
         
            +
                testGetPrevious()
         
     | 
| 
       1674 
2285 
     | 
    
         
             
              end
         
     | 
| 
       1675 
2286 
     | 
    
         
             
              it 'get greater' do
         
     | 
| 
       1676 
     | 
    
         
            -
                testGetGreater( 
     | 
| 
      
 2287 
     | 
    
         
            +
                testGetGreater()
         
     | 
| 
       1677 
2288 
     | 
    
         
             
              end
         
     | 
| 
       1678 
2289 
     | 
    
         
             
              it 'get less than' do
         
     | 
| 
       1679 
     | 
    
         
            -
                testGetLessThan( 
     | 
| 
      
 2290 
     | 
    
         
            +
                testGetLessThan()
         
     | 
| 
       1680 
2291 
     | 
    
         
             
              end
         
     | 
| 
       1681 
2292 
     | 
    
         
             
              it 'get first' do
         
     | 
| 
       1682 
     | 
    
         
            -
                testGetFirst( 
     | 
| 
      
 2293 
     | 
    
         
            +
                testGetFirst()
         
     | 
| 
       1683 
2294 
     | 
    
         
             
              end
         
     | 
| 
       1684 
2295 
     | 
    
         
             
              it 'get last' do
         
     | 
| 
       1685 
     | 
    
         
            -
                testGetLast( 
     | 
| 
      
 2296 
     | 
    
         
            +
                testGetLast()
         
     | 
| 
       1686 
2297 
     | 
    
         
             
              end
         
     | 
| 
       1687 
2298 
     | 
    
         
             
              it 'move position' do
         
     | 
| 
       1688 
     | 
    
         
            -
                testMovePosition( 
     | 
| 
      
 2299 
     | 
    
         
            +
                testMovePosition()
         
     | 
| 
       1689 
2300 
     | 
    
         
             
              end
         
     | 
| 
       1690 
2301 
     | 
    
         
             
              it 'update' do
         
     | 
| 
       1691 
     | 
    
         
            -
                testUpdate( 
     | 
| 
      
 2302 
     | 
    
         
            +
                testUpdate()
         
     | 
| 
       1692 
2303 
     | 
    
         
             
              end
         
     | 
| 
       1693 
2304 
     | 
    
         
             
              it 'snapshot' do
         
     | 
| 
       1694 
     | 
    
         
            -
                testSnapShot( 
     | 
| 
      
 2305 
     | 
    
         
            +
                testSnapShot()
         
     | 
| 
       1695 
2306 
     | 
    
         
             
              end
         
     | 
| 
       1696 
2307 
     | 
    
         
             
              it 'send conflict error' do
         
     | 
| 
       1697 
     | 
    
         
            -
                testConflict( 
     | 
| 
      
 2308 
     | 
    
         
            +
                testConflict()
         
     | 
| 
       1698 
2309 
     | 
    
         
             
              end
         
     | 
| 
       1699 
2310 
     | 
    
         
             
              it 'transaction' do
         
     | 
| 
       1700 
     | 
    
         
            -
                testTransactionLock( 
     | 
| 
      
 2311 
     | 
    
         
            +
                testTransactionLock()
         
     | 
| 
      
 2312 
     | 
    
         
            +
              end
         
     | 
| 
      
 2313 
     | 
    
         
            +
              it 'exclusive' do
         
     | 
| 
      
 2314 
     | 
    
         
            +
                testExclusive()
         
     | 
| 
       1701 
2315 
     | 
    
         
             
              end
         
     | 
| 
       1702 
2316 
     | 
    
         
             
              it 'insert2' do
         
     | 
| 
       1703 
     | 
    
         
            -
                testInsert2( 
     | 
| 
      
 2317 
     | 
    
         
            +
                testInsert2()
         
     | 
| 
       1704 
2318 
     | 
    
         
             
              end
         
     | 
| 
       1705 
2319 
     | 
    
         
             
              it 'delete' do
         
     | 
| 
       1706 
     | 
    
         
            -
                testDelete( 
     | 
| 
      
 2320 
     | 
    
         
            +
                testDelete()
         
     | 
| 
       1707 
2321 
     | 
    
         
             
              end
         
     | 
| 
       1708 
2322 
     | 
    
         
             
              it 'set owner' do
         
     | 
| 
       1709 
     | 
    
         
            -
                testSetOwner( 
     | 
| 
      
 2323 
     | 
    
         
            +
                testSetOwner()
         
     | 
| 
       1710 
2324 
     | 
    
         
             
              end
         
     | 
| 
       1711 
2325 
     | 
    
         
             
              it 'drop index' do
         
     | 
| 
       1712 
     | 
    
         
            -
                testDropIndex( 
     | 
| 
      
 2326 
     | 
    
         
            +
                testDropIndex()
         
     | 
| 
       1713 
2327 
     | 
    
         
             
              end
         
     | 
| 
       1714 
2328 
     | 
    
         
             
              it 'drop database' do
         
     | 
| 
       1715 
     | 
    
         
            -
                 
     | 
| 
      
 2329 
     | 
    
         
            +
                db = Transactd::Database.new()
         
     | 
| 
      
 2330 
     | 
    
         
            +
                testDropDatabase(db)
         
     | 
| 
      
 2331 
     | 
    
         
            +
                db.close()
         
     | 
| 
       1716 
2332 
     | 
    
         
             
              end
         
     | 
| 
       1717 
2333 
     | 
    
         
             
              it 'login' do
         
     | 
| 
       1718 
     | 
    
         
            -
                testLogin( 
     | 
| 
      
 2334 
     | 
    
         
            +
                testLogin()
         
     | 
| 
       1719 
2335 
     | 
    
         
             
              end
         
     | 
| 
       1720 
2336 
     | 
    
         
             
              it 'query' do
         
     | 
| 
       1721 
2337 
     | 
    
         
             
                testQuery()
         
     | 
| 
       1722 
2338 
     | 
    
         
             
              end
         
     | 
| 
      
 2339 
     | 
    
         
            +
              it 'create querytest db' do
         
     | 
| 
      
 2340 
     | 
    
         
            +
                testCreateQueryTest()
         
     | 
| 
      
 2341 
     | 
    
         
            +
              end
         
     | 
| 
      
 2342 
     | 
    
         
            +
              it 'new and delete objects' do
         
     | 
| 
      
 2343 
     | 
    
         
            +
                testNewDelete()
         
     | 
| 
      
 2344 
     | 
    
         
            +
              end
         
     | 
| 
      
 2345 
     | 
    
         
            +
              it 'activetable and join' do
         
     | 
| 
      
 2346 
     | 
    
         
            +
                testJoin()
         
     | 
| 
      
 2347 
     | 
    
         
            +
              end
         
     | 
| 
      
 2348 
     | 
    
         
            +
              it 'write with writableRecord' do
         
     | 
| 
      
 2349 
     | 
    
         
            +
                testWirtableRecord()
         
     | 
| 
      
 2350 
     | 
    
         
            +
              end
         
     | 
| 
       1723 
2351 
     | 
    
         
             
            end
         
     | 
| 
       1724 
2352 
     | 
    
         | 
| 
       1725 
2353 
     | 
    
         
             
            describe Transactd, 'var tables' do
         
     | 
| 
       1726 
     | 
    
         
            -
              before :each do
         
     | 
| 
       1727 
     | 
    
         
            -
                @db = Transactd::Database.createObject()
         
     | 
| 
       1728 
     | 
    
         
            -
              end
         
     | 
| 
       1729 
     | 
    
         
            -
              after :each do
         
     | 
| 
       1730 
     | 
    
         
            -
                @db.close()
         
     | 
| 
       1731 
     | 
    
         
            -
                @db = nil
         
     | 
| 
       1732 
     | 
    
         
            -
              end
         
     | 
| 
       1733 
2354 
     | 
    
         
             
              it 'create var database' do
         
     | 
| 
       1734 
     | 
    
         
            -
                testCreateDatabaseVar( 
     | 
| 
      
 2355 
     | 
    
         
            +
                testCreateDatabaseVar()
         
     | 
| 
       1735 
2356 
     | 
    
         
             
              end
         
     | 
| 
       1736 
2357 
     | 
    
         
             
              it 'set kanji char to field' do
         
     | 
| 
       1737 
     | 
    
         
            -
                testVarField( 
     | 
| 
      
 2358 
     | 
    
         
            +
                testVarField()
         
     | 
| 
       1738 
2359 
     | 
    
         
             
              end
         
     | 
| 
       1739 
2360 
     | 
    
         
             
              it 'insert kanji char to field' do
         
     | 
| 
       1740 
     | 
    
         
            -
                testVarInsert( 
     | 
| 
      
 2361 
     | 
    
         
            +
                testVarInsert()
         
     | 
| 
       1741 
2362 
     | 
    
         
             
              end
         
     | 
| 
       1742 
2363 
     | 
    
         
             
              it 'read kanji char from field' do
         
     | 
| 
       1743 
     | 
    
         
            -
                testVarRead( 
     | 
| 
      
 2364 
     | 
    
         
            +
                testVarRead()
         
     | 
| 
       1744 
2365 
     | 
    
         
             
              end
         
     | 
| 
       1745 
2366 
     | 
    
         
             
              it 'filter' do
         
     | 
| 
       1746 
     | 
    
         
            -
                testFilterVar( 
     | 
| 
      
 2367 
     | 
    
         
            +
                testFilterVar()
         
     | 
| 
       1747 
2368 
     | 
    
         
             
              end
         
     | 
| 
       1748 
2369 
     | 
    
         
             
              it 'drop var database' do
         
     | 
| 
       1749 
     | 
    
         
            -
                 
     | 
| 
      
 2370 
     | 
    
         
            +
                db = Transactd::Database.new()
         
     | 
| 
      
 2371 
     | 
    
         
            +
                testDropDatabaseVar(db)
         
     | 
| 
       1750 
2372 
     | 
    
         
             
              end
         
     | 
| 
       1751 
2373 
     | 
    
         
             
            end
         
     | 
| 
       1752 
2374 
     | 
    
         | 
| 
       1753 
2375 
     | 
    
         
             
            describe Transactd, 'StringFilter' do
         
     | 
| 
       1754 
     | 
    
         
            -
              before :each do
         
     | 
| 
       1755 
     | 
    
         
            -
                @db = Transactd::Database.createObject()
         
     | 
| 
       1756 
     | 
    
         
            -
              end
         
     | 
| 
       1757 
     | 
    
         
            -
              after :each do
         
     | 
| 
       1758 
     | 
    
         
            -
                @db.close()
         
     | 
| 
       1759 
     | 
    
         
            -
                @db = nil
         
     | 
| 
       1760 
     | 
    
         
            -
              end
         
     | 
| 
       1761 
2376 
     | 
    
         
             
              it 'string filter' do
         
     | 
| 
       1762 
     | 
    
         
            -
                testStringFilter( 
     | 
| 
      
 2377 
     | 
    
         
            +
                testStringFilter()
         
     | 
| 
       1763 
2378 
     | 
    
         
             
              end
         
     | 
| 
       1764 
2379 
     | 
    
         
             
              it 'drop database' do
         
     | 
| 
       1765 
     | 
    
         
            -
                 
     | 
| 
       1766 
     | 
    
         
            -
             
     | 
| 
       1767 
     | 
    
         
            -
            end
         
     | 
| 
       1768 
     | 
    
         
            -
             
     | 
| 
       1769 
     | 
    
         
            -
            describe Transactd, 'convert' do
         
     | 
| 
       1770 
     | 
    
         
            -
              if !IS_WINDOWS
         
     | 
| 
       1771 
     | 
    
         
            -
                it 'convert char' do
         
     | 
| 
       1772 
     | 
    
         
            -
                  dummy = ''
         
     | 
| 
       1773 
     | 
    
         
            -
                  u8 = '123'
         
     | 
| 
       1774 
     | 
    
         
            -
                  mbcArray = '123'.encode('Shift_JIS').bytes.to_a # bites Shift-JIS '漢字'
         
     | 
| 
       1775 
     | 
    
         
            -
                  ret = Transactd::u8tombc(u8, -1, dummy, 256)
         
     | 
| 
       1776 
     | 
    
         
            -
                  mbc = ret[1].force_encoding('Shift_JIS')
         
     | 
| 
       1777 
     | 
    
         
            -
                  expect(mbc.bytes.to_a).to eq mbcArray
         
     | 
| 
       1778 
     | 
    
         
            -
                  
         
     | 
| 
       1779 
     | 
    
         
            -
                  u8 = '漢字'
         
     | 
| 
       1780 
     | 
    
         
            -
                  mbcArray = '漢字'.encode('Shift_JIS').bytes.to_a # bites Shift-JIS '漢字'
         
     | 
| 
       1781 
     | 
    
         
            -
                  ret = Transactd::u8tombc(u8, -1, dummy, 256)
         
     | 
| 
       1782 
     | 
    
         
            -
                  mbc = ret[1].force_encoding('Shift_JIS')
         
     | 
| 
       1783 
     | 
    
         
            -
                  expect(mbc.bytes.to_a).to eq mbcArray
         
     | 
| 
       1784 
     | 
    
         
            -
                  
         
     | 
| 
       1785 
     | 
    
         
            -
                  u8Array = '漢字'.encode('UTF-8').bytes.to_a # bites UTF-8 '漢字'
         
     | 
| 
       1786 
     | 
    
         
            -
                  ret = Transactd::mbctou8(mbc, -1, dummy , 256)
         
     | 
| 
       1787 
     | 
    
         
            -
                  u8 = ret[1].force_encoding('UTF-8')
         
     | 
| 
       1788 
     | 
    
         
            -
                  expect(u8.bytes.to_a).to eq u8Array
         
     | 
| 
       1789 
     | 
    
         
            -
                end
         
     | 
| 
      
 2380 
     | 
    
         
            +
                db = Transactd::Database.new()
         
     | 
| 
      
 2381 
     | 
    
         
            +
                testDropDatabaseStringFilter(db)
         
     | 
| 
       1790 
2382 
     | 
    
         
             
              end
         
     | 
| 
       1791 
2383 
     | 
    
         
             
            end
         
     |