dbmlite3 1.0.a1 → 1.0.a4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 546ca0010f91757ca1346cd87ca9f2846318e65123668363239b61e8f1f5bbdd
4
- data.tar.gz: 5500f44eec01f68da64ed8e8d8ec73a1325ffafeab274a2ae00604a68e16ae61
3
+ metadata.gz: fac72547c8bd87ca5fcc089e5570ee80b4a7beeb539e76df1888c8b1b97b163b
4
+ data.tar.gz: d689bf111e159c2c46568f921c945fdbdbed53f57e7a6fd68f24bc52baa5cf34
5
5
  SHA512:
6
- metadata.gz: 45e67ef18cff8f3f17610e888a7153bb83d83438334c8ce0d204fdda7c599926e5ec210e09cb67bf909dbfa829fb17046b46a540e5373960b049bccb77526cf1
7
- data.tar.gz: 7c113a41818d9bdea1aec2b8e3d5fe1f54c4c134e8fa777a6e19a6c0f8546c326f6ef901caddc4b65985df1b50a89d809db6b32196eb157034e619fd9cebade5
6
+ metadata.gz: a8706449a100a494853f57f5ee5f7d2c79a67794d835efb3ab5453a56898909129811b4acf72a9770ed61a55b4919105adedc1cdbf005b87475801c7effcb84a
7
+ data.tar.gz: ef3fc4ad6f06c4b270584cc86d60a0b9526f9e51f1456077edd8076d676bdf1b69f124fe45fca50eabfa88067214c669f7563bd1a29ac23921630614c82b7b35
data/DBMLite3.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'dbmlite3'
6
- s.version = '1.0.a1'
6
+ s.version = '1.0.a4'
7
7
  s.date = '2022-02-21'
8
8
  s.summary = "A DBM-style key-value store using SQLite3"
9
9
  s.description = <<-EOF
@@ -34,6 +34,6 @@ EOF
34
34
  s.add_development_dependency "rspec", '~> 3.10', '>= 3.10.0'
35
35
  s.add_development_dependency "yard", '~> 0.9.25', '>= 0.9.25'
36
36
 
37
- s.homepage = 'https://codeberg.org/suetanvil/dbmlite3-ruby'
37
+ s.homepage = 'https://codeberg.org/suetanvil/dbmlite'
38
38
  s.license = 'MIT'
39
39
  end
data/doc/Lite3/DBM.html CHANGED
@@ -940,8 +940,6 @@ and will result in a Lite3::Error exception.</p>
940
940
  <pre class="lines">
941
941
 
942
942
 
943
- 407
944
- 408
945
943
  409
946
944
  410
947
945
  411
@@ -960,10 +958,12 @@ and will result in a Lite3::Error exception.</p>
960
958
  424
961
959
  425
962
960
  426
963
- 427</pre>
961
+ 427
962
+ 428
963
+ 429</pre>
964
964
  </td>
965
965
  <td>
966
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 407</span>
966
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 409</span>
967
967
 
968
968
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_tablename'>tablename</span><span class='comma'>,</span> <span class='id identifier rubyid_serializer'>serializer</span> <span class='op'>=</span> <span class='symbol'>:yaml</span><span class='rparen'>)</span>
969
969
  <span class='ivar'>@filename</span> <span class='op'>=</span> <span class='id identifier rubyid_filename'>filename</span>
@@ -1025,8 +1025,6 @@ This is analagous to <code>File.open</code>.</p>
1025
1025
  <pre class="lines">
1026
1026
 
1027
1027
 
1028
- 433
1029
- 434
1030
1028
  435
1031
1029
  436
1032
1030
  437
@@ -1034,10 +1032,12 @@ This is analagous to <code>File.open</code>.</p>
1034
1032
  439
1035
1033
  440
1036
1034
  441
1037
- 442</pre>
1035
+ 442
1036
+ 443
1037
+ 444</pre>
1038
1038
  </td>
1039
1039
  <td>
1040
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 433</span>
1040
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 435</span>
1041
1041
 
1042
1042
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_tablename'>tablename</span><span class='comma'>,</span> <span class='id identifier rubyid_serializer'>serializer</span> <span class='op'>=</span> <span class='symbol'>:yaml</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1043
1043
  <span class='id identifier rubyid_instance'>instance</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_tablename'>tablename</span><span class='comma'>,</span> <span class='id identifier rubyid_serializer'>serializer</span><span class='rparen'>)</span>
@@ -1086,12 +1086,12 @@ nil if it is not present.</p>
1086
1086
  <pre class="lines">
1087
1087
 
1088
1088
 
1089
- 613
1090
- 614
1091
- 615</pre>
1089
+ 644
1090
+ 645
1091
+ 646</pre>
1092
1092
  </td>
1093
1093
  <td>
1094
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 613</span>
1094
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 644</span>
1095
1095
 
1096
1096
  <span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1097
1097
  <span class='kw'>return</span> <span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
@@ -1135,8 +1135,6 @@ serialization method you have chosen.</p>
1135
1135
  <pre class="lines">
1136
1136
 
1137
1137
 
1138
- 595
1139
- 596
1140
1138
  597
1141
1139
  598
1142
1140
  599
@@ -1148,21 +1146,81 @@ serialization method you have chosen.</p>
1148
1146
  605
1149
1147
  606
1150
1148
  607
1151
- 608</pre>
1149
+ 608
1150
+ 609
1151
+ 610
1152
+ 611
1153
+ 612
1154
+ 613
1155
+ 614
1156
+ 615
1157
+ 616
1158
+ 617
1159
+ 618
1160
+ 619
1161
+ 620
1162
+ 621
1163
+ 622
1164
+ 623
1165
+ 624
1166
+ 625
1167
+ 626
1168
+ 627
1169
+ 628
1170
+ 629
1171
+ 630
1172
+ 631
1173
+ 632
1174
+ 633
1175
+ 634
1176
+ 635
1177
+ 636
1178
+ 637
1179
+ 638
1180
+ 639</pre>
1152
1181
  </td>
1153
1182
  <td>
1154
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 595</span>
1183
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 597</span>
1155
1184
 
1156
1185
  <span class='kw'>def</span> <span class='op'>[]=</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1157
1186
  <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_check_key'>check_key</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1158
1187
  <span class='id identifier rubyid_valstr'>valstr</span> <span class='op'>=</span> <span class='const'>SQLite3</span><span class='op'>::</span><span class='const'>Blob</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span> <span class='ivar'>@valenc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='rparen'>)</span>
1159
1188
 
1160
- <span class='id identifier rubyid_insert'>insert</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;~SQL</span>
1161
- <span class='tstring_content'> insert into </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='embexpr_end'>}</span><span class='tstring_content'> (key, value) values (?,?)
1162
- </span><span class='tstring_content'> on conflict(key) do update set value = ?;
1163
- </span><span class='heredoc_end'> SQL
1189
+ <span class='comment'># At one point, this operation was done with SQLite3&#39;s UPSERT:
1190
+ </span> <span class='comment'>#
1191
+ </span> <span class='comment'># insert into #{actual_tbl} (key, value) values (?,?)
1192
+ </span> <span class='comment'># on conflict(key) do update set value = ?;
1193
+ </span> <span class='comment'>#
1194
+ </span> <span class='comment'># Unfortunately, this capability was only added to SQLite3 in
1195
+ </span> <span class='comment'># 2018, which means that at the time of this writing (2022)
1196
+ </span> <span class='comment'># there are still a lot of systems out there that have older
1197
+ </span> <span class='comment'># versions of SQLite3 and so can&#39;t do this.
1198
+ </span> <span class='comment'>#
1199
+ </span> <span class='comment'># The venerable `insert or replace` feature **almost** does what
1200
+ </span> <span class='comment'># I want:
1201
+ </span> <span class='comment'>#
1202
+ </span> <span class='comment'># insert or replace into #{actual_tbl} (key, value) values (?, ?);
1203
+ </span> <span class='comment'>#
1204
+ </span> <span class='comment'># The one problem is that it changes the order of the rows,
1205
+ </span> <span class='comment'># which we need to preserve in order to remain consistent with
1206
+ </span> <span class='comment'># `Hash` semantics (and because it&#39;s useful).
1207
+ </span> <span class='comment'>#
1208
+ </span> <span class='comment'># So we kick it old school and do a `select` followed by an
1209
+ </span> <span class='comment'># `insert` or `update` wrapped in a transaction.
1164
1210
  </span> <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
1165
- <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_sql'>sql</span><span class='lparen'>(</span><span class='id identifier rubyid_insert'>insert</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_valstr'>valstr</span><span class='comma'>,</span> <span class='id identifier rubyid_valstr'>valstr</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1211
+ <span class='id identifier rubyid_rowid'>rowid</span> <span class='op'>=</span> <span class='kw'>nil</span>
1212
+ <span class='id identifier rubyid_select'>select</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>select rowid, key, value from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='embexpr_end'>}</span><span class='tstring_content'> where key = ?;</span><span class='tstring_end'>&quot;</span></span>
1213
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_sql'>sql</span><span class='lparen'>(</span><span class='id identifier rubyid_select'>select</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
1214
+ <span class='id identifier rubyid_rowid'>rowid</span> <span class='op'>=</span> <span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
1215
+ <span class='rbrace'>}</span>
1216
+
1217
+ <span class='kw'>if</span> <span class='id identifier rubyid_rowid'>rowid</span>
1218
+ <span class='id identifier rubyid_update'>update</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>update </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='embexpr_end'>}</span><span class='tstring_content'> set value = ? where rowid = ?;</span><span class='tstring_end'>&quot;</span></span>
1219
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_sql'>sql</span><span class='lparen'>(</span><span class='id identifier rubyid_update'>update</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_valstr'>valstr</span><span class='comma'>,</span> <span class='id identifier rubyid_rowid'>rowid</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1220
+ <span class='kw'>else</span>
1221
+ <span class='id identifier rubyid_insert'>insert</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>insert into </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='embexpr_end'>}</span><span class='tstring_content'> (key, value) values (?,?);</span><span class='tstring_end'>&quot;</span></span>
1222
+ <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_sql'>sql</span><span class='lparen'>(</span><span class='id identifier rubyid_insert'>insert</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_valstr'>valstr</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1223
+ <span class='kw'>end</span>
1166
1224
  <span class='rbrace'>}</span>
1167
1225
 
1168
1226
  <span class='kw'>return</span> <span class='id identifier rubyid_value'>value</span>
@@ -1197,12 +1255,12 @@ serialization method you have chosen.</p>
1197
1255
  <pre class="lines">
1198
1256
 
1199
1257
 
1200
- 697
1201
- 698
1202
- 699</pre>
1258
+ 728
1259
+ 729
1260
+ 730</pre>
1203
1261
  </td>
1204
1262
  <td>
1205
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 697</span>
1263
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 728</span>
1206
1264
 
1207
1265
  <span class='kw'>def</span> <span class='id identifier rubyid_clear'>clear</span>
1208
1266
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_sql'>sql</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>delete from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='embexpr_end'>}</span><span class='tstring_content'>;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
@@ -1242,13 +1300,13 @@ no other <code>DBM</code> objects using that file.</p>
1242
1300
  <pre class="lines">
1243
1301
 
1244
1302
 
1245
- 530
1246
- 531
1247
1303
  532
1248
- 533</pre>
1304
+ 533
1305
+ 534
1306
+ 535</pre>
1249
1307
  </td>
1250
1308
  <td>
1251
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 530</span>
1309
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 532</span>
1252
1310
 
1253
1311
  <span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
1254
1312
  <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_delref'>delref</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
@@ -1298,12 +1356,12 @@ closed <code>DBM</code>.</p>
1298
1356
  <pre class="lines">
1299
1357
 
1300
1358
 
1301
- 537
1302
- 538
1303
- 539</pre>
1359
+ 539
1360
+ 540
1361
+ 541</pre>
1304
1362
  </td>
1305
1363
  <td>
1306
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 537</span>
1364
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 539</span>
1307
1365
 
1308
1366
  <span class='kw'>def</span> <span class='id identifier rubyid_closed?'>closed?</span><span class='lparen'>(</span><span class='rparen'>)</span>
1309
1367
  <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>ClosedHandle</span>
@@ -1339,14 +1397,14 @@ not present, does nothing.</p>
1339
1397
  <pre class="lines">
1340
1398
 
1341
1399
 
1342
- 786
1343
- 787
1344
- 788
1345
- 789
1346
- 790</pre>
1400
+ 817
1401
+ 818
1402
+ 819
1403
+ 820
1404
+ 821</pre>
1347
1405
  </td>
1348
1406
  <td>
1349
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 786</span>
1407
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 817</span>
1350
1408
 
1351
1409
  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1352
1410
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
@@ -1405,14 +1463,14 @@ each entry for which the block returns true.</p>
1405
1463
  <pre class="lines">
1406
1464
 
1407
1465
 
1408
- 796
1409
- 797
1410
- 798
1411
- 799
1412
- 800</pre>
1466
+ 827
1467
+ 828
1468
+ 829
1469
+ 830
1470
+ 831</pre>
1413
1471
  </td>
1414
1472
  <td>
1415
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 796</span>
1473
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 827</span>
1416
1474
 
1417
1475
  <span class='kw'>def</span> <span class='id identifier rubyid_delete_if'>delete_if</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1418
1476
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
@@ -1477,14 +1535,14 @@ own transaction.</p>
1477
1535
  <pre class="lines">
1478
1536
 
1479
1537
 
1480
- 711
1481
- 712
1482
- 713
1483
- 714
1484
- 715</pre>
1538
+ 742
1539
+ 743
1540
+ 744
1541
+ 745
1542
+ 746</pre>
1485
1543
  </td>
1486
1544
  <td>
1487
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 711</span>
1545
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 742</span>
1488
1546
 
1489
1547
  <span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1490
1548
  <span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_enum'>to_enum</span><span class='lparen'>(</span><span class='symbol'>:nt_each</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>
@@ -1539,13 +1597,13 @@ own transaction.</p>
1539
1597
  <pre class="lines">
1540
1598
 
1541
1599
 
1542
- 761
1543
- 762
1544
- 763
1545
- 764</pre>
1600
+ 792
1601
+ 793
1602
+ 794
1603
+ 795</pre>
1546
1604
  </td>
1547
1605
  <td>
1548
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 761</span>
1606
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 792</span>
1549
1607
 
1550
1608
  <span class='kw'>def</span> <span class='id identifier rubyid_each_key'>each_key</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1551
1609
  <span class='kw'>return</span> <span class='const'>Enumerator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_y'>y</span><span class='op'>|</span> <span class='id identifier rubyid_nt_each'>nt_each</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_y'>y</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_k'>k</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>
@@ -1599,13 +1657,13 @@ own transaction.</p>
1599
1657
  <pre class="lines">
1600
1658
 
1601
1659
 
1602
- 770
1603
- 771
1604
- 772
1605
- 773</pre>
1660
+ 801
1661
+ 802
1662
+ 803
1663
+ 804</pre>
1606
1664
  </td>
1607
1665
  <td>
1608
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 770</span>
1666
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 801</span>
1609
1667
 
1610
1668
  <span class='kw'>def</span> <span class='id identifier rubyid_each_value'>each_value</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1611
1669
  <span class='kw'>return</span> <span class='const'>Enumerator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_y'>y</span><span class='op'>|</span> <span class='id identifier rubyid_nt_each'>nt_each</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_y'>y</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_v'>v</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>
@@ -1654,12 +1712,12 @@ own transaction.</p>
1654
1712
  <pre class="lines">
1655
1713
 
1656
1714
 
1657
- 813
1658
- 814
1659
- 815</pre>
1715
+ 844
1716
+ 845
1717
+ 846</pre>
1660
1718
  </td>
1661
1719
  <td>
1662
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 813</span>
1720
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 844</span>
1663
1721
 
1664
1722
  <span class='kw'>def</span> <span class='id identifier rubyid_empty?'>empty?</span>
1665
1723
  <span class='kw'>return</span> <span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>0</span>
@@ -1735,36 +1793,36 @@ exception.</p>
1735
1793
  <pre class="lines">
1736
1794
 
1737
1795
 
1738
- 631
1739
- 632
1740
- 633
1741
- 634
1742
- 635
1743
- 636
1744
- 637
1745
- 638
1746
- 639
1747
- 640
1748
- 641
1749
- 642
1750
- 643
1751
- 644
1752
- 645
1753
- 646
1754
- 647
1755
- 648
1756
- 649
1757
- 650
1758
- 651
1759
- 652
1760
- 653
1761
- 654
1762
- 655
1763
- 656
1764
- 657</pre>
1796
+ 662
1797
+ 663
1798
+ 664
1799
+ 665
1800
+ 666
1801
+ 667
1802
+ 668
1803
+ 669
1804
+ 670
1805
+ 671
1806
+ 672
1807
+ 673
1808
+ 674
1809
+ 675
1810
+ 676
1811
+ 677
1812
+ 678
1813
+ 679
1814
+ 680
1815
+ 681
1816
+ 682
1817
+ 683
1818
+ 684
1819
+ 685
1820
+ 686
1821
+ 687
1822
+ 688</pre>
1765
1823
  </td>
1766
1824
  <td>
1767
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 631</span>
1825
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 662</span>
1768
1826
 
1769
1827
  <span class='kw'>def</span> <span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_default_block'>default_block</span><span class='rparen'>)</span>
1770
1828
 
@@ -1840,12 +1898,12 @@ to help with unit tests.</p>
1840
1898
  <pre class="lines">
1841
1899
 
1842
1900
 
1843
- 546
1844
- 547
1845
- 548</pre>
1901
+ 548
1902
+ 549
1903
+ 550</pre>
1846
1904
  </td>
1847
1905
  <td>
1848
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 546</span>
1906
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 548</span>
1849
1907
 
1850
1908
  <span class='kw'>def</span> <span class='id identifier rubyid_handle_closed?'>handle_closed?</span>
1851
1909
  <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span>
@@ -1898,14 +1956,14 @@ to help with unit tests.</p>
1898
1956
  <pre class="lines">
1899
1957
 
1900
1958
 
1901
- 687
1902
- 688
1903
- 689
1904
- 690
1905
- 691</pre>
1959
+ 718
1960
+ 719
1961
+ 720
1962
+ 721
1963
+ 722</pre>
1906
1964
  </td>
1907
1965
  <td>
1908
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 687</span>
1966
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 718</span>
1909
1967
 
1910
1968
  <span class='kw'>def</span> <span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1911
1969
  <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>String</span> <span class='op'>||</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Symbol</span>
@@ -1961,13 +2019,13 @@ to help with unit tests.</p>
1961
2019
  <pre class="lines">
1962
2020
 
1963
2021
 
1964
- 856
1965
- 857
1966
- 858
1967
- 859</pre>
2022
+ 887
2023
+ 888
2024
+ 889
2025
+ 890</pre>
1968
2026
  </td>
1969
2027
  <td>
1970
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 856</span>
2028
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 887</span>
1971
2029
 
1972
2030
  <span class='kw'>def</span> <span class='id identifier rubyid_has_value?'>has_value?</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
1973
2031
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_v'>v</span> <span class='op'>==</span> <span class='id identifier rubyid_val'>val</span><span class='rbrace'>}</span>
@@ -2008,14 +2066,14 @@ program.</p>
2008
2066
  <pre class="lines">
2009
2067
 
2010
2068
 
2011
- 868
2012
- 869
2013
- 870
2014
- 871
2015
- 872</pre>
2069
+ 899
2070
+ 900
2071
+ 901
2072
+ 902
2073
+ 903</pre>
2016
2074
  </td>
2017
2075
  <td>
2018
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 868</span>
2076
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 899</span>
2019
2077
 
2020
2078
  <span class='kw'>def</span> <span class='id identifier rubyid_invert'>invert</span>
2021
2079
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -2055,14 +2113,14 @@ that the result could exceed available memory.</p>
2055
2113
  <pre class="lines">
2056
2114
 
2057
2115
 
2058
- 669
2059
- 670
2060
- 671
2061
- 672
2062
- 673</pre>
2116
+ 700
2117
+ 701
2118
+ 702
2119
+ 703
2120
+ 704</pre>
2063
2121
  </td>
2064
2122
  <td>
2065
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 669</span>
2123
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 700</span>
2066
2124
 
2067
2125
  <span class='kw'>def</span> <span class='id identifier rubyid_keys'>keys</span>
2068
2126
  <span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -2101,19 +2159,19 @@ as determined by SQLite3.</p>
2101
2159
  <pre class="lines">
2102
2160
 
2103
2161
 
2104
- 877
2105
- 878
2106
- 879
2107
- 880
2108
- 881
2109
- 882
2110
- 883
2111
- 884
2112
- 885
2113
- 886</pre>
2162
+ 908
2163
+ 909
2164
+ 910
2165
+ 911
2166
+ 912
2167
+ 913
2168
+ 914
2169
+ 915
2170
+ 916
2171
+ 917</pre>
2114
2172
  </td>
2115
2173
  <td>
2116
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 877</span>
2174
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 908</span>
2117
2175
 
2118
2176
  <span class='kw'>def</span> <span class='id identifier rubyid_shift'>shift</span>
2119
2177
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
@@ -2159,15 +2217,15 @@ as determined by SQLite3.</p>
2159
2217
  <pre class="lines">
2160
2218
 
2161
2219
 
2162
- 804
2163
- 805
2164
- 806
2165
- 807
2166
- 808
2167
- 809</pre>
2220
+ 835
2221
+ 836
2222
+ 837
2223
+ 838
2224
+ 839
2225
+ 840</pre>
2168
2226
  </td>
2169
2227
  <td>
2170
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 804</span>
2228
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 835</span>
2171
2229
 
2172
2230
  <span class='kw'>def</span> <span class='id identifier rubyid_size'>size</span>
2173
2231
  <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_sql'>sql</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>select count(*) from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_actual_tbl'>actual_tbl</span><span class='embexpr_end'>}</span><span class='tstring_content'>;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
@@ -2210,14 +2268,14 @@ program.</p>
2210
2268
  <pre class="lines">
2211
2269
 
2212
2270
 
2213
- 841
2214
- 842
2215
- 843
2216
- 844
2217
- 845</pre>
2271
+ 872
2272
+ 873
2273
+ 874
2274
+ 875
2275
+ 876</pre>
2218
2276
  </td>
2219
2277
  <td>
2220
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 841</span>
2278
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 872</span>
2221
2279
 
2222
2280
  <span class='kw'>def</span> <span class='id identifier rubyid_to_a'>to_a</span>
2223
2281
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -2258,14 +2316,14 @@ program.</p>
2258
2316
  <pre class="lines">
2259
2317
 
2260
2318
 
2261
- 828
2262
- 829
2263
- 830
2264
- 831
2265
- 832</pre>
2319
+ 859
2320
+ 860
2321
+ 861
2322
+ 862
2323
+ 863</pre>
2266
2324
  </td>
2267
2325
  <td>
2268
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 828</span>
2326
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 859</span>
2269
2327
 
2270
2328
  <span class='kw'>def</span> <span class='id identifier rubyid_to_hash'>to_hash</span>
2271
2329
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
@@ -2296,14 +2354,14 @@ program.</p>
2296
2354
  <pre class="lines">
2297
2355
 
2298
2356
 
2299
- 517
2300
- 518
2301
2357
  519
2302
2358
  520
2303
- 521</pre>
2359
+ 521
2360
+ 522
2361
+ 523</pre>
2304
2362
  </td>
2305
2363
  <td>
2306
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 517</span>
2364
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 519</span>
2307
2365
 
2308
2366
  <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
2309
2367
  <span class='id identifier rubyid_openstr'>openstr</span> <span class='op'>=</span> <span class='id identifier rubyid_closed?'>closed?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>CLOSED</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>OPEN</span><span class='tstring_end'>&#39;</span></span>
@@ -2371,12 +2429,12 @@ argument.</p>
2371
2429
  <pre class="lines">
2372
2430
 
2373
2431
 
2374
- 574
2375
- 575
2376
- 576</pre>
2432
+ 576
2433
+ 577
2434
+ 578</pre>
2377
2435
  </td>
2378
2436
  <td>
2379
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 574</span>
2437
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 576</span>
2380
2438
 
2381
2439
  <span class='kw'>def</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
2382
2440
  <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
@@ -2424,12 +2482,12 @@ argument.</p>
2424
2482
  <pre class="lines">
2425
2483
 
2426
2484
 
2427
- 579
2428
- 580
2429
- 581</pre>
2485
+ 581
2486
+ 582
2487
+ 583</pre>
2430
2488
  </td>
2431
2489
  <td>
2432
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 579</span>
2490
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 581</span>
2433
2491
 
2434
2492
  <span class='kw'>def</span> <span class='id identifier rubyid_transaction_active?'>transaction_active?</span>
2435
2493
  <span class='kw'>return</span> <span class='ivar'>@handle</span><span class='period'>.</span><span class='id identifier rubyid_transaction_active?'>transaction_active?</span>
@@ -2466,14 +2524,14 @@ including <code>Hash</code> and <code>DBM</code> objects.</p>
2466
2524
  <pre class="lines">
2467
2525
 
2468
2526
 
2469
- 778
2470
- 779
2471
- 780
2472
- 781
2473
- 782</pre>
2527
+ 809
2528
+ 810
2529
+ 811
2530
+ 812
2531
+ 813</pre>
2474
2532
  </td>
2475
2533
  <td>
2476
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 778</span>
2534
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 809</span>
2477
2535
 
2478
2536
  <span class='kw'>def</span> <span class='id identifier rubyid_update'>update</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
2479
2537
  <span class='id identifier rubyid_transaction'>transaction</span> <span class='lbrace'>{</span>
@@ -2513,14 +2571,14 @@ that the result could exceed available memory.</p>
2513
2571
  <pre class="lines">
2514
2572
 
2515
2573
 
2516
- 679
2517
- 680
2518
- 681
2519
- 682
2520
- 683</pre>
2574
+ 710
2575
+ 711
2576
+ 712
2577
+ 713
2578
+ 714</pre>
2521
2579
  </td>
2522
2580
  <td>
2523
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 679</span>
2581
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 710</span>
2524
2582
 
2525
2583
  <span class='kw'>def</span> <span class='id identifier rubyid_values'>values</span>
2526
2584
  <span class='id identifier rubyid_values'>values</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -2558,12 +2616,12 @@ given keys.</p>
2558
2616
  <pre class="lines">
2559
2617
 
2560
2618
 
2561
- 661
2562
- 662
2563
- 663</pre>
2619
+ 692
2620
+ 693
2621
+ 694</pre>
2564
2622
  </td>
2565
2623
  <td>
2566
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 661</span>
2624
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 692</span>
2567
2625
 
2568
2626
  <span class='kw'>def</span> <span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_keys'>keys</span><span class='rparen'>)</span>
2569
2627
  <span class='kw'>return</span> <span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
@@ -2578,7 +2636,7 @@ given keys.</p>
2578
2636
  </div>
2579
2637
 
2580
2638
  <div id="footer">
2581
- Generated on Fri Feb 25 14:42:43 2022 by
2639
+ Generated on Sat Feb 26 11:46:07 2022 by
2582
2640
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2583
2641
  0.9.25 (ruby-2.7.0).
2584
2642
  </div>
data/doc/Lite3/Error.html CHANGED
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Fri Feb 25 14:42:43 2022 by
128
+ Generated on Sat Feb 26 11:46:07 2022 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.25 (ruby-2.7.0).
131
131
  </div>
data/doc/Lite3/SQL.html CHANGED
@@ -266,10 +266,10 @@ progress. (E.g. do <strong>not</strong> call this from the block of
266
266
  <pre class="lines">
267
267
 
268
268
 
269
- 307</pre>
269
+ 309</pre>
270
270
  </td>
271
271
  <td>
272
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 307</span>
272
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 309</span>
273
273
 
274
274
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_close_all'>close_all</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>return</span> <span class='const'>HandlePool</span><span class='period'>.</span><span class='id identifier rubyid_close_all'>close_all</span> <span class='kw'>end</span></pre>
275
275
  </td>
@@ -310,10 +310,10 @@ probably not useful to you; it&#39;s there for the unit tests.</p>
310
310
  <pre class="lines">
311
311
 
312
312
 
313
- 298</pre>
313
+ 300</pre>
314
314
  </td>
315
315
  <td>
316
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 298</span>
316
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 300</span>
317
317
 
318
318
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_gc'>gc</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>return</span> <span class='const'>HandlePool</span><span class='period'>.</span><span class='id identifier rubyid_gc'>gc</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
319
319
  </td>
@@ -360,12 +360,12 @@ thread safe. Just a wrapper around <code>SQLite3.threadsafe?</code></p>
360
360
  <pre class="lines">
361
361
 
362
362
 
363
- 285
364
- 286
365
- 287</pre>
363
+ 287
364
+ 288
365
+ 289</pre>
366
366
  </td>
367
367
  <td>
368
- <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 285</span>
368
+ <pre class="code"><span class="info file"># File 'lib/dbmlite3.rb', line 287</span>
369
369
 
370
370
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_threadsafe?'>threadsafe?</span>
371
371
  <span class='kw'>return</span> <span class='const'>SQLite3</span><span class='period'>.</span><span class='id identifier rubyid_threadsafe?'>threadsafe?</span>
@@ -380,7 +380,7 @@ thread safe. Just a wrapper around <code>SQLite3.threadsafe?</code></p>
380
380
  </div>
381
381
 
382
382
  <div id="footer">
383
- Generated on Fri Feb 25 14:42:43 2022 by
383
+ Generated on Sat Feb 26 11:46:07 2022 by
384
384
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
385
385
  0.9.25 (ruby-2.7.0).
386
386
  </div>
data/doc/Lite3.html CHANGED
@@ -107,7 +107,7 @@
107
107
  </div>
108
108
 
109
109
  <div id="footer">
110
- Generated on Fri Feb 25 14:42:43 2022 by
110
+ Generated on Sat Feb 26 11:46:07 2022 by
111
111
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
112
  0.9.25 (ruby-2.7.0).
113
113
  </div>
data/doc/_index.html CHANGED
@@ -142,7 +142,7 @@
142
142
  </div>
143
143
 
144
144
  <div id="footer">
145
- Generated on Fri Feb 25 14:42:43 2022 by
145
+ Generated on Sat Feb 26 11:46:07 2022 by
146
146
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
147
147
  0.9.25 (ruby-2.7.0).
148
148
  </div>
data/doc/file.README.html CHANGED
@@ -193,7 +193,7 @@ make sense of them.</p>
193
193
  </div></div>
194
194
 
195
195
  <div id="footer">
196
- Generated on Fri Feb 25 14:42:43 2022 by
196
+ Generated on Sat Feb 26 11:46:07 2022 by
197
197
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
198
198
  0.9.25 (ruby-2.7.0).
199
199
  </div>
data/doc/index.html CHANGED
@@ -193,7 +193,7 @@ make sense of them.</p>
193
193
  </div></div>
194
194
 
195
195
  <div id="footer">
196
- Generated on Fri Feb 25 14:42:43 2022 by
196
+ Generated on Sat Feb 26 11:46:07 2022 by
197
197
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
198
198
  0.9.25 (ruby-2.7.0).
199
199
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Fri Feb 25 14:42:43 2022 by
103
+ Generated on Sat Feb 26 11:46:07 2022 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.25 (ruby-2.7.0).
106
106
  </div>
data/lib/dbmlite3.rb CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ gem "sqlite3", "~> 1.4"
3
+
2
4
  require 'sqlite3'
3
5
  require 'yaml'
4
6
  require 'set'
@@ -338,7 +340,7 @@ module Lite3
338
340
  # string. you will need to do this instead:
339
341
  #
340
342
  # db.keys.include?('foo') or raise AbjectFailure.new
341
- #
343
+ #
342
344
  # Unlike DBM, values may (optionally) be any serializable Ruby type.
343
345
  #
344
346
  # You can select the serialization method with an optional third
@@ -596,12 +598,41 @@ SQL
596
598
  key = check_key(key)
597
599
  valstr = SQLite3::Blob.new( @valenc.call(value) )
598
600
 
599
- insert = <<~SQL
600
- insert into #{actual_tbl} (key, value) values (?,?)
601
- on conflict(key) do update set value = ?;
602
- SQL
601
+ # At one point, this operation was done with SQLite3's UPSERT:
602
+ #
603
+ # insert into #{actual_tbl} (key, value) values (?,?)
604
+ # on conflict(key) do update set value = ?;
605
+ #
606
+ # Unfortunately, this capability was only added to SQLite3 in
607
+ # 2018, which means that at the time of this writing (2022)
608
+ # there are still a lot of systems out there that have older
609
+ # versions of SQLite3 and so can't do this.
610
+ #
611
+ # The venerable `insert or replace` feature **almost** does what
612
+ # I want:
613
+ #
614
+ # insert or replace into #{actual_tbl} (key, value) values (?, ?);
615
+ #
616
+ # The one problem is that it changes the order of the rows,
617
+ # which we need to preserve in order to remain consistent with
618
+ # `Hash` semantics (and because it's useful).
619
+ #
620
+ # So we kick it old school and do a `select` followed by an
621
+ # `insert` or `update` wrapped in a transaction.
603
622
  transaction {
604
- @handle.sql(insert, [key, valstr, valstr])
623
+ rowid = nil
624
+ select = "select rowid, key, value from #{actual_tbl} where key = ?;"
625
+ @handle.sql(select, [key]) { |row|
626
+ rowid = row[0]
627
+ }
628
+
629
+ if rowid
630
+ update = "update #{actual_tbl} set value = ? where rowid = ?;"
631
+ @handle.sql(update, [valstr, rowid])
632
+ else
633
+ insert = "insert into #{actual_tbl} (key, value) values (?,?);"
634
+ @handle.sql(insert, [key, valstr])
635
+ end
605
636
  }
606
637
 
607
638
  return value
@@ -1,8 +1,6 @@
1
1
 
2
2
  # Tests for *some* of util.rb; this is nowhere near complete.
3
3
 
4
- gem "sqlite3", "~> 1.4"
5
-
6
4
  require_relative '../lib/dbmlite3.rb'
7
5
  require 'fileutils'
8
6
  require 'set'
@@ -122,6 +120,25 @@ Serializations = Set.new
122
120
  db.close
123
121
  end
124
122
 
123
+ it "preserves order after modification" do
124
+ path = Tmp.file
125
+ db = newdb.call(path, "floop")
126
+
127
+ expect( db.keys ) .to eq []
128
+ expect( db.values ) .to eq []
129
+
130
+ db["foo"] = 42
131
+ db["bar"] = 99
132
+ db["quux"] = 123
133
+
134
+ db["foo"] = 88
135
+
136
+ expect( db.keys ) .to eq %w{foo bar quux}
137
+ expect( db.values ) .to eq [88, 99, 123]
138
+
139
+ db.close
140
+ end
141
+
125
142
  it "implements has_key?" do
126
143
  path = Tmp.file
127
144
  db = newdb.call(path, "floop")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbmlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.a1
4
+ version: 1.0.a4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Reuter
@@ -104,7 +104,7 @@ files:
104
104
  - lib/dbmlite3.rb
105
105
  - spec/dbmlite3_spec.rb
106
106
  - spec/spec_helper.rb
107
- homepage: https://codeberg.org/suetanvil/dbmlite3-ruby
107
+ homepage: https://codeberg.org/suetanvil/dbmlite
108
108
  licenses:
109
109
  - MIT
110
110
  metadata: {}