extralite 1.11 → 1.12

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: d88bd81eca07e148be1f8d5b07d24c0aab49b32a9dc9aeb4a9ea5a74cf769491
4
- data.tar.gz: 9f5d55a8cd4a58e2026ca3e850d48c28d86878e191e91fb92e59c76335a64484
3
+ metadata.gz: ed6cb05e12c36bbbc92701af98639a9a92b91d9ba0fca0362b35fb12f3af676e
4
+ data.tar.gz: 6d7976fc5b39aa414a5a3431a9c5a1a6c517166d4e82de621b22da3be50fe38b
5
5
  SHA512:
6
- metadata.gz: cca614a4e3ffde8ff56ef3e8394f85f4a57d37f8615f2f144a9a39f84d50e51dd015348da7f93340326b40ff4b16202ec21bc03f23edacf678c03f57d0955974
7
- data.tar.gz: 2e9f9c9091ac99fa96c3562fdb1e49642b2961ee682c30d98f8babd95b8366d9c96019df7185c5ef493b330f6c32066be6868398dcdb123c4607e9ab4875462b
6
+ metadata.gz: 9baa147f13fa4498264e6e942e9c154bcdcd458f503944be9385f5ea61b82a8e6d381f77a75ad7a4c7643aa124cc2a4d5aa8ffb58400efa641dcb62fad810437
7
+ data.tar.gz: 789d203582c86f54a8f234b67d7b54b03150b900d25a5c76e81a57d779d1735fa7a8dc9822d121df7d08af4513481bf4c0a1a6d2fb1d6dfc54d80022b2b6e559
@@ -8,7 +8,7 @@ jobs:
8
8
  fail-fast: false
9
9
  matrix:
10
10
  os: [ubuntu-latest, macos-10.15]
11
- ruby: [2.6, 2.7, '3.0']
11
+ ruby: [2.7, 3.0, 3.1, truffleruby]
12
12
 
13
13
  name: >-
14
14
  ${{matrix.os}}, ${{matrix.ruby}}
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.12 2022-02-15
2
+
3
+ - Add `Extralite.sqlite3_version` method
4
+ - Bundle sqlite3 in gem
5
+
1
6
  ## 1.11 2021-12-17
2
7
 
3
8
  - Fix compilation on MacOS (#3)
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- extralite (1.11)
4
+ extralite (1.12)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  docile (1.4.0)
10
- json (2.5.1)
10
+ json (2.6.1)
11
11
  minitest (5.15.0)
12
12
  rake (13.0.6)
13
13
  rake-compiler (1.1.6)
@@ -34,4 +34,4 @@ DEPENDENCIES
34
34
  yard (= 0.9.27)
35
35
 
36
36
  BUNDLED WITH
37
- 2.1.4
37
+ 2.3.3
data/README.md CHANGED
@@ -29,6 +29,8 @@ interacting with an SQLite3 database.
29
29
 
30
30
  ## Features
31
31
 
32
+ - Zero dependencies: Extralite bundles SQLite3 version 3.37.2 - no need to
33
+ install any `libsqlite3` packages.
32
34
  - A variety of methods for different data access patterns: rows as hashes, rows
33
35
  as arrays, single row, single column, single value.
34
36
  - Super fast - [up to 12.5x faster](#performance) than the
@@ -45,13 +47,16 @@ interacting with an SQLite3 database.
45
47
  - Get number of rows changed by last query.
46
48
  - Load extensions (loading of extensions is autmatically enabled. You can find
47
49
  some useful extensions here: https://github.com/nalgeon/sqlean.)
48
- - Includes a [Sequel adapter](#usage-with-sequel) (an ActiveRecord)
50
+ - Includes a [Sequel adapter](#usage-with-sequel).
49
51
 
50
52
  ## Usage
51
53
 
52
54
  ```ruby
53
55
  require 'extralite'
54
56
 
57
+ # get sqlite3 version
58
+ Extralite.sqlite3_version #=> "3.37.2"
59
+
55
60
  # open a database
56
61
  db = Extralite::Database.new('/tmp/my.db')
57
62
 
@@ -113,7 +118,7 @@ Extralite includes an adapter for
113
118
  just use the `extralite` scheme instead of `sqlite`:
114
119
 
115
120
  ```ruby
116
- DB = Sequel.connect('extralite:blog.db')
121
+ DB = Sequel.connect('extralite://blog.db')
117
122
  articles = DB[:articles]
118
123
  p articles.to_a
119
124
  ```
@@ -137,6 +142,7 @@ Here's a table summarizing the differences between the two gems:
137
142
 
138
143
  | |sqlite3-ruby|Extralite|
139
144
  |-|-|-|
145
+ |SQLite3 dependency|depends on OS-installed libsqlite3|bundles latest version of SQLite3|
140
146
  |API design|multiple classes|single class|
141
147
  |Query results|row as hash, row as array, single row, single value|row as hash, row as array, __single column__, single row, single value|
142
148
  |execute multiple statements|separate API (#execute_batch)|integrated|
@@ -1,115 +1,9 @@
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
-
17
3
  require 'mkmf'
18
4
 
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_backup_init')
102
- have_func('sqlite3_column_database_name')
103
- have_func('sqlite3_enable_load_extension')
104
- have_func('sqlite3_load_extension')
105
-
106
- unless have_func('sqlite3_open_v2')
107
- abort "Please use a newer version of SQLite3"
108
- end
109
-
110
- have_func('sqlite3_prepare_v2')
111
- have_type('sqlite3_int64', 'sqlite3.h')
112
- have_type('sqlite3_uint64', 'sqlite3.h')
5
+ $CFLAGS << " -Wno-undef"
6
+ $CFLAGS << " -Wno-discarded-qualifiers"
113
7
 
114
8
  dir_config('extralite_ext')
115
- create_makefile('extralite_ext')
9
+ create_makefile('extralite_ext')
@@ -51,6 +51,15 @@ static VALUE Database_allocate(VALUE klass) {
51
51
  } \
52
52
  }
53
53
 
54
+ /* call-seq: sqlite3_version
55
+ *
56
+ * Returns the sqlite3 version used by Extralite.
57
+ */
58
+
59
+ VALUE Extralite_sqlite3_version(VALUE self) {
60
+ return rb_str_new_cstr(sqlite3_version);
61
+ }
62
+
54
63
  /* call-seq: initialize(path)
55
64
  *
56
65
  * Initializes a new SQLite database with the given path.
@@ -658,6 +667,8 @@ VALUE Database_load_extension(VALUE self, VALUE path) {
658
667
 
659
668
  void Init_Extralite() {
660
669
  VALUE mExtralite = rb_define_module("Extralite");
670
+ rb_define_singleton_method(mExtralite, "sqlite3_version", Extralite_sqlite3_version, 0);
671
+
661
672
  VALUE cDatabase = rb_define_class_under(mExtralite, "Database", rb_cObject);
662
673
  rb_define_alloc_func(cDatabase, Database_allocate);
663
674