sqlite3 1.6.3 → 2.10.2

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +615 -1
  3. data/CONTRIBUTING.md +103 -6
  4. data/{faq/faq.md → FAQ.md} +66 -79
  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 +178 -178
  10. data/ext/sqlite3/aggregator.h +7 -4
  11. data/ext/sqlite3/backup.c +92 -65
  12. data/ext/sqlite3/backup.h +2 -2
  13. data/ext/sqlite3/database.c +964 -477
  14. data/ext/sqlite3/database.h +26 -4
  15. data/ext/sqlite3/exception.c +213 -94
  16. data/ext/sqlite3/exception.h +26 -1
  17. data/ext/sqlite3/extconf.rb +59 -29
  18. data/ext/sqlite3/sqlite3.c +190 -115
  19. data/ext/sqlite3/sqlite3_ruby.h +5 -2
  20. data/ext/sqlite3/statement.c +672 -297
  21. data/ext/sqlite3/statement.h +4 -3
  22. data/ext/sqlite3/timespec.h +29 -0
  23. data/lib/sqlite3/constants.rb +195 -47
  24. data/lib/sqlite3/database.rb +272 -225
  25. data/lib/sqlite3/errors.rb +54 -1
  26. data/lib/sqlite3/fork_safety.rb +66 -0
  27. data/lib/sqlite3/pragmas.rb +194 -141
  28. data/lib/sqlite3/resultset.rb +30 -111
  29. data/lib/sqlite3/statement.rb +105 -25
  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-3540100.tar.gz +0 -0
  35. metadata +16 -48
  36. data/API_CHANGES.md +0 -49
  37. data/ChangeLog.cvs +0 -88
  38. data/Gemfile +0 -11
  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-3420000.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 -569
  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 -49
  52. data/test/test_encoding.rb +0 -165
  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_pragmas.rb +0 -22
  60. data/test/test_result_set.rb +0 -47
  61. data/test/test_sqlite3.rb +0 -30
  62. data/test/test_statement.rb +0 -288
  63. data/test/test_statement_execute.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd05b46af0d4f89e125660bec21d64440653c7e8c9ebcc425f90390ce7b8f9c9
4
- data.tar.gz: 619be5f01d500878ad1d101683d67503ac8f18e6c4e78326c9c735344d141997
3
+ metadata.gz: 04fc8d37ba845e25af3d976633e7042b376b4bd33186ca0af5950ae5999d8548
4
+ data.tar.gz: ffb42ff2e840bec7bcb8c790c212517b20f476988974e48b9289f9970cdb1d46
5
5
  SHA512:
6
- metadata.gz: d51109b1fc40075a89eb5d1dbde3332c750490bdb8fc7c979aca45c3010083435a4453da40671b0a046767390b6555c117f450ddae6fb92f0c68f299db1cec5d
7
- data.tar.gz: dde78179c5e10ffc088d99161178e47c857fe54d673a3641b54bcc70075a97512785c1ee3cc56266054894483b75c05f2fa89e194d416034b9c6b1f2c268b8f8
6
+ metadata.gz: e2aa6a5adf371a4ce60e672ae1b2903f70af4af3fbed6dec3d2ae92c5e91b63a7ff9feb598657706d0a4c3eeda8bdaf9750f74d65faa7e3184c7c45f814e39aa
7
+ data.tar.gz: 80a444a02a70cc3f2100dbd25be2f2c5fc9a6ed39926d3c1de40f33b5c2ce7b47b843bd8328f13ba2016b02eb815a69926d4a266a9250bc8c7a55fcaca47aa5b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,619 @@
1
1
  # sqlite3-ruby Changelog
2
2
 
3
+ ## 2.10.2 / 2026-10-26
4
+
5
+ ### Security / Stability
6
+
7
+ - Raise `RangeError` when a SQL string, a bound String or Blob value, or a String or Blob returned from a custom function or aggregate is longer than `INT_MAX` bytes. Previously the length was truncated to 32 bits, so SQLite could read only part of the string and drop trailing clauses from a query. See [GHSA-4fqr-96q8-xrfx](https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-4fqr-96q8-xrfx) for more information. #762 @flavorjones
8
+ - Fix a crash when a custom aggregate's `finalize` returns a value that can't be converted to a SQLite result. The exception is now raised from the query and the connection remains usable. #762 @flavorjones
9
+ - Fix a use-after-free when the hash returned by `Database#collations` is cleared, modified or frozen. GC could free a comparator that SQLite still called. When that hash is frozen, `Database#collation` still raises `FrozenError`, but the new comparator stays registered and in use. #764 @flavorjones
10
+ - Fix a deadlock when a collation comparator, `trace` block, `busy_handler` block or authorizer raises, or when an interrupt such as `Thread#raise` arrives while an aggregate's handler is being created. Another thread that used the connection blocked forever. The exception is now raised from the query and the connection remains usable. See "Changed" below for what SQLite does before the exception is raised. #764 @flavorjones
11
+ - Fix a crash when a custom function or aggregate uses `throw`. The throw now unwinds to its `catch`. #764 @flavorjones
12
+
13
+ ### Changed
14
+
15
+ - When a callback raises or throws, SQLite now finishes its current call before the exception is raised, instead of being unwound in the middle of it. #764 @flavorjones
16
+ - When a `trace` block raises, SQLite runs the statement up to its first row, or to completion, before the exception is raised. Previously the statement stopped where the block raised. For example, an `INSERT` whose `trace` block raises now inserts its row.
17
+ - The other callbacks in that SQLite call skip their Ruby code: collation comparators return 0, functions and aggregates report an error to SQLite, the busy handler stops retrying and the authorizer denies.
18
+ - `Database#execute_batch2` now raises the exception from a custom function, instead of `SQLite3::SQLException` "Ruby Exception occurred".
19
+ - An exception from a callback that SQLite runs during `Statement#reset!` or `Database#close` is discarded.
20
+ - The extension keeps per-fiber state in `Thread.current[:__sqlite3_callback_frames__]`. A query raises `FrozenError` on a `Thread` that was frozen before its first query. #764 @flavorjones
21
+ - When SQLite can't allocate an aggregate's context, the query raises `SQLite3::MemoryException` instead of aborting the process. #764 @flavorjones
22
+
23
+ ### Improved
24
+
25
+ - `Statement#step` no longer allocates and discards an array when the statement has no more rows. This saves one object per statement execution. #758 @thomasklemm
26
+ - `ObjectSpace.dump` and heap profilers now report `SQLite3::Database` and `SQLite3::Statement` objects under their own type names, instead of `SQLite3::Backup`. #764 @flavorjones
27
+
28
+ ### Documentation
29
+
30
+ - Document that parameters bound by `Statement#execute`, `#execute!`, `#bind_param` and `#bind_params` stay bound across executions, and that `Statement#clear_bindings!` clears them. #751 @flavorjones
31
+
32
+
33
+ ## 2.10.1 / 2026-10-19
34
+
35
+ ### Dependencies
36
+
37
+ - Vendored sqlite is updated to [v3.54.1](https://www.sqlite.org/releaselog/3_54_1.html) (from v3.54.0). This release contains a fix for a possible heap buffer overflow on 32-bit builds, including the precompiled `x86-linux-gnu` and `x86-linux-musl` gems. #756 @flavorjones
38
+
39
+ ### Improved
40
+
41
+ - `Database#define_aggregator` no longer creates an anonymous class for each aggregate function it defines. Each invocation of the function still runs on a clone of the template object. #752 @jhawthorn
42
+
43
+
44
+ ## 2.10.0 / 2026-10-13
45
+
46
+ ### Dependencies
47
+
48
+ - Vendored sqlite is updated to [v3.54.0](https://www.sqlite.org/releaselog/3_54_0.html) (from v3.53.2). #750 @flavorjones
49
+
50
+ Notable changes in this version include:
51
+ - `ALTER TABLE` now raises an error when adding, renaming, or dropping a column named `ROWID`, `_ROWID_`, or `OID`.
52
+ - The authorizer callback is now invoked for SQL functions in the `DEFAULT` clauses of `CREATE TABLE` statements.
53
+ - SQLite no longer supports Windows XP or earlier. On Windows, the precompiled gem and any installation that compiles the vendored sqlite now require Windows Vista or later.
54
+
55
+ ### Added
56
+
57
+ - `ResultSet#each` and `#each_hash` return an `Enumerator` when called without a block. Previously they raised `LocalJumpError`. #656 @kch
58
+ - Introduce `Database#serialize`, which returns a database as a binary string, and `Database#deserialize`, which replaces a database with the contents of such a string. These wrap [`sqlite3_serialize()`](https://www.sqlite.org/c3ref/serialize.html) and [`sqlite3_deserialize()`](https://www.sqlite.org/c3ref/deserialize.html). Both methods are defined only when SQLite was compiled without `SQLITE_OMIT_DESERIALIZE`, and `Database#deserialize` also requires that the loaded SQLite is v3.54.0 or later. An image of a database in WAL mode cannot be queried after deserializing; see the `Database#deserialize` documentation. #685 @Maaarcocr
59
+
60
+ ### Fixed
61
+
62
+ - Fix `Database#statement_timeout=` interrupting statements almost immediately instead of after the timeout elapsed, including re-executed prepared statements and calls to `Database#execute_batch2`. #737 @palkan @flavorjones
63
+
64
+ ### Improved
65
+
66
+ - On CRuby, `Statement#types` allocates fewer strings. Each declared type is downcased and interned in C, instead of allocating two strings per column. #743 @jhawthorn
67
+
68
+ ### Changed
69
+
70
+ - `ResultSet#each` and `#each_hash` return the result set when called with a block. As a consequence, `Database#execute` and `#execute2` called with a block return the closed `ResultSet` instead of `nil`. #656 @kch
71
+ - `Statement#columns` and `Statement#types` return frozen arrays, and the strings in `Statement#types` are frozen. Code that mutates them now raises `FrozenError`. #743 @jhawthorn
72
+ - `Statement#column_decltype` and `Statement#types` return UTF-8 strings. Previously they returned ASCII-8BIT strings. #743 @jhawthorn
73
+
74
+
75
+ ## 2.9.6 / 2026-08-11
76
+
77
+ ### Security / Stability
78
+
79
+ - 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
80
+
81
+ ### Fixed
82
+
83
+ - 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
84
+ - 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
85
+ - 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
86
+ - 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
87
+ - 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
88
+ - `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
89
+
90
+
91
+ ### Improved
92
+
93
+ - 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
94
+
95
+
96
+ ## 2.9.5 / 2026-06-07
97
+
98
+ ### Dependencies
99
+
100
+ - Vendored sqlite is updated to [v3.53.2](https://www.sqlite.org/releaselog/3_53_2.html) (from v3.53.1). #709 @flavorjones
101
+
102
+ ### Security / Stability
103
+
104
+ - 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
105
+ - 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
106
+
107
+
108
+ ## 2.9.4 / 2026-05-05
109
+
110
+ - Vendored sqlite is updated to [v3.53.1](https://www.sqlite.org/releaselog/3_53_1.html) (from v3.53.0). #704 @flavorjones
111
+
112
+
113
+ ## 2.9.3 / 2026-04-15
114
+
115
+ - Vendored sqlite is updated to [v3.53.0](https://www.sqlite.org/releaselog/3_53_0.html) (from v3.51.3). #696 @flavorjones
116
+
117
+
118
+ ## 2.9.2 / 2026-03-15
119
+
120
+ - Vendored sqlite is updated to [v3.51.3](https://www.sqlite.org/releaselog/3_51_3.html) (from v3.51.2). #688 @flavorjones
121
+
122
+
123
+ ## 2.9.1 / 2026-02-28
124
+
125
+ - Vendored sqlite is updated to [v3.51.2](https://www.sqlite.org/releaselog/3_51_2.html) (from v3.51.1). #683 @flavorjones
126
+
127
+ ## 2.9.0 / 2025-12-27
128
+
129
+ ### Ruby
130
+
131
+ - Introduce native gem packages for Ruby 4.0. @flavorjones
132
+ - Drop support for Ruby 3.1. @flavorjones
133
+
134
+ ### Added
135
+
136
+ - Introduce `Statement#named_params` to introspect on a parameterized SQL statement. #627 #642 @captn3m0
137
+
138
+ ### Improved
139
+
140
+ - Small improvements to docstrings and comments. @flavorjones @houyuanjie
141
+
142
+
143
+ ## 2.8.1 / 2025-11-29
144
+
145
+ - Vendored sqlite is updated to [v3.51.1](https://www.sqlite.org/releaselog/3_51_1.html) (from v3.51.0). #659 @flavorjones
146
+ - Precompiled native gems are built with rake-compiler-dock v1.10.0 (previously v1.9.1).
147
+
148
+
149
+ ## 2.8.0 / 2025-11-05
150
+
151
+ - Vendored sqlite is updated to [v3.51.0](https://www.sqlite.org/releaselog/3_51_0.html) (from v3.50.4). #652 @flavorjones
152
+
153
+
154
+ ## 2.7.4 / 2025-09-19
155
+
156
+ - Vendored sqlite is updated to [v3.50.4](https://www.sqlite.org/releaselog/3_50_4.html) (from v3.50.3). #644 @flavorjones
157
+
158
+
159
+ ## 2.7.3 / 2025-07-18
160
+
161
+ - Vendored sqlite is updated to [v3.50.3](https://sqlite.org/releaselog/3_50_3.html) (from v3.50.2). #638 @flavorjones
162
+
163
+
164
+ ## 2.7.2 / 2025-07-05
165
+
166
+ - 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
167
+
168
+
169
+ ## 2.7.1 / 2025-06-30
170
+
171
+ - Vendored sqlite is updated to [v3.50.2](https://sqlite.org/releaselog/3_50_2.html) (from v3.50.1). #633 @flavorjones
172
+
173
+
174
+ ## 2.7.0 / 2025-06-09
175
+
176
+ - Vendored sqlite is updated to [v3.50.1](https://sqlite.org/releaselog/3_50_1.html) (from v3.49.1). #630 @flavorjones
177
+
178
+
179
+ ## 2.6.0 / 2025-02-20
180
+
181
+ ### Dependencies
182
+
183
+ - Vendored sqlite is updated to [v3.49.1](https://sqlite.org/releaselog/3_49_1.html) (from v3.47.2). #605 @flavorjones
184
+ - Updated to rake-compiler-dock v1.9.1. #610 @flavorjones
185
+
186
+ ### Important note for Window users
187
+
188
+ 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.
189
+
190
+ 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.
191
+
192
+ 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.
193
+
194
+ If you are willing and able to help fix this, let us know at https://github.com/sparklemotion/sqlite3-ruby/issues/618.
195
+
196
+
197
+ ## 2.5.0 / 2024-12-25
198
+
199
+ ### Ruby
200
+
201
+ This release introduces native gem packages that include Ruby 3.4.
202
+
203
+
204
+ ## 2.4.1 / 2024-12-08
205
+
206
+ ### Dependencies
207
+
208
+ - Vendored sqlite is updated to [v3.47.2](https://sqlite.org/releaselog/3_47.2.html) #593 @flavorjones
209
+
210
+ The description from the upstream maintainers is:
211
+
212
+ > SQLite version 3.47.2, now available, fixes an important bug that first appeared in the 3.47.0
213
+ > release. In SQLite versions 3.47.0 and 3.47.1, if you try to convert a string into a
214
+ > floating-point value and the first 16 significant digits of the value are exactly
215
+ > "1844674407370955", then the floating-point number generated might be incorrect. The problem
216
+ > only affects x64 and i386 CPUs, so it does not affect you if you are running on ARM. And it only
217
+ > affects releases 3.47.0 and 3.47.1. **If you are running SQLite versions 3.47.0 or 3.47.1, then
218
+ > upgrading is recommended.**
219
+
220
+ Saving you a click, you should upgrade if you're running sqlite3-ruby v2.1.1 or later.
221
+
222
+
223
+ ### Fixed
224
+
225
+ - Prevent unnecessary "Invalid Reference" warnings from the `ForkSafety` module when GC runs during the "after fork" hook. #592 @flavorjones
226
+
227
+
228
+ ## 2.4.0 / 2024-12-03
229
+
230
+ ### Added
231
+
232
+ - `Database#load_extension` now accepts any object that responds to `#to_path`, in addition to String filesystem paths. [#586] @flavorjones
233
+ - `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
234
+
235
+
236
+ ## 2.3.1 / 2024-11-25
237
+
238
+ ### Dependencies
239
+
240
+ - Vendored sqlite is updated to [v3.47.1](https://sqlite.org/releaselog/3_47_1.html) [#589] @flavorjones
241
+
242
+
243
+ ## 2.3.0 / 2024-11-20
244
+
245
+ ### Added
246
+
247
+ - 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
248
+ - 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
249
+ - `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
250
+ - `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
251
+
252
+
253
+ ### Fixed
254
+
255
+ - `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
256
+ - Omit mention of the `pkg-config` gem when failing to build from source, since it is not used. [#358] @flavorjones
257
+
258
+
259
+ ## 2.2.0 / 2024-10-30
260
+
261
+ ### Added
262
+
263
+ - 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
264
+
265
+
266
+ ### Improved
267
+
268
+ - 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
269
+
270
+
271
+ ## 2.1.1 / 2024-10-22
272
+
273
+ ### Dependencies
274
+
275
+ - Vendored sqlite is updated to [v3.47.0](https://sqlite.org/releaselog/3_47_0.html) [#570] @flavorjones
276
+
277
+
278
+ ## 2.1.0 / 2024-09-24
279
+
280
+ ### Ruby
281
+
282
+ - This release drops support for Ruby 3.0. [#563] @flavorjones
283
+
284
+
285
+ ### Fork safety improvements
286
+
287
+ 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:
288
+
289
+ - 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.
290
+ - These connections will be incompletely closed ("discarded") which will result in a one-time memory leak in the child process.
291
+
292
+ 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!`.
293
+
294
+ See the README's "Fork Safety" section and `adr/2024-09-fork-safety.md` for more information. [#558, #565, #566] @flavorjones
295
+
296
+
297
+ ### Improved
298
+
299
+ - 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
300
+ - When setting a Database `busy_handler`, fire the write barrier to prevent potential crashes during the GC mark phase. [#556] @jhawthorn
301
+
302
+
303
+ ### Documentation
304
+
305
+ - The `FAQ.md` has been updated to fix some inaccuracies. [#562] @rickhull
306
+
307
+
308
+ ## 2.0.4 / 2024-08-13
309
+
310
+ ### Dependencies
311
+
312
+ - Vendored sqlite is updated to [v3.46.1](https://sqlite.org/releaselog/3_46_1.html) @flavorjones
313
+
314
+
315
+ ## 2.0.3 / 2024-07-29
316
+
317
+ ### Improved
318
+
319
+ - `Database#quote` avoids allocating strings where reusing frozen strings is preferable. #548 @casperisfine
320
+
321
+
322
+ ## 2.0.2 / 2024-05-23
323
+
324
+ ### Dependencies
325
+
326
+ - Vendored sqlite is updated to [v3.46.0](https://sqlite.org/releaselog/3_46_0.html) @flavorjones
327
+
328
+
329
+ ## 2.0.1 / 2024-04-20
330
+
331
+ ### Fixed
332
+
333
+ - 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
334
+ - 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
335
+
336
+
337
+ ## 2.0.0 / 2024-04-17
338
+
339
+ This is a major release which contains some breaking changes, primarily the removal of
340
+ long-deprecated functionality. Before upgrading, please make sure to address deprecation warnings
341
+ emitted from your application using sqlite3-ruby v1.7.x.
342
+
343
+
344
+ ### Ruby
345
+
346
+ - This release drops support for Ruby 2.7. [#453] @flavorjones
347
+
348
+
349
+ ### Packaging
350
+
351
+ Native (precompiled) gems are now available for Linux Musl. [#442] @flavorjones
352
+
353
+ Here are the platforms for which native gems are shipped:
354
+
355
+ - `aarch64-linux-gnu` (requires: glibc >= 2.29)
356
+ - `aarch64-linux-musl`
357
+ - `arm-linux-gnu` (requires: glibc >= 2.29)
358
+ - `arm-linux-musl`
359
+ - `arm64-darwin`
360
+ - `x64-mingw32` / `x64-mingw-ucrt`
361
+ - `x86-linux-gnu` (requires: glibc >= 2.17)
362
+ - `x86-linux-musl`
363
+ - `x86_64-darwin`
364
+ - `x86_64-linux-gnu` (requires: glibc >= 2.17)
365
+ - `x86_64-linux-musl`
366
+
367
+ ⚠ Ruby 3.0 linux users must use Rubygems >= 3.3.22 in order to use these gems.
368
+
369
+ ⚠ Musl linux users should update to Bundler >= 2.5.6 to avoid https://github.com/rubygems/rubygems/issues/7432
370
+
371
+ See [the INSTALLATION doc](https://github.com/sparklemotion/sqlite3-ruby/blob/main/INSTALLATION.md) for more information.
372
+
373
+
374
+ ### Dependencies
375
+
376
+ - Vendored sqlite is updated to [v3.45.3](https://sqlite.org/releaselog/3_45_3.html). @flavorjones
377
+
378
+
379
+ ### Added
380
+
381
+ - `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
382
+ - Support the `SUPER_JOURNAL` flag which is an alias for `MASTER_JOURNAL` as of sqlite 3.33.0. [#467] @flavorjones
383
+ - `Statement#stat` and `Statement#memused` introduced to report statistics. [#461] @fractaledmind
384
+ - `Statement#sql` and `Statement#expanded_sql` introduced to retrieve the SQL statement associated with the `Statement` object. [#293, #498] @tenderlove
385
+ - `SQLite3.status` introduced to return run-time status and reset high-water marks. See `SQLite3::Constants::Status` for details. [#520] @wjlroe
386
+
387
+
388
+ ### Improved
389
+
390
+ - Avoid leaking memory for statements that are not closed properly. [#392] @haileys
391
+ - Moved some C code into Ruby. [#451, #455] @tenderlove
392
+ - Improve performance of `ResultSet` hashes. [#154, #484, #468] @tenderlove
393
+ - Fix a GC compaction issue with `busy_handler`. [#466] @byroot
394
+ - Remove unused `ResultSet` instance variable. [#469] @tenderlove
395
+ - Fix encoding for values passed to custom functions. [#218, #488] @tenderlove
396
+
397
+
398
+ ### Changed
399
+
400
+ - 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
401
+ - `Database#columns` returns a list of internal frozen strings. [#155, #474, #486] @tenderlove
402
+ - Freeze results that come from the database. [#480] @tenderlove
403
+ - The encoding of a Database is no longer cached. [#485] @tenderlove
404
+ - `Database#transaction` returns the result of the block when used with a block. [#508] @alexcwatt
405
+ - `Database#execute_batch` returns the result of the last statement executed. [#512] @alexcwatt
406
+
407
+
408
+ ### Removed
409
+
410
+ - Removed class `SQLite3::Translator` and all related type translation methods which have been deprecated since v1.3.2. [#470] @tenderlove
411
+
412
+ If you need to do type translation on values returned from the statement object, please wrap it
413
+ with a delegate object. Here is an example of using a delegate class to implement type
414
+ translation:
415
+
416
+ ```ruby
417
+ require "sqlite3"
418
+ require "delegate"
419
+
420
+ db = SQLite3::Database.new(":memory:")
421
+
422
+ return_value = db.execute_batch2 <<-EOSQL
423
+ CREATE TABLE items (id integer PRIMARY KEY AUTOINCREMENT, name string);
424
+ INSERT INTO items (name) VALUES ("foo");
425
+ INSERT INTO items (name) VALUES ("bar");
426
+ EOSQL
427
+
428
+ class MyTranslator < DelegateClass(SQLite3::Statement)
429
+ def step
430
+ row = super
431
+ return if done?
432
+
433
+ row.map.with_index do |item, i|
434
+ case types[i]
435
+ when "integer" # turn all integers to floats
436
+ item.to_f
437
+ when "string" # add "hello" to all strings
438
+ item + "hello"
439
+ end
440
+ end
441
+ end
442
+ end
443
+
444
+ db.prepare("SELECT * FROM items") do |stmt|
445
+ stmt = MyTranslator.new(stmt)
446
+ while row = stmt.step
447
+ p row
448
+ end
449
+ end
450
+ ```
451
+
452
+ - Removed `types` and `fields` readers on row objects, which have been deprecated since
453
+ v1.3.6. [#471] @tenderlove
454
+
455
+ Deprecated code looks like this:
456
+
457
+ ```ruby
458
+ row = @db.execute("select * from foo")
459
+ assert_equal ["blob"], row.first.types
460
+ ```
461
+
462
+ If you would like to access the "types" associated with a returned query,
463
+ use a prepared statement like this:
464
+
465
+ ```ruby
466
+ @db.prepare("select * from foo") do |v|
467
+ assert_equal ["blob"], v.types
468
+ end
469
+ ```
470
+
471
+ - 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
472
+
473
+ Deprecated code looks like this:
474
+
475
+ ``` ruby
476
+ @db.query("select * from foo where a = ? and b = ? and c = ?", 1, 2, 3)
477
+ ```
478
+
479
+ For these cases, pass the bind parameters as an array:
480
+
481
+ ``` ruby
482
+ @db.query("select * from foo where a = ? and b = ? and c = ?", [1, 2, 3])
483
+ ```
484
+
485
+ - Removed class `SQLite3::VersionProxy` which has been deprecated since v1.3.2. [#453] @flavorjones
486
+ - Removed methods `SQLite3::Database::FunctionProxy#count` and `#set_error` which have been broken since at least v1.3.13. [#164, #509, #510] @alexcwatt @flavorjones
487
+
488
+
489
+ ## 1.7.3 / 2024-03-15
490
+
491
+ ### Dependencies
492
+
493
+ - Vendored sqlite is updated to [v3.45.2](https://www.sqlite.org/releaselog/3_45_2.html). @flavorjones
494
+
495
+
496
+ ## 1.7.2 / 2024-01-30
497
+
498
+ ### Dependencies
499
+
500
+ - Vendored sqlite is updated to [v3.45.1](https://www.sqlite.org/releaselog/3_45_1.html). @flavorjones
501
+
502
+
503
+ ## 1.7.1 / 2024-01-24
504
+
505
+ ### Dependencies
506
+
507
+ - Vendored sqlite is updated to [v3.45.0](https://www.sqlite.org/releaselog/3_45_0.html). @flavorjones
508
+
509
+
510
+ ## 1.7.0 / 2023-12-27
511
+
512
+ ### Ruby
513
+
514
+ This release introduces native gem support for Ruby 3.3.
515
+
516
+ 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.
517
+
518
+ This release ends support for Ruby 1.9.3, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, and 2.6.
519
+
520
+ ### Improved
521
+
522
+ - 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
523
+
524
+
525
+ ## 1.6.9 / 2023-11-26
526
+
527
+ ### Dependencies
528
+
529
+ - Vendored sqlite is update to [v3.44.2](https://sqlite.org/releaselog/3_44_2.html). @flavorjones
530
+
531
+ ### Added
532
+
533
+ - `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
534
+
535
+
536
+ ## 1.6.8 / 2023-11-01
537
+
538
+ ### Dependencies
539
+
540
+ - Vendored sqlite is updated to [v3.44.0](https://sqlite.org/releaselog/3_44_0.html). @flavorjones
541
+ - rake-compiler-dock updated to v1.3.1 for precompiled native gems. @flavorjones
542
+
543
+
544
+ ### Added
545
+
546
+ - `SQLite3::Database.open` now returns the block result. Previously this returned the Database object. [#415] @toy
547
+ - Documentation improvement in `lib/sqlite3/database.rb`. [#421] @szTheory
548
+
549
+
550
+ ## 1.6.7 / 2023-10-10
551
+
552
+ ### Dependencies
553
+
554
+ Vendored sqlite is updated to [v3.43.2](https://sqlite.org/releaselog/3_43_2.html).
555
+
556
+ Upstream release notes:
557
+
558
+ > - Fix a couple of obscure UAF errors and an obscure memory leak.
559
+ > - 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.
560
+ > - Avoid conversion of a double into unsigned long long integer, as some platforms do not do such conversions correctly.
561
+
562
+
563
+ ### Added
564
+
565
+ * Compile packaged sqlite3 with additional flags to explicitly enable FTS5, and set synchronous mode to normal when in WAL mode. [#408] (@flavorjones)
566
+
567
+
568
+ ## 1.6.6 / 2023-09-12
569
+
570
+ ### Dependencies
571
+
572
+ Vendored sqlite is updated to [v3.43.1](https://sqlite.org/releaselog/3_43_1.html).
573
+
574
+ Upstream release notes:
575
+
576
+ > - 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.
577
+ > - 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).
578
+ > - 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.
579
+ > - Other minor fixes.
580
+
581
+
582
+ ## 1.6.5 / 2023-09-08
583
+
584
+ ### Packaging
585
+
586
+ * 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)
587
+
588
+
589
+ ## 1.6.4 / 2023-08-26
590
+
591
+ ### Dependencies
592
+
593
+ Vendored sqlite is updated to [v3.43.0](https://sqlite.org/releaselog/3_43_0.html).
594
+
595
+ Upstream release notes:
596
+
597
+ > SQLite Release 3.43.0 On 2023-08-24
598
+ > * 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.
599
+ > * Enhancements to the date and time functions:
600
+ > * Added new time shift modifiers of the form ±YYYY-MM-DD HH:MM:SS.SSS.
601
+ > * Added the timediff() SQL function.
602
+ > * Added the octet_length(X) SQL function.
603
+ > * Added the sqlite3_stmt_explain() API.
604
+ > * Query planner enhancements:
605
+ > * 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.
606
+ > * Enhance the theorem prover in the OUTER JOIN strength reduction optimization so that it returns fewer false-negatives.
607
+ > * Enhancements to the decimal extension:
608
+ > * New function decimal_pow2(N) returns the N-th power of 2 for integer N between -20000 and +20000.
609
+ > * 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.
610
+ > * 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.
611
+ > * Performance enhancements to JSON processing results in a 2x performance improvement for some kinds of processing on large JSON strings.
612
+ > * 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.)
613
+ > * 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.
614
+ > * The VFS for unix now assumes that the nanosleep() system call is available unless compiled with -DHAVE_NANOSLEEP=0.
615
+
616
+
3
617
  ## 1.6.3 / 2023-05-16
4
618
 
5
619
  ### Dependencies
@@ -171,7 +785,7 @@ You can opt-out of the packaged version of sqlite (and use your system-installed
171
785
 
172
786
  ## 1.4.1
173
787
 
174
- * Don't mandate dl functions for the extention build
788
+ * Don't mandate dl functions for the extension build
175
789
  * bumping version
176
790
 
177
791