sqlite3 2.2.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 479e7054b162696f5eb93924c679100d344ad55a99c89b78388e4704607671b9
4
- data.tar.gz: '0284ba95e06b2b6e5ecb3da9254e0821deb9bde428971376f13de1a7402aade8'
3
+ metadata.gz: 44f18cd0e1a516835e098651813a16650ee150cbca072d7b79cf01985a46cb17
4
+ data.tar.gz: 354f8cc6b3fdbc3fdcb94b7f5c059af5a546c7b27e97a37ba83054eca96845c0
5
5
  SHA512:
6
- metadata.gz: a166ac9e72cdb74d1b632610ad11e60ed6fc80bd35bdcabd324e311d47143e1fe2a31011e19a7105ffeb688439e024b55e896e499ce34c9bedd1053b36e1274b
7
- data.tar.gz: aa22f0c6720ae18619f206330fd47aab916bb4916b147686813c8f8fc7240ed0da9da33360f77e6b85ae9a4465c96fa4b29bdc67138be26130f9ab74ecf155a7
6
+ metadata.gz: 45ac5eeb5c17f32b36e3e28ad07ed322466ead714a246e3a26714e7439c564b09ba22907b12b85d2b8fe1f5a40b4e064fb5e1d47f86b02477eb6cb14c16507f1
7
+ data.tar.gz: ff61bacb08bd6ef512fa160aabd0f0b47be0c3889801c17ec0c86764dc271e4b112e6ced95f9b504cf225247f885afddec1d6f3ea433323e00366fd9ce254a45
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # sqlite3-ruby Changelog
2
2
 
3
+ ## 2.3.1 / 2024-11-25
4
+
5
+ ### Dependencies
6
+
7
+ - Vendored sqlite is updated to [v3.47.1](https://sqlite.org/releaselog/3_47_1.html) [#589] @flavorjones
8
+
9
+
10
+ ## 2.3.0 / 2024-11-20
11
+
12
+ ### Added
13
+
14
+ - 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
15
+ - 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
16
+ - `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
17
+ - `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
18
+
19
+
20
+ ### Fixed
21
+
22
+ - `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
23
+ - Omit mention of the `pkg-config` gem when failing to build from source, since it is not used. [#358] @flavorjones
24
+
25
+
3
26
  ## 2.2.0 / 2024-10-30
4
27
 
5
28
  ### Added
data/CONTRIBUTING.md CHANGED
@@ -45,12 +45,16 @@ Update `/dependencies.yml` to reflect:
45
45
 
46
46
  ## Making a release
47
47
 
48
- A quick checklist:
48
+ A quick checklist to cutting a release of the sqlite3 gem:
49
49
 
50
50
  - [ ] make sure CI is green!
51
- - [ ] update `CHANGELOG.md` and `lib/sqlite3/version.rb`
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`
55
- - [ ] `for g in gems/*.gem ; do gem push $g ; done`
56
- - [ ] create a release at https://github.com/sparklemotion/sqlite3-ruby/releases and include sha2 checksums
51
+ - bump the version
52
+ - [ ] update `CHANGELOG.md` and `lib/sqlite3/version.rb`
53
+ - [ ] create a git tag using a format that matches the pattern `v\d+\.\d+\.\d+`, e.g. `v1.3.13`
54
+ - build the native gems
55
+ - [ ] run `bin/build-gems` and make sure it completes and all the tests pass
56
+ - push
57
+ - [ ] `git push && git push --tags`
58
+ - [ ] `for g in gems/*.gem ; do gem push $g ; done`
59
+ - announce
60
+ - [ ] create a release at https://github.com/sparklemotion/sqlite3-ruby/releases and include sha2 checksums
data/dependencies.yml CHANGED
@@ -1,13 +1,13 @@
1
1
  sqlite3:
2
2
  # checksum verified by first checking the published sha3(256) checksum against https://sqlite.org/download.html:
3
- # a9166e017ef8bc33379b1c2eed346bf43cded6d40df0feb984a33fba1a828ba9
3
+ # c6c1756fbeb1e34e0ee31f8609bfc1fd4630b3faadde71a28ad3a55df259d854
4
4
  #
5
- # $ sha3sum -a 256 ports/archives/sqlite-autoconf-3470000.tar.gz
6
- # a9166e017ef8bc33379b1c2eed346bf43cded6d40df0feb984a33fba1a828ba9 ports/archives/sqlite-autoconf-3470000.tar.gz
5
+ # $ sha3sum -a 256 ports/archives/sqlite-autoconf-3470100.tar.gz
6
+ # c6c1756fbeb1e34e0ee31f8609bfc1fd4630b3faadde71a28ad3a55df259d854 ports/archives/sqlite-autoconf-3470100.tar.gz
7
7
  #
8
- # $ sha256sum ports/archives/sqlite-autoconf-3470000.tar.gz
9
- # 83eb21a6f6a649f506df8bd3aab85a08f7556ceed5dbd8dea743ea003fc3a957 ports/archives/sqlite-autoconf-3470000.tar.gz
10
- version: "3.47.0"
8
+ # $ sha256sum ports/archives/sqlite-autoconf-3470100.tar.gz
9
+ # 416a6f45bf2cacd494b208fdee1beda509abda951d5f47bc4f2792126f01b452 ports/archives/sqlite-autoconf-3470100.tar.gz
10
+ version: "3.47.1"
11
11
  files:
12
- - url: "https://sqlite.org/2024/sqlite-autoconf-3470000.tar.gz"
13
- sha256: "83eb21a6f6a649f506df8bd3aab85a08f7556ceed5dbd8dea743ea003fc3a957"
12
+ - url: "https://sqlite.org/2024/sqlite-autoconf-3470100.tar.gz"
13
+ sha256: "416a6f45bf2cacd494b208fdee1beda509abda951d5f47bc4f2792126f01b452"
@@ -62,7 +62,9 @@ module Sqlite3
62
62
  "-O2", # see https://github.com/sparklemotion/sqlite3-ruby/issues/335 for some benchmarks
63
63
  "-fvisibility=hidden", # see https://github.com/rake-compiler/rake-compiler-dock/issues/87
64
64
  "-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1",
65
- "-DSQLITE_USE_URI=1"
65
+ "-DSQLITE_USE_URI=1",
66
+ "-DSQLITE_ENABLE_DBPAGE_VTAB=1",
67
+ "-DSQLITE_ENABLE_DBSTAT_VTAB=1"
66
68
  ]
67
69
  env["CFLAGS"] = [user_cflags, env["CFLAGS"], more_cflags].flatten.join(" ")
68
70
  recipe.configure_options += env.select { |k, v| ENV_ALLOWLIST.include?(k) }
@@ -95,6 +97,9 @@ module Sqlite3
95
97
  end
96
98
 
97
99
  ldflags.each { |ldflag| append_ldflags(ldflag) }
100
+
101
+ append_cppflags("-DUSING_PACKAGED_LIBRARIES")
102
+ append_cppflags("-DUSING_PRECOMPILED_LIBRARIES") if cross_build?
98
103
  end
99
104
  end
100
105
 
@@ -171,7 +176,7 @@ module Sqlite3
171
176
  end
172
177
 
173
178
  def abort_pkg_config(id)
174
- abort("\nCould not configure the build properly (#{id}). Please install either the `pkg-config` utility or the `pkg-config` rubygem.\n\n")
179
+ abort("\nCould not configure the build properly (#{id}). Please install the `pkg-config` utility.\n\n")
175
180
  end
176
181
 
177
182
  def cross_build?
@@ -201,8 +201,25 @@ Init_sqlite3_native(void)
201
201
  rb_define_singleton_method(mSqlite3, "libversion", libversion, 0);
202
202
  rb_define_singleton_method(mSqlite3, "threadsafe", threadsafe_p, 0);
203
203
  rb_define_singleton_method(mSqlite3, "status", rb_sqlite3_status, -1);
204
+
205
+ /* (String) The version of the sqlite3 library compiled with (e.g., "3.46.1") */
204
206
  rb_define_const(mSqlite3, "SQLITE_VERSION", rb_str_new2(SQLITE_VERSION));
207
+
208
+ /* (Integer) The version of the sqlite3 library compiled with (e.g., 346001) */
205
209
  rb_define_const(mSqlite3, "SQLITE_VERSION_NUMBER", INT2FIX(SQLITE_VERSION_NUMBER));
210
+
211
+ /* (String) The version of the sqlite3 library loaded at runtime (e.g., "3.46.1") */
206
212
  rb_define_const(mSqlite3, "SQLITE_LOADED_VERSION", rb_str_new2(sqlite3_libversion()));
207
213
 
214
+ #ifdef USING_PACKAGED_LIBRARIES
215
+ rb_define_const(mSqlite3, "SQLITE_PACKAGED_LIBRARIES", Qtrue);
216
+ #else
217
+ rb_define_const(mSqlite3, "SQLITE_PACKAGED_LIBRARIES", Qfalse);
218
+ #endif
219
+
220
+ #ifdef USING_PRECOMPILED_LIBRARIES
221
+ rb_define_const(mSqlite3, "SQLITE_PRECOMPILED_LIBRARIES", Qtrue);
222
+ #else
223
+ rb_define_const(mSqlite3, "SQLITE_PRECOMPILED_LIBRARIES", Qfalse);
224
+ #endif
208
225
  }
@@ -170,5 +170,29 @@ module SQLite3
170
170
  # This parameter records the number of separate memory allocations currently checked out.
171
171
  MALLOC_COUNT = 9
172
172
  end
173
+
174
+ module Optimize
175
+ # Debugging mode. Do not actually perform any optimizations but instead return one line of
176
+ # text for each optimization that would have been done. Off by default.
177
+ DEBUG = 0x00001
178
+
179
+ # Run ANALYZE on tables that might benefit. On by default.
180
+ ANALYZE_TABLES = 0x00002
181
+
182
+ # When running ANALYZE, set a temporary PRAGMA analysis_limit to prevent excess run-time. On
183
+ # by default.
184
+ LIMIT_ANALYZE = 0x00010
185
+
186
+ # Check the size of all tables, not just tables that have not been recently used, to see if
187
+ # any have grown and shrunk significantly and hence might benefit from being re-analyzed. Off
188
+ # by default.
189
+ CHECK_ALL_TABLES = 0x10000
190
+
191
+ # Useful for adding a bit to the default behavior, for example
192
+ #
193
+ # db.optimize(Optimize::DEFAULT | Optimize::CHECK_ALL_TABLES)
194
+ #
195
+ DEFAULT = ANALYZE_TABLES | LIMIT_ANALYZE
196
+ end
173
197
  end
174
198
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  require "weakref"
4
4
 
5
- # based on Rails's active_support/fork_tracker.rb
6
5
  module SQLite3
6
+ # based on Rails's active_support/fork_tracker.rb
7
7
  module ForkSafety
8
- module CoreExt
8
+ module CoreExt # :nodoc:
9
9
  def _fork
10
10
  pid = super
11
11
  if pid == 0
@@ -20,17 +20,17 @@ module SQLite3
20
20
  @suppress = false
21
21
 
22
22
  class << self
23
- def hook!
23
+ def hook! # :nodoc:
24
24
  ::Process.singleton_class.prepend(CoreExt)
25
25
  end
26
26
 
27
- def track(database)
27
+ def track(database) # :nodoc:
28
28
  @mutex.synchronize do
29
29
  @databases << WeakRef.new(database)
30
30
  end
31
31
  end
32
32
 
33
- def discard
33
+ def discard # :nodoc:
34
34
  warned = @suppress
35
35
  @databases.each do |db|
36
36
  next unless db.weakref_alive?
@@ -93,7 +93,7 @@ module SQLite3
93
93
  LOCKING_MODES = [["normal"], ["exclusive"]]
94
94
 
95
95
  # The list of valid encodings.
96
- ENCODINGS = [["utf-8"], ["utf-16"], ["utf-16le"], ["utf-16be "]]
96
+ ENCODINGS = [["utf-8"], ["utf-16"], ["utf-16le"], ["utf-16be"]]
97
97
 
98
98
  # The list of valid WAL checkpoints.
99
99
  WAL_CHECKPOINTS = [["passive"], ["full"], ["restart"], ["truncate"]]
@@ -338,6 +338,20 @@ module SQLite3
338
338
  set_int_pragma "mmap_size", size
339
339
  end
340
340
 
341
+ # Attempt to optimize the database.
342
+ #
343
+ # To customize the optimization options, pass +bitmask+ with a combination
344
+ # of the Constants::Optimize masks.
345
+ #
346
+ # See https://www.sqlite.org/pragma.html#pragma_optimize for more information.
347
+ def optimize(bitmask = nil)
348
+ if bitmask
349
+ set_int_pragma "optimize", bitmask
350
+ else
351
+ execute("PRAGMA optimize")
352
+ end
353
+ end
354
+
341
355
  def page_count
342
356
  get_int_pragma "page_count"
343
357
  end
@@ -1,3 +1,4 @@
1
1
  module SQLite3
2
- VERSION = "2.2.0"
2
+ # (String) the version of the sqlite3 gem, e.g. "2.1.1"
3
+ VERSION = "2.3.1"
3
4
  end
@@ -0,0 +1,17 @@
1
+ module SQLite3
2
+ # a hash of descriptive metadata about the current version of the sqlite3 gem
3
+ VERSION_INFO = {
4
+ ruby: RUBY_DESCRIPTION,
5
+ gem: {
6
+ version: SQLite3::VERSION
7
+ },
8
+ sqlite: {
9
+ compiled: SQLite3::SQLITE_VERSION,
10
+ loaded: SQLite3::SQLITE_LOADED_VERSION,
11
+ packaged: SQLite3::SQLITE_PACKAGED_LIBRARIES,
12
+ precompiled: SQLite3::SQLITE_PRECOMPILED_LIBRARIES,
13
+ sqlcipher: SQLite3.sqlcipher?,
14
+ threadsafe: SQLite3.threadsafe?
15
+ }
16
+ }
17
+ end
data/lib/sqlite3.rb CHANGED
@@ -15,3 +15,5 @@ module SQLite3
15
15
  threadsafe > 0
16
16
  end
17
17
  end
18
+
19
+ require "sqlite3/version_info"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-10-30 00:00:00.000000000 Z
14
+ date: 2024-11-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: mini_portile2
@@ -76,7 +76,8 @@ files:
76
76
  - lib/sqlite3/statement.rb
77
77
  - lib/sqlite3/value.rb
78
78
  - lib/sqlite3/version.rb
79
- - ports/archives/sqlite-autoconf-3470000.tar.gz
79
+ - lib/sqlite3/version_info.rb
80
+ - ports/archives/sqlite-autoconf-3470100.tar.gz
80
81
  homepage: https://github.com/sparklemotion/sqlite3-ruby
81
82
  licenses:
82
83
  - BSD-3-Clause
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
106
  - !ruby/object:Gem::Version
106
107
  version: '0'
107
108
  requirements: []
108
- rubygems_version: 3.3.22
109
+ rubygems_version: 3.5.22
109
110
  signing_key:
110
111
  specification_version: 4
111
112
  summary: Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org).