sqlite3 1.5.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +390 -0
- data/CONTRIBUTING.md +34 -2
- data/{faq/faq.md → FAQ.md} +0 -43
- data/INSTALLATION.md +269 -0
- data/LICENSE +18 -22
- data/README.md +76 -128
- data/dependencies.yml +13 -0
- data/ext/sqlite3/aggregator.c +142 -146
- data/ext/sqlite3/aggregator.h +2 -4
- data/ext/sqlite3/backup.c +86 -64
- data/ext/sqlite3/backup.h +2 -2
- data/ext/sqlite3/database.c +543 -465
- data/ext/sqlite3/database.h +9 -4
- data/ext/sqlite3/exception.c +111 -92
- data/ext/sqlite3/exception.h +3 -1
- data/ext/sqlite3/extconf.rb +83 -51
- data/ext/sqlite3/sqlite3.c +160 -115
- data/ext/sqlite3/sqlite3_ruby.h +2 -2
- data/ext/sqlite3/statement.c +518 -293
- data/ext/sqlite3/statement.h +3 -3
- data/ext/sqlite3/timespec.h +20 -0
- data/lib/sqlite3/constants.rb +171 -47
- data/lib/sqlite3/database.rb +141 -181
- data/lib/sqlite3/errors.rb +26 -1
- data/lib/sqlite3/pragmas.rb +128 -138
- data/lib/sqlite3/resultset.rb +14 -105
- data/lib/sqlite3/statement.rb +58 -13
- data/lib/sqlite3/value.rb +17 -20
- data/lib/sqlite3/version.rb +1 -21
- data/lib/sqlite3.rb +6 -4
- data/ports/archives/sqlite-autoconf-3460000.tar.gz +0 -0
- metadata +19 -107
- data/API_CHANGES.md +0 -49
- data/ChangeLog.cvs +0 -88
- data/Gemfile +0 -3
- data/LICENSE-DEPENDENCIES +0 -20
- data/faq/faq.rb +0 -145
- data/faq/faq.yml +0 -426
- data/lib/sqlite3/translator.rb +0 -118
- data/ports/archives/sqlite-autoconf-3380500.tar.gz +0 -0
- data/test/helper.rb +0 -27
- data/test/test_backup.rb +0 -33
- data/test/test_collation.rb +0 -82
- data/test/test_database.rb +0 -545
- data/test/test_database_flags.rb +0 -95
- data/test/test_database_readonly.rb +0 -36
- data/test/test_database_readwrite.rb +0 -41
- data/test/test_deprecated.rb +0 -44
- data/test/test_encoding.rb +0 -155
- data/test/test_integration.rb +0 -507
- data/test/test_integration_aggregate.rb +0 -336
- data/test/test_integration_open_close.rb +0 -30
- data/test/test_integration_pending.rb +0 -115
- data/test/test_integration_resultset.rb +0 -142
- data/test/test_integration_statement.rb +0 -194
- data/test/test_result_set.rb +0 -37
- data/test/test_sqlite3.rb +0 -30
- data/test/test_statement.rb +0 -263
- data/test/test_statement_execute.rb +0 -35
data/lib/sqlite3/resultset.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "sqlite3/constants"
|
2
|
+
require "sqlite3/errors"
|
3
3
|
|
4
4
|
module SQLite3
|
5
|
-
|
6
5
|
# The ResultSet object encapsulates the enumerability of a query's output.
|
7
6
|
# It is a simple cursor over the data that the query returns. It will
|
8
7
|
# very rarely (if ever) be instantiated directly. Instead, clients should
|
@@ -10,76 +9,18 @@ module SQLite3
|
|
10
9
|
class ResultSet
|
11
10
|
include Enumerable
|
12
11
|
|
13
|
-
class ArrayWithTypes < Array # :nodoc:
|
14
|
-
attr_accessor :types
|
15
|
-
end
|
16
|
-
|
17
|
-
class ArrayWithTypesAndFields < Array # :nodoc:
|
18
|
-
attr_writer :types
|
19
|
-
attr_writer :fields
|
20
|
-
|
21
|
-
def types
|
22
|
-
warn(<<-eowarn) if $VERBOSE
|
23
|
-
#{caller[0]} is calling #{self.class}#types. This method will be removed in
|
24
|
-
sqlite3 version 2.0.0, please call the `types` method on the SQLite3::ResultSet
|
25
|
-
object that created this object
|
26
|
-
eowarn
|
27
|
-
@types
|
28
|
-
end
|
29
|
-
|
30
|
-
def fields
|
31
|
-
warn(<<-eowarn) if $VERBOSE
|
32
|
-
#{caller[0]} is calling #{self.class}#fields. This method will be removed in
|
33
|
-
sqlite3 version 2.0.0, please call the `columns` method on the SQLite3::ResultSet
|
34
|
-
object that created this object
|
35
|
-
eowarn
|
36
|
-
@fields
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# The class of which we return an object in case we want a Hash as
|
41
|
-
# result.
|
42
|
-
class HashWithTypesAndFields < Hash # :nodoc:
|
43
|
-
attr_writer :types
|
44
|
-
attr_writer :fields
|
45
|
-
|
46
|
-
def types
|
47
|
-
warn(<<-eowarn) if $VERBOSE
|
48
|
-
#{caller[0]} is calling #{self.class}#types. This method will be removed in
|
49
|
-
sqlite3 version 2.0.0, please call the `types` method on the SQLite3::ResultSet
|
50
|
-
object that created this object
|
51
|
-
eowarn
|
52
|
-
@types
|
53
|
-
end
|
54
|
-
|
55
|
-
def fields
|
56
|
-
warn(<<-eowarn) if $VERBOSE
|
57
|
-
#{caller[0]} is calling #{self.class}#fields. This method will be removed in
|
58
|
-
sqlite3 version 2.0.0, please call the `columns` method on the SQLite3::ResultSet
|
59
|
-
object that created this object
|
60
|
-
eowarn
|
61
|
-
@fields
|
62
|
-
end
|
63
|
-
|
64
|
-
def [] key
|
65
|
-
key = fields[key] if key.is_a? Numeric
|
66
|
-
super key
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
12
|
# Create a new ResultSet attached to the given database, using the
|
71
13
|
# given sql text.
|
72
14
|
def initialize db, stmt
|
73
|
-
@db
|
15
|
+
@db = db
|
74
16
|
@stmt = stmt
|
75
17
|
end
|
76
18
|
|
77
19
|
# Reset the cursor, so that a result set which has reached end-of-file
|
78
20
|
# can be rewound and reiterated.
|
79
|
-
def reset(
|
21
|
+
def reset(*bind_params)
|
80
22
|
@stmt.reset!
|
81
|
-
@stmt.bind_params(
|
82
|
-
@eof = false
|
23
|
+
@stmt.bind_params(*bind_params)
|
83
24
|
end
|
84
25
|
|
85
26
|
# Query whether the cursor has reached the end of the result set or not.
|
@@ -88,9 +29,7 @@ object that created this object
|
|
88
29
|
end
|
89
30
|
|
90
31
|
# Obtain the next row from the cursor. If there are no more rows to be
|
91
|
-
# had, this will return +nil+.
|
92
|
-
# corresponding database, the values in the row will be translated
|
93
|
-
# according to their types.
|
32
|
+
# had, this will return +nil+.
|
94
33
|
#
|
95
34
|
# The returned value will be an array, unless Database#results_as_hash has
|
96
35
|
# been set to +true+, in which case the returned value will be a hash.
|
@@ -101,36 +40,13 @@ object that created this object
|
|
101
40
|
# For hashes, the column names are the keys of the hash, and the column
|
102
41
|
# types are accessible via the +types+ property.
|
103
42
|
def next
|
104
|
-
|
105
|
-
return next_hash
|
106
|
-
end
|
107
|
-
|
108
|
-
row = @stmt.step
|
109
|
-
return nil if @stmt.done?
|
110
|
-
|
111
|
-
row = @db.translate_from_db @stmt.types, row
|
112
|
-
|
113
|
-
if row.respond_to?(:fields)
|
114
|
-
# FIXME: this can only happen if the translator returns something
|
115
|
-
# that responds to `fields`. Since we're removing the translator
|
116
|
-
# in 2.0, we can remove this branch in 2.0.
|
117
|
-
row = ArrayWithTypes.new(row)
|
118
|
-
else
|
119
|
-
# FIXME: the `fields` and `types` methods are deprecated on this
|
120
|
-
# object for version 2.0, so we can safely remove this branch
|
121
|
-
# as well.
|
122
|
-
row = ArrayWithTypesAndFields.new(row)
|
123
|
-
end
|
124
|
-
|
125
|
-
row.fields = @stmt.columns
|
126
|
-
row.types = @stmt.types
|
127
|
-
row
|
43
|
+
@stmt.step
|
128
44
|
end
|
129
45
|
|
130
46
|
# Required by the Enumerable mixin. Provides an internal iterator over the
|
131
47
|
# rows of the result set.
|
132
48
|
def each
|
133
|
-
while node = self.next
|
49
|
+
while (node = self.next)
|
134
50
|
yield node
|
135
51
|
end
|
136
52
|
end
|
@@ -138,7 +54,7 @@ object that created this object
|
|
138
54
|
# Provides an internal iterator over the rows of the result set where
|
139
55
|
# each row is yielded as a hash.
|
140
56
|
def each_hash
|
141
|
-
while node = next_hash
|
57
|
+
while (node = next_hash)
|
142
58
|
yield node
|
143
59
|
end
|
144
60
|
end
|
@@ -170,18 +86,11 @@ object that created this object
|
|
170
86
|
row = @stmt.step
|
171
87
|
return nil if @stmt.done?
|
172
88
|
|
173
|
-
|
174
|
-
# in 2.0
|
175
|
-
row = @db.translate_from_db @stmt.types, row
|
176
|
-
|
177
|
-
# FIXME: this can be switched to a regular hash in 2.0
|
178
|
-
row = HashWithTypesAndFields[*@stmt.columns.zip(row).flatten]
|
179
|
-
|
180
|
-
# FIXME: these methods are deprecated for version 2.0, so we can remove
|
181
|
-
# this code in 2.0
|
182
|
-
row.fields = @stmt.columns
|
183
|
-
row.types = @stmt.types
|
184
|
-
row
|
89
|
+
@stmt.columns.zip(row).to_h
|
185
90
|
end
|
186
91
|
end
|
92
|
+
|
93
|
+
class HashResultSet < ResultSet # :nodoc:
|
94
|
+
alias_method :next, :next_hash
|
95
|
+
end
|
187
96
|
end
|
data/lib/sqlite3/statement.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "sqlite3/errors"
|
2
|
+
require "sqlite3/resultset"
|
3
3
|
|
4
4
|
class String
|
5
5
|
def to_blob
|
6
|
-
SQLite3::Blob.new(
|
6
|
+
SQLite3::Blob.new(self)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -19,6 +19,23 @@ module SQLite3
|
|
19
19
|
# this will be the empty string.
|
20
20
|
attr_reader :remainder
|
21
21
|
|
22
|
+
# call-seq: SQLite3::Statement.new(db, sql)
|
23
|
+
#
|
24
|
+
# Create a new statement attached to the given Database instance, and which
|
25
|
+
# encapsulates the given SQL text. If the text contains more than one
|
26
|
+
# statement (i.e., separated by semicolons), then the #remainder property
|
27
|
+
# will be set to the trailing text.
|
28
|
+
def initialize(db, sql)
|
29
|
+
raise ArgumentError, "prepare called on a closed database" if db.closed?
|
30
|
+
|
31
|
+
sql = sql.encode(Encoding::UTF_8) if sql && sql.encoding != Encoding::UTF_8
|
32
|
+
|
33
|
+
@connection = db
|
34
|
+
@columns = nil
|
35
|
+
@types = nil
|
36
|
+
@remainder = prepare db, sql
|
37
|
+
end
|
38
|
+
|
22
39
|
# Binds the given variables to the corresponding placeholders in the SQL
|
23
40
|
# text.
|
24
41
|
#
|
@@ -32,7 +49,7 @@ module SQLite3
|
|
32
49
|
#
|
33
50
|
# See also #execute, #bind_param, Statement#bind_param, and
|
34
51
|
# Statement#bind_params.
|
35
|
-
def bind_params(
|
52
|
+
def bind_params(*bind_vars)
|
36
53
|
index = 1
|
37
54
|
bind_vars.flatten.each do |var|
|
38
55
|
if Hash === var
|
@@ -58,16 +75,16 @@ module SQLite3
|
|
58
75
|
# end
|
59
76
|
#
|
60
77
|
# See also #bind_params, #execute!.
|
61
|
-
def execute(
|
78
|
+
def execute(*bind_vars)
|
62
79
|
reset! if active? || done?
|
63
80
|
|
64
81
|
bind_params(*bind_vars) unless bind_vars.empty?
|
65
|
-
|
82
|
+
results = @connection.build_result_set self
|
66
83
|
|
67
|
-
step if
|
84
|
+
step if column_count == 0
|
68
85
|
|
69
|
-
yield
|
70
|
-
|
86
|
+
yield results if block_given?
|
87
|
+
results
|
71
88
|
end
|
72
89
|
|
73
90
|
# Execute the statement. If no block was given, this returns an array of
|
@@ -84,9 +101,9 @@ module SQLite3
|
|
84
101
|
# end
|
85
102
|
#
|
86
103
|
# See also #bind_params, #execute.
|
87
|
-
def execute!(
|
104
|
+
def execute!(*bind_vars, &block)
|
88
105
|
execute(*bind_vars)
|
89
|
-
|
106
|
+
block ? each(&block) : to_a
|
90
107
|
end
|
91
108
|
|
92
109
|
# Returns true if the statement is currently active, meaning it has an
|
@@ -100,7 +117,7 @@ module SQLite3
|
|
100
117
|
# a (potentially) expensive operation.
|
101
118
|
def columns
|
102
119
|
get_metadata unless @columns
|
103
|
-
|
120
|
+
@columns
|
104
121
|
end
|
105
122
|
|
106
123
|
def each
|
@@ -128,7 +145,35 @@ module SQLite3
|
|
128
145
|
end
|
129
146
|
end
|
130
147
|
|
148
|
+
# Returns a Hash containing information about the statement.
|
149
|
+
# The contents of the hash are implementation specific and may change in
|
150
|
+
# the future without notice. The hash includes information about internal
|
151
|
+
# statistics about the statement such as:
|
152
|
+
# - +fullscan_steps+: the number of times that SQLite has stepped forward
|
153
|
+
# in a table as part of a full table scan
|
154
|
+
# - +sorts+: the number of sort operations that have occurred
|
155
|
+
# - +autoindexes+: the number of rows inserted into transient indices
|
156
|
+
# that were created automatically in order to help joins run faster
|
157
|
+
# - +vm_steps+: the number of virtual machine operations executed by the
|
158
|
+
# prepared statement
|
159
|
+
# - +reprepares+: the number of times that the prepare statement has been
|
160
|
+
# automatically regenerated due to schema changes or changes to bound
|
161
|
+
# parameters that might affect the query plan
|
162
|
+
# - +runs+: the number of times that the prepared statement has been run
|
163
|
+
# - +filter_misses+: the number of times that the Bloom filter returned
|
164
|
+
# a find, and thus the join step had to be processed as normal
|
165
|
+
# - +filter_hits+: the number of times that a join step was bypassed
|
166
|
+
# because a Bloom filter returned not-found
|
167
|
+
def stat key = nil
|
168
|
+
if key
|
169
|
+
stat_for(key)
|
170
|
+
else
|
171
|
+
stats_as_hash
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
131
175
|
private
|
176
|
+
|
132
177
|
# A convenience method for obtaining the metadata about the query. Note
|
133
178
|
# that this will actually execute the SQL, which means it can be a
|
134
179
|
# (potentially) expensive operation.
|
@@ -138,7 +183,7 @@ module SQLite3
|
|
138
183
|
end
|
139
184
|
@types = Array.new(column_count) do |column|
|
140
185
|
val = column_decltype(column)
|
141
|
-
val
|
186
|
+
val&.downcase
|
142
187
|
end
|
143
188
|
end
|
144
189
|
end
|
data/lib/sqlite3/value.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "sqlite3/constants"
|
2
2
|
|
3
3
|
module SQLite3
|
4
|
-
|
5
4
|
class Value
|
6
5
|
attr_reader :handle
|
7
6
|
|
8
|
-
def initialize(
|
7
|
+
def initialize(db, handle)
|
9
8
|
@driver = db.driver
|
10
9
|
@handle = handle
|
11
10
|
end
|
@@ -15,43 +14,41 @@ module SQLite3
|
|
15
14
|
end
|
16
15
|
|
17
16
|
def to_blob
|
18
|
-
@driver.value_blob(
|
17
|
+
@driver.value_blob(@handle)
|
19
18
|
end
|
20
19
|
|
21
|
-
def length(
|
20
|
+
def length(utf16 = false)
|
22
21
|
if utf16
|
23
|
-
@driver.value_bytes16(
|
22
|
+
@driver.value_bytes16(@handle)
|
24
23
|
else
|
25
|
-
@driver.value_bytes(
|
24
|
+
@driver.value_bytes(@handle)
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
29
28
|
def to_f
|
30
|
-
@driver.value_double(
|
29
|
+
@driver.value_double(@handle)
|
31
30
|
end
|
32
31
|
|
33
32
|
def to_i
|
34
|
-
@driver.value_int(
|
33
|
+
@driver.value_int(@handle)
|
35
34
|
end
|
36
35
|
|
37
36
|
def to_int64
|
38
|
-
@driver.value_int64(
|
37
|
+
@driver.value_int64(@handle)
|
39
38
|
end
|
40
39
|
|
41
|
-
def to_s(
|
42
|
-
@driver.value_text(
|
40
|
+
def to_s(utf16 = false)
|
41
|
+
@driver.value_text(@handle, utf16)
|
43
42
|
end
|
44
43
|
|
45
44
|
def type
|
46
|
-
case @driver.value_type(
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
case @driver.value_type(@handle)
|
46
|
+
when Constants::ColumnType::INTEGER then :int
|
47
|
+
when Constants::ColumnType::FLOAT then :float
|
48
|
+
when Constants::ColumnType::TEXT then :text
|
49
|
+
when Constants::ColumnType::BLOB then :blob
|
50
|
+
when Constants::ColumnType::NULL then :null
|
52
51
|
end
|
53
52
|
end
|
54
|
-
|
55
53
|
end
|
56
|
-
|
57
54
|
end
|
data/lib/sqlite3/version.rb
CHANGED
@@ -1,23 +1,3 @@
|
|
1
1
|
module SQLite3
|
2
|
-
|
3
|
-
VERSION = "1.5.0"
|
4
|
-
|
5
|
-
module VersionProxy
|
6
|
-
MAJOR = 1
|
7
|
-
MINOR = 5
|
8
|
-
TINY = 0
|
9
|
-
BUILD = nil
|
10
|
-
|
11
|
-
STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." )
|
12
|
-
|
13
|
-
VERSION = ::SQLite3::VERSION
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.const_missing(name)
|
17
|
-
return super unless name == :Version
|
18
|
-
warn(<<-eowarn) if $VERBOSE
|
19
|
-
#{caller[0]}: SQLite::Version will be removed in sqlite3-ruby version 2.0.0
|
20
|
-
eowarn
|
21
|
-
VersionProxy
|
22
|
-
end
|
2
|
+
VERSION = "2.0.2"
|
23
3
|
end
|
data/lib/sqlite3.rb
CHANGED
@@ -3,13 +3,15 @@ begin
|
|
3
3
|
RUBY_VERSION =~ /(\d+\.\d+)/
|
4
4
|
require "sqlite3/#{$1}/sqlite3_native"
|
5
5
|
rescue LoadError
|
6
|
-
require
|
6
|
+
require "sqlite3/sqlite3_native"
|
7
7
|
end
|
8
8
|
|
9
|
-
require
|
10
|
-
require
|
9
|
+
require "sqlite3/database"
|
10
|
+
require "sqlite3/version"
|
11
11
|
|
12
12
|
module SQLite3
|
13
13
|
# Was sqlite3 compiled with thread safety on?
|
14
|
-
def self.threadsafe
|
14
|
+
def self.threadsafe?
|
15
|
+
threadsafe > 0
|
16
|
+
end
|
15
17
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqlite3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
8
8
|
- Luis Lavena
|
9
9
|
- Aaron Patterson
|
10
|
-
|
10
|
+
- Mike Dalessio
|
11
|
+
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2024-05-23 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: mini_portile2
|
@@ -26,80 +27,15 @@ dependencies:
|
|
26
27
|
- - "~>"
|
27
28
|
- !ruby/object:Gem::Version
|
28
29
|
version: 2.8.0
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: '5.15'
|
36
|
-
type: :development
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - "~>"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '5.15'
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: rake-compiler
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 1.2.0
|
50
|
-
type: :development
|
51
|
-
prerelease: false
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - "~>"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 1.2.0
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: rake-compiler-dock
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - "~>"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 1.2.1
|
64
|
-
type: :development
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - "~>"
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: 1.2.1
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: rdoc
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - ">="
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '4.0'
|
78
|
-
- - "<"
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: '7'
|
81
|
-
type: :development
|
82
|
-
prerelease: false
|
83
|
-
version_requirements: !ruby/object:Gem::Requirement
|
84
|
-
requirements:
|
85
|
-
- - ">="
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '4.0'
|
88
|
-
- - "<"
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '7'
|
91
|
-
description: |-
|
92
|
-
This module allows Ruby programs to interface with the SQLite3
|
93
|
-
database engine (http://www.sqlite.org). You must have the
|
94
|
-
SQLite engine installed in order to build this module.
|
95
|
-
|
96
|
-
Note that this module is only compatible with SQLite 3.6.16 or newer.
|
97
|
-
email:
|
30
|
+
force_ruby_platform: false
|
31
|
+
description: |
|
32
|
+
Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org). Precompiled
|
33
|
+
binaries are available for common platforms for recent versions of Ruby.
|
34
|
+
email:
|
98
35
|
executables: []
|
99
36
|
extensions:
|
100
37
|
- ext/sqlite3/extconf.rb
|
101
38
|
extra_rdoc_files:
|
102
|
-
- API_CHANGES.md
|
103
39
|
- CHANGELOG.md
|
104
40
|
- README.md
|
105
41
|
- ext/sqlite3/aggregator.c
|
@@ -110,14 +46,13 @@ extra_rdoc_files:
|
|
110
46
|
- ext/sqlite3/statement.c
|
111
47
|
files:
|
112
48
|
- ".gemtest"
|
113
|
-
- API_CHANGES.md
|
114
49
|
- CHANGELOG.md
|
115
50
|
- CONTRIBUTING.md
|
116
|
-
-
|
117
|
-
-
|
51
|
+
- FAQ.md
|
52
|
+
- INSTALLATION.md
|
118
53
|
- LICENSE
|
119
|
-
- LICENSE-DEPENDENCIES
|
120
54
|
- README.md
|
55
|
+
- dependencies.yml
|
121
56
|
- ext/sqlite3/aggregator.c
|
122
57
|
- ext/sqlite3/aggregator.h
|
123
58
|
- ext/sqlite3/backup.c
|
@@ -131,9 +66,7 @@ files:
|
|
131
66
|
- ext/sqlite3/sqlite3_ruby.h
|
132
67
|
- ext/sqlite3/statement.c
|
133
68
|
- ext/sqlite3/statement.h
|
134
|
-
-
|
135
|
-
- faq/faq.rb
|
136
|
-
- faq/faq.yml
|
69
|
+
- ext/sqlite3/timespec.h
|
137
70
|
- lib/sqlite3.rb
|
138
71
|
- lib/sqlite3/constants.rb
|
139
72
|
- lib/sqlite3/database.rb
|
@@ -141,29 +74,9 @@ files:
|
|
141
74
|
- lib/sqlite3/pragmas.rb
|
142
75
|
- lib/sqlite3/resultset.rb
|
143
76
|
- lib/sqlite3/statement.rb
|
144
|
-
- lib/sqlite3/translator.rb
|
145
77
|
- lib/sqlite3/value.rb
|
146
78
|
- lib/sqlite3/version.rb
|
147
|
-
- ports/archives/sqlite-autoconf-
|
148
|
-
- test/helper.rb
|
149
|
-
- test/test_backup.rb
|
150
|
-
- test/test_collation.rb
|
151
|
-
- test/test_database.rb
|
152
|
-
- test/test_database_flags.rb
|
153
|
-
- test/test_database_readonly.rb
|
154
|
-
- test/test_database_readwrite.rb
|
155
|
-
- test/test_deprecated.rb
|
156
|
-
- test/test_encoding.rb
|
157
|
-
- test/test_integration.rb
|
158
|
-
- test/test_integration_aggregate.rb
|
159
|
-
- test/test_integration_open_close.rb
|
160
|
-
- test/test_integration_pending.rb
|
161
|
-
- test/test_integration_resultset.rb
|
162
|
-
- test/test_integration_statement.rb
|
163
|
-
- test/test_result_set.rb
|
164
|
-
- test/test_sqlite3.rb
|
165
|
-
- test/test_statement.rb
|
166
|
-
- test/test_statement_execute.rb
|
79
|
+
- ports/archives/sqlite-autoconf-3460000.tar.gz
|
167
80
|
homepage: https://github.com/sparklemotion/sqlite3-ruby
|
168
81
|
licenses:
|
169
82
|
- BSD-3-Clause
|
@@ -175,7 +88,7 @@ metadata:
|
|
175
88
|
source_code_uri: https://github.com/sparklemotion/sqlite3-ruby
|
176
89
|
msys2_mingw_dependencies: sqlite3
|
177
90
|
rubygems_mfa_required: 'true'
|
178
|
-
post_install_message:
|
91
|
+
post_install_message:
|
179
92
|
rdoc_options:
|
180
93
|
- "--main"
|
181
94
|
- README.md
|
@@ -185,16 +98,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
98
|
requirements:
|
186
99
|
- - ">="
|
187
100
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
101
|
+
version: '3.0'
|
189
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
103
|
requirements:
|
191
104
|
- - ">="
|
192
105
|
- !ruby/object:Gem::Version
|
193
106
|
version: '0'
|
194
107
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
196
|
-
signing_key:
|
108
|
+
rubygems_version: 3.5.10
|
109
|
+
signing_key:
|
197
110
|
specification_version: 4
|
198
|
-
summary:
|
199
|
-
(http://www.sqlite.org)
|
111
|
+
summary: Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org).
|
200
112
|
test_files: []
|
data/API_CHANGES.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# API Changes
|
2
|
-
|
3
|
-
* SQLite3::Database#execute only accepts an array for bind parameters.
|
4
|
-
|
5
|
-
* SQLite3::ResultSet used to query the database for the first row, regardless
|
6
|
-
of whether the user asked for it or not. I have removed that so that rows
|
7
|
-
will not be returned until the user asks for them. This is a subtle but
|
8
|
-
sometimes important change in behavior.
|
9
|
-
|
10
|
-
83882d2208ed189361617d5ab8532a325aaf729d
|
11
|
-
|
12
|
-
* SQLite3::Database#trace now takes either a block or an object that responds
|
13
|
-
to "call". The previous implementation passed around a VALUE that was cast
|
14
|
-
to a void *. This is dangerous because the value could get garbage collected
|
15
|
-
before the proc was called. If the user wants data passed around with the
|
16
|
-
block, they should use variables available to the closure or create an
|
17
|
-
object.
|
18
|
-
|
19
|
-
* SQLite3::Statement#step automatically converts to ruby types, where before
|
20
|
-
all values were automatically yielded as strings. This will only be a
|
21
|
-
problem for people who were accessing information about the database that
|
22
|
-
wasn't previously passed through the pure ruby conversion code.
|
23
|
-
|
24
|
-
* SQLite3::Database#errmsg no longer takes a parameter to return error
|
25
|
-
messages as UTF-16. Do people even use that? I opt for staying UTF-8 when
|
26
|
-
possible. See test_integration.rb test_errmsg_utf16
|
27
|
-
|
28
|
-
* SQLite3::Database#authorize same changes as trace
|
29
|
-
|
30
|
-
* test/test_tc_database.rb was removed because we no longer use the Driver
|
31
|
-
design pattern.
|
32
|
-
|
33
|
-
# Garbage Collection Strategy
|
34
|
-
|
35
|
-
All statements keep pointers back to their respective database connections.
|
36
|
-
The @connection instance variable on the Statement handle keeps the database
|
37
|
-
connection alive. Memory allocated for a statement handler will be freed in
|
38
|
-
two cases:
|
39
|
-
|
40
|
-
* close is called on the statement
|
41
|
-
* The SQLite3::Database object gets garbage collected
|
42
|
-
|
43
|
-
We can't free the memory for the statement in the garbage collection function
|
44
|
-
for the statement handler. The reason is because there exists a race
|
45
|
-
condition. We cannot guarantee the order in which objects will be garbage
|
46
|
-
collected. So, it is possible that a connection and a statement are up for
|
47
|
-
garbage collection. If the database connection were to be free'd before the
|
48
|
-
statement, then boom. Instead we'll be conservative and free unclosed
|
49
|
-
statements when the connection is terminated.
|