sqlite3 2.3.1-x86_64-linux-musl → 2.4.1-x86_64-linux-musl
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/README.md +5 -5
- data/dependencies.yml +8 -8
- data/ext/sqlite3/database.c +2 -8
- data/lib/sqlite3/3.1/sqlite3_native.so +0 -0
- data/lib/sqlite3/3.2/sqlite3_native.so +0 -0
- data/lib/sqlite3/3.3/sqlite3_native.so +0 -0
- data/lib/sqlite3/database.rb +119 -27
- data/lib/sqlite3/fork_safety.rb +14 -10
- data/lib/sqlite3/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de5008936e885419b15341034623547c77fdc01003ebd1a1515815b867979e1
|
4
|
+
data.tar.gz: a7968a840ef446f910552a82f8cee37f28d857d20121dde286c366ca0f6c7a8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1898280243a6a6f731500f9c381d7c987263d00984546de63946f7631c6b7b47cdc3777e04055fe42c05a128b9aaee17ec2b688e6314a72e3e2a5b823d39545
|
7
|
+
data.tar.gz: 9e561e72d318312c0e5fc8195ef11f6fac528fbd6941d4081b61642456aa0a5fa2e4e6ba20b250b18b393768b141839c33e7eb79daa89514b2b27ba3e4df0fc8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
# sqlite3-ruby Changelog
|
2
2
|
|
3
|
+
## 2.4.1 / 2024-12-08
|
4
|
+
|
5
|
+
### Dependencies
|
6
|
+
|
7
|
+
- Vendored sqlite is updated to [v3.47.2](https://sqlite.org/releaselog/3_47.2.html) #593 @flavorjones
|
8
|
+
|
9
|
+
The description from the upstream maintainers is:
|
10
|
+
|
11
|
+
> SQLite version 3.47.2, now available, fixes an important bug that first appeared in the 3.47.0
|
12
|
+
> release. In SQLite versions 3.47.0 and 3.47.1, if you try to convert a string into a
|
13
|
+
> floating-point value and the first 16 significant digits of the value are exactly
|
14
|
+
> "1844674407370955", then the floating-point number generated might be incorrect. The problem
|
15
|
+
> only affects x64 and i386 CPUs, so it does not affect you if you are running on ARM. And it only
|
16
|
+
> affects releases 3.47.0 and 3.47.1. **If you are running SQLite versions 3.47.0 or 3.47.1, then
|
17
|
+
> upgrading is recommended.**
|
18
|
+
|
19
|
+
Saving you a click, you should upgrade if you're running sqlite3-ruby v2.1.1 or later.
|
20
|
+
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
|
24
|
+
- Prevent unnecessary "Invalid Reference" warnings from the `ForkSafety` module when GC runs during the "after fork" hook. #592 @flavorjones
|
25
|
+
|
26
|
+
|
27
|
+
## 2.4.0 / 2024-12-03
|
28
|
+
|
29
|
+
### Added
|
30
|
+
|
31
|
+
- `Database#load_extension` now accepts any object that responds to `#to_path`, in addition to String filesystem paths. [#586] @flavorjones
|
32
|
+
- `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
|
33
|
+
|
34
|
+
|
3
35
|
## 2.3.1 / 2024-11-25
|
4
36
|
|
5
37
|
### Dependencies
|
data/README.md
CHANGED
@@ -9,20 +9,20 @@ Note that this module is only compatible with SQLite 3.6.16 or newer.
|
|
9
9
|
* Source code: https://github.com/sparklemotion/sqlite3-ruby
|
10
10
|
* Mailing list: http://groups.google.com/group/sqlite3-ruby
|
11
11
|
* Download: http://rubygems.org/gems/sqlite3
|
12
|
-
* Documentation:
|
12
|
+
* Documentation: https://sparklemotion.github.io/sqlite3-ruby/
|
13
13
|
|
14
14
|
[![Test suite](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/ci.yml)
|
15
15
|
|
16
16
|
|
17
17
|
## Quick start
|
18
18
|
|
19
|
-
For help understanding the SQLite3 Ruby API, please read the [FAQ](./FAQ.md) and the [full API documentation](https://
|
19
|
+
For help understanding the SQLite3 Ruby API, please read the [FAQ](./FAQ.md) and the [full API documentation](https://sparklemotion.github.io/sqlite3-ruby/).
|
20
20
|
|
21
21
|
A few key classes whose APIs are often-used are:
|
22
22
|
|
23
|
-
- SQLite3::Database ([rdoc](https://
|
24
|
-
- SQLite3::Statement ([rdoc](https://
|
25
|
-
- SQLite3::ResultSet ([rdoc](https://
|
23
|
+
- SQLite3::Database ([rdoc](https://sparklemotion.github.io/sqlite3-ruby/SQLite3/Database.html))
|
24
|
+
- SQLite3::Statement ([rdoc](https://sparklemotion.github.io/sqlite3-ruby/SQLite3/Statement.html))
|
25
|
+
- SQLite3::ResultSet ([rdoc](https://sparklemotion.github.io/sqlite3-ruby/SQLite3/ResultSet.html))
|
26
26
|
|
27
27
|
If you have any questions that you feel should be addressed in the FAQ, please send them to [the mailing list](http://groups.google.com/group/sqlite3-ruby) or open a [discussion thread](https://github.com/sparklemotion/sqlite3-ruby/discussions/categories/q-a).
|
28
28
|
|
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
|
-
#
|
3
|
+
# 52cd4a2304b627abbabe1a438ba853d0f6edb8e2774fcb5773c7af11077afe94
|
4
4
|
#
|
5
|
-
# $ sha3sum -a 256 ports/archives/sqlite-autoconf-
|
6
|
-
#
|
5
|
+
# $ sha3sum -a 256 ports/archives/sqlite-autoconf-3470200.tar.gz
|
6
|
+
# 52cd4a2304b627abbabe1a438ba853d0f6edb8e2774fcb5773c7af11077afe94 ports/archives/sqlite-autoconf-3470200.tar.gz
|
7
7
|
#
|
8
|
-
# $ sha256sum ports/archives/sqlite-autoconf-
|
9
|
-
#
|
10
|
-
version: "3.47.
|
8
|
+
# $ sha256sum ports/archives/sqlite-autoconf-3470200.tar.gz
|
9
|
+
# f1b2ee412c28d7472bc95ba996368d6f0cdcf00362affdadb27ed286c179540b ports/archives/sqlite-autoconf-3470200.tar.gz
|
10
|
+
version: "3.47.2"
|
11
11
|
files:
|
12
|
-
- url: "https://sqlite.org/2024/sqlite-autoconf-
|
13
|
-
sha256: "
|
12
|
+
- url: "https://sqlite.org/2024/sqlite-autoconf-3470200.tar.gz"
|
13
|
+
sha256: "f1b2ee412c28d7472bc95ba996368d6f0cdcf00362affdadb27ed286c179540b"
|
data/ext/sqlite3/database.c
CHANGED
@@ -771,14 +771,8 @@ collation(VALUE self, VALUE name, VALUE comparator)
|
|
771
771
|
}
|
772
772
|
|
773
773
|
#ifdef HAVE_SQLITE3_LOAD_EXTENSION
|
774
|
-
/* call-seq: db.load_extension(file)
|
775
|
-
*
|
776
|
-
* Loads an SQLite extension library from the named file. Extension
|
777
|
-
* loading must be enabled using db.enable_load_extension(true) prior
|
778
|
-
* to calling this API.
|
779
|
-
*/
|
780
774
|
static VALUE
|
781
|
-
|
775
|
+
load_extension_internal(VALUE self, VALUE file)
|
782
776
|
{
|
783
777
|
sqlite3RubyPtr ctx;
|
784
778
|
int status;
|
@@ -997,7 +991,7 @@ init_sqlite3_database(void)
|
|
997
991
|
rb_define_private_method(cSqlite3Database, "db_filename", db_filename, 1);
|
998
992
|
|
999
993
|
#ifdef HAVE_SQLITE3_LOAD_EXTENSION
|
1000
|
-
|
994
|
+
rb_define_private_method(cSqlite3Database, "load_extension_internal", load_extension_internal, 1);
|
1001
995
|
#endif
|
1002
996
|
|
1003
997
|
#ifdef HAVE_SQLITE3_ENABLE_LOAD_EXTENSION
|
Binary file
|
Binary file
|
Binary file
|
data/lib/sqlite3/database.rb
CHANGED
@@ -8,8 +8,10 @@ require "sqlite3/value"
|
|
8
8
|
require "sqlite3/fork_safety"
|
9
9
|
|
10
10
|
module SQLite3
|
11
|
-
#
|
12
|
-
#
|
11
|
+
# == Overview
|
12
|
+
#
|
13
|
+
# The Database class encapsulates a single connection to a SQLite3 database. Here's a
|
14
|
+
# straightforward example of usage:
|
13
15
|
#
|
14
16
|
# require 'sqlite3'
|
15
17
|
#
|
@@ -19,28 +21,68 @@ module SQLite3
|
|
19
21
|
# end
|
20
22
|
# end
|
21
23
|
#
|
22
|
-
# It wraps the lower-level methods provided by the selected driver, and
|
23
|
-
#
|
24
|
-
# methods.
|
24
|
+
# It wraps the lower-level methods provided by the selected driver, and includes the Pragmas
|
25
|
+
# module for access to various pragma convenience methods.
|
25
26
|
#
|
26
|
-
# The Database class provides type translation services as well, by which
|
27
|
-
#
|
28
|
-
#
|
29
|
-
# for their tables). This translation only occurs when querying data from
|
27
|
+
# The Database class provides type translation services as well, by which the SQLite3 data types
|
28
|
+
# (which are all represented as strings) may be converted into their corresponding types (as
|
29
|
+
# defined in the schemas for their tables). This translation only occurs when querying data from
|
30
30
|
# the database--insertions and updates are all still typeless.
|
31
31
|
#
|
32
|
-
# Furthermore, the Database class has been designed to work well with the
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
32
|
+
# Furthermore, the Database class has been designed to work well with the ArrayFields module from
|
33
|
+
# Ara Howard. If you require the ArrayFields module before performing a query, and if you have not
|
34
|
+
# enabled results as hashes, then the results will all be indexible by field name.
|
35
|
+
#
|
36
|
+
# == Thread safety
|
37
|
+
#
|
38
|
+
# When SQLite3.threadsafe? returns true, it is safe to share instances of the database class
|
39
|
+
# among threads without adding specific locking. Other object instances may require applications
|
40
|
+
# to provide their own locks if they are to be shared among threads. Please see the README.md for
|
41
|
+
# more information.
|
42
|
+
#
|
43
|
+
# == SQLite Extensions
|
44
|
+
#
|
45
|
+
# SQLite3::Database supports the universe of {sqlite
|
46
|
+
# extensions}[https://www.sqlite.org/loadext.html]. It's possible to load an extension into an
|
47
|
+
# existing Database object using the #load_extension method and passing a filesystem path:
|
48
|
+
#
|
49
|
+
# db = SQLite3::Database.new(":memory:")
|
50
|
+
# db.enable_load_extension(true)
|
51
|
+
# db.load_extension("/path/to/extension")
|
52
|
+
#
|
53
|
+
# As of v2.4.0, it's also possible to pass an object that responds to +#to_path+. This
|
54
|
+
# documentation will refer to the supported interface as +_ExtensionSpecifier+, which can be
|
55
|
+
# expressed in RBS syntax as:
|
56
|
+
#
|
57
|
+
# interface _ExtensionSpecifier
|
58
|
+
# def to_path: () → String
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# So, for example, if you are using the {sqlean gem}[https://github.com/flavorjones/sqlean-ruby]
|
62
|
+
# which provides modules that implement this interface, you can pass the module directly:
|
63
|
+
#
|
64
|
+
# db = SQLite3::Database.new(":memory:")
|
65
|
+
# db.enable_load_extension(true)
|
66
|
+
# db.load_extension(SQLean::Crypto)
|
67
|
+
#
|
68
|
+
# It's also possible in v2.4.0+ to load extensions via the SQLite3::Database constructor by using
|
69
|
+
# the +extensions:+ keyword argument to pass an array of String paths or extension specifiers:
|
70
|
+
#
|
71
|
+
# db = SQLite3::Database.new(":memory:", extensions: ["/path/to/extension", SQLean::Crypto])
|
72
|
+
#
|
73
|
+
# Note that when loading extensions via the constructor, there is no need to call
|
74
|
+
# #enable_load_extension; however it is still necessary to call #enable_load_extensions before any
|
75
|
+
# subsequently invocations of #load_extension on the initialized Database object.
|
36
76
|
#
|
37
|
-
#
|
77
|
+
# You can load extensions in a Rails application by using the +extensions:+ configuration option:
|
78
|
+
#
|
79
|
+
# # config/database.yml
|
80
|
+
# development:
|
81
|
+
# adapter: sqlite3
|
82
|
+
# extensions:
|
83
|
+
# - .sqlpkg/nalgeon/crypto/crypto.so # a filesystem path
|
84
|
+
# - <%= SQLean::UUID.to_path %> # or ruby code returning a path
|
38
85
|
#
|
39
|
-
# When `SQLite3.threadsafe?` returns true, it is safe to share instances of
|
40
|
-
# the database class among threads without adding specific locking. Other
|
41
|
-
# object instances may require applications to provide their own locks if
|
42
|
-
# they are to be shared among threads. Please see the README.md for more
|
43
|
-
# information.
|
44
86
|
class Database
|
45
87
|
attr_reader :collations
|
46
88
|
|
@@ -76,23 +118,25 @@ module SQLite3
|
|
76
118
|
# as hashes or not. By default, rows are returned as arrays.
|
77
119
|
attr_accessor :results_as_hash
|
78
120
|
|
79
|
-
# call-seq:
|
121
|
+
# call-seq:
|
122
|
+
# SQLite3::Database.new(file, options = {})
|
80
123
|
#
|
81
124
|
# Create a new Database object that opens the given file.
|
82
125
|
#
|
83
126
|
# Supported permissions +options+:
|
84
127
|
# - the default mode is <tt>READWRITE | CREATE</tt>
|
85
|
-
# -
|
86
|
-
# -
|
87
|
-
# -
|
128
|
+
# - +readonly:+ boolean (default false), true to set the mode to +READONLY+
|
129
|
+
# - +readwrite:+ boolean (default false), true to set the mode to +READWRITE+
|
130
|
+
# - +flags:+ set the mode to a combination of SQLite3::Constants::Open flags.
|
88
131
|
#
|
89
132
|
# Supported encoding +options+:
|
90
|
-
# -
|
133
|
+
# - +utf16:+ +boolish+ (default false), is the filename's encoding UTF-16 (only needed if the filename encoding is not UTF_16LE or BE)
|
91
134
|
#
|
92
135
|
# Other supported +options+:
|
93
|
-
# -
|
94
|
-
# -
|
95
|
-
# -
|
136
|
+
# - +strict:+ +boolish+ (default false), disallow the use of double-quoted string literals (see https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted)
|
137
|
+
# - +results_as_hash:+ +boolish+ (default false), return rows as hashes instead of arrays
|
138
|
+
# - +default_transaction_mode:+ one of +:deferred+ (default), +:immediate+, or +:exclusive+. If a mode is not specified in a call to #transaction, this will be the default transaction mode.
|
139
|
+
# - +extensions:+ <tt>Array[String | _ExtensionSpecifier]</tt> SQLite extensions to load into the database. See Database@SQLite+Extensions for more information.
|
96
140
|
#
|
97
141
|
def initialize file, options = {}, zvfs = nil
|
98
142
|
mode = Constants::Open::READWRITE | Constants::Open::CREATE
|
@@ -135,6 +179,8 @@ module SQLite3
|
|
135
179
|
@readonly = mode & Constants::Open::READONLY != 0
|
136
180
|
@default_transaction_mode = options[:default_transaction_mode] || :deferred
|
137
181
|
|
182
|
+
initialize_extensions(options[:extensions])
|
183
|
+
|
138
184
|
ForkSafety.track(self)
|
139
185
|
|
140
186
|
if block_given?
|
@@ -658,6 +704,52 @@ module SQLite3
|
|
658
704
|
end
|
659
705
|
end
|
660
706
|
|
707
|
+
# call-seq:
|
708
|
+
# load_extension(extension_specifier) -> self
|
709
|
+
#
|
710
|
+
# Loads an SQLite extension library from the named file. Extension loading must be enabled using
|
711
|
+
# #enable_load_extension prior to using this method.
|
712
|
+
#
|
713
|
+
# See also: Database@SQLite+Extensions
|
714
|
+
#
|
715
|
+
# [Parameters]
|
716
|
+
# - +extension_specifier+: (String | +_ExtensionSpecifier+) If a String, it is the filesystem path
|
717
|
+
# to the sqlite extension file. If an object that responds to #to_path, the
|
718
|
+
# return value of that method is used as the filesystem path to the sqlite extension file.
|
719
|
+
#
|
720
|
+
# [Example] Using a filesystem path:
|
721
|
+
#
|
722
|
+
# db.load_extension("/path/to/my_extension.so")
|
723
|
+
#
|
724
|
+
# [Example] Using the {sqlean gem}[https://github.com/flavorjones/sqlean-ruby]:
|
725
|
+
#
|
726
|
+
# db.load_extension(SQLean::VSV)
|
727
|
+
#
|
728
|
+
def load_extension(extension_specifier)
|
729
|
+
if extension_specifier.respond_to?(:to_path)
|
730
|
+
extension_specifier = extension_specifier.to_path
|
731
|
+
elsif !extension_specifier.is_a?(String)
|
732
|
+
raise TypeError, "extension_specifier #{extension_specifier.inspect} is not a String or a valid extension specifier object"
|
733
|
+
end
|
734
|
+
load_extension_internal(extension_specifier)
|
735
|
+
end
|
736
|
+
|
737
|
+
def initialize_extensions(extensions) # :nodoc:
|
738
|
+
return if extensions.nil?
|
739
|
+
raise TypeError, "extensions must be an Array" unless extensions.is_a?(Array)
|
740
|
+
return if extensions.empty?
|
741
|
+
|
742
|
+
begin
|
743
|
+
enable_load_extension(true)
|
744
|
+
|
745
|
+
extensions.each do |extension|
|
746
|
+
load_extension(extension)
|
747
|
+
end
|
748
|
+
ensure
|
749
|
+
enable_load_extension(false)
|
750
|
+
end
|
751
|
+
end
|
752
|
+
|
661
753
|
# A helper class for dealing with custom functions (see #create_function,
|
662
754
|
# #create_aggregate, and #create_aggregate_handler). It encapsulates the
|
663
755
|
# opaque function object that represents the current invocation. It also
|
data/lib/sqlite3/fork_safety.rb
CHANGED
@@ -35,17 +35,21 @@ module SQLite3
|
|
35
35
|
@databases.each do |db|
|
36
36
|
next unless db.weakref_alive?
|
37
37
|
|
38
|
-
|
39
|
-
unless
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
38
|
+
begin
|
39
|
+
unless db.closed? || db.readonly?
|
40
|
+
unless warned
|
41
|
+
# If you are here, you may want to read
|
42
|
+
# https://github.com/sparklemotion/sqlite3-ruby/pull/558
|
43
|
+
warn("Writable sqlite database connection(s) were inherited from a forked process. " \
|
44
|
+
"This is unsafe and the connections are being closed to prevent possible data " \
|
45
|
+
"corruption. Please close writable sqlite database connections before forking.",
|
46
|
+
uplevel: 0)
|
47
|
+
warned = true
|
48
|
+
end
|
49
|
+
db.close
|
47
50
|
end
|
48
|
-
|
51
|
+
rescue WeakRef::RefError
|
52
|
+
# GC may run while this method is executing, and that's OK
|
49
53
|
end
|
50
54
|
end
|
51
55
|
@databases.clear
|
data/lib/sqlite3/version.rb
CHANGED
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.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: x86_64-linux-musl
|
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-
|
14
|
+
date: 2024-12-08 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: |
|
17
17
|
Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org). Precompiled
|
@@ -71,7 +71,7 @@ licenses:
|
|
71
71
|
metadata:
|
72
72
|
homepage_uri: https://github.com/sparklemotion/sqlite3-ruby
|
73
73
|
bug_tracker_uri: https://github.com/sparklemotion/sqlite3-ruby/issues
|
74
|
-
documentation_uri: https://
|
74
|
+
documentation_uri: https://sparklemotion.github.io/sqlite3-ruby/
|
75
75
|
changelog_uri: https://github.com/sparklemotion/sqlite3-ruby/blob/master/CHANGELOG.md
|
76
76
|
source_code_uri: https://github.com/sparklemotion/sqlite3-ruby
|
77
77
|
rubygems_mfa_required: 'true'
|