sqlite3 1.5.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +390 -0
  3. data/CONTRIBUTING.md +34 -2
  4. data/{faq/faq.md → FAQ.md} +0 -43
  5. data/INSTALLATION.md +269 -0
  6. data/LICENSE +18 -22
  7. data/README.md +76 -128
  8. data/dependencies.yml +13 -0
  9. data/ext/sqlite3/aggregator.c +142 -146
  10. data/ext/sqlite3/aggregator.h +2 -4
  11. data/ext/sqlite3/backup.c +86 -64
  12. data/ext/sqlite3/backup.h +2 -2
  13. data/ext/sqlite3/database.c +543 -465
  14. data/ext/sqlite3/database.h +9 -4
  15. data/ext/sqlite3/exception.c +111 -92
  16. data/ext/sqlite3/exception.h +3 -1
  17. data/ext/sqlite3/extconf.rb +83 -51
  18. data/ext/sqlite3/sqlite3.c +160 -115
  19. data/ext/sqlite3/sqlite3_ruby.h +2 -2
  20. data/ext/sqlite3/statement.c +518 -293
  21. data/ext/sqlite3/statement.h +3 -3
  22. data/ext/sqlite3/timespec.h +20 -0
  23. data/lib/sqlite3/constants.rb +171 -47
  24. data/lib/sqlite3/database.rb +141 -181
  25. data/lib/sqlite3/errors.rb +26 -1
  26. data/lib/sqlite3/pragmas.rb +128 -138
  27. data/lib/sqlite3/resultset.rb +14 -105
  28. data/lib/sqlite3/statement.rb +58 -13
  29. data/lib/sqlite3/value.rb +17 -20
  30. data/lib/sqlite3/version.rb +1 -21
  31. data/lib/sqlite3.rb +6 -4
  32. data/ports/archives/sqlite-autoconf-3460000.tar.gz +0 -0
  33. metadata +19 -107
  34. data/API_CHANGES.md +0 -49
  35. data/ChangeLog.cvs +0 -88
  36. data/Gemfile +0 -3
  37. data/LICENSE-DEPENDENCIES +0 -20
  38. data/faq/faq.rb +0 -145
  39. data/faq/faq.yml +0 -426
  40. data/lib/sqlite3/translator.rb +0 -118
  41. data/ports/archives/sqlite-autoconf-3380500.tar.gz +0 -0
  42. data/test/helper.rb +0 -27
  43. data/test/test_backup.rb +0 -33
  44. data/test/test_collation.rb +0 -82
  45. data/test/test_database.rb +0 -545
  46. data/test/test_database_flags.rb +0 -95
  47. data/test/test_database_readonly.rb +0 -36
  48. data/test/test_database_readwrite.rb +0 -41
  49. data/test/test_deprecated.rb +0 -44
  50. data/test/test_encoding.rb +0 -155
  51. data/test/test_integration.rb +0 -507
  52. data/test/test_integration_aggregate.rb +0 -336
  53. data/test/test_integration_open_close.rb +0 -30
  54. data/test/test_integration_pending.rb +0 -115
  55. data/test/test_integration_resultset.rb +0 -142
  56. data/test/test_integration_statement.rb +0 -194
  57. data/test/test_result_set.rb +0 -37
  58. data/test/test_sqlite3.rb +0 -30
  59. data/test/test_statement.rb +0 -263
  60. data/test/test_statement_execute.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 685aec95d0550b6bd793a8d8e15a3be1c28b0eeddf28a8ae9b9d9077a3ce917d
4
- data.tar.gz: ed8fd1bd0fa72b7a1c631be188f867df640c1b6ce49f30b2f24398c0f4d2429a
3
+ metadata.gz: f55003062c0de8516574697a3a8aa323c0ec16265c6fea50ab51012447ea3751
4
+ data.tar.gz: 4c176a14ff9f12850b9f2cb5ebc1b7141127076a25d7ce75fd36aa14514a5b98
5
5
  SHA512:
6
- metadata.gz: 3dba348c4207f2092e9d36f813c566eb057a3f22c068f7a679871db3c44d6ec616884eaa996726c54840bcbbd27ae0b9afc231a05734583010999ff538039db5
7
- data.tar.gz: bdefe14b0d7eff11bf6b44dbaab57e83811fea0f9ba9a0cff941c7d14578ac8439cf90313a0c64ce431360bcd14f5bf117e8663d8321bd1c029cce5e41bf8b40
6
+ metadata.gz: a7f2b0891c6480a9cf2731ac8712cedcf15ffab08f2d2a68967cb9e1afc2a33e7d7501050d2056de74a069f65ae113e2e8bf195edb7f28dc010f8b6e70c2d795
7
+ data.tar.gz: aad1f26e943b7dd01543f86682b36a0f319fab42446501f747f2add4825d767eacf4efcb4f32d652e306d4ecd41ab2d4556501b7b3072361d9276fa99023a6d8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,395 @@
1
1
  # sqlite3-ruby Changelog
2
2
 
3
+ ## 2.0.2 / 2024-05-23
4
+
5
+ ### Dependencies
6
+
7
+ - Vendored sqlite is updated to [v3.46.0](https://sqlite.org/releaselog/3_46_0.html) @flavorjones
8
+
9
+
10
+ ## 2.0.1 / 2024-04-20
11
+
12
+ ### Fixed
13
+
14
+ - Raise `ArgumentError` if `Database#execute`, `#execute_batch`, or `#query` are passed multiple bind parameters that are not in an Array. In v2.0.0 these methods would silently swallow additional arguments, and this change makes the failure explicit. See the CHANGELOG notes for v2.0.0 for examples on how to update your code. [#527] @flavorjones
15
+ - Fixed a regression in v2.0.0 that caused `Database#execute_batch` to raise an encoding exception when passed some non-ascii strings. As a result of this fix, `Database#prepare` now ensures the "remainder" string will always be encoded as UTF-8. [#524] @flavorjones
16
+
17
+
18
+ ## 2.0.0 / 2024-04-17
19
+
20
+ This is a major release which contains some breaking changes, primarily the removal of
21
+ long-deprecated functionality. Before upgrading, please make sure to address deprecation warnings
22
+ emitted from your application using sqlite3-ruby v1.7.x.
23
+
24
+
25
+ ### Ruby
26
+
27
+ - This release drops support for Ruby 2.7. [#453] @flavorjones
28
+
29
+
30
+ ### Packaging
31
+
32
+ Native (precompiled) gems are now available for Linux Musl. [#442] @flavorjones
33
+
34
+ Here are the platforms for which native gems are shipped:
35
+
36
+ - `aarch64-linux-gnu` (requires: glibc >= 2.29)
37
+ - `aarch64-linux-musl`
38
+ - `arm-linux-gnu` (requires: glibc >= 2.29)
39
+ - `arm-linux-musl`
40
+ - `arm64-darwin`
41
+ - `x64-mingw32` / `x64-mingw-ucrt`
42
+ - `x86-linux-gnu` (requires: glibc >= 2.17)
43
+ - `x86-linux-musl`
44
+ - `x86_64-darwin`
45
+ - `x86_64-linux-gnu` (requires: glibc >= 2.17)
46
+ - `x86_64-linux-musl`
47
+
48
+ ⚠ Ruby 3.0 linux users must use Rubygems >= 3.3.22 in order to use these gems.
49
+
50
+ ⚠ Musl linux users should update to Bundler >= 2.5.6 to avoid https://github.com/rubygems/rubygems/issues/7432
51
+
52
+ See [the INSTALLATION doc](https://github.com/sparklemotion/sqlite3-ruby/blob/main/INSTALLATION.md) for more information.
53
+
54
+
55
+ ### Dependencies
56
+
57
+ - Vendored sqlite is updated to [v3.45.3](https://sqlite.org/releaselog/3_45_3.html). @flavorjones
58
+
59
+
60
+ ### Added
61
+
62
+ - `Database#busy_handler_timeout=` introduced as an alternative to `#busy_timeout=` that can be used when it's desired to release the GVL between retries. [#443, #456] @fractaledmind
63
+ - Support the `SUPER_JOURNAL` flag which is an alias for `MASTER_JOURNAL` as of sqlite 3.33.0. [#467] @flavorjones
64
+ - `Statement#stat` and `Statement#memused` introduced to report statistics. [#461] @fractaledmind
65
+ - `Statement#sql` and `Statement#expanded_sql` introduced to retrieve the SQL statement associated with the `Statement` object. [#293, #498] @tenderlove
66
+ - `SQLite3.status` introduced to return run-time status and reset high-water marks. See `SQLite3::Constants::Status` for details. [#520] @wjlroe
67
+
68
+
69
+ ### Improved
70
+
71
+ - Avoid leaking memory for statements that are not closed properly. [#392] @haileys
72
+ - Moved some C code into Ruby. [#451, #455] @tenderlove
73
+ - Improve performance of `ResultSet` hashes. [#154, #484, #468] @tenderlove
74
+ - Fix a GC compaction issue with `busy_handler`. [#466] @byroot
75
+ - Remove unused `ResultSet` instance variable. [#469] @tenderlove
76
+ - Fix encoding for values passed to custom functions. [#218, #488] @tenderlove
77
+
78
+
79
+ ### Changed
80
+
81
+ - Consistently use `SQLite3::Exception` or subclasses. Previously some `Pragmas` methods raised `Exception`, and `Database#execute_batch2` and `Database#load_extension` raised `RuntimeError`. [#467, #490] @flavorjones
82
+ - `Database#columns` returns a list of internal frozen strings. [#155, #474, #486] @tenderlove
83
+ - Freeze results that come from the database. [#480] @tenderlove
84
+ - The encoding of a Database is no longer cached. [#485] @tenderlove
85
+ - `Database#transaction` returns the result of the block when used with a block. [#508] @alexcwatt
86
+ - `Database#execute_batch` returns the result of the last statement executed. [#512] @alexcwatt
87
+
88
+
89
+ ### Removed
90
+
91
+ - Removed class `SQLite3::Translator` and all related type translation methods which have been deprecated since v1.3.2. [#470] @tenderlove
92
+
93
+ If you need to do type translation on values returned from the statement object, please wrap it
94
+ with a delegate object. Here is an example of using a delegate class to implement type
95
+ translation:
96
+
97
+ ```ruby
98
+ require "sqlite3"
99
+ require "delegate"
100
+
101
+ db = SQLite3::Database.new(":memory:")
102
+
103
+ return_value = db.execute_batch2 <<-EOSQL
104
+ CREATE TABLE items (id integer PRIMARY KEY AUTOINCREMENT, name string);
105
+ INSERT INTO items (name) VALUES ("foo");
106
+ INSERT INTO items (name) VALUES ("bar");
107
+ EOSQL
108
+
109
+ class MyTranslator < DelegateClass(SQLite3::Statement)
110
+ def step
111
+ row = super
112
+ return if done?
113
+
114
+ row.map.with_index do |item, i|
115
+ case types[i]
116
+ when "integer" # turn all integers to floats
117
+ item.to_f
118
+ when "string" # add "hello" to all strings
119
+ item + "hello"
120
+ end
121
+ end
122
+ end
123
+ end
124
+
125
+ db.prepare("SELECT * FROM items") do |stmt|
126
+ stmt = MyTranslator.new(stmt)
127
+ while row = stmt.step
128
+ p row
129
+ end
130
+ end
131
+ ```
132
+
133
+ - Removed `types` and `fields` readers on row objects, which have been deprecated since
134
+ v1.3.6. [#471] @tenderlove
135
+
136
+ Deprecated code looks like this:
137
+
138
+ ```ruby
139
+ row = @db.execute("select * from foo")
140
+ assert_equal ["blob"], row.first.types
141
+ ```
142
+
143
+ If you would like to access the "types" associated with a returned query,
144
+ use a prepared statement like this:
145
+
146
+ ```ruby
147
+ @db.prepare("select * from foo") do |v|
148
+ assert_equal ["blob"], v.types
149
+ end
150
+ ```
151
+
152
+ - Removed support for non-Array bind parameters to methods `Database#execute`, `#execute_batch`, and `#query`, which has been deprecated since v1.3.0. [#511] @flavorjones
153
+
154
+ Deprecated code looks like this:
155
+
156
+ ``` ruby
157
+ @db.query("select * from foo where a = ? and b = ? and c = ?", 1, 2, 3)
158
+ ```
159
+
160
+ For these cases, pass the bind parameters as an array:
161
+
162
+ ``` ruby
163
+ @db.query("select * from foo where a = ? and b = ? and c = ?", [1, 2, 3])
164
+ ```
165
+
166
+ - Removed class `SQLite3::VersionProxy` which has been deprecated since v1.3.2. [#453] @flavorjones
167
+ - Removed methods `SQLite3::Database::FunctionProxy#count` and `#set_error` which have been broken since at least v1.3.13. [#164, #509, #510] @alexcwatt @flavorjones
168
+
169
+
170
+ ## 1.7.3 / 2024-03-15
171
+
172
+ ### Dependencies
173
+
174
+ - Vendored sqlite is updated to [v3.45.2](https://www.sqlite.org/releaselog/3_45_2.html). @flavorjones
175
+
176
+
177
+ ## 1.7.2 / 2024-01-30
178
+
179
+ ### Dependencies
180
+
181
+ - Vendored sqlite is updated to [v3.45.1](https://www.sqlite.org/releaselog/3_45_1.html). @flavorjones
182
+
183
+
184
+ ## 1.7.1 / 2024-01-24
185
+
186
+ ### Dependencies
187
+
188
+ - Vendored sqlite is updated to [v3.45.0](https://www.sqlite.org/releaselog/3_45_0.html). @flavorjones
189
+
190
+
191
+ ## 1.7.0 / 2023-12-27
192
+
193
+ ### Ruby
194
+
195
+ This release introduces native gem support for Ruby 3.3.
196
+
197
+ This release ends native gem support for Ruby 2.7, for which [upstream support ended 2023-03-31](https://www.ruby-lang.org/en/downloads/branches/). Ruby 2.7 is still generally supported, but will not be shipped in the native gems.
198
+
199
+ This release ends support for Ruby 1.9.3, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, and 2.6.
200
+
201
+ ### Improved
202
+
203
+ - SQLite3::Statement, Database, and Backup objects have been converted to use the TypedData API. See https://bugs.ruby-lang.org/issues/19998 for more context. [#432] @casperisfine
204
+
205
+
206
+ ## 1.6.9 / 2023-11-26
207
+
208
+ ### Dependencies
209
+
210
+ - Vendored sqlite is update to [v3.44.2](https://sqlite.org/releaselog/3_44_2.html). @flavorjones
211
+
212
+ ### Added
213
+
214
+ - `Database.new` now accepts a `:default_transaction_mode` option (defaulting to `:deferred`), and `Database#transaction` no longer requires a transaction mode to be specified. This should allow higher-level adapters to more easily choose a transaction mode for a database connection. [#426] @masamitsu-murase
215
+
216
+
217
+ ## 1.6.8 / 2023-11-01
218
+
219
+ ### Dependencies
220
+
221
+ - Vendored sqlite is updated to [v3.44.0](https://sqlite.org/releaselog/3_44_0.html). @flavorjones
222
+ - rake-compiler-dock updated to v1.3.1 for precompiled native gems. @flavorjones
223
+
224
+
225
+ ### Added
226
+
227
+ - `SQLite3::Database.open` now returns the block result. Previously this returned the Database object. [#415] @toy
228
+ - Documentation improvement in `lib/sqlite3/database.rb`. [#421] @szTheory
229
+
230
+
231
+ ## 1.6.7 / 2023-10-10
232
+
233
+ ### Dependencies
234
+
235
+ Vendored sqlite is updated to [v3.43.2](https://sqlite.org/releaselog/3_43_2.html).
236
+
237
+ Upstream release notes:
238
+
239
+ > - Fix a couple of obscure UAF errors and an obscure memory leak.
240
+ > - Omit the use of the sprintf() function from the standard library in the [CLI](https://sqlite.org/cli.html), as this now generates warnings on some platforms.
241
+ > - Avoid conversion of a double into unsigned long long integer, as some platforms do not do such conversions correctly.
242
+
243
+
244
+ ### Added
245
+
246
+ * Compile packaged sqlite3 with additional flags to explicitly enable FTS5, and set synchronous mode to normal when in WAL mode. [#408] (@flavorjones)
247
+
248
+
249
+ ## 1.6.6 / 2023-09-12
250
+
251
+ ### Dependencies
252
+
253
+ Vendored sqlite is updated to [v3.43.1](https://sqlite.org/releaselog/3_43_1.html).
254
+
255
+ Upstream release notes:
256
+
257
+ > - Fix a regression in the way that the [sum()](https://sqlite.org/lang_aggfunc.html#sumunc), [avg()](https://sqlite.org/lang_aggfunc.html#avg), and [total()](https://sqlite.org/lang_aggfunc.html#sumunc) aggregate functions handle infinities.
258
+ > - Fix a bug in the [json_array_length()](https://sqlite.org/json1.html#jarraylen) function that occurs when the argument comes directly from [json_remove()](https://sqlite.org/json1.html#jrm).
259
+ > - Fix the omit-unused-subquery-columns optimization (introduced in in version 3.42.0) so that it works correctly if the subquery is a compound where one arm is DISTINCT and the other is not.
260
+ > - Other minor fixes.
261
+
262
+
263
+ ## 1.6.5 / 2023-09-08
264
+
265
+ ### Packaging
266
+
267
+ * Allow setting compiler flags for the sqlite library via a `--with-sqlite-cflags` argument to `extconf.rb`. See [`INSTALLATION.md`](https://github.com/sparklemotion/sqlite3-ruby/blob/master/INSTALLATION.md#controlling-compilation-flags-for-sqlite) for more information. [#401, #402] (@flavorjones)
268
+
269
+
270
+ ## 1.6.4 / 2023-08-26
271
+
272
+ ### Dependencies
273
+
274
+ Vendored sqlite is updated to [v3.43.0](https://sqlite.org/releaselog/3_43_0.html).
275
+
276
+ Upstream release notes:
277
+
278
+ > SQLite Release 3.43.0 On 2023-08-24
279
+ > * Add support for Contentless-Delete FTS5 Indexes. This is a variety of FTS5 full-text search index that omits storing the content that is being indexed while also allowing records to be deleted.
280
+ > * Enhancements to the date and time functions:
281
+ > * Added new time shift modifiers of the form ±YYYY-MM-DD HH:MM:SS.SSS.
282
+ > * Added the timediff() SQL function.
283
+ > * Added the octet_length(X) SQL function.
284
+ > * Added the sqlite3_stmt_explain() API.
285
+ > * Query planner enhancements:
286
+ > * Generalize the LEFT JOIN strength reduction optimization so that it works for RIGHT and FULL JOINs as well. Rename it to OUTER JOIN strength reduction.
287
+ > * Enhance the theorem prover in the OUTER JOIN strength reduction optimization so that it returns fewer false-negatives.
288
+ > * Enhancements to the decimal extension:
289
+ > * New function decimal_pow2(N) returns the N-th power of 2 for integer N between -20000 and +20000.
290
+ > * New function decimal_exp(X) works like decimal(X) except that it returns the result in exponential notation - with a "e+NN" at the end.
291
+ > * If X is a floating-point value, then the decimal(X) function now does a full expansion of that value into its exact decimal equivalent.
292
+ > * Performance enhancements to JSON processing results in a 2x performance improvement for some kinds of processing on large JSON strings.
293
+ > * New makefile target "verify-source" checks to ensure that there are no unintentional changes in the source tree. (Works for canonical source code only - not for precompiled amalgamation tarballs.)
294
+ > * Added the SQLITE_USE_SEH compile-time option that enables Structured Exception Handling on Windows while working with the memory-mapped shm file that is part of WAL mode processing. This option is enabled by default when building on Windows using Makefile.msc.
295
+ > * The VFS for unix now assumes that the nanosleep() system call is available unless compiled with -DHAVE_NANOSLEEP=0.
296
+
297
+
298
+ ## 1.6.3 / 2023-05-16
299
+
300
+ ### Dependencies
301
+
302
+ Vendored sqlite is updated to [v3.42.0](https://sqlite.org/releaselog/3_42_0.html).
303
+
304
+ From the release announcement:
305
+
306
+ > This is a regular enhancement release. The main new features are:
307
+ > * SQLite will now parse and understand JSON5, though it is careful to generate only pure, canonical JSON.
308
+ > * The secure-delete option has been added to the FTS5 extension.
309
+
310
+
311
+ ## 1.6.2 / 2023-03-27
312
+
313
+ ### Dependencies
314
+
315
+ Vendored sqlite is updated from v3.41.0 to [v3.41.2](https://sqlite.org/releaselog/3_41_2.html).
316
+
317
+
318
+ ### Packaging
319
+
320
+ * Allow compilation against system libraries without the presence of `mini_portile2`, primarily for the convenience of linux distro repackagers. [#381] (Thank you, @voxik!)
321
+
322
+
323
+ ## 1.6.1 / 2023-02-22
324
+
325
+ ### Dependencies
326
+
327
+ * Vendored sqlite is updated to [v3.41.0](https://sqlite.org/releaselog/3_41_0.html).
328
+
329
+
330
+ ## 1.6.0 / 2023-01-13
331
+
332
+ ### Ruby
333
+
334
+ This release introduces native gem support for Ruby 3.2.
335
+
336
+ This release ends native gem support for Ruby 2.6, for which [upstream support ended 2022-04-12](https://www.ruby-lang.org/en/downloads/branches/).
337
+
338
+
339
+ ### Dependencies
340
+
341
+ * Vendored sqlite3 is updated to [v3.40.1](https://sqlite.org/releaselog/3_40_1.html).
342
+
343
+
344
+ ### Fixes
345
+
346
+ * `get_boolean_pragma` now returns the correct value. Previously, it always returned true. [#275] (Thank you, @Edouard-chin!)
347
+
348
+
349
+ ## 1.5.4 / 2022-11-18
350
+
351
+ ### Dependencies
352
+
353
+ * Vendored sqlite is updated to [v3.40.0](https://sqlite.org/releaselog/3_40_0.html).
354
+
355
+
356
+ ## 1.5.3 / 2022-10-11
357
+
358
+ ### Fixed
359
+
360
+ * Fixed installation of the "ruby" platform gem when building from source on Fedora. In v1.5.0..v1.5.2, installation failed on some systems due to the behavior of Fedora's pkg-config implementation. [#355]
361
+
362
+
363
+ ## 1.5.2 / 2022-10-01
364
+
365
+ ### Packaging
366
+
367
+ This version correctly vendors the tarball for sqlite v3.39.4 in the vanilla "ruby" platform gem package, so that users will not require network access at installation.
368
+
369
+ v1.5.0 and v1.5.1 mistakenly packaged the tarball for sqlite v3.38.5 in the vanilla "ruby" platform gem, resulting in downloading the intended tarball over the network at installation time (or, if the network was not available, failure to install). Note that the precompiled native gems were not affected by this issue. [#352]
370
+
371
+
372
+ ## 1.5.1 / 2022-09-29
373
+
374
+ ### Dependencies
375
+
376
+ * Vendored sqlite is updated to [v3.39.4](https://sqlite.org/releaselog/3_39_4.html).
377
+
378
+ ### Security
379
+
380
+ The vendored version of sqlite, v3.39.4, should be considered to be a security release. From the release notes:
381
+
382
+ > Version 3.39.4 is a minimal patch against the prior release that addresses issues found since the
383
+ > prior release. In particular, a potential vulnerability in the FTS3 extension has been fixed, so
384
+ > this should be considered a security update.
385
+ >
386
+ > In order to exploit the vulnerability, an attacker must have full SQL access and must be able to
387
+ > construct a corrupt database with over 2GB of FTS3 content. The problem arises from a 32-bit
388
+ > signed integer overflow.
389
+
390
+ For more information please see [GHSA-mgvv-5mxp-xq67](https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-mgvv-5mxp-xq67).
391
+
392
+
3
393
  ## 1.5.0 / 2022-09-08
4
394
 
5
395
  ### Packaging
data/CONTRIBUTING.md CHANGED
@@ -5,6 +5,28 @@
5
5
  This doc is a short introduction on how to modify and maintain the sqlite3-ruby gem.
6
6
 
7
7
 
8
+ ## Architecture notes
9
+
10
+ ### Garbage collection
11
+
12
+ All statements keep pointers back to their respective database connections.
13
+ The `@connection` instance variable on the `Statement` handle keeps the database
14
+ connection alive. Memory allocated for a statement handler will be freed in
15
+ two cases:
16
+
17
+ 1. `#close` is called on the statement
18
+ 2. The `SQLite3::Database` object gets garbage collected
19
+
20
+ We can't free the memory for the statement in the garbage collection function
21
+ for the statement handler. The reason is because there exists a race
22
+ condition. We cannot guarantee the order in which objects will be garbage
23
+ collected. So, it is possible that a connection and a statement are up for
24
+ garbage collection. If the database connection were to be free'd before the
25
+ statement, then boom. Instead we'll be conservative and free unclosed
26
+ statements when the connection is terminated.
27
+
28
+
29
+
8
30
  ## Building gems
9
31
 
10
32
  As a prerequisite please make sure you have `docker` correctly installed, so that you're able to cross-compile the native gems.
@@ -12,13 +34,23 @@ As a prerequisite please make sure you have `docker` correctly installed, so tha
12
34
  Run `bin/build-gems` which will package gems for all supported platforms, and run some basic sanity tests on those packages using `bin/test-gem-set` and `bin/test-gem-file-contents`.
13
35
 
14
36
 
37
+ ## Updating the version of libsqlite3
38
+
39
+ Update `/dependencies.yml` to reflect:
40
+
41
+ - the version of libsqlite3
42
+ - the URL from which to download
43
+ - the checksum of the file, which will need to be verified manually (see comments in that file)
44
+
45
+
15
46
  ## Making a release
16
47
 
17
48
  A quick checklist:
18
49
 
19
50
  - [ ] make sure CI is green!
20
- - [ ] update `CHANGELOG.md` and `lib/sqlite3/version.rb` including `VersionProxy::{MINOR,TINY}`
21
- - [ ] create a git tag using a format that matches the pattern `v\d+\.\d+\.\d+`, e.g. `v1.3.13`
51
+ - [ ] update `CHANGELOG.md` and `lib/sqlite3/version.rb`
22
52
  - [ ] run `bin/build-gems` and make sure it completes and all the tests pass
53
+ - [ ] create a git tag using a format that matches the pattern `v\d+\.\d+\.\d+`, e.g. `v1.3.13`
54
+ - [ ] `git push && git push --tags`
23
55
  - [ ] `for g in gems/*.gem ; do gem push $g ; done`
24
56
  - [ ] create a release at https://github.com/sparklemotion/sqlite3-ruby/releases and include sha2 checksums
@@ -289,49 +289,6 @@ by column name, even though they are still arrays!
289
289
  end
290
290
  ```
291
291
 
292
- ## I'd like the values from a query to be the correct types, instead of String.
293
-
294
- You can turn on "type translation" by setting `Database#type_translation` to
295
- true:
296
-
297
-
298
- ```ruby
299
- db.type_translation = true
300
- db.execute( "select * from table" ) do |row|
301
- p row
302
- end
303
- ```
304
-
305
-
306
- By doing this, each return value for each row will be translated to its
307
- correct type, based on its declared column type.
308
-
309
-
310
- You can even declare your own translation routines, if (for example) you are
311
- using an SQL type that is not handled by default:
312
-
313
-
314
- ```ruby
315
- # assume "objects" table has the following schema:
316
- # create table objects (
317
- # name varchar2(20),
318
- # thing object
319
- # )
320
-
321
- db.type_translation = true
322
- db.translator.add_translator( "object" ) do |type, value|
323
- db.decode( value )
324
- end
325
-
326
- h = { :one=>:two, "three"=>"four", 5=>6 }
327
- dump = db.encode( h )
328
-
329
- db.execute( "insert into objects values ( ?, ? )", "bob", dump )
330
-
331
- obj = db.get_first_value( "select thing from objects where name='bob'" )
332
- p obj == h
333
- ```
334
-
335
292
  ## How do I insert binary data into the database?
336
293
 
337
294
  Use blobs. Blobs are new features of SQLite3. You have to use bind