extralite 1.13.1 → 1.14
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 +5 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/LICENSE +1 -1
- data/README.md +26 -9
- data/Rakefile +0 -1
- data/ext/extralite/extconf-bundle.rb +9 -0
- data/ext/extralite/extconf.rb +108 -2
- data/ext/extralite/extralite.h +5 -0
- data/ext/extralite/extralite_sqlite3.c +3 -0
- data/ext/{extralite → sqlite3}/sqlite3.c +0 -0
- data/ext/{extralite → sqlite3}/sqlite3.h +0 -0
- data/extralite-bundle.gemspec +8 -0
- data/extralite.gemspec +3 -25
- data/gemspec.rb +26 -0
- data/lib/extralite/version.rb +1 -1
- data/test/helper.rb +1 -1
- data/test/test_extralite.rb +5 -6
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32105cda1ba5871c89609e42828a095d76d4cd2da29bd6d47beefc6a3ae93bd6
|
4
|
+
data.tar.gz: 4ff38c0e6144b22792e2a57792f295fc85a6b3d4b9eb09820e4f3b3e4c78bec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0e94553b7ca02732fe93729844ef16ce58bce7582be1e9c1684f215999b7a4a84414265c6a6932fbc379887940bd70d8ff913c782b0ce6b1ee0eebd9f4438a0
|
7
|
+
data.tar.gz: 14db1538d2aafb781375d636cdcb9a42e92a74ce11304a953930f7456c76895051f8a37e61cf5dfff7b8dc3c4e02694187fd0ad6a8204ca0d948ec1fe3b26479
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -25,14 +25,16 @@
|
|
25
25
|
|
26
26
|
Extralite is a fast, extra-lightweight (about 600 lines of C-code) SQLite3
|
27
27
|
wrapper for Ruby. It provides a minimal set of methods for interacting with an
|
28
|
-
SQLite3 database, as well as prepared statements.
|
29
|
-
|
28
|
+
SQLite3 database, as well as prepared statements.
|
29
|
+
|
30
|
+
Extralite comes in two flavors: the `extralite` gem which uses the
|
31
|
+
system-installed sqlite3 library, and the `extralite-bundle` gem which bundles
|
32
|
+
the latest version of SQLite
|
33
|
+
([3.38.0](https://sqlite.org/releaselog/3_38_0.html)), offering access to the
|
34
|
+
latest features and enhancements.
|
30
35
|
|
31
36
|
## Features
|
32
37
|
|
33
|
-
- Zero dependencies: Extralite bundles SQLite3 version
|
34
|
-
[3.38.0](https://sqlite.org/releaselog/3_38_0.html) - no need to install any
|
35
|
-
`libsqlite3` packages.
|
36
38
|
- A variety of methods for different data access patterns: rows as hashes, rows
|
37
39
|
as arrays, single row, single column, single value.
|
38
40
|
- Prepared statements.
|
@@ -61,9 +63,18 @@ gem 'extralite'
|
|
61
63
|
|
62
64
|
You can also run `gem install extralite` if you just want to check it out.
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
## Installing the Extralite-SQLite3 bundle
|
67
|
+
|
68
|
+
If you don't have sqlite3 installed on your system, do not want to use the
|
69
|
+
system-installed version of SQLite3, or would like to use the latest version of
|
70
|
+
SQLite3, you can install the `extralite-bundle` gem, which integrates the
|
71
|
+
SQLite3 source code.
|
72
|
+
|
73
|
+
> **Important note**: The `extralite-bundle` will take a while to install (on my
|
74
|
+
> modest machine it takes about a minute), due to the size of the sqlite3 code.
|
75
|
+
|
76
|
+
Usage of the `extralite-bundle` gem is identical to the usage of the normal
|
77
|
+
`extralite` gem.
|
67
78
|
|
68
79
|
## Usage
|
69
80
|
|
@@ -71,7 +82,7 @@ You can also run `gem install extralite` if you just want to check it out.
|
|
71
82
|
require 'extralite'
|
72
83
|
|
73
84
|
# get sqlite3 version
|
74
|
-
Extralite.sqlite3_version #=> "3.
|
85
|
+
Extralite.sqlite3_version #=> "3.35.2"
|
75
86
|
|
76
87
|
# open a database
|
77
88
|
db = Extralite::Database.new('/tmp/my.db')
|
@@ -225,6 +236,12 @@ As those benchmarks show, Extralite is capabale of reading up to 3M rows/second
|
|
225
236
|
when fetching rows as arrays, and up to 2.6M rows/second when fetching
|
226
237
|
rows as hashes.
|
227
238
|
|
239
|
+
## License
|
240
|
+
|
241
|
+
The source code for Extralite is published under the [MIT license](LICENSE). The
|
242
|
+
source code for SQLite is in the [public
|
243
|
+
domain](https://sqlite.org/copyright.html).
|
244
|
+
|
228
245
|
## Contributing
|
229
246
|
|
230
247
|
Contributions in the form of issues, PRs or comments will be greatly
|
data/Rakefile
CHANGED
data/ext/extralite/extconf.rb
CHANGED
@@ -1,9 +1,115 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# require 'rubygems'
|
4
|
+
# require 'mkmf'
|
5
|
+
|
6
|
+
# # $CFLAGS << "-Wdiscarded-qualifier"
|
7
|
+
# # $CFLAGS << " -Wno-comment"
|
8
|
+
# # $CFLAGS << " -Wno-unused-result"
|
9
|
+
# # $CFLAGS << " -Wno-dangling-else"
|
10
|
+
# # $CFLAGS << " -Wno-parentheses"
|
11
|
+
|
12
|
+
# dir_config 'extralite_ext'
|
13
|
+
# create_makefile 'extralite_ext'
|
14
|
+
|
15
|
+
ENV['RC_ARCHS'] = '' if RUBY_PLATFORM =~ /darwin/
|
16
|
+
|
3
17
|
require 'mkmf'
|
4
18
|
|
5
|
-
|
6
|
-
|
19
|
+
# :stopdoc:
|
20
|
+
|
21
|
+
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
22
|
+
|
23
|
+
ldflags = cppflags = nil
|
24
|
+
if RbConfig::CONFIG["host_os"] =~ /darwin/
|
25
|
+
begin
|
26
|
+
if with_config('sqlcipher')
|
27
|
+
brew_prefix = `brew --prefix sqlcipher`.chomp
|
28
|
+
ldflags = "#{brew_prefix}/lib"
|
29
|
+
cppflags = "#{brew_prefix}/include/sqlcipher"
|
30
|
+
pkg_conf = "#{brew_prefix}/lib/pkgconfig"
|
31
|
+
else
|
32
|
+
brew_prefix = `brew --prefix sqlite3`.chomp
|
33
|
+
ldflags = "#{brew_prefix}/lib"
|
34
|
+
cppflags = "#{brew_prefix}/include"
|
35
|
+
pkg_conf = "#{brew_prefix}/lib/pkgconfig"
|
36
|
+
end
|
37
|
+
|
38
|
+
# pkg_config should be less error prone than parsing compiler
|
39
|
+
# commandline options, but we need to set default ldflags and cpp flags
|
40
|
+
# in case the user doesn't have pkg-config installed
|
41
|
+
ENV['PKG_CONFIG_PATH'] ||= pkg_conf
|
42
|
+
rescue
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
if with_config('sqlcipher')
|
47
|
+
pkg_config("sqlcipher")
|
48
|
+
else
|
49
|
+
pkg_config("sqlite3")
|
50
|
+
end
|
51
|
+
|
52
|
+
# --with-sqlite3-{dir,include,lib}
|
53
|
+
if with_config('sqlcipher')
|
54
|
+
$CFLAGS << ' -DUSING_SQLCIPHER'
|
55
|
+
dir_config("sqlcipher", cppflags, ldflags)
|
56
|
+
else
|
57
|
+
dir_config("sqlite3", cppflags, ldflags)
|
58
|
+
end
|
59
|
+
|
60
|
+
if RbConfig::CONFIG["host_os"] =~ /mswin/
|
61
|
+
$CFLAGS << ' -W3'
|
62
|
+
end
|
63
|
+
|
64
|
+
if RUBY_VERSION < '2.7'
|
65
|
+
$CFLAGS << ' -DTAINTING_SUPPORT'
|
66
|
+
end
|
67
|
+
|
68
|
+
def asplode missing
|
69
|
+
if RUBY_PLATFORM =~ /mingw|mswin/
|
70
|
+
abort "#{missing} is missing. Install SQLite3 from " +
|
71
|
+
"http://www.sqlite.org/ first."
|
72
|
+
else
|
73
|
+
abort <<-error
|
74
|
+
#{missing} is missing. Try 'brew install sqlite3',
|
75
|
+
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
|
76
|
+
and check your shared library search path (the
|
77
|
+
location where your sqlite3 shared library is located).
|
78
|
+
error
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
asplode('sqlite3.h') unless find_header 'sqlite3.h'
|
83
|
+
find_library 'pthread', 'pthread_create' # 1.8 support. *shrug*
|
84
|
+
|
85
|
+
have_library 'dl' # for static builds
|
86
|
+
|
87
|
+
if with_config('sqlcipher')
|
88
|
+
asplode('sqlcipher') unless find_library 'sqlcipher', 'sqlite3_libversion_number'
|
89
|
+
else
|
90
|
+
asplode('sqlite3') unless find_library 'sqlite3', 'sqlite3_libversion_number'
|
91
|
+
end
|
92
|
+
|
93
|
+
# Functions defined in 1.9 but not 1.8
|
94
|
+
have_func('rb_proc_arity')
|
95
|
+
|
96
|
+
# Functions defined in 2.1 but not 2.0
|
97
|
+
have_func('rb_integer_pack')
|
98
|
+
|
99
|
+
# These functions may not be defined
|
100
|
+
have_func('sqlite3_initialize')
|
101
|
+
have_func('sqlite3_enable_load_extension')
|
102
|
+
have_func('sqlite3_load_extension')
|
103
|
+
|
104
|
+
unless have_func('sqlite3_open_v2')
|
105
|
+
abort "Please use a newer version of SQLite3"
|
106
|
+
end
|
107
|
+
|
108
|
+
have_func('sqlite3_prepare_v2')
|
109
|
+
have_type('sqlite3_int64', 'sqlite3.h')
|
110
|
+
have_type('sqlite3_uint64', 'sqlite3.h')
|
111
|
+
|
112
|
+
$defs << "-DEXTRALITE_NO_BUNDLE"
|
7
113
|
|
8
114
|
dir_config('extralite_ext')
|
9
115
|
create_makefile('extralite_ext')
|
data/ext/extralite/extralite.h
CHANGED
File without changes
|
File without changes
|
data/extralite.gemspec
CHANGED
@@ -1,30 +1,8 @@
|
|
1
|
-
require_relative './
|
1
|
+
require_relative './gemspec'
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
+
common_spec(s)
|
4
5
|
s.name = 'extralite'
|
5
|
-
s.version = Extralite::VERSION
|
6
|
-
s.licenses = ['MIT']
|
7
6
|
s.summary = 'Extra-lightweight SQLite3 wrapper for Ruby'
|
8
|
-
s.
|
9
|
-
s.email = 'sharon@noteflakes.com'
|
10
|
-
s.files = `git ls-files`.split
|
11
|
-
s.homepage = 'https://github.com/digital-fabric/extralite'
|
12
|
-
s.metadata = {
|
13
|
-
"source_code_uri" => "https://github.com/digital-fabric/extralite",
|
14
|
-
"documentation_uri" => "https://www.rubydoc.info/gems/extralite",
|
15
|
-
"homepage_uri" => "https://github.com/digital-fabric/extralite",
|
16
|
-
"changelog_uri" => "https://github.com/digital-fabric/extralite/blob/master/CHANGELOG.md"
|
17
|
-
}
|
18
|
-
s.rdoc_options = ["--title", "extralite", "--main", "README.md"]
|
19
|
-
s.extra_rdoc_files = ["README.md"]
|
20
|
-
s.extensions = ["ext/extralite/extconf.rb"]
|
21
|
-
s.require_paths = ["lib"]
|
22
|
-
s.required_ruby_version = '>= 2.7'
|
23
|
-
|
24
|
-
s.add_development_dependency 'rake-compiler', '1.1.6'
|
25
|
-
s.add_development_dependency 'minitest', '5.15.0'
|
26
|
-
s.add_development_dependency 'simplecov', '0.17.1'
|
27
|
-
s.add_development_dependency 'yard', '0.9.27'
|
28
|
-
|
29
|
-
s.add_development_dependency 'sequel', '5.51.0'
|
7
|
+
s.extensions = ["ext/extralite/extconf.rb"]
|
30
8
|
end
|
data/gemspec.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative './lib/extralite/version'
|
2
|
+
|
3
|
+
def common_spec(s)
|
4
|
+
s.version = Extralite::VERSION
|
5
|
+
s.licenses = ['MIT']
|
6
|
+
s.author = 'Sharon Rosner'
|
7
|
+
s.email = 'sharon@noteflakes.com'
|
8
|
+
s.files = `git ls-files`.split
|
9
|
+
s.homepage = 'https://github.com/digital-fabric/extralite'
|
10
|
+
s.metadata = {
|
11
|
+
"source_code_uri" => "https://github.com/digital-fabric/extralite",
|
12
|
+
"documentation_uri" => "https://www.rubydoc.info/gems/extralite",
|
13
|
+
"homepage_uri" => "https://github.com/digital-fabric/extralite",
|
14
|
+
"changelog_uri" => "https://github.com/digital-fabric/extralite/blob/master/CHANGELOG.md"
|
15
|
+
}
|
16
|
+
s.rdoc_options = ["--title", "extralite", "--main", "README.md"]
|
17
|
+
s.extra_rdoc_files = ["README.md"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.required_ruby_version = '>= 2.7'
|
20
|
+
|
21
|
+
s.add_development_dependency 'rake-compiler', '1.1.6'
|
22
|
+
s.add_development_dependency 'minitest', '5.15.0'
|
23
|
+
s.add_development_dependency 'simplecov', '0.17.1'
|
24
|
+
s.add_development_dependency 'yard', '0.9.27'
|
25
|
+
s.add_development_dependency 'sequel', '5.51.0'
|
26
|
+
end
|
data/lib/extralite/version.rb
CHANGED
data/test/helper.rb
CHANGED
data/test/test_extralite.rb
CHANGED
@@ -3,12 +3,11 @@
|
|
3
3
|
require_relative 'helper'
|
4
4
|
|
5
5
|
class ExtraliteTest < MiniTest::Test
|
6
|
-
SQLITE3_C_PATH = File.expand_path('../ext/extralite/sqlite3.c', __dir__)
|
7
|
-
SQLITE_VERSION_DEFINE_REGEXP = /#define SQLITE_VERSION\s+"([\d\.]+)"/m.freeze
|
8
|
-
|
9
6
|
def test_sqlite3_version
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
reported = `sqlite3 --version` rescue ''
|
8
|
+
match = reported.match(/^([\d\.]+)/)
|
9
|
+
if match
|
10
|
+
assert_equal match[1], Extralite.sqlite3_version
|
11
|
+
end
|
13
12
|
end
|
14
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extralite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.14'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -101,13 +101,17 @@ files:
|
|
101
101
|
- bin/update_sqlite_source
|
102
102
|
- ext/extralite/common.c
|
103
103
|
- ext/extralite/database.c
|
104
|
+
- ext/extralite/extconf-bundle.rb
|
104
105
|
- ext/extralite/extconf.rb
|
105
106
|
- ext/extralite/extralite.h
|
106
107
|
- ext/extralite/extralite_ext.c
|
108
|
+
- ext/extralite/extralite_sqlite3.c
|
107
109
|
- ext/extralite/prepared_statement.c
|
108
|
-
- ext/
|
109
|
-
- ext/
|
110
|
+
- ext/sqlite3/sqlite3.c
|
111
|
+
- ext/sqlite3/sqlite3.h
|
112
|
+
- extralite-bundle.gemspec
|
110
113
|
- extralite.gemspec
|
114
|
+
- gemspec.rb
|
111
115
|
- lib/extralite.rb
|
112
116
|
- lib/extralite/version.rb
|
113
117
|
- lib/sequel/adapters/extralite.rb
|