sqlite3-ffi 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +11 -11
- data/lib/sqlite3/ffi/c_api.rb +1 -1
- data/lib/sqlite3/ffi/database.rb +6 -6
- data/lib/sqlite3/ffi/functions.rb +1 -0
- data/lib/sqlite3/ffi/utils.rb +1 -2
- data/lib/sqlite3/ffi/version.rb +1 -1
- metadata +5 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ae96e16626c5d549bf53b0c973c79aa41f62e33a9a1c707555d6c623d5a1af9
|
4
|
+
data.tar.gz: e3eded8d5d2dcec88043ea0ef153c9f70dfd0752e2072462e4766bf4d7a1b4fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e729d03db7dbf940791852c4c213bb2c20f41485c67333213d478a690700a8897eaa3b83d9f220b70056a0dc1fe85a750a6bc2ac91062d2d35e102116c9a2df7
|
7
|
+
data.tar.gz: e98bcefe911cd6f9a2f4fb96cf506c0bf40ba83af8a7425e938a181df0f696b75b14c290d1d5480c97aa2c1e99c8445625a8b800fac96be79fd180e785caeff3
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# sqlite3-ffi
|
1
|
+
# sqlite3-ruby-ffi
|
2
2
|
|
3
|
-
:tada: A drop-in replacement for [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) for JRuby
|
3
|
+
:tada: A drop-in replacement for the [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) gem for JRuby
|
4
4
|
|
5
|
-
- Passes 99% of the sqlite3 test suite
|
5
|
+
- Passes > 99% of the sqlite3 test suite
|
6
6
|
- Works with Active Record without a custom adapter
|
7
7
|
|
8
|
-
[](https://github.com/ankane/sqlite3-ffi/actions)
|
8
|
+
[](https://github.com/ankane/sqlite3-ruby-ffi/actions)
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -15,11 +15,11 @@ Add this line to your Gemfile:
|
|
15
15
|
gem "sqlite3-ffi"
|
16
16
|
```
|
17
17
|
|
18
|
-
And use it the
|
18
|
+
And use it the same way as the sqlite3 gem.
|
19
19
|
|
20
20
|
## Why FFI for JRuby?
|
21
21
|
|
22
|
-
I tried [JDBC](https://github.com/xerial/sqlite-jdbc), [JNI](https://sqlite.org/src/dir/ext/jni), and FFI. Since SQLite is written in C, all three approaches eventually call C,
|
22
|
+
I tried [JDBC](https://github.com/xerial/sqlite-jdbc), [JNI](https://sqlite.org/src/dir/ext/jni), and FFI. Since SQLite is written in C, all three approaches eventually call C, and FFI provides the most compatibility.
|
23
23
|
|
24
24
|
## Credits
|
25
25
|
|
@@ -34,22 +34,22 @@ The code in `lib` and `test` is an exact copy, plus some additional files:
|
|
34
34
|
|
35
35
|
## History
|
36
36
|
|
37
|
-
View the [changelog](https://github.com/ankane/sqlite3-ffi/blob/master/CHANGELOG.md)
|
37
|
+
View the [changelog](https://github.com/ankane/sqlite3-ruby-ffi/blob/master/CHANGELOG.md)
|
38
38
|
|
39
39
|
## Contributing
|
40
40
|
|
41
41
|
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
42
42
|
|
43
|
-
- [Report bugs](https://github.com/ankane/sqlite3-ffi/issues)
|
44
|
-
- Fix bugs and [submit pull requests](https://github.com/ankane/sqlite3-ffi/pulls)
|
43
|
+
- [Report bugs](https://github.com/ankane/sqlite3-ruby-ffi/issues)
|
44
|
+
- Fix bugs and [submit pull requests](https://github.com/ankane/sqlite3-ruby-ffi/pulls)
|
45
45
|
- Write, clarify, or fix documentation
|
46
46
|
- Suggest or add new features
|
47
47
|
|
48
48
|
To get started with development:
|
49
49
|
|
50
50
|
```sh
|
51
|
-
git clone https://github.com/ankane/sqlite3-ffi.git
|
52
|
-
cd sqlite3-ffi
|
51
|
+
git clone https://github.com/ankane/sqlite3-ruby-ffi.git
|
52
|
+
cd sqlite3-ruby-ffi
|
53
53
|
bundle install
|
54
54
|
bundle exec rake test
|
55
55
|
```
|
data/lib/sqlite3/ffi/c_api.rb
CHANGED
@@ -204,7 +204,7 @@ module SQLite3
|
|
204
204
|
end
|
205
205
|
|
206
206
|
HAVE_SQLITE3_LOAD_EXTENSION = begin
|
207
|
-
attach_function :sqlite3_load_extension, [:pointer, :string, :
|
207
|
+
attach_function :sqlite3_load_extension, [:pointer, :string, :pointer, :pointer], :int
|
208
208
|
true
|
209
209
|
rescue ::FFI::NotFoundError
|
210
210
|
false
|
data/lib/sqlite3/ffi/database.rb
CHANGED
@@ -168,8 +168,8 @@ module SQLite3
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
def discard_db
|
172
|
-
FFI::CApi.sqlite3_db_release_memory(db)
|
171
|
+
def discard_db
|
172
|
+
FFI::CApi.sqlite3_db_release_memory(@db)
|
173
173
|
# TODO sqlite3_file_control
|
174
174
|
@db = nil
|
175
175
|
@discarded = true
|
@@ -181,7 +181,7 @@ module SQLite3
|
|
181
181
|
FFI::CApi.sqlite3_close_v2(@db)
|
182
182
|
@db = nil
|
183
183
|
else
|
184
|
-
discard_db
|
184
|
+
discard_db
|
185
185
|
end
|
186
186
|
end
|
187
187
|
end
|
@@ -211,7 +211,7 @@ module SQLite3
|
|
211
211
|
end
|
212
212
|
|
213
213
|
def discard
|
214
|
-
discard_db
|
214
|
+
discard_db
|
215
215
|
@aggregators = nil
|
216
216
|
self
|
217
217
|
end
|
@@ -220,8 +220,8 @@ module SQLite3
|
|
220
220
|
def load_extension_internal(file)
|
221
221
|
require_open_db
|
222
222
|
|
223
|
-
err_msg = FFI::MemoryPointer.new(:pointer)
|
224
|
-
status = FFI::CApi.sqlite3_load_extension(@db, FFI.string_value(file),
|
223
|
+
err_msg = ::FFI::MemoryPointer.new(:pointer)
|
224
|
+
status = FFI::CApi.sqlite3_load_extension(@db, FFI.string_value(file), nil, err_msg)
|
225
225
|
FFI.check_msg(@db, status, err_msg)
|
226
226
|
self
|
227
227
|
end
|
@@ -56,6 +56,7 @@ module SQLite3
|
|
56
56
|
current_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
57
57
|
if ctx.instance_variable_get(:@stmt_deadline).nil?
|
58
58
|
ctx.instance_variable_set(:@stmt_deadline, current_time)
|
59
|
+
0
|
59
60
|
elsif current_time >= ctx.instance_variable_get(:@stmt_deadline)
|
60
61
|
1
|
61
62
|
else
|
data/lib/sqlite3/ffi/utils.rb
CHANGED
data/lib/sqlite3/ffi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqlite3-ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
@@ -9,10 +9,9 @@ authors:
|
|
9
9
|
- Aaron Patterson
|
10
10
|
- Mike Dalessio
|
11
11
|
- Andrew Kane
|
12
|
-
autorequire:
|
13
12
|
bindir: bin
|
14
13
|
cert_chain: []
|
15
|
-
date:
|
14
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
16
15
|
dependencies:
|
17
16
|
- !ruby/object:Gem::Dependency
|
18
17
|
name: ffi
|
@@ -28,7 +27,6 @@ dependencies:
|
|
28
27
|
- - ">="
|
29
28
|
- !ruby/object:Gem::Version
|
30
29
|
version: '0'
|
31
|
-
description:
|
32
30
|
email: andrew@ankane.org
|
33
31
|
executables: []
|
34
32
|
extensions: []
|
@@ -61,11 +59,10 @@ files:
|
|
61
59
|
- lib/sqlite3/value.rb
|
62
60
|
- lib/sqlite3/version.rb
|
63
61
|
- lib/sqlite3/version_info.rb
|
64
|
-
homepage: https://github.com/ankane/sqlite3-ffi
|
62
|
+
homepage: https://github.com/ankane/sqlite3-ruby-ffi
|
65
63
|
licenses:
|
66
64
|
- BSD-3-Clause
|
67
65
|
metadata: {}
|
68
|
-
post_install_message:
|
69
66
|
rdoc_options: []
|
70
67
|
require_paths:
|
71
68
|
- lib
|
@@ -80,8 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
77
|
- !ruby/object:Gem::Version
|
81
78
|
version: '0'
|
82
79
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
84
|
-
signing_key:
|
80
|
+
rubygems_version: 3.6.7
|
85
81
|
specification_version: 4
|
86
|
-
summary: A drop-in replacement for sqlite3 for JRuby
|
82
|
+
summary: A drop-in replacement for the sqlite3 gem for JRuby
|
87
83
|
test_files: []
|