sqlite_extensions 0.1.0-x86_64-linux-gnu
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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +231 -0
- data/extensions.yml +377 -0
- data/lib/sqlite_extensions/constants.rb +24 -0
- data/lib/sqlite_extensions/error.rb +7 -0
- data/lib/sqlite_extensions/extension.rb +70 -0
- data/lib/sqlite_extensions/incompatible_sqlite.rb +30 -0
- data/lib/sqlite_extensions/native/anycollseq.so +0 -0
- data/lib/sqlite_extensions/native/appendvfs.so +0 -0
- data/lib/sqlite_extensions/native/base64.so +0 -0
- data/lib/sqlite_extensions/native/base85.so +0 -0
- data/lib/sqlite_extensions/native/cksumvfs.so +0 -0
- data/lib/sqlite_extensions/native/completion.so +0 -0
- data/lib/sqlite_extensions/native/compress.so +0 -0
- data/lib/sqlite_extensions/native/csv.so +0 -0
- data/lib/sqlite_extensions/native/decimal.so +0 -0
- data/lib/sqlite_extensions/native/eval.so +0 -0
- data/lib/sqlite_extensions/native/fileio.so +0 -0
- data/lib/sqlite_extensions/native/fossildelta.so +0 -0
- data/lib/sqlite_extensions/native/ieee754.so +0 -0
- data/lib/sqlite_extensions/native/nextchar.so +0 -0
- data/lib/sqlite_extensions/native/percentile.so +0 -0
- data/lib/sqlite_extensions/native/prefixes.so +0 -0
- data/lib/sqlite_extensions/native/regexp.so +0 -0
- data/lib/sqlite_extensions/native/series.so +0 -0
- data/lib/sqlite_extensions/native/sha1.so +0 -0
- data/lib/sqlite_extensions/native/shathree.so +0 -0
- data/lib/sqlite_extensions/native/spellfix.so +0 -0
- data/lib/sqlite_extensions/native/sqlar.so +0 -0
- data/lib/sqlite_extensions/native/totype.so +0 -0
- data/lib/sqlite_extensions/native/uint.so +0 -0
- data/lib/sqlite_extensions/native/unionvtab.so +0 -0
- data/lib/sqlite_extensions/native/uuid.so +0 -0
- data/lib/sqlite_extensions/native/vec1.so +0 -0
- data/lib/sqlite_extensions/native/zipfile.so +0 -0
- data/lib/sqlite_extensions/native/zorder.so +0 -0
- data/lib/sqlite_extensions/unsupported_platform.rb +26 -0
- data/lib/sqlite_extensions.rb +21 -0
- metadata +80 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 73b7a89209ef3327d5150052aa16e6c0a1f2b4e03fc922cf30dc860f058a82c8
|
|
4
|
+
data.tar.gz: 335a15f742c5be66621e5a55f0be1574f1423902bf79403efa9ed8a72509749d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: adf6ba3bb224e62944f028c240031df485468c6b24392de6a02599d615e8ac0165c23c1f273ff887f061f3378c10f684e7df8c62767c0bf5439f5851119e343a
|
|
7
|
+
data.tar.gz: a0a6e3bd673d948fb8d48275e36f020a34fe57fade8c5a1a8cc648a1a46d24f5874e6818fbf3ee8e3f6a2144136a48cc077663cce5711e79ac33099c22216f05
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nialto Services
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# SQLite Extensions
|
|
2
|
+
|
|
3
|
+
Precompiled builds of SQLite's own production-ready loadable extensions, including the `vec1` vector search extension,
|
|
4
|
+
`spellfix`, `generate_series` and `zipfile`, packaged so they can be loaded into the
|
|
5
|
+
[sqlite3 gem](https://github.com/sparklemotion/sqlite3-ruby) without a compiler.
|
|
6
|
+
|
|
7
|
+
This gem is unofficial and is not affiliated with or endorsed by the SQLite project. It compiles SQLite's published
|
|
8
|
+
source code unchanged.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Add the gem to your `Gemfile`:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
gem 'sqlite_extensions'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or install it directly:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
$ gem install sqlite_extensions
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The gem ships precompiled binaries for each supported platform (see [Platforms](#platforms)), so installing it never
|
|
25
|
+
needs a C compiler.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Each extension is a constant under `SQLiteExtensions` that responds to `#to_path`, which is the interface the sqlite3
|
|
30
|
+
gem (v2.4.0 or newer) accepts wherever it loads an extension. Pass extensions when opening a database:
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
require 'sqlite3'
|
|
34
|
+
require 'sqlite_extensions'
|
|
35
|
+
|
|
36
|
+
database = SQLite3::Database.new('app.sqlite3', extensions: [SQLiteExtensions::Vec1, SQLiteExtensions::Spellfix])
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or load them into a database that is already open:
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
database.enable_load_extension(true)
|
|
43
|
+
database.load_extension(SQLiteExtensions::Series)
|
|
44
|
+
database.enable_load_extension(false)
|
|
45
|
+
|
|
46
|
+
database.execute('SELECT value FROM generate_series(1, 3)') # => [[1], [2], [3]]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Extensions are loaded per connection, so load them into every connection that uses them. `SQLiteExtensions::EXTENSIONS`
|
|
50
|
+
lists every extension the gem packages.
|
|
51
|
+
|
|
52
|
+
### Rails
|
|
53
|
+
|
|
54
|
+
Rails' SQLite adapter takes an `extensions:` list in `config/database.yml`.
|
|
55
|
+
|
|
56
|
+
**Rails 8.1 and newer** accept the constant's name directly:
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
development:
|
|
60
|
+
adapter: sqlite3
|
|
61
|
+
database: storage/development.sqlite3
|
|
62
|
+
extensions:
|
|
63
|
+
- SQLiteExtensions::Vec1
|
|
64
|
+
- SQLiteExtensions::Spellfix
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Rails 8.0** passes each entry through as a file path, so use ERB to ask the constant for its path:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
development:
|
|
71
|
+
adapter: sqlite3
|
|
72
|
+
database: storage/development.sqlite3
|
|
73
|
+
extensions:
|
|
74
|
+
- <%= SQLiteExtensions::Vec1.to_path %>
|
|
75
|
+
- <%= SQLiteExtensions::Spellfix.to_path %>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Bundler loads the gem when Rails boots, so neither form needs a `require`.
|
|
79
|
+
|
|
80
|
+
## Extensions
|
|
81
|
+
|
|
82
|
+
Each extension's full usage is documented in the header comment of its source file, under `vendor/sqlite/ext/`.
|
|
83
|
+
|
|
84
|
+
| Constant | Provides | Needs SQLite |
|
|
85
|
+
|---------------|-------------------------------------------------------------------------------------------------|--------------|
|
|
86
|
+
| `AnyCollSeq` | A stand-in, BINARY-like collation for any collation a schema names but the connection lacks | 3.7.16 |
|
|
87
|
+
| `AppendVFS` | The `apndvfs` VFS, for a database appended to the end of another file, such as an executable | 3.7.16 |
|
|
88
|
+
| `Base64` | `base64()`, converting between blobs and Base64 text | 3.8.7 |
|
|
89
|
+
| `Base85` | `base85()`, converting between blobs and Base85 text | 3.8.7 |
|
|
90
|
+
| `CksumVFS` | The `cksmvfs` VFS, which checksums every page of a database (see [Cautions](#cautions)) | 3.10.0 |
|
|
91
|
+
| `Completion` | `completion()`, suggesting completions for partially typed SQL | 3.24.0 |
|
|
92
|
+
| `Compress` | `compress()` and `uncompress()`, using zlib | 3.8.7 |
|
|
93
|
+
| `CSV` | The `csv` virtual table, reading CSV text or files (see [Security](#security)) | 3.24.0 |
|
|
94
|
+
| `Decimal` | Arbitrary-precision decimal arithmetic on text values, and the `decimal` collation | 3.25.0 |
|
|
95
|
+
| `Eval` | `eval()`, which runs SQL text and returns its output (see [Security](#security)) | 3.44.0 |
|
|
96
|
+
| `FileIO` | `readfile()`, `writefile()`, `realpath()`, `lsmode()` and `fsdir()` (see [Security](#security)) | 3.8.7 |
|
|
97
|
+
| `FossilDelta` | `delta_create()`, `delta_apply()`, `delta_output_size()` and `delta_parse()` | 3.8.7 |
|
|
98
|
+
| `IEEE754` | `ieee754()` and related functions, converting floats to and from their binary parts | 3.7.16 |
|
|
99
|
+
| `NextChar` | `next_char()`, the characters that can follow a prefix in a vocabulary table, for autocomplete | 3.8.7 |
|
|
100
|
+
| `Percentile` | `percentile()`, `median()`, `percentile_cont()` and `percentile_disc()` | 3.25.0 |
|
|
101
|
+
| `Prefixes` | `prefixes()`, every prefix of a string | 3.8.7 |
|
|
102
|
+
| `Regexp` | The `REGEXP` operator, `regexp()` and the case-insensitive `regexpi()` | 3.8.7 |
|
|
103
|
+
| `Series` | `generate_series()` | 3.8.7 |
|
|
104
|
+
| `SHA1` | `sha1()`, `sha1b()` and `sha1_query()` | 3.44.0 |
|
|
105
|
+
| `SHA3` | `sha3()` and `sha3_query()` | 3.44.0 |
|
|
106
|
+
| `Spellfix` | The `spellfix1` virtual table for fuzzy word matching, and `editdist3()` | 3.8.7 |
|
|
107
|
+
| `SQLAR` | `sqlar_compress()` and `sqlar_uncompress()`, for SQLite Archive files | 3.8.7 |
|
|
108
|
+
| `ToType` | `tointeger()` and `toreal()`, lossless conversions that return NULL otherwise | 3.7.16 |
|
|
109
|
+
| `UInt` | The `UINT` collation, which sorts embedded numbers numerically (`file9` before `file10`) | 3.7.16 |
|
|
110
|
+
| `UnionVTab` | The `unionvtab` and `swarmvtab` virtual tables, reading many tables, across files, as one | 3.8.7 |
|
|
111
|
+
| `UUID` | `uuid()`, `uuid_str()` and `uuid_blob()` | 3.7.16 |
|
|
112
|
+
| `Vec1` | [vec1](https://sqlite.org/vec1) approximate nearest-neighbour vector search (see below) | 3.38.0 |
|
|
113
|
+
| `ZipFile` | The `zipfile` virtual table and `zipfile()` aggregate, reading and writing ZIP archives | 3.20.0 |
|
|
114
|
+
| `ZOrder` | `zorder()` and `unzorder()`, Morton codes for multi-dimensional indexing | 3.7.16 |
|
|
115
|
+
|
|
116
|
+
**vec1 is a draft.** Its upstream documentation is marked as a draft, and it reports itself as version 0.8. Expect its
|
|
117
|
+
behaviour to change between versions of this gem, and rebuild vec1 indexes after upgrading. Its version string does not
|
|
118
|
+
change with each fix, so `SELECT vec1_info()` cannot tell you which build you have; the SQLite commit it was built from
|
|
119
|
+
is recorded in this gem's `extensions.yml`.
|
|
120
|
+
|
|
121
|
+
### What is not included
|
|
122
|
+
|
|
123
|
+
The gem packages every extension SQLite publishes that is production-ready and not superseded. Left out are:
|
|
124
|
+
|
|
125
|
+
- **Test, debugging and diagnostic code:** `btreeinfo`, `diskused`, `explain`, `memstat`, `noop`, `qpvtab`,
|
|
126
|
+
`randomjson`, `remember`, `rot13`, `showauth`, `stmt`, `stmtrand`, `strdup`, `templatevtab`, `tmstmpvfs`,
|
|
127
|
+
`urifuncs`, `vfsstat`, `vtablog` and `wholenumber`, as well as `closure`, which upstream disables outside test builds.
|
|
128
|
+
- **Superseded extensions:** `amatch` and `fuzzer`, by `spellfix`.
|
|
129
|
+
- **Code that is not a loadable extension:** `basexx`, which bundles `base64` and `base85` for SQLite's shell, and
|
|
130
|
+
`vtshim`, a helper for C programs.
|
|
131
|
+
- **Extensions that cannot be built as loadable extensions:** R*Tree and Geopoly, which call SQLite internals, and
|
|
132
|
+
FTS3/FTS4, whose successor FTS5 is built into the SQLite the sqlite3 gem ships. ICU needs the ICU library.
|
|
133
|
+
|
|
134
|
+
## Compatibility
|
|
135
|
+
|
|
136
|
+
What matters is the SQLite library loaded into your Ruby process, which is not the same thing as your database file.
|
|
137
|
+
That library comes bundled with the sqlite3 gem, unless the gem was installed with `--enable-system-libraries`, in which
|
|
138
|
+
case it is the operating system's. `SQLite3::SQLITE_LOADED_VERSION` reports which version you have.
|
|
139
|
+
|
|
140
|
+
An extension works with any SQLite at least as new as the newest API function it calls, which is the "Needs SQLite"
|
|
141
|
+
column above, so this gem's version does not need to match the sqlite3 gem's. Loading an extension into an older
|
|
142
|
+
SQLite would crash the process, so `#to_path` checks the loaded version first and raises
|
|
143
|
+
`SQLiteExtensions::IncompatibleSQLite` instead. It raises `SQLiteExtensions::UnsupportedPlatform` when there is no
|
|
144
|
+
binary for the current platform.
|
|
145
|
+
|
|
146
|
+
## Platforms
|
|
147
|
+
|
|
148
|
+
| Platform | Runs on |
|
|
149
|
+
|----------------------|--------------------------------------------------------|
|
|
150
|
+
| `arm64-darwin` | macOS 11 or newer on Apple silicon |
|
|
151
|
+
| `x86_64-darwin` | macOS 11 or newer on Intel |
|
|
152
|
+
| `x86_64-linux-gnu` | x86_64 Linux with glibc 2.14 or newer |
|
|
153
|
+
| `aarch64-linux-gnu` | ARM64 Linux with glibc 2.17 or newer |
|
|
154
|
+
| `x86-linux-gnu` | 32-bit x86 Linux with glibc 2.3.2 or newer |
|
|
155
|
+
| `arm-linux-gnu` | 32-bit ARMv7 Linux with glibc 2.4 or newer (see below) |
|
|
156
|
+
| `x86_64-linux-musl` | x86_64 Linux with musl, such as Alpine |
|
|
157
|
+
| `aarch64-linux-musl` | ARM64 Linux with musl, such as Alpine |
|
|
158
|
+
| `x86-linux-musl` | 32-bit x86 Linux with musl |
|
|
159
|
+
| `arm-linux-musl` | 32-bit ARMv7 Linux with musl (see below) |
|
|
160
|
+
| `x64-mingw-ucrt` | 64-bit Windows with RubyInstaller 3.1 or newer |
|
|
161
|
+
|
|
162
|
+
On any other platform the gem still installs, so a Gemfile shared with such a machine still resolves, but it carries no
|
|
163
|
+
binaries there, and `#to_path` raises `SQLiteExtensions::UnsupportedPlatform`. Choosing the right platform gem needs
|
|
164
|
+
RubyGems 3.3.22 or newer, which the gem requires.
|
|
165
|
+
|
|
166
|
+
The 32-bit ARM builds need an ARMv7 processor with hardware floating point, so they run on a Raspberry Pi 2 or newer
|
|
167
|
+
but not on an original Raspberry Pi or Pi Zero, which are ARMv6.
|
|
168
|
+
|
|
169
|
+
On x86_64, vec1 contains both a plain build and an AVX2 build, and picks one when it loads by checking the CPU, so it
|
|
170
|
+
runs on processors without AVX2. `Compress`, `SQLAR` and `ZipFile` have zlib compiled in, so they need nothing from the
|
|
171
|
+
system.
|
|
172
|
+
|
|
173
|
+
## Security
|
|
174
|
+
|
|
175
|
+
Four extensions give SQL access beyond the database. Load them only into connections that need them, and never into a
|
|
176
|
+
connection that runs SQL built from untrusted input:
|
|
177
|
+
|
|
178
|
+
- **`FileIO`** reads and writes any file the process can, and lists directories.
|
|
179
|
+
- **`CSV`** reads any file the process can (`CREATE VIRTUAL TABLE temp.t USING csv(filename='/etc/passwd')`).
|
|
180
|
+
- **`ZipFile`** reads and writes ZIP archives by filename.
|
|
181
|
+
- **`Eval`** runs any SQL passed to it as a value, so a string that reaches it becomes SQL that runs.
|
|
182
|
+
|
|
183
|
+
Upstream stops a database's own schema, such as a trigger or view, from using any of these four, so opening an
|
|
184
|
+
untrusted database file cannot trigger them. SQL your application runs, including any SQL injection, can.
|
|
185
|
+
|
|
186
|
+
## Cautions
|
|
187
|
+
|
|
188
|
+
- **`CksumVFS` becomes the default VFS for the whole process** as soon as it is loaded into any connection, as upstream
|
|
189
|
+
intends. It only checksums databases set up for it, with 8 reserved bytes per page; others pass through unchanged.
|
|
190
|
+
- **`AppendVFS` registers the `apndvfs` VFS for the whole process**, used only by databases opened with `vfs=apndvfs`.
|
|
191
|
+
- **`AnyCollSeq` is for reading.** An index written under its stand-in collation is out of order for the real one.
|
|
192
|
+
- **On Windows, `writefile()` cannot create missing parent directories in a path that starts with a drive letter**,
|
|
193
|
+
such as `C:/data/new/file.txt`. It can for a relative path or one without the drive, such as `/data/new/file.txt`.
|
|
194
|
+
This is an upstream bug shared by every Windows build of `fileio`, including SQLite's own shell.
|
|
195
|
+
|
|
196
|
+
## Development
|
|
197
|
+
|
|
198
|
+
The build is driven by `extensions.yml`, which pins the sources and describes how to compile and smoke-test each
|
|
199
|
+
extension.
|
|
200
|
+
|
|
201
|
+
```sh
|
|
202
|
+
$ bundle exec rake vendor # download the pinned sources into vendor/
|
|
203
|
+
$ bundle exec rake compile # compile every extension for this machine
|
|
204
|
+
$ bundle exec rake spec # compile, then run the specs, including a smoke test of every binary
|
|
205
|
+
$ bundle exec rake native_gem # compile, then build this machine's platform gem into pkg/
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Every extension compiles against the headers from the pinned SQLite release, so a source that calls a newer SQLite API
|
|
209
|
+
fails to build. An extension's source comes from that release unless it declares its own pre-1.0 version, as vec1 does,
|
|
210
|
+
or its catalogue entry gives a `trunk_reason`, which is reserved for fixes to wrong results, crashes and hangs that no
|
|
211
|
+
release contains yet; either may be pinned to a commit on SQLite's trunk instead. `rake vendor:verify`, which runs
|
|
212
|
+
before every compile, checks the vendored files against these pins and rules and checks each recorded minimum SQLite
|
|
213
|
+
version against the API functions the source calls.
|
|
214
|
+
|
|
215
|
+
Continuous integration builds and tests the gem on every platform above, natively apart from 32-bit ARM, which runs
|
|
216
|
+
under emulation. It installs each platform gem into a clean environment, loads every extension from it, and keeps the
|
|
217
|
+
gems as workflow artifacts.
|
|
218
|
+
|
|
219
|
+
Each week, the Upstream Check workflow compares the pins with upstream and opens an issue when SQLite, its trunk or zlib
|
|
220
|
+
has moved on. [docs/maintenance.md](docs/maintenance.md) describes how to move the pins forward.
|
|
221
|
+
|
|
222
|
+
To release, set `SQLiteExtensions::VERSION` in `lib/sqlite_extensions/constants.rb` and push a matching tag, such as
|
|
223
|
+
`v0.2.0`. The Release workflow builds and tests every gem as continuous integration does, then waits for a maintainer
|
|
224
|
+
to approve the `rubygems` environment before publishing them to RubyGems.org through trusted publishing, each with a
|
|
225
|
+
Sigstore attestation of the workflow run that built it.
|
|
226
|
+
|
|
227
|
+
## Licence
|
|
228
|
+
|
|
229
|
+
This gem's own code is released under the [MIT License](LICENSE). The SQLite source code it compiles, in
|
|
230
|
+
`vendor/sqlite`, is in the public domain, as each file's header states. `Compress`, `SQLAR` and `ZipFile` include
|
|
231
|
+
[zlib](https://zlib.net), © Jean-loup Gailly and Mark Adler, under the zlib licence in `vendor/zlib/LICENSE`.
|
data/extensions.yml
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# The catalogue of extensions this gem packages. The Rakefile builds from it, the Ruby module defines one constant per
|
|
2
|
+
# entry from it, and the smoke specs test every entry in it.
|
|
3
|
+
#
|
|
4
|
+
# Every extension compiles against the headers from `release`, so a source that calls an SQLite API newer than that
|
|
5
|
+
# release fails to build rather than crashing at load time. `rake vendor` refreshes vendor/ from the pins below, and
|
|
6
|
+
# `rake vendor:verify` (run before every compile) fails if the vendored files or the `minimum_sqlite` values have
|
|
7
|
+
# drifted from what the pins produce.
|
|
8
|
+
|
|
9
|
+
release:
|
|
10
|
+
version: '3.54.1'
|
|
11
|
+
url: https://sqlite.org/2026/sqlite-src-3540100.zip
|
|
12
|
+
sha3_256: 877c6f4996ce7adb368686bce21638de9e3d91534832ad3d9d119037d1bc22ad
|
|
13
|
+
|
|
14
|
+
# A commit in SQLite's official Git mirror, https://github.com/sqlite/sqlite. Only extensions with `from: trunk` use it.
|
|
15
|
+
# `rake vendor:verify` refuses a trunk pin unless the source declares its own pre-1.0 version
|
|
16
|
+
# (`#define X_VERSION "0.8"`) or the entry gives a `trunk_reason`, which is reserved for fixes to wrong results, crashes
|
|
17
|
+
# and hangs that no release contains yet.
|
|
18
|
+
trunk:
|
|
19
|
+
commit: 18d88a276c203d0f28f8bcbeeb53b1ee73616b5e
|
|
20
|
+
|
|
21
|
+
# Third-party libraries compiled into the extensions that list them under `bundles`, so those binaries need nothing from
|
|
22
|
+
# the system. `files` are vendored and `sources` compiled; `cflags` apply to the library and to the extensions using
|
|
23
|
+
# it. Z_PREFIX renames zlib's symbols so the bundled copy never collides with a zlib already loaded into the process.
|
|
24
|
+
bundled:
|
|
25
|
+
zlib:
|
|
26
|
+
version: '1.4'
|
|
27
|
+
url: https://zlib.net/zlib-1.4.tar.gz
|
|
28
|
+
sha256: 02dd159783677a749c04adbdd02b55b8a2bcc7e054f51b76b549199a916ad584
|
|
29
|
+
sources: [adler32.c, compress.c, crc32.c, deflate.c, inffast.c, inflate.c, inftrees.c, trees.c, uncompr.c, zutil.c]
|
|
30
|
+
cflags: [-DZ_PREFIX]
|
|
31
|
+
|
|
32
|
+
# Settings shared by every extension, followed by settings for one OS (`darwin`, `linux` or `mingw`) or one CPU
|
|
33
|
+
# (`x86_64` or `aarch64`), which add to them.
|
|
34
|
+
build:
|
|
35
|
+
cflags: [-O2, -DNDEBUG]
|
|
36
|
+
link: [m]
|
|
37
|
+
darwin:
|
|
38
|
+
cflags: [-mmacosx-version-min=11.0]
|
|
39
|
+
linux:
|
|
40
|
+
cflags: [-fPIC]
|
|
41
|
+
mingw:
|
|
42
|
+
# Without this the binaries would need libgcc's DLL, which a Ruby install does not necessarily ship.
|
|
43
|
+
ldflags: [-static-libgcc]
|
|
44
|
+
|
|
45
|
+
# Each entry is keyed by the name of its source file, which is also the name of its binary. SQLite derives the entry
|
|
46
|
+
# point from the binary's name, so renaming a binary can stop it from loading.
|
|
47
|
+
#
|
|
48
|
+
# constant The constant under SQLiteExtensions that exposes the extension.
|
|
49
|
+
# source The source file's path within SQLite's source tree.
|
|
50
|
+
# companions Other files from SQLite's source tree the source includes, taken from the same pin.
|
|
51
|
+
# from `release` or `trunk`, selecting which pin above the source is taken from.
|
|
52
|
+
# trunk_reason Why a source without its own pre-1.0 version is taken from trunk.
|
|
53
|
+
# minimum_sqlite The oldest SQLite that provides every API function the extension calls, as
|
|
54
|
+
# `rake vendor:verify` computes it.
|
|
55
|
+
# bundles Libraries from `bundled` compiled into the extension.
|
|
56
|
+
# cflags, link Compiler flags and system libraries added to those from `build`.
|
|
57
|
+
# <os>, <cpu> `cflags`, `ldflags` and `link` added on that OS or CPU only. A CPU section may also give `objects`,
|
|
58
|
+
# which compiles the source once per entry, each with its own extra flags, and links every object
|
|
59
|
+
# into the one binary.
|
|
60
|
+
# smoke Statements run in a fresh in-memory database after loading the extension: each `setup`
|
|
61
|
+
# statement, then `sql`, whose first column of its first row must equal `expect`. `{directory}`
|
|
62
|
+
# is replaced with the path of an empty temporary directory.
|
|
63
|
+
extensions:
|
|
64
|
+
anycollseq:
|
|
65
|
+
constant: AnyCollSeq
|
|
66
|
+
source: ext/misc/anycollseq.c
|
|
67
|
+
from: release
|
|
68
|
+
minimum_sqlite: '3.7.16'
|
|
69
|
+
smoke:
|
|
70
|
+
setup:
|
|
71
|
+
- create table t(x text collate unknown_collation)
|
|
72
|
+
- insert into t values ('b'), ('a')
|
|
73
|
+
sql: select group_concat(x, ',') from (select x from t order by x)
|
|
74
|
+
expect: a,b
|
|
75
|
+
|
|
76
|
+
appendvfs:
|
|
77
|
+
constant: AppendVFS
|
|
78
|
+
source: ext/misc/appendvfs.c
|
|
79
|
+
from: trunk
|
|
80
|
+
trunk_reason: A failed registration leaves a dangling pointer that the next open dereferences.
|
|
81
|
+
minimum_sqlite: '3.7.16'
|
|
82
|
+
smoke:
|
|
83
|
+
setup:
|
|
84
|
+
- attach 'file:{directory}/appended.db?vfs=apndvfs' as appended
|
|
85
|
+
- create table appended.t(x)
|
|
86
|
+
- insert into appended.t values (42)
|
|
87
|
+
sql: select x from appended.t
|
|
88
|
+
expect: 42
|
|
89
|
+
|
|
90
|
+
base64:
|
|
91
|
+
constant: Base64
|
|
92
|
+
source: ext/misc/base64.c
|
|
93
|
+
from: trunk
|
|
94
|
+
trunk_reason: Decoding mishandles whitespace in the input.
|
|
95
|
+
minimum_sqlite: '3.8.7'
|
|
96
|
+
smoke:
|
|
97
|
+
sql: select cast(base64(base64(cast('Hello' as blob))) as text)
|
|
98
|
+
expect: Hello
|
|
99
|
+
|
|
100
|
+
base85:
|
|
101
|
+
constant: Base85
|
|
102
|
+
source: ext/misc/base85.c
|
|
103
|
+
from: release
|
|
104
|
+
minimum_sqlite: '3.8.7'
|
|
105
|
+
smoke:
|
|
106
|
+
sql: select cast(base85(base85(cast('Hello' as blob))) as text)
|
|
107
|
+
expect: Hello
|
|
108
|
+
|
|
109
|
+
cksumvfs:
|
|
110
|
+
constant: CksumVFS
|
|
111
|
+
source: ext/misc/cksumvfs.c
|
|
112
|
+
from: release
|
|
113
|
+
minimum_sqlite: '3.10.0'
|
|
114
|
+
smoke:
|
|
115
|
+
setup:
|
|
116
|
+
- attach 'file:{directory}/checksummed.db?vfs=cksmvfs' as checksummed
|
|
117
|
+
- create table checksummed.t(x)
|
|
118
|
+
- insert into checksummed.t values (1)
|
|
119
|
+
sql: select x from checksummed.t
|
|
120
|
+
expect: 1
|
|
121
|
+
|
|
122
|
+
completion:
|
|
123
|
+
constant: Completion
|
|
124
|
+
source: ext/misc/completion.c
|
|
125
|
+
from: release
|
|
126
|
+
minimum_sqlite: '3.24.0'
|
|
127
|
+
smoke:
|
|
128
|
+
sql: select count(*) from completion('sel') where candidate = 'SELECT'
|
|
129
|
+
expect: 1
|
|
130
|
+
|
|
131
|
+
compress:
|
|
132
|
+
constant: Compress
|
|
133
|
+
source: ext/misc/compress.c
|
|
134
|
+
from: release
|
|
135
|
+
minimum_sqlite: '3.8.7'
|
|
136
|
+
bundles: [zlib]
|
|
137
|
+
smoke:
|
|
138
|
+
sql: select cast(uncompress(compress('hello hello hello')) as text)
|
|
139
|
+
expect: hello hello hello
|
|
140
|
+
|
|
141
|
+
csv:
|
|
142
|
+
constant: CSV
|
|
143
|
+
source: ext/misc/csv.c
|
|
144
|
+
from: release
|
|
145
|
+
minimum_sqlite: '3.24.0'
|
|
146
|
+
smoke:
|
|
147
|
+
setup:
|
|
148
|
+
- "create virtual table temp.people using csv(data='name,age\nAda,36', header=true)"
|
|
149
|
+
sql: select name from temp.people where age = '36'
|
|
150
|
+
expect: Ada
|
|
151
|
+
|
|
152
|
+
decimal:
|
|
153
|
+
constant: Decimal
|
|
154
|
+
source: ext/misc/decimal.c
|
|
155
|
+
from: trunk
|
|
156
|
+
trunk_reason: decimal_cmp() and the decimal collation compare wrongly, and NULL arguments are mishandled.
|
|
157
|
+
minimum_sqlite: '3.25.0'
|
|
158
|
+
smoke:
|
|
159
|
+
sql: select decimal_add('0.1', '0.2')
|
|
160
|
+
expect: '0.3'
|
|
161
|
+
|
|
162
|
+
eval:
|
|
163
|
+
constant: Eval
|
|
164
|
+
source: ext/misc/eval.c
|
|
165
|
+
from: release
|
|
166
|
+
minimum_sqlite: '3.44.0'
|
|
167
|
+
smoke:
|
|
168
|
+
sql: select eval('select 6 * 7')
|
|
169
|
+
expect: '42'
|
|
170
|
+
|
|
171
|
+
fileio:
|
|
172
|
+
constant: FileIO
|
|
173
|
+
source: ext/misc/fileio.c
|
|
174
|
+
companions: [ext/misc/windirent.h]
|
|
175
|
+
from: trunk
|
|
176
|
+
trunk_reason: fsdir() mishandles unreasonable LEVEL constraints.
|
|
177
|
+
minimum_sqlite: '3.8.7'
|
|
178
|
+
# Under MinGW, fileio.c relies on its host (SQLite's shell) to have included these headers already, and windirent.h
|
|
179
|
+
# only covers MSVC, so they are included here. S_ISLNK is 0 on Windows, as windirent.h defines it for MSVC.
|
|
180
|
+
mingw:
|
|
181
|
+
cflags: [-include, windows.h, -include, stdlib.h, -include, dirent.h, -DS_ISLNK(m)=0]
|
|
182
|
+
smoke:
|
|
183
|
+
setup:
|
|
184
|
+
- select writefile('{directory}/note.txt', 'hello')
|
|
185
|
+
sql: select cast(readfile('{directory}/note.txt') as text)
|
|
186
|
+
expect: hello
|
|
187
|
+
|
|
188
|
+
fossildelta:
|
|
189
|
+
constant: FossilDelta
|
|
190
|
+
source: ext/misc/fossildelta.c
|
|
191
|
+
from: trunk
|
|
192
|
+
trunk_reason: A signed integer overflow, and pointer arithmetic in delta_parse() that is not portable.
|
|
193
|
+
minimum_sqlite: '3.8.7'
|
|
194
|
+
smoke:
|
|
195
|
+
sql: select cast(delta_apply('hello world', delta_create('hello world', 'hello there')) as text)
|
|
196
|
+
expect: hello there
|
|
197
|
+
|
|
198
|
+
ieee754:
|
|
199
|
+
constant: IEEE754
|
|
200
|
+
source: ext/misc/ieee754.c
|
|
201
|
+
from: release
|
|
202
|
+
minimum_sqlite: '3.7.16'
|
|
203
|
+
smoke:
|
|
204
|
+
sql: select ieee754(2.5)
|
|
205
|
+
expect: ieee754(5,-1)
|
|
206
|
+
|
|
207
|
+
nextchar:
|
|
208
|
+
constant: NextChar
|
|
209
|
+
source: ext/misc/nextchar.c
|
|
210
|
+
from: trunk
|
|
211
|
+
trunk_reason: A possible infinite loop with the NOCASE collation.
|
|
212
|
+
minimum_sqlite: '3.8.7'
|
|
213
|
+
smoke:
|
|
214
|
+
setup:
|
|
215
|
+
- create table vocabulary(word text)
|
|
216
|
+
- insert into vocabulary values ('apple'), ('apricot'), ('banana')
|
|
217
|
+
sql: select next_char('ap', 'vocabulary', 'word')
|
|
218
|
+
expect: pr
|
|
219
|
+
|
|
220
|
+
percentile:
|
|
221
|
+
constant: Percentile
|
|
222
|
+
source: ext/misc/percentile.c
|
|
223
|
+
from: release
|
|
224
|
+
minimum_sqlite: '3.25.0'
|
|
225
|
+
smoke:
|
|
226
|
+
sql: select percentile(value, 50) from (select 1 as value union all select 2 union all select 3)
|
|
227
|
+
expect: 2.0
|
|
228
|
+
|
|
229
|
+
prefixes:
|
|
230
|
+
constant: Prefixes
|
|
231
|
+
source: ext/misc/prefixes.c
|
|
232
|
+
from: release
|
|
233
|
+
minimum_sqlite: '3.8.7'
|
|
234
|
+
smoke:
|
|
235
|
+
sql: select group_concat(prefix, ',') from prefixes('abc')
|
|
236
|
+
expect: abc,ab,a,
|
|
237
|
+
|
|
238
|
+
regexp:
|
|
239
|
+
constant: Regexp
|
|
240
|
+
source: ext/misc/regexp.c
|
|
241
|
+
from: trunk
|
|
242
|
+
trunk_reason: '"^" and "$" match wrongly, and "|" binds less tightly than "^".'
|
|
243
|
+
minimum_sqlite: '3.8.7'
|
|
244
|
+
smoke:
|
|
245
|
+
sql: select 'sqlite' regexp '^s[a-z]+e$'
|
|
246
|
+
expect: 1
|
|
247
|
+
|
|
248
|
+
series:
|
|
249
|
+
constant: Series
|
|
250
|
+
source: ext/misc/series.c
|
|
251
|
+
from: trunk
|
|
252
|
+
trunk_reason: generate_series() returns wrong results for some ORDER BY and comparison constraints.
|
|
253
|
+
minimum_sqlite: '3.8.7'
|
|
254
|
+
smoke:
|
|
255
|
+
sql: select group_concat(value, ',') from generate_series(1, 3)
|
|
256
|
+
expect: '1,2,3'
|
|
257
|
+
|
|
258
|
+
sha1:
|
|
259
|
+
constant: SHA1
|
|
260
|
+
source: ext/misc/sha1.c
|
|
261
|
+
from: release
|
|
262
|
+
minimum_sqlite: '3.44.0'
|
|
263
|
+
smoke:
|
|
264
|
+
sql: select sha1('abc')
|
|
265
|
+
expect: a9993e364706816aba3e25717850c26c9cd0d89d
|
|
266
|
+
|
|
267
|
+
shathree:
|
|
268
|
+
constant: SHA3
|
|
269
|
+
source: ext/misc/shathree.c
|
|
270
|
+
from: release
|
|
271
|
+
minimum_sqlite: '3.44.0'
|
|
272
|
+
smoke:
|
|
273
|
+
sql: select hex(sha3('abc'))
|
|
274
|
+
expect: 3A985DA74FE225B2045C172D6BD390BD855F086E3E9D525B46BFE24511431532
|
|
275
|
+
|
|
276
|
+
spellfix:
|
|
277
|
+
constant: Spellfix
|
|
278
|
+
source: ext/misc/spellfix.c
|
|
279
|
+
from: release
|
|
280
|
+
minimum_sqlite: '3.8.7'
|
|
281
|
+
smoke:
|
|
282
|
+
setup:
|
|
283
|
+
- create virtual table words using spellfix1
|
|
284
|
+
- insert into words(word) values ('kitten'), ('mitten')
|
|
285
|
+
sql: select word from words where word match 'kiten' and top = 1
|
|
286
|
+
expect: kitten
|
|
287
|
+
|
|
288
|
+
sqlar:
|
|
289
|
+
constant: SQLAR
|
|
290
|
+
source: ext/misc/sqlar.c
|
|
291
|
+
from: release
|
|
292
|
+
minimum_sqlite: '3.8.7'
|
|
293
|
+
bundles: [zlib]
|
|
294
|
+
smoke:
|
|
295
|
+
sql: select length(sqlar_uncompress(sqlar_compress(zeroblob(1000)), 1000))
|
|
296
|
+
expect: 1000
|
|
297
|
+
|
|
298
|
+
totype:
|
|
299
|
+
constant: ToType
|
|
300
|
+
source: ext/misc/totype.c
|
|
301
|
+
from: release
|
|
302
|
+
minimum_sqlite: '3.7.16'
|
|
303
|
+
smoke:
|
|
304
|
+
sql: select tointeger('42')
|
|
305
|
+
expect: 42
|
|
306
|
+
|
|
307
|
+
uint:
|
|
308
|
+
constant: UInt
|
|
309
|
+
source: ext/misc/uint.c
|
|
310
|
+
from: release
|
|
311
|
+
minimum_sqlite: '3.7.16'
|
|
312
|
+
smoke:
|
|
313
|
+
sql: >-
|
|
314
|
+
select group_concat(name, ',')
|
|
315
|
+
from (select column1 as name from (values ('file10'), ('file9')) order by name collate uint)
|
|
316
|
+
expect: file9,file10
|
|
317
|
+
|
|
318
|
+
unionvtab:
|
|
319
|
+
constant: UnionVTab
|
|
320
|
+
source: ext/misc/unionvtab.c
|
|
321
|
+
from: release
|
|
322
|
+
minimum_sqlite: '3.8.7'
|
|
323
|
+
smoke:
|
|
324
|
+
setup:
|
|
325
|
+
- create table first(a)
|
|
326
|
+
- insert into first(rowid, a) values (1, 1)
|
|
327
|
+
- create virtual table temp.everything using unionvtab("select 'main', 'first', 1, 10")
|
|
328
|
+
sql: select count(*) from temp.everything
|
|
329
|
+
expect: 1
|
|
330
|
+
|
|
331
|
+
uuid:
|
|
332
|
+
constant: UUID
|
|
333
|
+
source: ext/misc/uuid.c
|
|
334
|
+
from: release
|
|
335
|
+
minimum_sqlite: '3.7.16'
|
|
336
|
+
smoke:
|
|
337
|
+
sql: select uuid_str(uuid_blob('A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11'))
|
|
338
|
+
expect: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
|
|
339
|
+
|
|
340
|
+
vec1:
|
|
341
|
+
constant: Vec1
|
|
342
|
+
source: ext/vec1/vec1.c
|
|
343
|
+
from: trunk
|
|
344
|
+
minimum_sqlite: '3.38.0'
|
|
345
|
+
# vec1 depends on the unrolling and inlining that -O3 provides.
|
|
346
|
+
cflags: [-O3]
|
|
347
|
+
linux:
|
|
348
|
+
link: [pthread]
|
|
349
|
+
# Upstream's own build on x86_64: a scalar and an AVX2 object in one binary, which picks one at load time by
|
|
350
|
+
# checking the CPU, so the binary also works on CPUs without AVX2.
|
|
351
|
+
x86_64:
|
|
352
|
+
objects:
|
|
353
|
+
- [-DVEC1SIMD=SCALAR]
|
|
354
|
+
- [-DVEC1SIMD=AVX2, -mavx2, -mfma]
|
|
355
|
+
smoke:
|
|
356
|
+
sql: select vec1_cos_distance(vec1_from_json('[1,0,0,0]'), vec1_from_json('[0,1,0,0]'))
|
|
357
|
+
expect: 1.0
|
|
358
|
+
|
|
359
|
+
zipfile:
|
|
360
|
+
constant: ZipFile
|
|
361
|
+
source: ext/misc/zipfile.c
|
|
362
|
+
from: trunk
|
|
363
|
+
trunk_reason: Several fixes, including an unbounded number of archive entries being processed.
|
|
364
|
+
minimum_sqlite: '3.20.0'
|
|
365
|
+
bundles: [zlib]
|
|
366
|
+
smoke:
|
|
367
|
+
sql: select count(*) from zipfile((select zipfile('hello.txt', 'hello')))
|
|
368
|
+
expect: 1
|
|
369
|
+
|
|
370
|
+
zorder:
|
|
371
|
+
constant: ZOrder
|
|
372
|
+
source: ext/misc/zorder.c
|
|
373
|
+
from: release
|
|
374
|
+
minimum_sqlite: '3.7.16'
|
|
375
|
+
smoke:
|
|
376
|
+
sql: select unzorder(zorder(3, 5), 2, 1)
|
|
377
|
+
expect: 5
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SQLiteExtensions
|
|
4
|
+
# @return [String] The gem's semantic version number.
|
|
5
|
+
#
|
|
6
|
+
VERSION = '0.1.0'
|
|
7
|
+
|
|
8
|
+
# @return [String] The path of the catalogue describing every extension the gem packages.
|
|
9
|
+
#
|
|
10
|
+
CATALOGUE_PATH = File.expand_path('../../extensions.yml', __dir__)
|
|
11
|
+
|
|
12
|
+
# @return [String] The directory holding the compiled extension binaries.
|
|
13
|
+
#
|
|
14
|
+
NATIVE_DIRECTORY = File.expand_path('native', __dir__)
|
|
15
|
+
|
|
16
|
+
# @return [String] The file extension SQLite expects on a loadable extension on this platform.
|
|
17
|
+
#
|
|
18
|
+
SHARED_LIBRARY_EXTENSION =
|
|
19
|
+
case RUBY_PLATFORM
|
|
20
|
+
when /darwin/ then 'dylib'
|
|
21
|
+
when /mingw|mswin|cygwin/ then 'dll'
|
|
22
|
+
else 'so'
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SQLiteExtensions
|
|
4
|
+
# A packaged SQLite extension. It responds to `#to_path`, so it can be passed anywhere the sqlite3 gem accepts an
|
|
5
|
+
# extension, such as `SQLite3::Database#load_extension` or the `extensions:` option of `SQLite3::Database.new`.
|
|
6
|
+
#
|
|
7
|
+
class Extension
|
|
8
|
+
# @return [String] The extension's name, which is also the base name of its binary.
|
|
9
|
+
#
|
|
10
|
+
attr_reader :name
|
|
11
|
+
|
|
12
|
+
# @return [Gem::Version] The oldest SQLite that provides every API function the extension calls.
|
|
13
|
+
#
|
|
14
|
+
attr_reader :minimum_sqlite_version
|
|
15
|
+
|
|
16
|
+
# Creates a new extension instance.
|
|
17
|
+
#
|
|
18
|
+
# @param name [String] The extension's name, which is also the base name of its binary.
|
|
19
|
+
# @param minimum_sqlite_version [String] The oldest SQLite that provides every API function the extension calls.
|
|
20
|
+
# @param directory [String] The directory holding the extension's binary.
|
|
21
|
+
#
|
|
22
|
+
def initialize(name, minimum_sqlite_version:, directory: NATIVE_DIRECTORY)
|
|
23
|
+
@name = name
|
|
24
|
+
@minimum_sqlite_version = Gem::Version.new(minimum_sqlite_version)
|
|
25
|
+
@directory = directory
|
|
26
|
+
freeze
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# @return [String] The absolute path of the extension's binary, whether or not it exists.
|
|
30
|
+
#
|
|
31
|
+
def path
|
|
32
|
+
File.join(@directory, "#{name}.#{SHARED_LIBRARY_EXTENSION}")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Returns the path of the extension's binary, once it is known to be safe to load.
|
|
36
|
+
#
|
|
37
|
+
# @return [String] The absolute path of the extension's binary.
|
|
38
|
+
#
|
|
39
|
+
# @raise [UnsupportedPlatform] When there is no binary of the extension for this platform.
|
|
40
|
+
# @raise [IncompatibleSQLite] When the SQLite loaded by the sqlite3 gem is older than the extension needs.
|
|
41
|
+
#
|
|
42
|
+
def to_path
|
|
43
|
+
raise UnsupportedPlatform.new(extension: self) unless File.exist?(path)
|
|
44
|
+
|
|
45
|
+
loaded_version = loaded_sqlite_version
|
|
46
|
+
raise IncompatibleSQLite.new(extension: self, loaded_version:) if loaded_version&.<(minimum_sqlite_version)
|
|
47
|
+
|
|
48
|
+
path
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @return [String] A short description of the extension for debugging.
|
|
52
|
+
#
|
|
53
|
+
def inspect
|
|
54
|
+
"#<#{self.class.name} #{name}>"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
# The binaries load into any SQLite host, so the sqlite3 gem is not a dependency; without it loaded there is no
|
|
60
|
+
# version to check against.
|
|
61
|
+
#
|
|
62
|
+
# @return [Gem::Version, nil] The version of the SQLite library the sqlite3 gem has loaded, if it is loaded.
|
|
63
|
+
#
|
|
64
|
+
def loaded_sqlite_version
|
|
65
|
+
return unless defined?(::SQLite3::SQLITE_LOADED_VERSION)
|
|
66
|
+
|
|
67
|
+
Gem::Version.new(::SQLite3::SQLITE_LOADED_VERSION)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SQLiteExtensions
|
|
4
|
+
# Raised when the SQLite library loaded into the process is older than an extension needs. Loading the extension
|
|
5
|
+
# anyway would crash the process the first time it called an API function that library lacks.
|
|
6
|
+
#
|
|
7
|
+
class IncompatibleSQLite < Error
|
|
8
|
+
# @return [Extension] The extension that cannot be loaded.
|
|
9
|
+
#
|
|
10
|
+
attr_reader :extension
|
|
11
|
+
|
|
12
|
+
# @return [Gem::Version] The version of the SQLite library loaded into the process.
|
|
13
|
+
#
|
|
14
|
+
attr_reader :loaded_version
|
|
15
|
+
|
|
16
|
+
# Creates a new error instance.
|
|
17
|
+
#
|
|
18
|
+
# @param extension [Extension] The extension that cannot be loaded.
|
|
19
|
+
# @param loaded_version [Gem::Version] The version of the SQLite library loaded into the process.
|
|
20
|
+
#
|
|
21
|
+
def initialize(extension:, loaded_version:)
|
|
22
|
+
@extension = extension
|
|
23
|
+
@loaded_version = loaded_version
|
|
24
|
+
super(
|
|
25
|
+
"#{extension.name} needs SQLite #{extension.minimum_sqlite_version} or newer, " \
|
|
26
|
+
"but the sqlite3 gem has loaded SQLite #{loaded_version}."
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SQLiteExtensions
|
|
4
|
+
# Raised when the gem has no compiled binary of an extension for the current platform.
|
|
5
|
+
#
|
|
6
|
+
class UnsupportedPlatform < Error
|
|
7
|
+
# @return [Extension] The extension whose binary is missing.
|
|
8
|
+
#
|
|
9
|
+
attr_reader :extension
|
|
10
|
+
|
|
11
|
+
# @return [String] The platform Ruby is running on.
|
|
12
|
+
#
|
|
13
|
+
attr_reader :platform
|
|
14
|
+
|
|
15
|
+
# Creates a new error instance.
|
|
16
|
+
#
|
|
17
|
+
# @param extension [Extension] The extension whose binary is missing.
|
|
18
|
+
# @param platform [String] The platform Ruby is running on.
|
|
19
|
+
#
|
|
20
|
+
def initialize(extension:, platform: RUBY_PLATFORM)
|
|
21
|
+
@extension = extension
|
|
22
|
+
@platform = platform
|
|
23
|
+
super("sqlite_extensions has no #{extension.name} binary for #{platform} (expected at #{extension.path}).")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'yaml'
|
|
4
|
+
|
|
5
|
+
require_relative 'sqlite_extensions/constants'
|
|
6
|
+
require_relative 'sqlite_extensions/error'
|
|
7
|
+
require_relative 'sqlite_extensions/unsupported_platform'
|
|
8
|
+
require_relative 'sqlite_extensions/incompatible_sqlite'
|
|
9
|
+
require_relative 'sqlite_extensions/extension'
|
|
10
|
+
|
|
11
|
+
# Precompiled builds of SQLite's first-party loadable extensions. Each extension in the catalogue is exposed as a
|
|
12
|
+
# constant (`SQLiteExtensions::Vec1`, `SQLiteExtensions::Spellfix`, …) responding to `#to_path`.
|
|
13
|
+
#
|
|
14
|
+
module SQLiteExtensions
|
|
15
|
+
# @return [Array<Extension>] Every extension the gem packages, in catalogue order.
|
|
16
|
+
#
|
|
17
|
+
EXTENSIONS = YAML.load_file(CATALOGUE_PATH).fetch('extensions').map do |name, attributes|
|
|
18
|
+
extension = Extension.new(name, minimum_sqlite_version: attributes.fetch('minimum_sqlite'))
|
|
19
|
+
const_set(attributes.fetch('constant'), extension)
|
|
20
|
+
end.freeze
|
|
21
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sqlite_extensions
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: x86_64-linux-gnu
|
|
6
|
+
authors:
|
|
7
|
+
- Nialto Services
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
email:
|
|
13
|
+
- support@nialtoservices.co.uk
|
|
14
|
+
executables: []
|
|
15
|
+
extensions: []
|
|
16
|
+
extra_rdoc_files: []
|
|
17
|
+
files:
|
|
18
|
+
- LICENSE
|
|
19
|
+
- README.md
|
|
20
|
+
- extensions.yml
|
|
21
|
+
- lib/sqlite_extensions.rb
|
|
22
|
+
- lib/sqlite_extensions/constants.rb
|
|
23
|
+
- lib/sqlite_extensions/error.rb
|
|
24
|
+
- lib/sqlite_extensions/extension.rb
|
|
25
|
+
- lib/sqlite_extensions/incompatible_sqlite.rb
|
|
26
|
+
- lib/sqlite_extensions/native/anycollseq.so
|
|
27
|
+
- lib/sqlite_extensions/native/appendvfs.so
|
|
28
|
+
- lib/sqlite_extensions/native/base64.so
|
|
29
|
+
- lib/sqlite_extensions/native/base85.so
|
|
30
|
+
- lib/sqlite_extensions/native/cksumvfs.so
|
|
31
|
+
- lib/sqlite_extensions/native/completion.so
|
|
32
|
+
- lib/sqlite_extensions/native/compress.so
|
|
33
|
+
- lib/sqlite_extensions/native/csv.so
|
|
34
|
+
- lib/sqlite_extensions/native/decimal.so
|
|
35
|
+
- lib/sqlite_extensions/native/eval.so
|
|
36
|
+
- lib/sqlite_extensions/native/fileio.so
|
|
37
|
+
- lib/sqlite_extensions/native/fossildelta.so
|
|
38
|
+
- lib/sqlite_extensions/native/ieee754.so
|
|
39
|
+
- lib/sqlite_extensions/native/nextchar.so
|
|
40
|
+
- lib/sqlite_extensions/native/percentile.so
|
|
41
|
+
- lib/sqlite_extensions/native/prefixes.so
|
|
42
|
+
- lib/sqlite_extensions/native/regexp.so
|
|
43
|
+
- lib/sqlite_extensions/native/series.so
|
|
44
|
+
- lib/sqlite_extensions/native/sha1.so
|
|
45
|
+
- lib/sqlite_extensions/native/shathree.so
|
|
46
|
+
- lib/sqlite_extensions/native/spellfix.so
|
|
47
|
+
- lib/sqlite_extensions/native/sqlar.so
|
|
48
|
+
- lib/sqlite_extensions/native/totype.so
|
|
49
|
+
- lib/sqlite_extensions/native/uint.so
|
|
50
|
+
- lib/sqlite_extensions/native/unionvtab.so
|
|
51
|
+
- lib/sqlite_extensions/native/uuid.so
|
|
52
|
+
- lib/sqlite_extensions/native/vec1.so
|
|
53
|
+
- lib/sqlite_extensions/native/zipfile.so
|
|
54
|
+
- lib/sqlite_extensions/native/zorder.so
|
|
55
|
+
- lib/sqlite_extensions/unsupported_platform.rb
|
|
56
|
+
homepage: https://github.com/NialtoServices/sqlite_extensions
|
|
57
|
+
licenses:
|
|
58
|
+
- MIT
|
|
59
|
+
metadata:
|
|
60
|
+
rubygems_mfa_required: 'true'
|
|
61
|
+
yard.run: yri
|
|
62
|
+
rdoc_options: []
|
|
63
|
+
require_paths:
|
|
64
|
+
- lib
|
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: 3.1.0
|
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 3.3.22
|
|
75
|
+
requirements: []
|
|
76
|
+
rubygems_version: 3.6.9
|
|
77
|
+
specification_version: 4
|
|
78
|
+
summary: Precompiled builds of SQLite's first-party loadable extensions, including
|
|
79
|
+
vec1 and spellfix.
|
|
80
|
+
test_files: []
|