sqlite3 1.7.3 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +292 -0
  3. data/CONTRIBUTING.md +33 -7
  4. data/FAQ.md +43 -77
  5. data/INSTALLATION.md +14 -6
  6. data/LICENSE +18 -22
  7. data/README.md +97 -9
  8. data/dependencies.yml +10 -11
  9. data/ext/sqlite3/aggregator.c +142 -145
  10. data/ext/sqlite3/aggregator.h +2 -4
  11. data/ext/sqlite3/backup.c +74 -65
  12. data/ext/sqlite3/backup.h +2 -2
  13. data/ext/sqlite3/database.c +621 -493
  14. data/ext/sqlite3/database.h +13 -4
  15. data/ext/sqlite3/exception.c +116 -92
  16. data/ext/sqlite3/exception.h +5 -1
  17. data/ext/sqlite3/extconf.rb +33 -24
  18. data/ext/sqlite3/sqlite3.c +176 -115
  19. data/ext/sqlite3/sqlite3_ruby.h +2 -2
  20. data/ext/sqlite3/statement.c +553 -300
  21. data/ext/sqlite3/statement.h +4 -3
  22. data/ext/sqlite3/timespec.h +20 -0
  23. data/lib/sqlite3/constants.rb +195 -47
  24. data/lib/sqlite3/database.rb +223 -187
  25. data/lib/sqlite3/errors.rb +54 -1
  26. data/lib/sqlite3/fork_safety.rb +66 -0
  27. data/lib/sqlite3/pragmas.rb +140 -136
  28. data/lib/sqlite3/resultset.rb +14 -97
  29. data/lib/sqlite3/statement.rb +58 -13
  30. data/lib/sqlite3/value.rb +17 -20
  31. data/lib/sqlite3/version.rb +2 -21
  32. data/lib/sqlite3/version_info.rb +17 -0
  33. data/lib/sqlite3.rb +8 -4
  34. data/ports/archives/sqlite-autoconf-3470200.tar.gz +0 -0
  35. metadata +9 -37
  36. data/API_CHANGES.md +0 -49
  37. data/ChangeLog.cvs +0 -88
  38. data/Gemfile +0 -10
  39. data/LICENSE-DEPENDENCIES +0 -20
  40. data/lib/sqlite3/translator.rb +0 -117
  41. data/ports/archives/sqlite-autoconf-3450200.tar.gz +0 -0
  42. data/test/helper.rb +0 -27
  43. data/test/test_backup.rb +0 -33
  44. data/test/test_collation.rb +0 -82
  45. data/test/test_database.rb +0 -668
  46. data/test/test_database_flags.rb +0 -95
  47. data/test/test_database_readonly.rb +0 -36
  48. data/test/test_database_readwrite.rb +0 -41
  49. data/test/test_deprecated.rb +0 -49
  50. data/test/test_encoding.rb +0 -165
  51. data/test/test_integration.rb +0 -507
  52. data/test/test_integration_aggregate.rb +0 -336
  53. data/test/test_integration_open_close.rb +0 -30
  54. data/test/test_integration_pending.rb +0 -115
  55. data/test/test_integration_resultset.rb +0 -142
  56. data/test/test_integration_statement.rb +0 -194
  57. data/test/test_pragmas.rb +0 -22
  58. data/test/test_result_set.rb +0 -47
  59. data/test/test_sqlite3.rb +0 -30
  60. data/test/test_statement.rb +0 -290
  61. data/test/test_statement_execute.rb +0 -39
@@ -1,8 +1,7 @@
1
- require 'sqlite3/constants'
2
- require 'sqlite3/errors'
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,68 +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` which is deprecated and will be removed in sqlite3 version 2.0.0. Please call the `types` method on the SQLite3::ResultSet object that created this object.
24
- eowarn
25
- @types
26
- end
27
-
28
- def fields
29
- warn(<<-eowarn) if $VERBOSE
30
- #{caller[0]} is calling `#{self.class}#fields` which is deprecated and will be removed in sqlite3 version 2.0.0. Please call the `columns` method on the SQLite3::ResultSet object that created this object.
31
- eowarn
32
- @fields
33
- end
34
- end
35
-
36
- # The class of which we return an object in case we want a Hash as
37
- # result.
38
- class HashWithTypesAndFields < Hash # :nodoc:
39
- attr_writer :types
40
- attr_writer :fields
41
-
42
- def types
43
- warn(<<-eowarn) if $VERBOSE
44
- #{caller[0]} is calling `#{self.class}#types` which is deprecated and will be removed in sqlite3 version 2.0.0. Please call the `types` method on the SQLite3::ResultSet object that created this object.
45
- eowarn
46
- @types
47
- end
48
-
49
- def fields
50
- warn(<<-eowarn) if $VERBOSE
51
- #{caller[0]} is calling `#{self.class}#fields` which is deprecated and will be removed in sqlite3 version 2.0.0. Please call the `columns` method on the SQLite3::ResultSet object that created this object.
52
- eowarn
53
- @fields
54
- end
55
-
56
- def [] key
57
- key = fields[key] if key.is_a? Numeric
58
- super key
59
- end
60
- end
61
-
62
12
  # Create a new ResultSet attached to the given database, using the
63
13
  # given sql text.
64
14
  def initialize db, stmt
65
- @db = db
15
+ @db = db
66
16
  @stmt = stmt
67
17
  end
68
18
 
69
19
  # Reset the cursor, so that a result set which has reached end-of-file
70
20
  # can be rewound and reiterated.
71
- def reset( *bind_params )
21
+ def reset(*bind_params)
72
22
  @stmt.reset!
73
- @stmt.bind_params( *bind_params )
74
- @eof = false
23
+ @stmt.bind_params(*bind_params)
75
24
  end
76
25
 
77
26
  # Query whether the cursor has reached the end of the result set or not.
@@ -80,9 +29,7 @@ module SQLite3
80
29
  end
81
30
 
82
31
  # Obtain the next row from the cursor. If there are no more rows to be
83
- # had, this will return +nil+. If type translation is active on the
84
- # corresponding database, the values in the row will be translated
85
- # according to their types.
32
+ # had, this will return +nil+.
86
33
  #
87
34
  # The returned value will be an array, unless Database#results_as_hash has
88
35
  # been set to +true+, in which case the returned value will be a hash.
@@ -93,36 +40,13 @@ module SQLite3
93
40
  # For hashes, the column names are the keys of the hash, and the column
94
41
  # types are accessible via the +types+ property.
95
42
  def next
96
- if @db.results_as_hash
97
- return next_hash
98
- end
99
-
100
- row = @stmt.step
101
- return nil if @stmt.done?
102
-
103
- row = @db.translate_from_db @stmt.types, row
104
-
105
- if row.respond_to?(:fields)
106
- # FIXME: this can only happen if the translator returns something
107
- # that responds to `fields`. Since we're removing the translator
108
- # in 2.0, we can remove this branch in 2.0.
109
- row = ArrayWithTypes.new(row)
110
- else
111
- # FIXME: the `fields` and `types` methods are deprecated on this
112
- # object for version 2.0, so we can safely remove this branch
113
- # as well.
114
- row = ArrayWithTypesAndFields.new(row)
115
- end
116
-
117
- row.fields = @stmt.columns
118
- row.types = @stmt.types
119
- row
43
+ @stmt.step
120
44
  end
121
45
 
122
46
  # Required by the Enumerable mixin. Provides an internal iterator over the
123
47
  # rows of the result set.
124
48
  def each
125
- while node = self.next
49
+ while (node = self.next)
126
50
  yield node
127
51
  end
128
52
  end
@@ -130,7 +54,7 @@ module SQLite3
130
54
  # Provides an internal iterator over the rows of the result set where
131
55
  # each row is yielded as a hash.
132
56
  def each_hash
133
- while node = next_hash
57
+ while (node = next_hash)
134
58
  yield node
135
59
  end
136
60
  end
@@ -162,18 +86,11 @@ module SQLite3
162
86
  row = @stmt.step
163
87
  return nil if @stmt.done?
164
88
 
165
- # FIXME: type translation is deprecated, so this can be removed
166
- # in 2.0
167
- row = @db.translate_from_db @stmt.types, row
168
-
169
- # FIXME: this can be switched to a regular hash in 2.0
170
- row = HashWithTypesAndFields[*@stmt.columns.zip(row).flatten]
171
-
172
- # FIXME: these methods are deprecated for version 2.0, so we can remove
173
- # this code in 2.0
174
- row.fields = @stmt.columns
175
- row.types = @stmt.types
176
- row
89
+ @stmt.columns.zip(row).to_h
177
90
  end
178
91
  end
92
+
93
+ class HashResultSet < ResultSet # :nodoc:
94
+ alias_method :next, :next_hash
95
+ end
179
96
  end
@@ -1,9 +1,9 @@
1
- require 'sqlite3/errors'
2
- require 'sqlite3/resultset'
1
+ require "sqlite3/errors"
2
+ require "sqlite3/resultset"
3
3
 
4
4
  class String
5
5
  def to_blob
6
- SQLite3::Blob.new( self )
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( *bind_vars )
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( *bind_vars )
78
+ def execute(*bind_vars)
62
79
  reset! if active? || done?
63
80
 
64
81
  bind_params(*bind_vars) unless bind_vars.empty?
65
- @results = ResultSet.new(@connection, self)
82
+ results = @connection.build_result_set self
66
83
 
67
- step if 0 == column_count
84
+ step if column_count == 0
68
85
 
69
- yield @results if block_given?
70
- @results
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!( *bind_vars, &block )
104
+ def execute!(*bind_vars, &block)
88
105
  execute(*bind_vars)
89
- block_given? ? each(&block) : to_a
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
- return @columns
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.nil? ? nil : val.downcase
186
+ val&.downcase
142
187
  end
143
188
  end
144
189
  end
data/lib/sqlite3/value.rb CHANGED
@@ -1,11 +1,10 @@
1
- require 'sqlite3/constants'
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( db, handle )
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( @handle )
17
+ @driver.value_blob(@handle)
19
18
  end
20
19
 
21
- def length( utf16=false )
20
+ def length(utf16 = false)
22
21
  if utf16
23
- @driver.value_bytes16( @handle )
22
+ @driver.value_bytes16(@handle)
24
23
  else
25
- @driver.value_bytes( @handle )
24
+ @driver.value_bytes(@handle)
26
25
  end
27
26
  end
28
27
 
29
28
  def to_f
30
- @driver.value_double( @handle )
29
+ @driver.value_double(@handle)
31
30
  end
32
31
 
33
32
  def to_i
34
- @driver.value_int( @handle )
33
+ @driver.value_int(@handle)
35
34
  end
36
35
 
37
36
  def to_int64
38
- @driver.value_int64( @handle )
37
+ @driver.value_int64(@handle)
39
38
  end
40
39
 
41
- def to_s( utf16=false )
42
- @driver.value_text( @handle, utf16 )
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( @handle )
47
- when Constants::ColumnType::INTEGER then :int
48
- when Constants::ColumnType::FLOAT then :float
49
- when Constants::ColumnType::TEXT then :text
50
- when Constants::ColumnType::BLOB then :blob
51
- when Constants::ColumnType::NULL then :null
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
@@ -1,23 +1,4 @@
1
1
  module SQLite3
2
-
3
- VERSION = "1.7.3"
4
-
5
- module VersionProxy
6
- MAJOR = 1
7
- MINOR = 7
8
- TINY = 3
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
+ # (String) the version of the sqlite3 gem, e.g. "2.1.1"
3
+ VERSION = "2.5.0"
23
4
  end
@@ -0,0 +1,17 @@
1
+ module SQLite3
2
+ # a hash of descriptive metadata about the current version of the sqlite3 gem
3
+ VERSION_INFO = {
4
+ ruby: RUBY_DESCRIPTION,
5
+ gem: {
6
+ version: SQLite3::VERSION
7
+ },
8
+ sqlite: {
9
+ compiled: SQLite3::SQLITE_VERSION,
10
+ loaded: SQLite3::SQLITE_LOADED_VERSION,
11
+ packaged: SQLite3::SQLITE_PACKAGED_LIBRARIES,
12
+ precompiled: SQLite3::SQLITE_PRECOMPILED_LIBRARIES,
13
+ sqlcipher: SQLite3.sqlcipher?,
14
+ threadsafe: SQLite3.threadsafe?
15
+ }
16
+ }
17
+ end
data/lib/sqlite3.rb CHANGED
@@ -3,13 +3,17 @@ begin
3
3
  RUBY_VERSION =~ /(\d+\.\d+)/
4
4
  require "sqlite3/#{$1}/sqlite3_native"
5
5
  rescue LoadError
6
- require 'sqlite3/sqlite3_native'
6
+ require "sqlite3/sqlite3_native"
7
7
  end
8
8
 
9
- require 'sqlite3/database'
10
- require 'sqlite3/version'
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?; threadsafe > 0; end
14
+ def self.threadsafe?
15
+ threadsafe > 0
16
+ end
15
17
  end
18
+
19
+ require "sqlite3/version_info"
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 2.5.0
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:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2024-03-15 00:00:00.000000000 Z
13
+ date: 2024-12-25 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: mini_portile2
@@ -27,16 +26,13 @@ dependencies:
27
26
  - - "~>"
28
27
  - !ruby/object:Gem::Version
29
28
  version: 2.8.0
30
- force_ruby_platform: false
31
29
  description: |
32
30
  Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org). Precompiled
33
31
  binaries are available for common platforms for recent versions of Ruby.
34
- email:
35
32
  executables: []
36
33
  extensions:
37
34
  - ext/sqlite3/extconf.rb
38
35
  extra_rdoc_files:
39
- - API_CHANGES.md
40
36
  - CHANGELOG.md
41
37
  - README.md
42
38
  - ext/sqlite3/aggregator.c
@@ -47,15 +43,11 @@ extra_rdoc_files:
47
43
  - ext/sqlite3/statement.c
48
44
  files:
49
45
  - ".gemtest"
50
- - API_CHANGES.md
51
46
  - CHANGELOG.md
52
47
  - CONTRIBUTING.md
53
- - ChangeLog.cvs
54
48
  - FAQ.md
55
- - Gemfile
56
49
  - INSTALLATION.md
57
50
  - LICENSE
58
- - LICENSE-DEPENDENCIES
59
51
  - README.md
60
52
  - dependencies.yml
61
53
  - ext/sqlite3/aggregator.c
@@ -71,49 +63,30 @@ files:
71
63
  - ext/sqlite3/sqlite3_ruby.h
72
64
  - ext/sqlite3/statement.c
73
65
  - ext/sqlite3/statement.h
66
+ - ext/sqlite3/timespec.h
74
67
  - lib/sqlite3.rb
75
68
  - lib/sqlite3/constants.rb
76
69
  - lib/sqlite3/database.rb
77
70
  - lib/sqlite3/errors.rb
71
+ - lib/sqlite3/fork_safety.rb
78
72
  - lib/sqlite3/pragmas.rb
79
73
  - lib/sqlite3/resultset.rb
80
74
  - lib/sqlite3/statement.rb
81
- - lib/sqlite3/translator.rb
82
75
  - lib/sqlite3/value.rb
83
76
  - lib/sqlite3/version.rb
84
- - ports/archives/sqlite-autoconf-3450200.tar.gz
85
- - test/helper.rb
86
- - test/test_backup.rb
87
- - test/test_collation.rb
88
- - test/test_database.rb
89
- - test/test_database_flags.rb
90
- - test/test_database_readonly.rb
91
- - test/test_database_readwrite.rb
92
- - test/test_deprecated.rb
93
- - test/test_encoding.rb
94
- - test/test_integration.rb
95
- - test/test_integration_aggregate.rb
96
- - test/test_integration_open_close.rb
97
- - test/test_integration_pending.rb
98
- - test/test_integration_resultset.rb
99
- - test/test_integration_statement.rb
100
- - test/test_pragmas.rb
101
- - test/test_result_set.rb
102
- - test/test_sqlite3.rb
103
- - test/test_statement.rb
104
- - test/test_statement_execute.rb
77
+ - lib/sqlite3/version_info.rb
78
+ - ports/archives/sqlite-autoconf-3470200.tar.gz
105
79
  homepage: https://github.com/sparklemotion/sqlite3-ruby
106
80
  licenses:
107
81
  - BSD-3-Clause
108
82
  metadata:
109
83
  homepage_uri: https://github.com/sparklemotion/sqlite3-ruby
110
84
  bug_tracker_uri: https://github.com/sparklemotion/sqlite3-ruby/issues
111
- documentation_uri: https://www.rubydoc.info/gems/sqlite3
85
+ documentation_uri: https://sparklemotion.github.io/sqlite3-ruby/
112
86
  changelog_uri: https://github.com/sparklemotion/sqlite3-ruby/blob/master/CHANGELOG.md
113
87
  source_code_uri: https://github.com/sparklemotion/sqlite3-ruby
114
88
  msys2_mingw_dependencies: sqlite3
115
89
  rubygems_mfa_required: 'true'
116
- post_install_message:
117
90
  rdoc_options:
118
91
  - "--main"
119
92
  - README.md
@@ -123,15 +96,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
96
  requirements:
124
97
  - - ">="
125
98
  - !ruby/object:Gem::Version
126
- version: '2.7'
99
+ version: '3.1'
127
100
  required_rubygems_version: !ruby/object:Gem::Requirement
128
101
  requirements:
129
102
  - - ">="
130
103
  - !ruby/object:Gem::Version
131
104
  version: '0'
132
105
  requirements: []
133
- rubygems_version: 3.4.19
134
- signing_key:
106
+ rubygems_version: 3.6.2
135
107
  specification_version: 4
136
108
  summary: Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org).
137
109
  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.