sqlite3 1.4.1 → 1.4.4

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: 4e623044cbeb457ce05dd65a38cd36f3470bf42d194db814582c5e6914550358
4
- data.tar.gz: a80ca4968643d496ddb4e8b14f509a45c0767e50545e8bf3fec7f953b61ddb8f
3
+ metadata.gz: ca0eaf6464e1b4511b2de2dd6c49b0dd5cb9d38b02783f7c6eb6478e2e0451e2
4
+ data.tar.gz: ff8a6c67d814961cbce231dc17f4aaa9ca88337422bfe19cb0c6252448a31939
5
5
  SHA512:
6
- metadata.gz: b040bd12646223baabee60c3a79488f12c9697a7561f948245b2c058d2c115270522d2acddf5770a965b0cf1df81c711b3a8a5fde0ad1975e7958bbf1299fa4b
7
- data.tar.gz: 6c24d5561f646245cfeaa3fe17936d33d1bfbcee3d8428102e47c2c9beae2dbcd5be0755197e43accdcd01ecdc8f6cdcab9ae553c87ca8c3bf6507e3afdf1623
6
+ metadata.gz: 63219833df3802f61631a9e42678af579daa22fdaf1dcac4ab636f538567835403ae9f98db534308a72778ef71aa8bce63c7d4d9f388adbbacdef00f80aa8d1f
7
+ data.tar.gz: 8d83cb828a3cd12f9cb5e85c6d6229c6bf08c2633afb7e3e9468cfe8f3a144f5621019fb488b83f077a8a62e816aaa7bc4458cac81d2332ddd3d27feabf335ed
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,30 @@
1
+ === 1.4.4 (2022-06-14)
2
+
3
+ * Fixes
4
+ * Compilation no longer fails against SQLite3 versions < 3.29.0. This issue was introduced in v1.4.3. [#324] (Thank you, @r6e!)
5
+
6
+
7
+ === 1.4.3 (2022-05-25)
8
+
9
+ * Enhancements
10
+ * Disable non-standard support for double-quoted string literals via the `:strict` option. [#317] (Thank you, @casperisfine!)
11
+ * Column type names are now explicitly downcased on platforms where they may have been in shoutcaps. [#315] (Thank you, @petergoldstein!)
12
+ * Support File or Pathname arguments to `Database.new`. [#283] (Thank you, @yb66!)
13
+ * Support building on MSVC. [#285] (Thank you, @jmarrec!)
14
+
15
+
16
+ === 1.4.2 (2019-12-18)
17
+
18
+ * Travis: Drop unused setting "sudo: false"
19
+ * The taint mechanism will be deprecated in Ruby 2.7
20
+ * Fix Ruby 2.7 rb_check_safe_obj warnings
21
+ * Update travis config
22
+
23
+ === 1.4.1
24
+
25
+ * Don't mandate dl functions for the extention build
26
+ * bumping version
27
+
1
28
  === 1.4.0
2
29
 
3
30
  * Enhancements
@@ -122,7 +149,7 @@
122
149
  installed anymore
123
150
 
124
151
  * Bugfixes
125
- * Backup API is conditionaly required so that older libsqlite3 can be used.
152
+ * Backup API is conditionally required so that older libsqlite3 can be used.
126
153
  Thanks Hongli Lai.
127
154
  * Fixed segmentation fault when nil is passed to SQLite3::Statement.new
128
155
  * Fix extconf's hardcoded path that affected installation on certain systems.
data/Gemfile CHANGED
@@ -8,10 +8,13 @@ source "https://rubygems.org/"
8
8
  gem "minitest", "~>5.11", :group => [:development, :test]
9
9
  gem "rake-compiler", "~>1.0", :group => [:development, :test]
10
10
  gem "rake-compiler-dock", "~>0.6.0", :group => [:development, :test]
11
- gem "mini_portile", "~>0.6.2", :group => [:development, :test]
11
+ gem "mini_portile2", "~>2.0", :group => [:development, :test]
12
12
  gem "hoe-bundler", "~>1.0", :group => [:development, :test]
13
13
  gem "hoe-gemspec", "~>1.0", :group => [:development, :test]
14
14
  gem "rdoc", ">=4.0", "<6", :group => [:development, :test]
15
- gem "hoe", "~>3.17", :group => [:development, :test]
15
+
16
+ # hoe versions >= 3.19.0 are incompatible with Ruby 2.0 and earlier,
17
+ # but the gemspec does not indicate so...
18
+ gem "hoe", (RUBY_VERSION < "2.1" ? "3.18.1" : "~>3.20"), :group => [:development, :test]
16
19
 
17
20
  # vim: syntax=ruby
data/Manifest.txt CHANGED
@@ -1,5 +1,4 @@
1
1
  .gemtest
2
- .travis.yml
3
2
  API_CHANGES.rdoc
4
3
  CHANGELOG.rdoc
5
4
  ChangeLog.cvs
data/README.rdoc CHANGED
@@ -5,7 +5,7 @@
5
5
  * http://rubygems.org/gems/sqlite3
6
6
  * http://www.rubydoc.info/gems/sqlite3/frames
7
7
 
8
- {<img src="https://travis-ci.org/sparklemotion/sqlite3-ruby.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/sparklemotion/sqlite3-ruby]
8
+ {<img src="https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/sqlite3-ruby.yml/badge.svg" alt="Build Status" />}[https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/sqlite3-ruby.yml]
9
9
 
10
10
  == DESCRIPTION
11
11
 
@@ -66,7 +66,7 @@ Note that this module is only compatible with SQLite 3.6.16 or newer.
66
66
  == Compilation and Installation
67
67
 
68
68
  Install SQLite3, enabling the option SQLITE_ENABLE_COLUMN_METADATA (see
69
- www.sqlite.org/compile.html for details).
69
+ {www.sqlite.org/compile.html}[https://www.sqlite.org/compile.html] for details).
70
70
 
71
71
  Then do the following:
72
72
 
@@ -10,13 +10,13 @@
10
10
  * in-flight for this aggregator. */
11
11
  static VALUE cAggregatorWrapper;
12
12
 
13
- /* wraps a intance of the "handler" class. Loses its reference at the end of
13
+ /* wraps a instance of the "handler" class. Loses its reference at the end of
14
14
  * the xFinal callback.
15
15
  *
16
- * An AggregatorInstance holds the following instnace variables:
16
+ * An AggregatorInstance holds the following instance variables:
17
17
  * -handler_instance: the instance to call `step` and `finalize` on.
18
18
  * -exc_status: status returned by rb_protect.
19
- * != 0 if an exception occurred. If an exception occured
19
+ * != 0 if an exception occurred. If an exception occurred
20
20
  * `step` and `finalize` won't be called any more. */
21
21
  static VALUE cAggregatorInstance;
22
22
 
@@ -48,7 +48,7 @@ rb_sqlite3_protected_funcall(VALUE self, ID method, int argc, VALUE *params,
48
48
  }
49
49
 
50
50
  /* called in rb_sqlite3_aggregator_step and rb_sqlite3_aggregator_final. It
51
- * checks if the exection context already has an associated instance. If it
51
+ * checks if the execution context already has an associated instance. If it
52
52
  * has one, it returns it. If there is no instance yet, it creates one and
53
53
  * associates it with the context. */
54
54
  static VALUE
@@ -165,8 +165,8 @@ rb_sqlite3_aggregator_final(sqlite3_context * ctx)
165
165
  if (exc_status) {
166
166
  /* the user should never see this, as Statement.step() will pick up the
167
167
  * outstanding exception and raise it instead of generating a new one
168
- * for SQLITE_ERROR with message "Ruby Exception occured" */
169
- sqlite3_result_error(ctx, "Ruby Exception occured", -1);
168
+ * for SQLITE_ERROR with message "Ruby Exception occurred" */
169
+ sqlite3_result_error(ctx, "Ruby Exception occurred", -1);
170
170
  }
171
171
 
172
172
  rb_sqlite3_aggregate_instance_destroy(ctx);
@@ -1,6 +1,11 @@
1
1
  #include <sqlite3_ruby.h>
2
2
  #include <aggregator.h>
3
3
 
4
+ #if _MSC_VER
5
+ #pragma warning( push )
6
+ #pragma warning( disable : 4028 )
7
+ #endif
8
+
4
9
  #define REQUIRE_OPEN_DB(_ctxt) \
5
10
  if(!_ctxt->db) \
6
11
  rb_raise(rb_path2class("SQLite3::Exception"), "cannot use a closed database");
@@ -40,11 +45,13 @@ static VALUE rb_sqlite3_open_v2(VALUE self, VALUE file, VALUE mode, VALUE zvfs)
40
45
 
41
46
  Data_Get_Struct(self, sqlite3Ruby, ctx);
42
47
 
48
+ #if defined TAINTING_SUPPORT
43
49
  #if defined StringValueCStr
44
50
  StringValuePtr(file);
45
51
  rb_check_safe_obj(file);
46
52
  #else
47
53
  Check_SafeStr(file);
54
+ #endif
48
55
  #endif
49
56
 
50
57
  status = sqlite3_open_v2(
@@ -59,6 +66,23 @@ static VALUE rb_sqlite3_open_v2(VALUE self, VALUE file, VALUE mode, VALUE zvfs)
59
66
  return self;
60
67
  }
61
68
 
69
+ static VALUE rb_sqlite3_disable_quirk_mode(VALUE self)
70
+ {
71
+ #if defined SQLITE_DBCONFIG_DQS_DDL
72
+ sqlite3RubyPtr ctx;
73
+ Data_Get_Struct(self, sqlite3Ruby, ctx);
74
+
75
+ if(!ctx->db) return Qfalse;
76
+
77
+ sqlite3_db_config(ctx->db, SQLITE_DBCONFIG_DQS_DDL, 0, (void*)0);
78
+ sqlite3_db_config(ctx->db, SQLITE_DBCONFIG_DQS_DML, 0, (void*)0);
79
+
80
+ return Qtrue;
81
+ #else
82
+ return Qfalse;
83
+ #endif
84
+ }
85
+
62
86
  /* call-seq: db.close
63
87
  *
64
88
  * Closes this database.
@@ -213,16 +237,16 @@ VALUE sqlite3val2rb(sqlite3_value * val)
213
237
  return rb_float_new(sqlite3_value_double(val));
214
238
  break;
215
239
  case SQLITE_TEXT:
216
- return rb_tainted_str_new2((const char *)sqlite3_value_text(val));
240
+ return rb_str_new2((const char *)sqlite3_value_text(val));
217
241
  break;
218
242
  case SQLITE_BLOB: {
219
243
  /* Sqlite warns calling sqlite3_value_bytes may invalidate pointer from sqlite3_value_blob,
220
244
  so we explicitly get the length before getting blob pointer.
221
- Note that rb_str_new and rb_tainted_str_new apparently create string with ASCII-8BIT (BINARY) encoding,
245
+ Note that rb_str_new apparently create string with ASCII-8BIT (BINARY) encoding,
222
246
  which is what we want, as blobs are binary
223
247
  */
224
248
  int len = sqlite3_value_bytes(val);
225
- return rb_tainted_str_new((const char *)sqlite3_value_blob(val), len);
249
+ return rb_str_new((const char *)sqlite3_value_blob(val), len);
226
250
  break;
227
251
  }
228
252
  case SQLITE_NULL:
@@ -703,7 +727,7 @@ static int regular_callback_function(VALUE callback_ary, int count, char **data,
703
727
 
704
728
  /* Is invoked by calling db.execute_batch2(sql, &block)
705
729
  *
706
- * Executes all statments in a given string separated by semicolons.
730
+ * Executes all statements in a given string separated by semicolons.
707
731
  * If a query is made, all values returned are strings
708
732
  * (except for 'NULL' values which return nil),
709
733
  * so the user may parse values with a block.
@@ -761,11 +785,13 @@ static VALUE rb_sqlite3_open16(VALUE self, VALUE file)
761
785
 
762
786
  Data_Get_Struct(self, sqlite3Ruby, ctx);
763
787
 
788
+ #if defined TAINTING_SUPPORT
764
789
  #if defined StringValueCStr
765
790
  StringValuePtr(file);
766
791
  rb_check_safe_obj(file);
767
792
  #else
768
793
  Check_SafeStr(file);
794
+ #endif
769
795
  #endif
770
796
 
771
797
  status = sqlite3_open16(utf16_string_value_ptr(file), &ctx->db);
@@ -796,6 +822,7 @@ void init_sqlite3_database()
796
822
  /* public "define_aggregator" is now a shim around define_aggregator2
797
823
  * implemented in Ruby */
798
824
  rb_define_private_method(cSqlite3Database, "define_aggregator2", rb_sqlite3_define_aggregator2, 2);
825
+ rb_define_private_method(cSqlite3Database, "disable_quirk_mode", rb_sqlite3_disable_quirk_mode, 0);
799
826
  rb_define_method(cSqlite3Database, "interrupt", interrupt, 0);
800
827
  rb_define_method(cSqlite3Database, "errmsg", errmsg, 0);
801
828
  rb_define_method(cSqlite3Database, "errcode", errcode_, 0);
@@ -821,3 +848,7 @@ void init_sqlite3_database()
821
848
 
822
849
  rb_sqlite3_aggregator_init();
823
850
  }
851
+
852
+ #if _MSC_VER
853
+ #pragma warning( pop )
854
+ #endif
@@ -47,6 +47,10 @@ if RbConfig::CONFIG["host_os"] =~ /mswin/
47
47
  $CFLAGS << ' -W3'
48
48
  end
49
49
 
50
+ if RUBY_VERSION < '2.7'
51
+ $CFLAGS << ' -DTAINTING_SUPPORT'
52
+ end
53
+
50
54
  def asplode missing
51
55
  if RUBY_PLATFORM =~ /mingw|mswin/
52
56
  abort "#{missing} is missing. Install SQLite3 from " +
@@ -151,7 +151,7 @@ static VALUE step(VALUE self)
151
151
  break;
152
152
  case SQLITE_TEXT:
153
153
  {
154
- VALUE str = rb_tainted_str_new(
154
+ VALUE str = rb_str_new(
155
155
  (const char *)sqlite3_column_text(stmt, i),
156
156
  (long)sqlite3_column_bytes(stmt, i)
157
157
  );
@@ -163,7 +163,7 @@ static VALUE step(VALUE self)
163
163
  break;
164
164
  case SQLITE_BLOB:
165
165
  {
166
- VALUE str = rb_tainted_str_new(
166
+ VALUE str = rb_str_new(
167
167
  (const char *)sqlite3_column_blob(stmt, i),
168
168
  (long)sqlite3_column_bytes(stmt, i)
169
169
  );
@@ -290,7 +290,7 @@ static VALUE bind_param(VALUE self, VALUE key, VALUE value)
290
290
  /* call-seq: stmt.reset!
291
291
  *
292
292
  * Resets the statement. This is typically done internally, though it might
293
- * occassionally be necessary to manually reset the statement.
293
+ * occasionally be necessary to manually reset the statement.
294
294
  */
295
295
  static VALUE reset_bang(VALUE self)
296
296
  {
@@ -309,7 +309,7 @@ static VALUE reset_bang(VALUE self)
309
309
  /* call-seq: stmt.clear_bindings!
310
310
  *
311
311
  * Resets the statement. This is typically done internally, though it might
312
- * occassionally be necessary to manually reset the statement.
312
+ * occasionally be necessary to manually reset the statement.
313
313
  */
314
314
  static VALUE clear_bindings_bang(VALUE self)
315
315
  {
data/faq/faq.yml CHANGED
@@ -128,7 +128,7 @@
128
128
  Where _n_ is an integer, and _word_ is an alpha-numeric identifier (or
129
129
  number). When the placeholder is associated with a number, that number
130
130
  identifies the index of the bind variable to replace it with. When it
131
- is an identifier, it identifies the name of the correponding bind
131
+ is an identifier, it identifies the name of the corresponding bind
132
132
  variable. (In the instance of the first format--a single question
133
133
  mark--the placeholder is assigned a number one greater than the last
134
134
  index used, or 1 if it is the first.)
@@ -37,7 +37,7 @@ module SQLite3 ; module Constants
37
37
  EMPTY = 16 # (Internal Only) Database table is empty
38
38
  SCHEMA = 17 # The database schema changed
39
39
  TOOBIG = 18 # Too much data for one row of a table
40
- CONSTRAINT = 19 # Abort due to contraint violation
40
+ CONSTRAINT = 19 # Abort due to constraint violation
41
41
  MISMATCH = 20 # Data type mismatch
42
42
  MISUSE = 21 # Library used incorrectly
43
43
  NOLFS = 22 # Uses OS features not supported on host
@@ -65,6 +65,7 @@ module SQLite3
65
65
  def initialize file, options = {}, zvfs = nil
66
66
  mode = Constants::Open::READWRITE | Constants::Open::CREATE
67
67
 
68
+ file = file.to_path if file.respond_to? :to_path
68
69
  if file.encoding == ::Encoding::UTF_16LE || file.encoding == ::Encoding::UTF_16BE || options[:utf16]
69
70
  open16 file
70
71
  else
@@ -87,6 +88,10 @@ module SQLite3
87
88
  end
88
89
 
89
90
  open_v2 file.encode("utf-8"), mode, zvfs
91
+
92
+ if options[:strict]
93
+ disable_quirk_mode
94
+ end
90
95
  end
91
96
 
92
97
  @tracefunc = nil
@@ -237,7 +242,7 @@ Support for bind parameters as *args will be removed in 2.0.0.
237
242
  # rows.
238
243
  #
239
244
  # See also #execute_batch2 for additional ways of
240
- # executing statments.
245
+ # executing statements.
241
246
  def execute_batch( sql, bind_vars = [], *args )
242
247
  # FIXME: remove this stuff later
243
248
  unless [Array, Hash].include?(bind_vars.class)
@@ -294,7 +299,7 @@ Support for this behavior will be removed in version 2.0.0.
294
299
  # a block can be passed to parse the values accordingly.
295
300
  #
296
301
  # See also #execute_batch for additional ways of
297
- # executing statments.
302
+ # executing statements.
298
303
  def execute_batch2(sql, &block)
299
304
  if block_given?
300
305
  result = exec_batch(sql, @results_as_hash)
@@ -307,7 +312,7 @@ Support for this behavior will be removed in version 2.0.0.
307
312
  end
308
313
 
309
314
  # This is a convenience method for creating a statement, binding
310
- # paramters to it, and calling execute:
315
+ # parameters to it, and calling execute:
311
316
  #
312
317
  # result = db.query( "select * from foo where a=?", [5])
313
318
  # # is the same as
@@ -536,10 +541,10 @@ Support for this will be removed in version 2.0.0.
536
541
  # db.create_aggregate_handler( LengthsAggregateHandler )
537
542
  # puts db.get_first_value( "select lengths(name) from A" )
538
543
  def create_aggregate_handler( handler )
539
- # This is a compatiblity shim so the (basically pointless) FunctionProxy
544
+ # This is a compatibility shim so the (basically pointless) FunctionProxy
540
545
  # "ctx" object is passed as first argument to both step() and finalize().
541
546
  # Now its up to the library user whether he prefers to store his
542
- # temporaries as instance varibales or fields in the FunctionProxy.
547
+ # temporaries as instance variables or fields in the FunctionProxy.
543
548
  # The library user still must set the result value with
544
549
  # FunctionProxy.result= as there is no backwards compatible way to
545
550
  # change this.
@@ -574,7 +579,7 @@ Support for this will be removed in version 2.0.0.
574
579
  # The functions arity is the arity of the +step+ method.
575
580
  def define_aggregator( name, aggregator )
576
581
  # Previously, this has been implemented in C. Now this is just yet
577
- # another compatiblity shim
582
+ # another compatibility shim
578
583
  proxy = Class.new do
579
584
  @template = aggregator
580
585
  @name = name
@@ -42,11 +42,11 @@ module SQLite3
42
42
  # Requests the given pragma (and parameters), and if the block is given,
43
43
  # each row of the result set will be yielded to it. Otherwise, the results
44
44
  # are returned as an array.
45
- def get_query_pragma( name, *parms, &block ) # :yields: row
46
- if parms.empty?
45
+ def get_query_pragma( name, *params, &block ) # :yields: row
46
+ if params.empty?
47
47
  execute( "PRAGMA #{name}", &block )
48
48
  else
49
- args = "'" + parms.join("','") + "'"
49
+ args = "'" + params.join("','") + "'"
50
50
  execute( "PRAGMA #{name}( #{args} )", &block )
51
51
  end
52
52
  end
@@ -543,6 +543,13 @@ module SQLite3
543
543
 
544
544
  tweak_default(new_row) if needs_tweak_default
545
545
 
546
+ # Ensure the type value is downcased. On Mac and Windows
547
+ # platforms this value is now being returned as all upper
548
+ # case.
549
+ if new_row['type']
550
+ new_row['type'] = new_row['type'].downcase
551
+ end
552
+
546
553
  if block_given?
547
554
  yield new_row
548
555
  else
@@ -137,7 +137,8 @@ module SQLite3
137
137
  column_name column
138
138
  end
139
139
  @types = Array.new(column_count) do |column|
140
- column_decltype column
140
+ val = column_decltype(column)
141
+ val.nil? ? nil : val.downcase
141
142
  end
142
143
  end
143
144
  end
@@ -43,7 +43,7 @@ Built in translators are deprecated and will be removed in version 2.0.0
43
43
  end
44
44
 
45
45
  # Translate the given string value to a value of the given type. In the
46
- # absense of an installed translator block for the given type, the value
46
+ # absence of an installed translator block for the given type, the value
47
47
  # itself is always returned. Further, +nil+ values are never translated,
48
48
  # and are always passed straight through regardless of the type parameter.
49
49
  def translate( type, value )
@@ -1,12 +1,12 @@
1
1
  module SQLite3
2
2
 
3
- VERSION = '1.4.1'
3
+ VERSION = '1.4.4'
4
4
 
5
5
  module VersionProxy
6
6
 
7
7
  MAJOR = 1
8
- MINOR = 3
9
- TINY = 13
8
+ MINOR = 4
9
+ TINY = 4
10
10
  BUILD = nil
11
11
 
12
12
  STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." )
data/rakelib/gem.rake CHANGED
@@ -27,7 +27,7 @@ HOE = Hoe.spec 'sqlite3' do
27
27
 
28
28
  extra_dev_deps << ['rake-compiler', "~> 1.0"]
29
29
  extra_dev_deps << ['rake-compiler-dock', "~> 0.6.0"]
30
- extra_dev_deps << ["mini_portile", "~> 0.6.2"]
30
+ extra_dev_deps << ["mini_portile2", "~> 2.0"]
31
31
  extra_dev_deps << ["minitest", "~> 5.0"]
32
32
  extra_dev_deps << ["hoe-bundler", "~> 1.0"]
33
33
  extra_dev_deps << ["hoe-gemspec", "~> 1.0"]
data/rakelib/native.rake CHANGED
@@ -51,6 +51,9 @@ RUBY_EXTENSION = Rake::ExtensionTask.new('sqlite3_native', HOE.spec) do |ext|
51
51
  end
52
52
 
53
53
  # ensure things are compiled prior testing
54
- task :test => [:compile]
55
-
54
+ if RUBY_PLATFORM =~ /mingw/ then
55
+ task :test => ["compile:msys2"]
56
+ else
57
+ task :test => [:compile]
58
+ end
56
59
  # vim: syntax=ruby
@@ -1,6 +1,6 @@
1
1
  require "rake/clean"
2
2
  require "rake/extensioncompiler"
3
- require "mini_portile"
3
+ require "mini_portile2"
4
4
 
5
5
  CLOBBER.include("ports")
6
6
 
@@ -8,7 +8,7 @@ directory "ports"
8
8
 
9
9
  def define_sqlite_task(platform, host)
10
10
  recipe = MiniPortile.new "sqlite3", BINARY_VERSION
11
- recipe.files << "http://sqlite.org#{URL_PATH}/sqlite-autoconf-#{URL_VERSION}.tar.gz"
11
+ recipe.files = ["http://sqlite.org#{URL_PATH}/sqlite-autoconf-#{URL_VERSION}.tar.gz"]
12
12
  recipe.host = host
13
13
 
14
14
  desc "Compile sqlite3 for #{platform} (#{host})"
@@ -37,6 +37,17 @@ if RUBY_PLATFORM =~ /mingw/
37
37
  # also prepend DevKit into compilation phase
38
38
  Rake::Task["compile"].prerequisites.unshift "devkit", "ports:sqlite3:#{RUBY_PLATFORM}"
39
39
  Rake::Task["native"].prerequisites.unshift "devkit", "ports:sqlite3:#{RUBY_PLATFORM}"
40
+
41
+ namespace "compile" do
42
+ desc "Build using MSYS2 sqlite package"
43
+ task :msys2 do
44
+ RUBY_EXTENSION.config_options.pop
45
+ t = Rake::Task["compile"]
46
+ t.prerequisites.clear
47
+ t.prerequisites << "devkit" << "compile:#{RUBY_PLATFORM}"
48
+ t.invoke
49
+ end
50
+ end
40
51
  end
41
52
 
42
53
  # trick to test local compilation of sqlite3
data/test/helper.rb CHANGED
@@ -1,6 +1,13 @@
1
1
  require 'sqlite3'
2
2
  require 'minitest/autorun'
3
3
 
4
+ if ENV['GITHUB_ACTIONS'] == 'true' || ENV['CI']
5
+ $VERBOSE = nil
6
+ puts "\nSQLite3 Version: #{SQLite3::SQLITE_VERSION} $VERBOSE = nil", ""
7
+ else
8
+ puts "\nSQLite3 Version: #{SQLite3::SQLITE_VERSION}", ""
9
+ end
10
+
4
11
  unless RUBY_VERSION >= "1.9"
5
12
  require 'iconv'
6
13
  end
@@ -45,6 +45,17 @@ module SQLite3
45
45
  tf.unlink if tf
46
46
  end
47
47
 
48
+
49
+ def test_filename_to_path
50
+ tf = Tempfile.new 'thing'
51
+ pn = Pathname tf.path
52
+ db = SQLite3::Database.new pn
53
+ assert_equal pn.expand_path.to_s, File.expand_path(db.filename)
54
+ ensure
55
+ tf.close! if tf
56
+ end
57
+
58
+
48
59
  def test_error_code
49
60
  begin
50
61
  db.execute 'SELECT'
@@ -499,5 +510,22 @@ module SQLite3
499
510
  def test_execute_with_named_bind_params
500
511
  assert_equal [['foo']], @db.execute("select :n", {'n' => 'foo'})
501
512
  end
513
+
514
+ def test_strict_mode
515
+ unless Gem::Requirement.new(">= 3.29.0").satisfied_by?(Gem::Version.new(SQLite3::SQLITE_VERSION))
516
+ skip("strict mode feature not available in #{SQLite3::SQLITE_VERSION}")
517
+ end
518
+
519
+ db = SQLite3::Database.new(':memory:')
520
+ db.execute('create table numbers (val int);')
521
+ db.execute('create index index_numbers_nope ON numbers ("nope");') # nothing raised
522
+
523
+ db = SQLite3::Database.new(':memory:', :strict => true)
524
+ db.execute('create table numbers (val int);')
525
+ error = assert_raises SQLite3::SQLException do
526
+ db.execute('create index index_numbers_nope ON numbers ("nope");')
527
+ end
528
+ assert_includes error.message, "no such column: nope"
529
+ end
502
530
  end
503
531
  end
@@ -105,23 +105,6 @@ class TC_ResultSet < SQLite3::TestCase
105
105
  assert_equal hash[1], "foo"
106
106
  end
107
107
 
108
- def test_tainted_results_as_hash
109
- @db.results_as_hash = true
110
- @result.reset( 1 )
111
- row = @result.next
112
- row.each do |_, v|
113
- assert(v.tainted?) if String === v
114
- end
115
- end
116
-
117
- def test_tainted_row_values
118
- @result.reset( 1 )
119
- row = @result.next
120
- row.each do |v|
121
- assert(v.tainted?) if String === v
122
- end
123
- end
124
-
125
108
  def test_each
126
109
  called = 0
127
110
  @result.reset( 1, 2 )
@@ -127,7 +127,7 @@ module SQLite3
127
127
  row = @db.execute('select * from foo')
128
128
 
129
129
  assert_equal ['hello'], row.first
130
- assert_equal row.first.types, ['BLOB']
130
+ assert_equal ['blob'], row.first.types
131
131
  end
132
132
 
133
133
  def test_bind_64
@@ -198,11 +198,6 @@ module SQLite3
198
198
  assert_equal ['foo'], r
199
199
  end
200
200
 
201
- def test_tainted
202
- r = @stmt.step
203
- assert r.first.tainted?
204
- end
205
-
206
201
  def test_step_twice
207
202
  assert_not_nil @stmt.step
208
203
  assert !@stmt.done?
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
8
8
  - Luis Lavena
9
9
  - Aaron Patterson
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-04-29 00:00:00.000000000 Z
13
+ date: 2022-06-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '5.11'
21
+ version: '5.15'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '5.11'
28
+ version: '5.15'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rake-compiler
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -55,19 +55,19 @@ dependencies:
55
55
  - !ruby/object:Gem::Version
56
56
  version: 0.6.0
57
57
  - !ruby/object:Gem::Dependency
58
- name: mini_portile
58
+ name: mini_portile2
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: 0.6.2
63
+ version: '2.0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: 0.6.2
70
+ version: '2.0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: hoe-bundler
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -122,14 +122,14 @@ dependencies:
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '3.17'
125
+ version: '3.23'
126
126
  type: :development
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '3.17'
132
+ version: '3.23'
133
133
  description: |-
134
134
  This module allows Ruby programs to interface with the SQLite3
135
135
  database engine (http://www.sqlite.org). You must have the
@@ -156,7 +156,6 @@ extra_rdoc_files:
156
156
  - ext/sqlite3/statement.c
157
157
  files:
158
158
  - ".gemtest"
159
- - ".travis.yml"
160
159
  - API_CHANGES.rdoc
161
160
  - CHANGELOG.rdoc
162
161
  - ChangeLog.cvs
@@ -220,7 +219,7 @@ licenses:
220
219
  - BSD-3-Clause
221
220
  metadata:
222
221
  msys2_mingw_dependencies: sqlite3
223
- post_install_message:
222
+ post_install_message:
224
223
  rdoc_options:
225
224
  - "--main"
226
225
  - README.rdoc
@@ -237,8 +236,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
236
  - !ruby/object:Gem::Version
238
237
  version: 1.3.5
239
238
  requirements: []
240
- rubygems_version: 3.0.1
241
- signing_key:
239
+ rubygems_version: 3.4.0.dev
240
+ signing_key:
242
241
  specification_version: 4
243
242
  summary: This module allows Ruby programs to interface with the SQLite3 database engine
244
243
  (http://www.sqlite.org)
data/.travis.yml DELETED
@@ -1,32 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- before_install:
5
- - gem update --system
6
- - gem install bundler
7
- addons:
8
- apt:
9
- packages:
10
- - libgmp-dev
11
-
12
- after_failure:
13
- - "find . -name mkmf.log -exec cat {} \\;"
14
-
15
- after_success:
16
- - "find . -name mkmf.log -exec cat {} \\;"
17
-
18
- env:
19
- - USE_MINI_PORTILE=true
20
- - USE_MINI_PORTILE=false
21
- rvm:
22
- - 1.9.3
23
- - 2.0.0
24
- - 2.1
25
- - 2.2
26
- - 2.3
27
- - 2.4
28
- - 2.5
29
- - ruby-head
30
- matrix:
31
- allow_failures:
32
- - env: USE_MINI_PORTILE=false