sqlite3 1.5.4 → 2.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +594 -1
  3. data/CONTRIBUTING.md +112 -6
  4. data/{faq/faq.md → FAQ.md} +52 -84
  5. data/INSTALLATION.md +267 -0
  6. data/LICENSE +18 -22
  7. data/README.md +87 -124
  8. data/dependencies.yml +10 -11
  9. data/ext/sqlite3/aggregator.c +153 -147
  10. data/ext/sqlite3/aggregator.h +6 -4
  11. data/ext/sqlite3/backup.c +86 -64
  12. data/ext/sqlite3/backup.h +2 -2
  13. data/ext/sqlite3/database.c +744 -484
  14. data/ext/sqlite3/database.h +23 -4
  15. data/ext/sqlite3/exception.c +116 -92
  16. data/ext/sqlite3/exception.h +5 -1
  17. data/ext/sqlite3/extconf.rb +68 -33
  18. data/ext/sqlite3/sqlite3.c +177 -115
  19. data/ext/sqlite3/sqlite3_ruby.h +2 -2
  20. data/ext/sqlite3/statement.c +590 -293
  21. data/ext/sqlite3/statement.h +4 -3
  22. data/ext/sqlite3/timespec.h +20 -0
  23. data/lib/sqlite3/constants.rb +195 -47
  24. data/lib/sqlite3/database.rb +252 -195
  25. data/lib/sqlite3/errors.rb +54 -1
  26. data/lib/sqlite3/fork_safety.rb +66 -0
  27. data/lib/sqlite3/pragmas.rb +196 -143
  28. data/lib/sqlite3/resultset.rb +14 -105
  29. data/lib/sqlite3/statement.rb +58 -13
  30. data/lib/sqlite3/value.rb +17 -20
  31. data/lib/sqlite3/version.rb +2 -21
  32. data/lib/sqlite3/version_info.rb +17 -0
  33. data/lib/sqlite3.rb +8 -4
  34. data/ports/archives/sqlite-autoconf-3530200.tar.gz +0 -0
  35. metadata +16 -108
  36. data/API_CHANGES.md +0 -49
  37. data/ChangeLog.cvs +0 -88
  38. data/Gemfile +0 -3
  39. data/LICENSE-DEPENDENCIES +0 -20
  40. data/faq/faq.rb +0 -145
  41. data/faq/faq.yml +0 -426
  42. data/lib/sqlite3/translator.rb +0 -118
  43. data/ports/archives/sqlite-autoconf-3400000.tar.gz +0 -0
  44. data/test/helper.rb +0 -27
  45. data/test/test_backup.rb +0 -33
  46. data/test/test_collation.rb +0 -82
  47. data/test/test_database.rb +0 -545
  48. data/test/test_database_flags.rb +0 -95
  49. data/test/test_database_readonly.rb +0 -36
  50. data/test/test_database_readwrite.rb +0 -41
  51. data/test/test_deprecated.rb +0 -44
  52. data/test/test_encoding.rb +0 -155
  53. data/test/test_integration.rb +0 -507
  54. data/test/test_integration_aggregate.rb +0 -336
  55. data/test/test_integration_open_close.rb +0 -30
  56. data/test/test_integration_pending.rb +0 -115
  57. data/test/test_integration_resultset.rb +0 -142
  58. data/test/test_integration_statement.rb +0 -194
  59. data/test/test_result_set.rb +0 -37
  60. data/test/test_sqlite3.rb +0 -30
  61. data/test/test_statement.rb +0 -263
  62. data/test/test_statement_execute.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b90b6b29818fed972c55598d50dd2e395e4c7b9f3c0709d34cb99a462ea8ec5
4
- data.tar.gz: e28aa12b3bac56cb43f8935bd654274cc79464cbef355a07aab3f0a19321b656
3
+ metadata.gz: dbb79f96aa8c13ac20bc538637290a2774d6b0b2d871395daba91ccf5474cdb3
4
+ data.tar.gz: 35015943cf52ce0db1d832622d28452f3ec9ea5eedc8e7640d9813e9eb3142be
5
5
  SHA512:
6
- metadata.gz: 1b8eb37dbf8097870eec21db848c51494834790d547896f1769da7ad7a40d5f2857dc3c09271ab4ec2e242527b993d105fe813f0e13efbc4b0977570cb45aedd
7
- data.tar.gz: a0a2b779e97adb130490734a5b0699aa63064681fea662f61a8a5dc03b75664c0da929cd8f8be8a7f74ddc1925b0192ed9447e6f47bc3161151df4759a91ca8b
6
+ metadata.gz: b626691438c66b6a9fd1eba7fa6bff93b3f761d702ec7e1c39cfbdf308ee988052e91bc0ee52c83a3b91f33847f95683eab22121882bcc8139515027333d3987
7
+ data.tar.gz: 5d8efaa282bae975f9a08f2abf1976f9929e98b4c174b417cff7b62a4a9a5451c9ea2cac677690187168fdf0ebc0a043e870d59ea763a9a88d57ffaa078f78b0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,598 @@
1
1
  # sqlite3-ruby Changelog
2
2
 
3
+ ## 2.9.6 / 2026-08-11
4
+
5
+ ### Security / Stability
6
+
7
+ - Fix a garbage collection bug where the argument array passed to a custom aggregate function's `step` was not visible to the GC, so arguments could be collected mid-conversion when the aggregate takes two or more arguments, corrupting the values passed to `step` or crashing the process. See [GHSA-mwm8-39rw-8826](https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-mwm8-39rw-8826) for more information. #733 @jeremy
8
+
9
+ ### Fixed
10
+
11
+ - Fix a leak where custom aggregate handler instances were never released, so a connection accumulated one instance per `GROUP BY` group per query for its lifetime. #722 @djmb
12
+ - Fix GC compaction issues with custom functions, aggregates, collations, `#trace` and `#authorizer=`. These callbacks were registered with sqlite by passing a raw Ruby object pointer as user data; keeping the object reachable prevented collection but not relocation, after which sqlite held a stale address and the next call could raise `NoMethodError`, return a wrong result, or segfault. Affects applications that call `GC.compact` or run with `GC.auto_compact = true`. The equivalent issue in `#busy_handler` was fixed in #466. #723 @djmb
13
+ - Fix the private methods `Database#open_v2` and `#open16` silently replacing a live connection and leaking the previous connection handle when invoked via `send` on an open database. They now raise `SQLite3::Exception`. #729 @flavorjones
14
+ - Fix TEXT values containing an embedded NUL byte being truncated at the first NUL when passed as arguments to functions created with `Database#define_function`. #730 @flavorjones
15
+ - Fix an exception raised inside a `Database#define_function` block leaving the connection's sqlite mutex held, which deadlocked any other thread that later used the connection. The exception now propagates to the caller and the connection remains usable. #731 @flavorjones
16
+ - `Database.new` now raises `ArgumentError` when the filename or VFS name contains an embedded NUL byte (or an embedded 0x0000 code unit in a UTF-16 filename), instead of silently opening a path truncated at the NUL. #732 @flavorjones
17
+
18
+
19
+ ### Improved
20
+
21
+ - When `Database.new` fails to open the database file, the underlying sqlite3 connection handle is now closed immediately instead of waiting for the garbage collector to clean it up. #719 @katafrakt
22
+
23
+
24
+ ## 2.9.5 / 2026-06-07
25
+
26
+ ### Dependencies
27
+
28
+ - Vendored sqlite is updated to [v3.53.2](https://www.sqlite.org/releaselog/3_53_3.html) (from v3.53.1). #709 @flavorjones
29
+
30
+ ### Security / Stability
31
+
32
+ - Fix use-after-free issue with custom functions, when the same function name is used with multiple arities. See https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-28hh-pr2h-2w89 for more information. #710 @flavorjones
33
+ - Fix use-after-free issue with aggregate functions, if a statement is used after a soft database close. See https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-j7fr-3v8c-3qc3 for more information. #711 @flavorjones
34
+
35
+
36
+ ## 2.9.4 / 2026-05-05
37
+
38
+ - Vendored sqlite is updated to [v3.53.1](https://www.sqlite.org/releaselog/3_53_1.html) (from v3.53.0). #704 @flavorjones
39
+
40
+
41
+ ## 2.9.3 / 2026-04-15
42
+
43
+ - Vendored sqlite is updated to [v3.53.0](https://www.sqlite.org/releaselog/3_53_0.html) (from v3.51.3). #696 @flavorjones
44
+
45
+
46
+ ## 2.9.2 / 2026-03-15
47
+
48
+ - Vendored sqlite is updated to [v3.51.3](https://www.sqlite.org/releaselog/3_51_3.html) (from v3.51.2). #688 @flavorjones
49
+
50
+
51
+ ## 2.9.1 / 2026-02-28
52
+
53
+ - Vendored sqlite is updated to [v3.51.2](https://www.sqlite.org/releaselog/3_51_2.html) (from v3.51.1). #683 @flavorjones
54
+
55
+ ## 2.9.0 / 2025-12-27
56
+
57
+ ### Ruby
58
+
59
+ - Introduce native gem packages for Ruby 4.0. @flavorjones
60
+ - Drop support for Ruby 3.1. @flavorjones
61
+
62
+ ### Added
63
+
64
+ - Introduce `Statement#named_params` to introspect on a parameterized SQL statement. #627 #642 @captn3m0
65
+
66
+ ### Improved
67
+
68
+ - Small improvements to docstrings and comments. @flavorjones @houyuanjie
69
+
70
+
71
+ ## 2.8.1 / 2025-11-29
72
+
73
+ - Vendored sqlite is updated to [v3.51.1](https://www.sqlite.org/releaselog/3_51_1.html) (from v3.51.0). #659 @flavorjones
74
+ - Precompiled native gems are built with rake-compiler-dock v1.10.0 (previously v1.9.1).
75
+
76
+
77
+ ## 2.8.0 / 2025-11-05
78
+
79
+ - Vendored sqlite is updated to [v3.51.0](https://www.sqlite.org/releaselog/3_51_0.html) (from v3.50.4). #652 @flavorjones
80
+
81
+
82
+ ## 2.7.4 / 2025-09-19
83
+
84
+ - Vendored sqlite is updated to [v3.50.4](https://www.sqlite.org/releaselog/3_50_4.html) (from v3.50.3). #644 @flavorjones
85
+
86
+
87
+ ## 2.7.3 / 2025-07-18
88
+
89
+ - Vendored sqlite is updated to [v3.50.3](https://sqlite.org/releaselog/3_50_3.html) (from v3.50.2). #638 @flavorjones
90
+
91
+
92
+ ## 2.7.2 / 2025-07-05
93
+
94
+ - Backport a [fix](https://sqlite.org/src/info/64f5f14322) to the vendored SQLite to support compilation on Rocky Linux. See the [SQLite forum post](https://sqlite.org/forum/forumpost/44a58c8073) for more details. #634, #635 @flavorjones
95
+
96
+
97
+ ## 2.7.1 / 2025-06-30
98
+
99
+ - Vendored sqlite is updated to [v3.50.2](https://sqlite.org/releaselog/3_50_2.html) (from v3.50.1). #633 @flavorjones
100
+
101
+
102
+ ## 2.7.0 / 2025-06-09
103
+
104
+ - Vendored sqlite is updated to [v3.50.1](https://sqlite.org/releaselog/3_50_1.html) (from v3.49.1). #630 @flavorjones
105
+
106
+
107
+ ## 2.6.0 / 2025-02-20
108
+
109
+ ### Dependencies
110
+
111
+ - Vendored sqlite is updated to [v3.49.1](https://sqlite.org/releaselog/3_49_1.html) (from v3.47.2). #605 @flavorjones
112
+ - Updated to rake-compiler-dock v1.9.1. #610 @flavorjones
113
+
114
+ ### Important note for Window users
115
+
116
+ Loading extensions is not available on Windows when using the precompiled native gems or compiling the vendored sqlite library from source, starting with sqlite3-ruby v2.6.0.
117
+
118
+ Sqlite 3.48.0 and later have dramatically changed the "autoconf amalgamation" that is vendored in this gem. Specifically, the configuration is no longer actually autoconf, but some scripts that emulate autoconf's interface and behavior.
119
+
120
+ Although this _mostly_ "just worked", we're having a problem resolving the libraries necessary for loading extensions. As a result, starting with sqlite3-ruby v2.6.0, extensions cannot be loaded on Windows when using precompiled native gems or when compiling the vendored sqlite library.
121
+
122
+ If you are willing and able to help fix this, let us know at https://github.com/sparklemotion/sqlite3-ruby/issues/618.
123
+
124
+
125
+ ## 2.5.0 / 2024-12-25
126
+
127
+ ### Ruby
128
+
129
+ This release introduces native gem packages that include Ruby 3.4.
130
+
131
+
132
+ ## 2.4.1 / 2024-12-08
133
+
134
+ ### Dependencies
135
+
136
+ - Vendored sqlite is updated to [v3.47.2](https://sqlite.org/releaselog/3_47.2.html) #593 @flavorjones
137
+
138
+ The description from the upstream maintainers is:
139
+
140
+ > SQLite version 3.47.2, now available, fixes an important bug that first appeared in the 3.47.0
141
+ > release. In SQLite versions 3.47.0 and 3.47.1, if you try to convert a string into a
142
+ > floating-point value and the first 16 significant digits of the value are exactly
143
+ > "1844674407370955", then the floating-point number generated might be incorrect. The problem
144
+ > only affects x64 and i386 CPUs, so it does not affect you if you are running on ARM. And it only
145
+ > affects releases 3.47.0 and 3.47.1. **If you are running SQLite versions 3.47.0 or 3.47.1, then
146
+ > upgrading is recommended.**
147
+
148
+ Saving you a click, you should upgrade if you're running sqlite3-ruby v2.1.1 or later.
149
+
150
+
151
+ ### Fixed
152
+
153
+ - Prevent unnecessary "Invalid Reference" warnings from the `ForkSafety` module when GC runs during the "after fork" hook. #592 @flavorjones
154
+
155
+
156
+ ## 2.4.0 / 2024-12-03
157
+
158
+ ### Added
159
+
160
+ - `Database#load_extension` now accepts any object that responds to `#to_path`, in addition to String filesystem paths. [#586] @flavorjones
161
+ - `Database.new` now accepts an `extensions:` parameter, which is an array of SQLite extensions that will be loaded during initialization. The array may contain String filesystem paths and objects that respond to `#to_path`. [#586] @flavorjones
162
+
163
+
164
+ ## 2.3.1 / 2024-11-25
165
+
166
+ ### Dependencies
167
+
168
+ - Vendored sqlite is updated to [v3.47.1](https://sqlite.org/releaselog/3_47_1.html) [#589] @flavorjones
169
+
170
+
171
+ ## 2.3.0 / 2024-11-20
172
+
173
+ ### Added
174
+
175
+ - The SQLITE_DBPAGE extension is now enabled by default, which implements an eponymous-only virtual table that provides direct access to the underlying database file by interacting with the pager. See https://www.sqlite.org/dbpage.html for more information. [#578] @flavorjones
176
+ - The DBSTAT extension is now enabled by default, which implements a read-only eponymous virtual table that returns information about the amount of disk space used to store the content of an SQLite database. See https://sqlite.org/dbstat.html for more information. [#580] @pawurb @flavorjones
177
+ - `Database#optimize` which wraps the `pragma optimize;` statement. Also added `Constants::Optimize` to allow advanced users to pass a bitmask of options. See https://www.sqlite.org/pragma.html#pragma_optimize. [#572] @alexcwatt @flavorjones
178
+ - `SQLite3::VERSION_INFO` is contains a bag of metadata about the gem and the sqlite library used. `SQLite3::SQLITE_PACKAGED_LIBRARIES` and `SQLite3::SQLITE_PRECOMPILED_LIBRARIES` are indicate how the gem was built. [#581] @flavorjones
179
+
180
+
181
+ ### Fixed
182
+
183
+ - `Database#encoding=` support for switching the database encoding to `UTF-16BE`, which has been broken since `Database#encoding=` was introduced in v1.3.12 in 2016. [#575] @miyucy
184
+ - Omit mention of the `pkg-config` gem when failing to build from source, since it is not used. [#358] @flavorjones
185
+
186
+
187
+ ## 2.2.0 / 2024-10-30
188
+
189
+ ### Added
190
+
191
+ - URI filenames are now allowed. This allows the injection of some behavior via recognized query parameters. See https://www.sqlite.org/uri.html for more information. [#571] @flavorjones
192
+
193
+
194
+ ### Improved
195
+
196
+ - SQL Syntax errors during `Database#prepare` will raise a verbose exception with a multiline message indicating with a "^" exactly where in the statement the error occurred. [#554] @fractaledmind @flavorjones
197
+
198
+
199
+ ## 2.1.1 / 2024-10-22
200
+
201
+ ### Dependencies
202
+
203
+ - Vendored sqlite is updated to [v3.47.0](https://sqlite.org/releaselog/3_47_0.html) [#570] @flavorjones
204
+
205
+
206
+ ## 2.1.0 / 2024-09-24
207
+
208
+ ### Ruby
209
+
210
+ - This release drops support for Ruby 3.0. [#563] @flavorjones
211
+
212
+
213
+ ### Fork safety improvements
214
+
215
+ Sqlite itself is [not fork-safe](https://www.sqlite.org/howtocorrupt.html#_carrying_an_open_database_connection_across_a_fork_). Specifically, writing in a child process to a database connection that was created in the parent process may corrupt the database file. To mitigate this risk, sqlite3-ruby has implemented the following changes:
216
+
217
+ - All open writable database connections carried across a `fork()` will immediately be closed in the child process to mitigate the risk of corrupting the database file.
218
+ - These connections will be incompletely closed ("discarded") which will result in a one-time memory leak in the child process.
219
+
220
+ If it's at all possible, we strongly recommend that you close writable database connections in the parent before forking. If absolutely necessary (and you know what you're doing), you may suppress the fork safety warnings by calling `SQLite3::ForkSafety.suppress_warnings!`.
221
+
222
+ See the README's "Fork Safety" section and `adr/2024-09-fork-safety.md` for more information. [#558, #565, #566] @flavorjones
223
+
224
+
225
+ ### Improved
226
+
227
+ - Use `sqlite3_close_v2` to close databases in a deferred manner if there are unclosed prepared statements. Previously closing a database while statements were open resulted in a `BusyException`. See https://www.sqlite.org/c3ref/close.html for more context. [#557] @flavorjones
228
+ - When setting a Database `busy_handler`, fire the write barrier to prevent potential crashes during the GC mark phase. [#556] @jhawthorn
229
+
230
+
231
+ ### Documentation
232
+
233
+ - The `FAQ.md` has been updated to fix some inaccuracies. [#562] @rickhull
234
+
235
+
236
+ ## 2.0.4 / 2024-08-13
237
+
238
+ ### Dependencies
239
+
240
+ - Vendored sqlite is updated to [v3.46.1](https://sqlite.org/releaselog/3_46_1.html) @flavorjones
241
+
242
+
243
+ ## 2.0.3 / 2024-07-29
244
+
245
+ ### Improved
246
+
247
+ - `Database#quote` avoids allocating strings where reusing frozen strings is preferable. #548 @casperisfine
248
+
249
+
250
+ ## 2.0.2 / 2024-05-23
251
+
252
+ ### Dependencies
253
+
254
+ - Vendored sqlite is updated to [v3.46.0](https://sqlite.org/releaselog/3_46_0.html) @flavorjones
255
+
256
+
257
+ ## 2.0.1 / 2024-04-20
258
+
259
+ ### Fixed
260
+
261
+ - 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
262
+ - 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
263
+
264
+
265
+ ## 2.0.0 / 2024-04-17
266
+
267
+ This is a major release which contains some breaking changes, primarily the removal of
268
+ long-deprecated functionality. Before upgrading, please make sure to address deprecation warnings
269
+ emitted from your application using sqlite3-ruby v1.7.x.
270
+
271
+
272
+ ### Ruby
273
+
274
+ - This release drops support for Ruby 2.7. [#453] @flavorjones
275
+
276
+
277
+ ### Packaging
278
+
279
+ Native (precompiled) gems are now available for Linux Musl. [#442] @flavorjones
280
+
281
+ Here are the platforms for which native gems are shipped:
282
+
283
+ - `aarch64-linux-gnu` (requires: glibc >= 2.29)
284
+ - `aarch64-linux-musl`
285
+ - `arm-linux-gnu` (requires: glibc >= 2.29)
286
+ - `arm-linux-musl`
287
+ - `arm64-darwin`
288
+ - `x64-mingw32` / `x64-mingw-ucrt`
289
+ - `x86-linux-gnu` (requires: glibc >= 2.17)
290
+ - `x86-linux-musl`
291
+ - `x86_64-darwin`
292
+ - `x86_64-linux-gnu` (requires: glibc >= 2.17)
293
+ - `x86_64-linux-musl`
294
+
295
+ ⚠ Ruby 3.0 linux users must use Rubygems >= 3.3.22 in order to use these gems.
296
+
297
+ ⚠ Musl linux users should update to Bundler >= 2.5.6 to avoid https://github.com/rubygems/rubygems/issues/7432
298
+
299
+ See [the INSTALLATION doc](https://github.com/sparklemotion/sqlite3-ruby/blob/main/INSTALLATION.md) for more information.
300
+
301
+
302
+ ### Dependencies
303
+
304
+ - Vendored sqlite is updated to [v3.45.3](https://sqlite.org/releaselog/3_45_3.html). @flavorjones
305
+
306
+
307
+ ### Added
308
+
309
+ - `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
310
+ - Support the `SUPER_JOURNAL` flag which is an alias for `MASTER_JOURNAL` as of sqlite 3.33.0. [#467] @flavorjones
311
+ - `Statement#stat` and `Statement#memused` introduced to report statistics. [#461] @fractaledmind
312
+ - `Statement#sql` and `Statement#expanded_sql` introduced to retrieve the SQL statement associated with the `Statement` object. [#293, #498] @tenderlove
313
+ - `SQLite3.status` introduced to return run-time status and reset high-water marks. See `SQLite3::Constants::Status` for details. [#520] @wjlroe
314
+
315
+
316
+ ### Improved
317
+
318
+ - Avoid leaking memory for statements that are not closed properly. [#392] @haileys
319
+ - Moved some C code into Ruby. [#451, #455] @tenderlove
320
+ - Improve performance of `ResultSet` hashes. [#154, #484, #468] @tenderlove
321
+ - Fix a GC compaction issue with `busy_handler`. [#466] @byroot
322
+ - Remove unused `ResultSet` instance variable. [#469] @tenderlove
323
+ - Fix encoding for values passed to custom functions. [#218, #488] @tenderlove
324
+
325
+
326
+ ### Changed
327
+
328
+ - 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
329
+ - `Database#columns` returns a list of internal frozen strings. [#155, #474, #486] @tenderlove
330
+ - Freeze results that come from the database. [#480] @tenderlove
331
+ - The encoding of a Database is no longer cached. [#485] @tenderlove
332
+ - `Database#transaction` returns the result of the block when used with a block. [#508] @alexcwatt
333
+ - `Database#execute_batch` returns the result of the last statement executed. [#512] @alexcwatt
334
+
335
+
336
+ ### Removed
337
+
338
+ - Removed class `SQLite3::Translator` and all related type translation methods which have been deprecated since v1.3.2. [#470] @tenderlove
339
+
340
+ If you need to do type translation on values returned from the statement object, please wrap it
341
+ with a delegate object. Here is an example of using a delegate class to implement type
342
+ translation:
343
+
344
+ ```ruby
345
+ require "sqlite3"
346
+ require "delegate"
347
+
348
+ db = SQLite3::Database.new(":memory:")
349
+
350
+ return_value = db.execute_batch2 <<-EOSQL
351
+ CREATE TABLE items (id integer PRIMARY KEY AUTOINCREMENT, name string);
352
+ INSERT INTO items (name) VALUES ("foo");
353
+ INSERT INTO items (name) VALUES ("bar");
354
+ EOSQL
355
+
356
+ class MyTranslator < DelegateClass(SQLite3::Statement)
357
+ def step
358
+ row = super
359
+ return if done?
360
+
361
+ row.map.with_index do |item, i|
362
+ case types[i]
363
+ when "integer" # turn all integers to floats
364
+ item.to_f
365
+ when "string" # add "hello" to all strings
366
+ item + "hello"
367
+ end
368
+ end
369
+ end
370
+ end
371
+
372
+ db.prepare("SELECT * FROM items") do |stmt|
373
+ stmt = MyTranslator.new(stmt)
374
+ while row = stmt.step
375
+ p row
376
+ end
377
+ end
378
+ ```
379
+
380
+ - Removed `types` and `fields` readers on row objects, which have been deprecated since
381
+ v1.3.6. [#471] @tenderlove
382
+
383
+ Deprecated code looks like this:
384
+
385
+ ```ruby
386
+ row = @db.execute("select * from foo")
387
+ assert_equal ["blob"], row.first.types
388
+ ```
389
+
390
+ If you would like to access the "types" associated with a returned query,
391
+ use a prepared statement like this:
392
+
393
+ ```ruby
394
+ @db.prepare("select * from foo") do |v|
395
+ assert_equal ["blob"], v.types
396
+ end
397
+ ```
398
+
399
+ - 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
400
+
401
+ Deprecated code looks like this:
402
+
403
+ ``` ruby
404
+ @db.query("select * from foo where a = ? and b = ? and c = ?", 1, 2, 3)
405
+ ```
406
+
407
+ For these cases, pass the bind parameters as an array:
408
+
409
+ ``` ruby
410
+ @db.query("select * from foo where a = ? and b = ? and c = ?", [1, 2, 3])
411
+ ```
412
+
413
+ - Removed class `SQLite3::VersionProxy` which has been deprecated since v1.3.2. [#453] @flavorjones
414
+ - Removed methods `SQLite3::Database::FunctionProxy#count` and `#set_error` which have been broken since at least v1.3.13. [#164, #509, #510] @alexcwatt @flavorjones
415
+
416
+
417
+ ## 1.7.3 / 2024-03-15
418
+
419
+ ### Dependencies
420
+
421
+ - Vendored sqlite is updated to [v3.45.2](https://www.sqlite.org/releaselog/3_45_2.html). @flavorjones
422
+
423
+
424
+ ## 1.7.2 / 2024-01-30
425
+
426
+ ### Dependencies
427
+
428
+ - Vendored sqlite is updated to [v3.45.1](https://www.sqlite.org/releaselog/3_45_1.html). @flavorjones
429
+
430
+
431
+ ## 1.7.1 / 2024-01-24
432
+
433
+ ### Dependencies
434
+
435
+ - Vendored sqlite is updated to [v3.45.0](https://www.sqlite.org/releaselog/3_45_0.html). @flavorjones
436
+
437
+
438
+ ## 1.7.0 / 2023-12-27
439
+
440
+ ### Ruby
441
+
442
+ This release introduces native gem support for Ruby 3.3.
443
+
444
+ 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.
445
+
446
+ This release ends support for Ruby 1.9.3, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, and 2.6.
447
+
448
+ ### Improved
449
+
450
+ - 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
451
+
452
+
453
+ ## 1.6.9 / 2023-11-26
454
+
455
+ ### Dependencies
456
+
457
+ - Vendored sqlite is update to [v3.44.2](https://sqlite.org/releaselog/3_44_2.html). @flavorjones
458
+
459
+ ### Added
460
+
461
+ - `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
462
+
463
+
464
+ ## 1.6.8 / 2023-11-01
465
+
466
+ ### Dependencies
467
+
468
+ - Vendored sqlite is updated to [v3.44.0](https://sqlite.org/releaselog/3_44_0.html). @flavorjones
469
+ - rake-compiler-dock updated to v1.3.1 for precompiled native gems. @flavorjones
470
+
471
+
472
+ ### Added
473
+
474
+ - `SQLite3::Database.open` now returns the block result. Previously this returned the Database object. [#415] @toy
475
+ - Documentation improvement in `lib/sqlite3/database.rb`. [#421] @szTheory
476
+
477
+
478
+ ## 1.6.7 / 2023-10-10
479
+
480
+ ### Dependencies
481
+
482
+ Vendored sqlite is updated to [v3.43.2](https://sqlite.org/releaselog/3_43_2.html).
483
+
484
+ Upstream release notes:
485
+
486
+ > - Fix a couple of obscure UAF errors and an obscure memory leak.
487
+ > - 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.
488
+ > - Avoid conversion of a double into unsigned long long integer, as some platforms do not do such conversions correctly.
489
+
490
+
491
+ ### Added
492
+
493
+ * Compile packaged sqlite3 with additional flags to explicitly enable FTS5, and set synchronous mode to normal when in WAL mode. [#408] (@flavorjones)
494
+
495
+
496
+ ## 1.6.6 / 2023-09-12
497
+
498
+ ### Dependencies
499
+
500
+ Vendored sqlite is updated to [v3.43.1](https://sqlite.org/releaselog/3_43_1.html).
501
+
502
+ Upstream release notes:
503
+
504
+ > - 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.
505
+ > - 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).
506
+ > - 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.
507
+ > - Other minor fixes.
508
+
509
+
510
+ ## 1.6.5 / 2023-09-08
511
+
512
+ ### Packaging
513
+
514
+ * 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)
515
+
516
+
517
+ ## 1.6.4 / 2023-08-26
518
+
519
+ ### Dependencies
520
+
521
+ Vendored sqlite is updated to [v3.43.0](https://sqlite.org/releaselog/3_43_0.html).
522
+
523
+ Upstream release notes:
524
+
525
+ > SQLite Release 3.43.0 On 2023-08-24
526
+ > * 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.
527
+ > * Enhancements to the date and time functions:
528
+ > * Added new time shift modifiers of the form ±YYYY-MM-DD HH:MM:SS.SSS.
529
+ > * Added the timediff() SQL function.
530
+ > * Added the octet_length(X) SQL function.
531
+ > * Added the sqlite3_stmt_explain() API.
532
+ > * Query planner enhancements:
533
+ > * 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.
534
+ > * Enhance the theorem prover in the OUTER JOIN strength reduction optimization so that it returns fewer false-negatives.
535
+ > * Enhancements to the decimal extension:
536
+ > * New function decimal_pow2(N) returns the N-th power of 2 for integer N between -20000 and +20000.
537
+ > * 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.
538
+ > * 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.
539
+ > * Performance enhancements to JSON processing results in a 2x performance improvement for some kinds of processing on large JSON strings.
540
+ > * 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.)
541
+ > * 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.
542
+ > * The VFS for unix now assumes that the nanosleep() system call is available unless compiled with -DHAVE_NANOSLEEP=0.
543
+
544
+
545
+ ## 1.6.3 / 2023-05-16
546
+
547
+ ### Dependencies
548
+
549
+ Vendored sqlite is updated to [v3.42.0](https://sqlite.org/releaselog/3_42_0.html).
550
+
551
+ From the release announcement:
552
+
553
+ > This is a regular enhancement release. The main new features are:
554
+ > * SQLite will now parse and understand JSON5, though it is careful to generate only pure, canonical JSON.
555
+ > * The secure-delete option has been added to the FTS5 extension.
556
+
557
+
558
+ ## 1.6.2 / 2023-03-27
559
+
560
+ ### Dependencies
561
+
562
+ Vendored sqlite is updated from v3.41.0 to [v3.41.2](https://sqlite.org/releaselog/3_41_2.html).
563
+
564
+
565
+ ### Packaging
566
+
567
+ * Allow compilation against system libraries without the presence of `mini_portile2`, primarily for the convenience of linux distro repackagers. [#381] (Thank you, @voxik!)
568
+
569
+
570
+ ## 1.6.1 / 2023-02-22
571
+
572
+ ### Dependencies
573
+
574
+ * Vendored sqlite is updated to [v3.41.0](https://sqlite.org/releaselog/3_41_0.html).
575
+
576
+
577
+ ## 1.6.0 / 2023-01-13
578
+
579
+ ### Ruby
580
+
581
+ This release introduces native gem support for Ruby 3.2.
582
+
583
+ 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/).
584
+
585
+
586
+ ### Dependencies
587
+
588
+ * Vendored sqlite3 is updated to [v3.40.1](https://sqlite.org/releaselog/3_40_1.html).
589
+
590
+
591
+ ### Fixes
592
+
593
+ * `get_boolean_pragma` now returns the correct value. Previously, it always returned true. [#275] (Thank you, @Edouard-chin!)
594
+
595
+
3
596
  ## 1.5.4 / 2022-11-18
4
597
 
5
598
  ### Dependencies
@@ -120,7 +713,7 @@ You can opt-out of the packaged version of sqlite (and use your system-installed
120
713
 
121
714
  ## 1.4.1
122
715
 
123
- * Don't mandate dl functions for the extention build
716
+ * Don't mandate dl functions for the extension build
124
717
  * bumping version
125
718
 
126
719