sqlite3 1.4.0 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +22 -1
- data/Gemfile +5 -2
- data/Manifest.txt +0 -1
- data/README.rdoc +2 -2
- data/ext/sqlite3/aggregator.c +6 -6
- data/ext/sqlite3/database.c +35 -4
- data/ext/sqlite3/extconf.rb +5 -5
- data/ext/sqlite3/statement.c +4 -4
- data/faq/faq.yml +1 -1
- data/lib/sqlite3/constants.rb +1 -1
- data/lib/sqlite3/database.rb +11 -6
- data/lib/sqlite3/pragmas.rb +10 -3
- data/lib/sqlite3/statement.rb +2 -1
- data/lib/sqlite3/translator.rb +1 -1
- data/lib/sqlite3/version.rb +3 -3
- data/rakelib/gem.rake +1 -1
- data/rakelib/native.rake +5 -2
- data/rakelib/vendor_sqlite3.rake +13 -2
- data/test/helper.rb +7 -0
- data/test/test_database.rb +24 -0
- data/test/test_integration_resultset.rb +0 -17
- data/test/test_statement.rb +1 -6
- metadata +13 -14
- data/.travis.yml +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 500f3a489a64a9536ea4f62f6682e2885dda163ea86b711b647a48a4241c12c0
|
4
|
+
data.tar.gz: 24a2a48a47618b1ee76bc3858bf9e1f62879901e6b53f9f5cdc0ace8a3760ccb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1fd86f1fae87af8a25aa0369d3dd80f204a8617a0fd909c1e7ab6645831883f586029722b4708f72e09f1d3595167346174e7078ef641941dd6bb1b704981d6
|
7
|
+
data.tar.gz: 887e45ad0ed70120b4457b4e56aca7d92b658f4a885dd02fabe6b50f6712015c2ec8689965b982251c4b43c2ab4ab7f002613823af144ab943906fedb2c019ff
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
=== 1.4.3 (2022-05-25)
|
2
|
+
|
3
|
+
* Enhancements
|
4
|
+
* Disable non-standard support for double-quoted string literals via the `:strict` option. [#317] (Thank you, @casperisfine!)
|
5
|
+
* Column type names are now explicitly downcased on platforms where they may have been in shoutcaps. [#315] (Thank you, @petergoldstein!)
|
6
|
+
* Support File or Pathname arguments to `Database.new`. [#283] (Thank you, @yb66!)
|
7
|
+
* Support building on MSVC. [#285] (Thank you, @jmarrec!)
|
8
|
+
|
9
|
+
|
10
|
+
=== 1.4.2 (2019-12-18)
|
11
|
+
|
12
|
+
* Travis: Drop unused setting "sudo: false"
|
13
|
+
* The taint mechanism will be deprecated in Ruby 2.7
|
14
|
+
* Fix Ruby 2.7 rb_check_safe_obj warnings
|
15
|
+
* Update travis config
|
16
|
+
|
17
|
+
=== 1.4.1
|
18
|
+
|
19
|
+
* Don't mandate dl functions for the extention build
|
20
|
+
* bumping version
|
21
|
+
|
1
22
|
=== 1.4.0
|
2
23
|
|
3
24
|
* Enhancements
|
@@ -122,7 +143,7 @@
|
|
122
143
|
installed anymore
|
123
144
|
|
124
145
|
* Bugfixes
|
125
|
-
* Backup API is
|
146
|
+
* Backup API is conditionally required so that older libsqlite3 can be used.
|
126
147
|
Thanks Hongli Lai.
|
127
148
|
* Fixed segmentation fault when nil is passed to SQLite3::Statement.new
|
128
149
|
* 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 "
|
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
|
-
|
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
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://
|
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
|
|
data/ext/sqlite3/aggregator.c
CHANGED
@@ -10,13 +10,13 @@
|
|
10
10
|
* in-flight for this aggregator. */
|
11
11
|
static VALUE cAggregatorWrapper;
|
12
12
|
|
13
|
-
/* wraps a
|
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
|
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
|
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
|
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
|
169
|
-
sqlite3_result_error(ctx, "Ruby Exception
|
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);
|
data/ext/sqlite3/database.c
CHANGED
@@ -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
|
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
|
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
|
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
|
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
|
data/ext/sqlite3/extconf.rb
CHANGED
@@ -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 " +
|
@@ -64,11 +68,7 @@ end
|
|
64
68
|
asplode('sqlite3.h') unless find_header 'sqlite3.h'
|
65
69
|
find_library 'pthread', 'pthread_create' # 1.8 support. *shrug*
|
66
70
|
|
67
|
-
have_library 'dl'
|
68
|
-
|
69
|
-
%w{ dlopen dlclose dlsym }.each do |func|
|
70
|
-
abort "missing function #{func}" unless have_func(func)
|
71
|
-
end
|
71
|
+
have_library 'dl' # for static builds
|
72
72
|
|
73
73
|
if with_config('sqlcipher')
|
74
74
|
asplode('sqlcipher') unless find_library 'sqlcipher', 'sqlite3_libversion_number'
|
data/ext/sqlite3/statement.c
CHANGED
@@ -151,7 +151,7 @@ static VALUE step(VALUE self)
|
|
151
151
|
break;
|
152
152
|
case SQLITE_TEXT:
|
153
153
|
{
|
154
|
-
VALUE str =
|
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 =
|
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
|
-
*
|
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
|
-
*
|
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
|
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.)
|
data/lib/sqlite3/constants.rb
CHANGED
@@ -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
|
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
|
data/lib/sqlite3/database.rb
CHANGED
@@ -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
|
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
|
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
|
-
#
|
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
|
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
|
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
|
582
|
+
# another compatibility shim
|
578
583
|
proxy = Class.new do
|
579
584
|
@template = aggregator
|
580
585
|
@name = name
|
data/lib/sqlite3/pragmas.rb
CHANGED
@@ -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, *
|
46
|
-
if
|
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 = "'" +
|
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
|
data/lib/sqlite3/statement.rb
CHANGED
data/lib/sqlite3/translator.rb
CHANGED
@@ -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
|
-
#
|
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 )
|
data/lib/sqlite3/version.rb
CHANGED
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 << ["
|
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
|
-
|
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
|
data/rakelib/vendor_sqlite3.rake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "rake/clean"
|
2
2
|
require "rake/extensioncompiler"
|
3
|
-
require "
|
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
|
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
|
data/test/test_database.rb
CHANGED
@@ -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,18 @@ 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
|
+
db = SQLite3::Database.new(':memory:')
|
516
|
+
db.execute('create table numbers (val int);')
|
517
|
+
db.execute('create index index_numbers_nope ON numbers ("nope");') # nothing raised
|
518
|
+
|
519
|
+
db = SQLite3::Database.new(':memory:', :strict => true)
|
520
|
+
db.execute('create table numbers (val int);')
|
521
|
+
error = assert_raises SQLite3::SQLException do
|
522
|
+
db.execute('create index index_numbers_nope ON numbers ("nope");')
|
523
|
+
end
|
524
|
+
assert_includes error.message, "no such column: nope"
|
525
|
+
end
|
502
526
|
end
|
503
527
|
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 )
|
data/test/test_statement.rb
CHANGED
@@ -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
|
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.
|
4
|
+
version: 1.4.3
|
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:
|
13
|
+
date: 2022-06-13 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.
|
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.
|
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:
|
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
|
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
|
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.
|
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.
|
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.
|
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
|