sqlite3 1.5.0.rc1 → 1.5.0.rc2

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: 6ed713801ba79b79993138caebecbabd8e35d54a994815f322cbc4b8398b2ef2
4
- data.tar.gz: 653775fbf104ffd0eaaba5f9aa756a6c3c71bde33c1b9950b4d2d702cab6f685
3
+ metadata.gz: 3870b929ee6789561b453bf1bf32e961987daac368e906b04497cf048e599c46
4
+ data.tar.gz: 489f456707e21c72e128044d0b7f2f627cdf4d77afb7cddc389a236901999ff1
5
5
  SHA512:
6
- metadata.gz: a9754199a5d217d25a61195ee3a51b8a50d8e08fe6045826361206fcbb4fe48739fa097d6d9858dd559d138daad9bb3797fef50b74649203239c24d0c1e2cac7
7
- data.tar.gz: 30315a3532555df4928d5c8c91193d9fa8453fae671cdd135484b15205023fd4f44347f5ec32642818456ef5b9720fbf88b91fbf70c97e1e4ece6d6c45e92bb2
6
+ metadata.gz: 6a896073ed2fd4d00ad59b955e200c20b6a18b7f4297d715a2aecabb583a89ef61a12936ceae906a2b179f45c54ba833411d8d04d9960e2983b9b1782079c0b0
7
+ data.tar.gz: d08207f1bc69ee6bbfa17082c47bff82d4b3c67260bdcd25a6f1ba4fd3116e6a0b9e7f3206a05080a5f9c2432137121e99238b10f7fc302fc7b0ba409dfbf4da
data/CHANGELOG.md CHANGED
@@ -23,7 +23,7 @@ See [the README](https://github.com/sparklemotion/sqlite3-ruby#native-gems-recom
23
23
 
24
24
  #### More consistent developer experience
25
25
 
26
- Both the native (precompiled) gems and the vanilla "ruby platform" (source) gem include sqlite v3.39.0 by default.
26
+ Both the native (precompiled) gems and the vanilla "ruby platform" (source) gem include sqlite v3.39.2 by default.
27
27
 
28
28
  Defaulting to a consistent version of sqlite across all systems means that your development environment behaves exactly like your production environment, and you have access to the latest and greatest features of sqlite.
29
29
 
@@ -36,6 +36,7 @@ You can opt-out of the packaged version of sqlite (and use your system-installed
36
36
 
37
37
  * TruffleRuby is supported.
38
38
  * Apple Silicon is supported (M1, arm64-darwin).
39
+ * vcpkg system libraries supported. [#332] (Thanks, @MSP-Greg!)
39
40
 
40
41
 
41
42
  ### Added
@@ -43,6 +44,11 @@ You can opt-out of the packaged version of sqlite (and use your system-installed
43
44
  * `SQLite3::SQLITE_LOADED_VERSION` contains the version string of the sqlite3 library that is dynamically loaded (compare to `SQLite3::SQLITE_VERSION` which is the version at compile-time).
44
45
 
45
46
 
47
+ ### Fixed
48
+
49
+ * `SQLite3::Database#load_extensions` now raises a `TypeError` unless a String is passed as the file path. Previously it was possible to pass a non-string and cause a segfault. [#339]
50
+
51
+
46
52
  ## 1.4.4 / 2022-06-14
47
53
 
48
54
  ### Fixes
@@ -31,7 +31,7 @@ static char *
31
31
  utf16_string_value_ptr(VALUE str)
32
32
  {
33
33
  StringValue(str);
34
- rb_str_buf_cat(str, "\x00", 1L);
34
+ rb_str_buf_cat(str, "\x00\x00", 2L);
35
35
  return RSTRING_PTR(str);
36
36
  }
37
37
 
@@ -603,7 +603,7 @@ static VALUE load_extension(VALUE self, VALUE file)
603
603
  Data_Get_Struct(self, sqlite3Ruby, ctx);
604
604
  REQUIRE_OPEN_DB(ctx);
605
605
 
606
- status = sqlite3_load_extension(ctx->db, RSTRING_PTR(file), 0, &errMsg);
606
+ status = sqlite3_load_extension(ctx->db, StringValuePtr(file), 0, &errMsg);
607
607
  if (status != SQLITE_OK)
608
608
  {
609
609
  errexp = rb_exc_new2(rb_eRuntimeError, errMsg);
@@ -36,19 +36,26 @@ module Sqlite3
36
36
  end
37
37
 
38
38
  def sqlcipher?
39
- with_config("sqlcipher")
39
+ with_config("sqlcipher") ||
40
+ with_config("sqlcipher-dir") ||
41
+ with_config("sqlcipher-include") ||
42
+ with_config("sqlcipher-lib")
40
43
  end
41
44
 
42
45
  def configure_system_libraries
43
46
  pkg_config(libname)
44
- append_cflags("-DUSING_SQLCIPHER") if sqlcipher?
47
+ append_cppflags("-DUSING_SQLCIPHER") if sqlcipher?
45
48
  end
46
49
 
47
50
  def configure_packaged_libraries
48
51
  minimal_recipe.tap do |recipe|
49
52
  recipe.configure_options += ["--enable-shared=no", "--enable-static=yes"]
50
53
  ENV.to_h.tap do |env|
51
- env["CFLAGS"] = [env["CFLAGS"], "-fPIC"].join(" ") # needed for linking the static library into a shared library
54
+ additional_cflags = [
55
+ "-fPIC", # needed for linking the static library into a shared library
56
+ "-O2", # see https://github.com/sparklemotion/sqlite3-ruby/issues/335 for some benchmarks
57
+ ]
58
+ env["CFLAGS"] = [env["CFLAGS"], additional_cflags].flatten.join(" ")
52
59
  recipe.configure_options += env.select { |k,v| ENV_ALLOWLIST.include?(k) }
53
60
  .map { |key, value| "#{key}=#{value.strip}" }
54
61
  end
@@ -72,10 +79,17 @@ module Sqlite3
72
79
 
73
80
  def configure_extension
74
81
  if Gem::Requirement.new("< 2.7").satisfied_by?(Gem::Version.new(RUBY_VERSION))
75
- append_cflags("-DTAINTING_SUPPORT")
82
+ append_cppflags("-DTAINTING_SUPPORT")
83
+ end
84
+
85
+ if find_header("sqlite3.h")
86
+ # noop
87
+ elsif sqlcipher? && find_header("sqlcipher/sqlite3.h")
88
+ append_cppflags("-DUSING_SQLCIPHER_INC_SUBDIR")
89
+ else
90
+ abort_could_not_find("sqlite3.h")
76
91
  end
77
92
 
78
- abort_could_not_find("sqlite3.h") unless find_header("sqlite3.h")
79
93
  abort_could_not_find(libname) unless find_library(libname, "sqlite3_libversion_number", "sqlite3.h")
80
94
 
81
95
  # Functions defined in 1.9 but not 1.8
@@ -121,16 +135,16 @@ module Sqlite3
121
135
  sqlite3: {
122
136
  # checksum verified by first checking the published sha3(256) checksum:
123
137
  #
124
- # $ sha3sum -a 256 sqlite-autoconf-3390000.tar.gz
125
- # b8e5b3265992350d40c4ad31efc2e6dec6256813f1d5acc8f0ea805e9f33ca2a sqlite-autoconf-3390000.tar.gz
138
+ # $ sha3sum -a 256 ports/archives/sqlite-autoconf-3390200.tar.gz
139
+ # b195891eb32305481e61c6718b8cc3b090685b613c4824a076c63166a46c5bee ports/archives/sqlite-autoconf-3390200.tar.gz
126
140
  #
127
- # $ sha256sum sqlite-autoconf-3390000.tar.gz
128
- # e90bcaef6dd5813fcdee4e867f6b65f3c9bfd0aec0f1017f9f3bbce1e4ed09e2 sqlite-autoconf-3390000.tar.gz
141
+ # $ sha256sum ports/archives/sqlite-autoconf-3390200.tar.gz
142
+ # 852be8a6183a17ba47cee0bbff7400b7aa5affd283bf3beefc34fcd088a239de ports/archives/sqlite-autoconf-3390200.tar.gz
129
143
  #
130
- version: "3.39.0",
144
+ version: "3.39.2",
131
145
  files: [{
132
- url: "https://www.sqlite.org/2022/sqlite-autoconf-3390000.tar.gz",
133
- sha256: "e90bcaef6dd5813fcdee4e867f6b65f3c9bfd0aec0f1017f9f3bbce1e4ed09e2",
146
+ url: "https://www.sqlite.org/2022/sqlite-autoconf-3390200.tar.gz",
147
+ sha256: "852be8a6183a17ba47cee0bbff7400b7aa5affd283bf3beefc34fcd088a239de",
134
148
  }],
135
149
  }
136
150
  }
@@ -147,10 +161,89 @@ module Sqlite3
147
161
  def download
148
162
  minimal_recipe.download
149
163
  end
164
+
165
+ def print_help
166
+ print(<<~TEXT)
167
+ USAGE: ruby #{$PROGRAM_NAME} [options]
168
+
169
+ Flags that are always valid:
170
+
171
+ --disable-system-libraries
172
+ Use the packaged libraries, and ignore the system libraries.
173
+ (This is the default behavior.)
174
+
175
+ --enable-system-libraries
176
+ Use system libraries instead of building and using the packaged libraries.
177
+
178
+ --with-sqlcipher
179
+ Use libsqlcipher instead of libsqlite3.
180
+ (Implies `--enable-system-libraries`.)
181
+
182
+ --help
183
+ Display this message.
184
+
185
+
186
+ Flags only used when using system libraries:
187
+
188
+ General (applying to all system libraries):
189
+
190
+ --with-opt-dir=DIRECTORY
191
+ Look for headers and libraries in DIRECTORY.
192
+
193
+ --with-opt-lib=DIRECTORY
194
+ Look for libraries in DIRECTORY.
195
+
196
+ --with-opt-include=DIRECTORY
197
+ Look for headers in DIRECTORY.
198
+
199
+ Related to sqlcipher:
200
+
201
+ --with-sqlcipher-dir=DIRECTORY
202
+ Look for sqlcipher headers and library in DIRECTORY.
203
+ (Implies `--with-sqlcipher` and `--enable-system-libraries`.)
204
+
205
+ --with-sqlcipher-lib=DIRECTORY
206
+ Look for sqlcipher library in DIRECTORY.
207
+ (Implies `--with-sqlcipher` and `--enable-system-libraries`.)
208
+
209
+ --with-sqlcipher-include=DIRECTORY
210
+ Look for sqlcipher headers in DIRECTORY.
211
+ (Implies `--with-sqlcipher` and `--enable-system-libraries`.)
212
+
213
+
214
+ Flags only used when building and using the packaged libraries:
215
+
216
+ --enable-cross-build
217
+ Enable cross-build mode. (You probably do not want to set this manually.)
218
+
219
+
220
+ Environment variables used for compiling the C extension:
221
+
222
+ CC
223
+ Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`
224
+
225
+
226
+ Environment variables passed through to the compilation of packaged libraries:
227
+
228
+ CC
229
+ CPPFLAGS
230
+ CFLAGS
231
+ LDFLAGS
232
+ LIBS
233
+ LT_SYS_LIBRARY_PATH
234
+ CPP
235
+
236
+ TEXT
237
+ end
150
238
  end
151
239
  end
152
240
  end
153
241
 
242
+ if arg_config("--help")
243
+ Sqlite3::ExtConf.print_help
244
+ exit!(0)
245
+ end
246
+
154
247
  if arg_config("--download-dependencies")
155
248
  Sqlite3::ExtConf.download
156
249
  exit!(0)
@@ -21,8 +21,11 @@
21
21
  #define SQLITE3_UTF8_STR_NEW2(_obj) \
22
22
  (rb_enc_associate_index(rb_str_new2(_obj), rb_utf8_encindex()))
23
23
 
24
-
25
- #include <sqlite3.h>
24
+ #ifdef USING_SQLCIPHER_INC_SUBDIR
25
+ # include <sqlcipher/sqlite3.h>
26
+ #else
27
+ # include <sqlite3.h>
28
+ #endif
26
29
 
27
30
  #ifndef HAVE_TYPE_SQLITE3_INT64
28
31
  typedef sqlite_int64 sqlite3_int64;
@@ -1,13 +1,13 @@
1
1
  module SQLite3
2
2
 
3
- VERSION = "1.5.0.rc1"
3
+ VERSION = "1.5.0.rc2"
4
4
 
5
5
  module VersionProxy
6
6
 
7
7
  MAJOR = 1
8
8
  MINOR = 5
9
9
  TINY = 0
10
- BUILD = "rc1"
10
+ BUILD = "rc2"
11
11
 
12
12
  STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." )
13
13
  #:beta-tag:
@@ -534,5 +534,12 @@ module SQLite3
534
534
  end
535
535
  assert_includes error.message, "no such column: nope"
536
536
  end
537
+
538
+ def test_load_extension_with_nonstring_argument
539
+ db = SQLite3::Database.new(':memory:')
540
+ skip("extensions are not enabled") unless db.respond_to?(:load_extension)
541
+ assert_raises(TypeError) { db.load_extension(1) }
542
+ assert_raises(TypeError) { db.load_extension(Pathname.new("foo.so")) }
543
+ end
537
544
  end
538
545
  end
data/test/test_sqlite3.rb CHANGED
@@ -19,7 +19,12 @@ module SQLite3
19
19
  end
20
20
 
21
21
  def test_version_strings
22
+ skip if SQLite3::VERSION.include?("test") # see set-version-to-timestamp rake task
22
23
  assert_equal(SQLite3::VERSION, SQLite3::VersionProxy::STRING)
23
24
  end
25
+
26
+ def test_compiled_version_and_loaded_version
27
+ assert_equal(SQLite3::SQLITE_VERSION, SQLite3::SQLITE_LOADED_VERSION)
28
+ end
24
29
  end
25
30
  end
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: 1.5.0.rc1
4
+ version: 1.5.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-07-05 00:00:00.000000000 Z
13
+ date: 2022-08-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mini_portile2