extralite 2.7.1 → 2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,8 +30,8 @@ class IteratorTest < Minitest::Test
30
30
  assert_equal [{x: 1, y: 2, z: 3},{ x: 4, y: 5, z: 6 }, { x: 7, y: 8, z: 9 }], buf
31
31
  end
32
32
 
33
- def test_iterator_argv
34
- @query.mode = :argv
33
+ def test_iterator_splat
34
+ @query.mode = :splat
35
35
  iter = @query.each
36
36
  assert_kind_of Extralite::Iterator, iter
37
37
 
@@ -41,8 +41,8 @@ class IteratorTest < Minitest::Test
41
41
  assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9]], buf
42
42
  end
43
43
 
44
- def test_iterator_ary
45
- @query.mode = :ary
44
+ def test_iterator_array
45
+ @query.mode = :array
46
46
  iter = @query.each
47
47
  assert_kind_of Extralite::Iterator, iter
48
48
 
@@ -53,7 +53,7 @@ class IteratorTest < Minitest::Test
53
53
  end
54
54
 
55
55
  def test_iterator_single_column
56
- query = @db.prepare_argv('select x from t')
56
+ query = @db.prepare_splat('select x from t')
57
57
  iter = query.each
58
58
  assert_kind_of Extralite::Iterator, iter
59
59
 
@@ -71,7 +71,7 @@ class IteratorTest < Minitest::Test
71
71
  assert_nil iter.next
72
72
  assert_nil iter.next
73
73
 
74
- @query.mode = :ary
74
+ @query.mode = :array
75
75
  @query.reset
76
76
  assert_equal([1, 2, 3], iter.next)
77
77
  assert_equal([4, 5, 6], iter.next)
@@ -79,7 +79,7 @@ class IteratorTest < Minitest::Test
79
79
  assert_nil iter.next
80
80
  assert_nil iter.next
81
81
 
82
- iter = @db.prepare_argv('select y from t').each
82
+ iter = @db.prepare_splat('select y from t').each
83
83
  assert_equal(2, iter.next)
84
84
  assert_equal(5, iter.next)
85
85
  assert_equal(8, iter.next)
@@ -91,10 +91,10 @@ class IteratorTest < Minitest::Test
91
91
  iter = @query.each
92
92
  assert_equal [{x: 1, y: 2, z: 3},{ x: 4, y: 5, z: 6 }, { x: 7, y: 8, z: 9 }], iter.to_a
93
93
 
94
- @query.mode = :ary
94
+ @query.mode = :array
95
95
  assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9]], iter.to_a
96
96
 
97
- iter = @db.prepare_argv('select x from t').each
97
+ iter = @db.prepare_splat('select x from t').each
98
98
  assert_equal [1, 4, 7], iter.to_a
99
99
  end
100
100
 
@@ -102,17 +102,17 @@ class IteratorTest < Minitest::Test
102
102
  mapped = @query.each.map { |row| row[:x] * 10 }
103
103
  assert_equal [10, 40, 70], mapped
104
104
 
105
- @query.mode = :ary
105
+ @query.mode = :array
106
106
  mapped = @query.each.map { |row| row[1] * 10 }
107
107
  assert_equal [20, 50, 80], mapped
108
108
 
109
- query = @db.prepare_argv('select z from t')
109
+ query = @db.prepare_splat('select z from t')
110
110
  mapped = query.each.map { |v| v * 10 }
111
111
  assert_equal [30, 60, 90], mapped
112
112
  end
113
113
 
114
114
  def test_iterator_inspect
115
- @query.mode = :ary
115
+ @query.mode = :array
116
116
  i = @query.each
117
117
  assert_match(/^\#\<Extralite::Iterator:0x[0-9a-f]+\>$/, i.inspect)
118
118
  end
data/test/test_query.rb CHANGED
@@ -28,35 +28,35 @@ class QueryTest < Minitest::Test
28
28
  query = @db.prepare('select 1')
29
29
  assert_equal :hash, query.mode
30
30
 
31
- query.mode = :argv
32
- assert_equal :argv, query.mode
31
+ query.mode = :splat
32
+ assert_equal :splat, query.mode
33
33
 
34
- query.mode = :ary
35
- assert_equal :ary, query.mode
34
+ query.mode = :array
35
+ assert_equal :array, query.mode
36
36
 
37
37
  assert_raises(Extralite::Error) { query.mode = :foo }
38
- assert_equal :ary, query.mode
38
+ assert_equal :array, query.mode
39
39
 
40
40
  query.mode = :hash
41
41
  assert_equal :hash, query.mode
42
42
  end
43
43
 
44
- def test_prepare_argv
45
- query = @db.prepare_argv('select 1')
46
- assert_equal :argv, query.mode
44
+ def test_prepare_splat
45
+ query = @db.prepare_splat('select 1')
46
+ assert_equal :splat, query.mode
47
47
 
48
48
  assert_equal 1, query.next
49
49
  end
50
50
 
51
- def test_prepare_argv_with_too_many_columns
52
- q = @db.prepare_argv('select 1, 2, 3, 4, 5, 6, 7, 8, 9')
51
+ def test_prepare_splat_with_too_many_columns
52
+ q = @db.prepare_splat('select 1, 2, 3, 4, 5, 6, 7, 8, 9')
53
53
 
54
54
  assert_raises(Extralite::Error) { q.next }
55
55
  end
56
56
 
57
- def test_prepare_ary
58
- query = @db.prepare_ary('select 1')
59
- assert_equal :ary, query.mode
57
+ def test_prepare_array
58
+ query = @db.prepare_array('select 1')
59
+ assert_equal :array, query.mode
60
60
 
61
61
  assert_equal [1], query.next
62
62
  end
@@ -71,7 +71,7 @@ class QueryTest < Minitest::Test
71
71
  def test_bind
72
72
  @db.query("insert into t values ('a', 'b', 'c')")
73
73
 
74
- q = @db.prepare_ary('select * from t where `z` = :foo')
74
+ q = @db.prepare_array('select * from t where `z` = :foo')
75
75
  results = q.bind(foo: 'c').to_a
76
76
 
77
77
  assert_equal [['a', 'b', 'c']], results
@@ -158,8 +158,8 @@ class QueryTest < Minitest::Test
158
158
  assert_equal [], buf
159
159
  end
160
160
 
161
- def test_query_next_ary
162
- query = @db.prepare_ary('select * from t')
161
+ def test_query_next_array
162
+ query = @db.prepare_array('select * from t')
163
163
  v = query.next
164
164
  assert_equal([1, 2, 3], v)
165
165
 
@@ -176,8 +176,8 @@ class QueryTest < Minitest::Test
176
176
  assert_nil v
177
177
  end
178
178
 
179
- def test_query_next_ary_with_row_count
180
- query = @db.prepare_ary('select * from t')
179
+ def test_query_next_array_with_row_count
180
+ query = @db.prepare_array('select * from t')
181
181
  v = query.next(1)
182
182
  assert_equal([[1, 2, 3]], v)
183
183
 
@@ -191,8 +191,8 @@ class QueryTest < Minitest::Test
191
191
  assert_nil v
192
192
  end
193
193
 
194
- def test_query_next_ary_with_block
195
- query = @db.prepare_ary('select * from t')
194
+ def test_query_next_array_with_block
195
+ query = @db.prepare_array('select * from t')
196
196
  buf = []
197
197
  v = query.next { |r| buf << r }
198
198
  assert_equal query, v
@@ -209,8 +209,8 @@ class QueryTest < Minitest::Test
209
209
  assert_equal [], buf
210
210
  end
211
211
 
212
- def test_query_next_argv_single_column
213
- query = @db.prepare_argv('select x from t')
212
+ def test_query_next_splat_single_column
213
+ query = @db.prepare_splat('select x from t')
214
214
  v = query.next
215
215
  assert_equal(1, v)
216
216
 
@@ -224,8 +224,8 @@ class QueryTest < Minitest::Test
224
224
  assert_nil v
225
225
  end
226
226
 
227
- def test_query_next_argv_multi_column
228
- query = @db.prepare_argv('select x, y from t')
227
+ def test_query_next_splat_multi_column
228
+ query = @db.prepare_splat('select x, y from t')
229
229
  v = query.next
230
230
  assert_equal([1, 2], v)
231
231
 
@@ -239,8 +239,8 @@ class QueryTest < Minitest::Test
239
239
  assert_nil v
240
240
  end
241
241
 
242
- def test_query_next_argv_with_row_count
243
- query = @db.prepare_argv('select x from t')
242
+ def test_query_next_splat_with_row_count
243
+ query = @db.prepare_splat('select x from t')
244
244
  v = query.next(1)
245
245
  assert_equal([1], v)
246
246
 
@@ -251,8 +251,8 @@ class QueryTest < Minitest::Test
251
251
  assert_nil v
252
252
  end
253
253
 
254
- def test_query_next_argv_with_block
255
- query = @db.prepare_argv('select x, y from t')
254
+ def test_query_next_splat_with_block
255
+ query = @db.prepare_splat('select x, y from t')
256
256
  buf = []
257
257
  v = query.next { |x, y| buf << [x, y] }
258
258
  assert_equal query, v
@@ -273,12 +273,12 @@ class QueryTest < Minitest::Test
273
273
  assert_equal [{ x: 1, y: 2, z: 3 }], @query.bind(1).to_a
274
274
  assert_equal [{ x: 4, y: 5, z: 6 }], @query.bind(4).to_a
275
275
 
276
- @query.mode = :ary
276
+ @query.mode = :array
277
277
 
278
278
  assert_equal [[1, 2, 3]], @query.bind(1).to_a
279
279
  assert_equal [[4, 5, 6]], @query.bind(4).to_a
280
280
 
281
- query = @db.prepare_argv('select y from t')
281
+ query = @db.prepare_splat('select y from t')
282
282
  assert_equal [2, 5, 8], query.to_a
283
283
  end
284
284
 
@@ -322,9 +322,9 @@ class QueryTest < Minitest::Test
322
322
  assert_equal [{x: 1, y: 2, z: 3},{ x: 4, y: 5, z: 6 }, { x: 7, y: 8, z: 9 }], buf
323
323
  end
324
324
 
325
- def test_query_each_ary
325
+ def test_query_each_array
326
326
  buf = []
327
- @query.mode = :ary
327
+ @query.mode = :array
328
328
  @query.bind(1).each { |r| buf << r }
329
329
  assert_equal [[1, 2, 3]], buf
330
330
 
@@ -333,14 +333,14 @@ class QueryTest < Minitest::Test
333
333
  @query.each { |r| buf << r }
334
334
  assert_equal [[1, 2, 3]], buf
335
335
 
336
- query = @db.prepare_ary('select * from t')
336
+ query = @db.prepare_array('select * from t')
337
337
  buf = []
338
338
  query.each { |r| buf << r }
339
339
  assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9]], buf
340
340
  end
341
341
 
342
- def test_query_each_ary_without_block
343
- query = @db.prepare_ary('select * from t')
342
+ def test_query_each_array_without_block
343
+ query = @db.prepare_array('select * from t')
344
344
  iter = query.each
345
345
  assert_kind_of Extralite::Iterator, iter
346
346
 
@@ -350,9 +350,9 @@ class QueryTest < Minitest::Test
350
350
  assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9]], buf
351
351
  end
352
352
 
353
- def test_query_each_argv
353
+ def test_query_each_splat
354
354
  buf = []
355
- @query.mode = :argv
355
+ @query.mode = :splat
356
356
  @query.bind(1).each { |a, b, c| buf << [a, b, c] }
357
357
  assert_equal [[1, 2, 3]], buf
358
358
 
@@ -361,14 +361,14 @@ class QueryTest < Minitest::Test
361
361
  @query.each { |a, b, c| buf << [a, b, c] }
362
362
  assert_equal [[1, 2, 3]], buf
363
363
 
364
- query = @db.prepare_argv('select * from t')
364
+ query = @db.prepare_splat('select * from t')
365
365
  buf = []
366
366
  query.each { |a, b, c| buf << [a, b, c] }
367
367
  assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9]], buf
368
368
  end
369
369
 
370
- def test_query_each_argv_without_block
371
- query = @db.prepare_argv('select * from t')
370
+ def test_query_each_splat_without_block
371
+ query = @db.prepare_splat('select * from t')
372
372
  iter = query.each
373
373
  assert_kind_of Extralite::Iterator, iter
374
374
 
@@ -378,8 +378,8 @@ class QueryTest < Minitest::Test
378
378
  assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9]], buf
379
379
  end
380
380
 
381
- def test_query_each_argv_single_column
382
- query = @db.prepare_argv('select x from t where x = ?')
381
+ def test_query_each_splat_single_column
382
+ query = @db.prepare_splat('select x from t where x = ?')
383
383
  buf = []
384
384
  query.bind(1).each { |r| buf << r }
385
385
  assert_equal [1], buf
@@ -389,14 +389,14 @@ class QueryTest < Minitest::Test
389
389
  query.each { |r| buf << r }
390
390
  assert_equal [1], buf
391
391
 
392
- query = @db.prepare_argv('select x from t')
392
+ query = @db.prepare_splat('select x from t')
393
393
  buf = []
394
394
  query.each { |r| buf << r }
395
395
  assert_equal [1, 4, 7], buf
396
396
  end
397
397
 
398
- def test_query_each_argv_single_column_without_block
399
- query = @db.prepare_argv('select x from t')
398
+ def test_query_each_splat_single_column_without_block
399
+ query = @db.prepare_splat('select x from t')
400
400
  iter = query.each
401
401
  assert_kind_of Extralite::Iterator, iter
402
402
 
@@ -484,24 +484,24 @@ class QueryTest < Minitest::Test
484
484
  class Foo; end
485
485
 
486
486
  def test_parameter_binding_from_hash
487
- assert_equal 42, @db.prepare_argv('select :bar').bind(foo: 41, bar: 42).next
488
- assert_equal 42, @db.prepare_argv('select :bar').bind('foo' => 41, 'bar' => 42).next
489
- assert_equal 42, @db.prepare_argv('select ?8').bind(7 => 41, 8 => 42).next
490
- assert_nil @db.prepare_argv('select :bar').bind(foo: 41).next
487
+ assert_equal 42, @db.prepare_splat('select :bar').bind(foo: 41, bar: 42).next
488
+ assert_equal 42, @db.prepare_splat('select :bar').bind('foo' => 41, 'bar' => 42).next
489
+ assert_equal 42, @db.prepare_splat('select ?8').bind(7 => 41, 8 => 42).next
490
+ assert_nil @db.prepare_splat('select :bar').bind(foo: 41).next
491
491
 
492
- error = assert_raises(Extralite::ParameterError) { @db.prepare_argv('select ?').bind(Foo.new => 42).next }
492
+ error = assert_raises(Extralite::ParameterError) { @db.prepare_splat('select ?').bind(Foo.new => 42).next }
493
493
  assert_equal error.message, 'Cannot bind parameter with a key of type QueryTest::Foo'
494
494
 
495
- error = assert_raises(Extralite::ParameterError) { @db.prepare_argv('select ?').bind(%w[a b] => 42).next }
495
+ error = assert_raises(Extralite::ParameterError) { @db.prepare_splat('select ?').bind(%w[a b] => 42).next }
496
496
  assert_equal error.message, 'Cannot bind parameter with a key of type Array'
497
497
  end
498
498
 
499
499
  def test_parameter_binding_from_struct
500
500
  foo_bar = Struct.new(:':foo', :bar)
501
501
  value = foo_bar.new(41, 42)
502
- assert_equal 41, @db.prepare_argv('select :foo').bind(value).next
503
- assert_equal 42, @db.prepare_argv('select :bar').bind(value).next
504
- assert_nil @db.prepare_argv('select :baz').bind(value).next
502
+ assert_equal 41, @db.prepare_splat('select :foo').bind(value).next
503
+ assert_equal 42, @db.prepare_splat('select :bar').bind(value).next
504
+ assert_nil @db.prepare_splat('select :baz').bind(value).next
505
505
  end
506
506
 
507
507
  def test_parameter_binding_from_data_class
@@ -509,8 +509,8 @@ class QueryTest < Minitest::Test
509
509
 
510
510
  foo_bar = Data.define(:':foo', :bar)
511
511
  value = foo_bar.new(':foo': 41, bar: 42)
512
- assert_equal 42, @db.prepare_argv('select :bar').bind(value).next
513
- assert_nil @db.prepare_argv('select :baz').bind(value).next
512
+ assert_equal 42, @db.prepare_splat('select :bar').bind(value).next
513
+ assert_nil @db.prepare_splat('select :baz').bind(value).next
514
514
  end
515
515
 
516
516
  def test_query_columns
@@ -519,7 +519,7 @@ class QueryTest < Minitest::Test
519
519
  end
520
520
 
521
521
  def test_query_columns_with_parameterized_sql
522
- q = @db.prepare_ary('select * from t where z = :z')
522
+ q = @db.prepare_array('select * from t where z = :z')
523
523
  q.bind(z: 9)
524
524
  assert_equal [:x, :y, :z], q.columns
525
525
  assert_equal [[7, 8, 9]], q.to_a
@@ -542,13 +542,13 @@ class QueryTest < Minitest::Test
542
542
  def test_query_execute
543
543
  q = @db.prepare('update t set x = 42')
544
544
  assert_equal 3, q.execute
545
- assert_equal [[42, 2, 3], [42, 5, 6], [42, 8, 9]], @db.query_ary('select * from t order by z')
545
+ assert_equal [[42, 2, 3], [42, 5, 6], [42, 8, 9]], @db.query_array('select * from t order by z')
546
546
  end
547
547
 
548
548
  def test_query_execute_with_params
549
549
  q = @db.prepare('update t set x = ? where z = ?')
550
550
  assert_equal 1, q.execute(42, 9)
551
- assert_equal [[1, 2, 3], [4, 5, 6], [42, 8, 9]], @db.query_ary('select * from t order by z')
551
+ assert_equal [[1, 2, 3], [4, 5, 6], [42, 8, 9]], @db.query_array('select * from t order by z')
552
552
  end
553
553
 
554
554
  def test_query_execute_with_mixed_params
@@ -559,13 +559,13 @@ class QueryTest < Minitest::Test
559
559
  q.execute([4, 5], 6)
560
560
  q.execute([7], 8, [9])
561
561
 
562
- assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9]], @db.query_ary('select * from t order by z')
562
+ assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9]], @db.query_array('select * from t order by z')
563
563
  end
564
564
 
565
565
  def test_query_chverons
566
566
  q = @db.prepare('update t set x = ? where z = ?')
567
567
  assert_equal q, (q << [42, 9])
568
- assert_equal [[1, 2, 3], [4, 5, 6], [42, 8, 9]], @db.query_ary('select * from t order by z')
568
+ assert_equal [[1, 2, 3], [4, 5, 6], [42, 8, 9]], @db.query_array('select * from t order by z')
569
569
  end
570
570
 
571
571
 
@@ -626,7 +626,7 @@ class QueryTest < Minitest::Test
626
626
  assert_equal [], @db.query('select * from foo')
627
627
 
628
628
  data = [5, 4, 3]
629
- results = @db.batch_query_ary('insert into foo (b) values (?) returning *', data)
629
+ results = @db.batch_query_array('insert into foo (b) values (?) returning *', data)
630
630
  assert_equal [
631
631
  [[1, 5]],
632
632
  [[2, 4]],
@@ -657,7 +657,7 @@ class QueryTest < Minitest::Test
657
657
  assert_equal [], @db.query('select * from foo')
658
658
 
659
659
  data = [5, 4, 3]
660
- results = @db.batch_query_ary('insert into foo (b) values (?) returning *', data)
660
+ results = @db.batch_query_array('insert into foo (b) values (?) returning *', data)
661
661
  assert_equal [
662
662
  [[1, 5]],
663
663
  [[2, 4]],
@@ -692,7 +692,7 @@ class QueryTest < Minitest::Test
692
692
  assert_equal [], @db.query('select * from foo')
693
693
 
694
694
  data = [5, 4, 3]
695
- results = @db.batch_query_ary('insert into foo (b) values (?) returning *', data)
695
+ results = @db.batch_query_array('insert into foo (b) values (?) returning *', data)
696
696
  assert_equal [
697
697
  [[1, 5]],
698
698
  [[2, 4]],
@@ -720,19 +720,19 @@ class QueryTest < Minitest::Test
720
720
  ], array
721
721
  end
722
722
 
723
- def test_query_batch_query_ary_with_array
723
+ def test_query_batch_query_array_with_array
724
724
  @db.query('create table foo (a integer primary key, b)')
725
725
  assert_equal [], @db.query('select * from foo')
726
726
 
727
727
  data = [5, 4, 3]
728
- results = @db.batch_query_ary('insert into foo (b) values (?) returning *', data)
728
+ results = @db.batch_query_array('insert into foo (b) values (?) returning *', data)
729
729
  assert_equal [
730
730
  [[1, 5]],
731
731
  [[2, 4]],
732
732
  [[3, 3]]
733
733
  ], results
734
734
 
735
- q = @db.prepare_ary('update foo set b = ? returning *')
735
+ q = @db.prepare_array('update foo set b = ? returning *')
736
736
 
737
737
  results = q.batch_query([42, 43])
738
738
  assert_equal [
@@ -751,19 +751,19 @@ class QueryTest < Minitest::Test
751
751
  ], array
752
752
  end
753
753
 
754
- def test_query_batch_query_ary_with_enumerable
754
+ def test_query_batch_query_array_with_enumerable
755
755
  @db.query('create table foo (a integer primary key, b)')
756
756
  assert_equal [], @db.query('select * from foo')
757
757
 
758
758
  data = [5, 4, 3]
759
- results = @db.batch_query_ary('insert into foo (b) values (?) returning *', data)
759
+ results = @db.batch_query_array('insert into foo (b) values (?) returning *', data)
760
760
  assert_equal [
761
761
  [[1, 5]],
762
762
  [[2, 4]],
763
763
  [[3, 3]]
764
764
  ], results
765
765
 
766
- q = @db.prepare_ary('update foo set b = ? returning *')
766
+ q = @db.prepare_array('update foo set b = ? returning *')
767
767
 
768
768
  results = q.batch_query(42..43)
769
769
  assert_equal [
@@ -782,19 +782,19 @@ class QueryTest < Minitest::Test
782
782
  ], array
783
783
  end
784
784
 
785
- def test_query_batch_query_ary_with_proc
785
+ def test_query_batch_query_array_with_proc
786
786
  @db.query('create table foo (a integer primary key, b)')
787
787
  assert_equal [], @db.query('select * from foo')
788
788
 
789
789
  data = [5, 4, 3]
790
- results = @db.batch_query_ary('insert into foo (b) values (?) returning *', data)
790
+ results = @db.batch_query_array('insert into foo (b) values (?) returning *', data)
791
791
  assert_equal [
792
792
  [[1, 5]],
793
793
  [[2, 4]],
794
794
  [[3, 3]]
795
795
  ], results
796
796
 
797
- q = @db.prepare_ary('update foo set b = ? returning *')
797
+ q = @db.prepare_array('update foo set b = ? returning *')
798
798
 
799
799
  pr = parameter_source_proc([42, 43])
800
800
  results = q.batch_query(pr)
@@ -820,14 +820,14 @@ class QueryTest < Minitest::Test
820
820
  assert_equal [], @db.query('select * from foo')
821
821
 
822
822
  data = [5, 4, 3]
823
- results = @db.batch_query_ary('insert into foo (b) values (?) returning *', data)
823
+ results = @db.batch_query_array('insert into foo (b) values (?) returning *', data)
824
824
  assert_equal [
825
825
  [[1, 5]],
826
826
  [[2, 4]],
827
827
  [[3, 3]]
828
828
  ], results
829
829
 
830
- q = @db.prepare_argv('update foo set b = ? returning b * 10 + a')
830
+ q = @db.prepare_splat('update foo set b = ? returning b * 10 + a')
831
831
 
832
832
  results = q.batch_query([42, 43])
833
833
  assert_equal [
@@ -851,14 +851,14 @@ class QueryTest < Minitest::Test
851
851
  assert_equal [], @db.query('select * from foo')
852
852
 
853
853
  data = [5, 4, 3]
854
- results = @db.batch_query_ary('insert into foo (b) values (?) returning *', data)
854
+ results = @db.batch_query_array('insert into foo (b) values (?) returning *', data)
855
855
  assert_equal [
856
856
  [[1, 5]],
857
857
  [[2, 4]],
858
858
  [[3, 3]]
859
859
  ], results
860
860
 
861
- q = @db.prepare_argv('update foo set b = ? returning b * 10 + a')
861
+ q = @db.prepare_splat('update foo set b = ? returning b * 10 + a')
862
862
 
863
863
  results = q.batch_query(42..43)
864
864
  assert_equal [
@@ -882,14 +882,14 @@ class QueryTest < Minitest::Test
882
882
  assert_equal [], @db.query('select * from foo')
883
883
 
884
884
  data = [5, 4, 3]
885
- results = @db.batch_query_ary('insert into foo (b) values (?) returning *', data)
885
+ results = @db.batch_query_array('insert into foo (b) values (?) returning *', data)
886
886
  assert_equal [
887
887
  [[1, 5]],
888
888
  [[2, 4]],
889
889
  [[3, 3]]
890
890
  ], results
891
891
 
892
- q = @db.prepare_argv('update foo set b = ? returning b * 10 + a')
892
+ q = @db.prepare_splat('update foo set b = ? returning b * 10 + a')
893
893
 
894
894
  pr = parameter_source_proc([42, 43])
895
895
  results = q.batch_query(pr)
@@ -936,7 +936,7 @@ class QueryTest < Minitest::Test
936
936
  end
937
937
 
938
938
  def test_query_eof
939
- query = @db.prepare_argv('select x from t')
939
+ query = @db.prepare_splat('select x from t')
940
940
  assert_equal false, query.eof?
941
941
 
942
942
  query.next
@@ -985,18 +985,18 @@ class QueryTest < Minitest::Test
985
985
  assert_equal q1.sql, q2.sql
986
986
  refute_same q1, q2
987
987
 
988
- q1 = @db.prepare_argv('select x from t')
988
+ q1 = @db.prepare_splat('select x from t')
989
989
  q2 = q1.dup
990
990
 
991
991
  assert_kind_of Extralite::Query, q2
992
992
  assert_equal @db, q2.database
993
993
  assert_equal q1.sql, q2.sql
994
994
  refute_same q1, q2
995
- assert_equal :argv, q2.mode
995
+ assert_equal :splat, q2.mode
996
996
  end
997
997
 
998
998
  def test_query_dup_with_transform
999
- q1 = @db.prepare_ary('select x, y from t') { |a| a * 2 }
999
+ q1 = @db.prepare_array('select x, y from t') { |a| a * 2 }
1000
1000
  q2 = q1.dup
1001
1001
 
1002
1002
  assert_equal [
@@ -1012,8 +1012,8 @@ class QueryTransformTest < Minitest::Test
1012
1012
  @db = Extralite::Database.new(':memory:')
1013
1013
  @db.query('create table t (a, b, c)')
1014
1014
 
1015
- @q1 = @db.prepare_argv('select c from t where a = ?')
1016
- @q2 = @db.prepare_argv('select c from t order by a')
1015
+ @q1 = @db.prepare_splat('select c from t where a = ?')
1016
+ @q2 = @db.prepare_splat('select c from t order by a')
1017
1017
 
1018
1018
  @q3 = @db.prepare('select * from t where a = ?')
1019
1019
  @q4 = @db.prepare('select * from t order by a')
@@ -1068,8 +1068,8 @@ class QueryTransformTest < Minitest::Test
1068
1068
  ], buf
1069
1069
  end
1070
1070
 
1071
- def test_transform_ary
1072
- @q5.mode = :ary
1071
+ def test_transform_array
1072
+ @q5.mode = :array
1073
1073
  q = @q5.transform { |h| MyModel.new(h) }
1074
1074
  assert_equal @q5, q
1075
1075
 
@@ -1086,7 +1086,7 @@ class QueryTransformTest < Minitest::Test
1086
1086
  [[4, 5]]
1087
1087
  ], @q5.batch_query([[1], [4]]).map { |a| a.map(&:values) }
1088
1088
 
1089
- @q6.mode = :ary
1089
+ @q6.mode = :array
1090
1090
  @q6.transform { |h| MyModel.new(h) }
1091
1091
  assert_equal [
1092
1092
  [1, 2],
@@ -1101,7 +1101,7 @@ class QueryTransformTest < Minitest::Test
1101
1101
  ], buf
1102
1102
  end
1103
1103
 
1104
- def test_transform_argv_single_column
1104
+ def test_transform_splat_single_column
1105
1105
  q = @q1.transform { |c| JSON.parse(c, symbolize_names: true) }
1106
1106
  assert_equal @q1, q
1107
1107
 
@@ -1127,8 +1127,8 @@ class QueryTransformTest < Minitest::Test
1127
1127
  ], buf
1128
1128
  end
1129
1129
 
1130
- def test_transform_argv_multi_column
1131
- @q3.mode = :argv
1130
+ def test_transform_splat_multi_column
1131
+ @q3.mode = :splat
1132
1132
  q = @q3.transform { |a, b, c| { a: a, b: b, c: JSON.parse(c, symbolize_names: true) } }
1133
1133
  assert_equal @q3, q
1134
1134
 
@@ -1140,7 +1140,7 @@ class QueryTransformTest < Minitest::Test
1140
1140
  [{ a: 4, b: 5, c: { foo: 45, bar: 46 }}]
1141
1141
  ], @q3.batch_query([[1], [4]])
1142
1142
 
1143
- @q4.mode = :argv
1143
+ @q4.mode = :splat
1144
1144
  @q4.transform { |a, b, c| { a: a, b: b, c: JSON.parse(c, symbolize_names: true) } }
1145
1145
  assert_equal [
1146
1146
  { a: 1, b: 2, c: { foo: 42, bar: 43 }},
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extralite
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: '2.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-11 00:00:00.000000000 Z
11
+ date: 2024-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 5.21.2
33
+ version: 5.22.2
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 5.21.2
40
+ version: 5.22.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +121,6 @@ files:
121
121
  - extralite.gemspec
122
122
  - gemspec.rb
123
123
  - lib/extralite.rb
124
- - lib/extralite/sqlite3_constants.rb
125
124
  - lib/extralite/version.rb
126
125
  - lib/sequel/adapters/extralite.rb
127
126
  - test/extensions/text.dylib
@@ -131,12 +130,13 @@ files:
131
130
  - test/issue-38.rb
132
131
  - test/issue-54.rb
133
132
  - test/issue-59.rb
134
- - test/perf_argv_transform.rb
135
- - test/perf_ary.rb
133
+ - test/perf_array.rb
136
134
  - test/perf_hash.rb
137
135
  - test/perf_hash_prepared.rb
138
136
  - test/perf_hash_transform.rb
139
137
  - test/perf_polyphony.rb
138
+ - test/perf_splat.rb
139
+ - test/perf_splat_transform.rb
140
140
  - test/run.rb
141
141
  - test/test_changeset.rb
142
142
  - test/test_database.rb