sqlite3 1.6.8-x86_64-linux → 1.6.9-x86_64-linux

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: d8933d98ae428405a8a78f1b895c23e1e01f16766f877e5ca3adbd7769546de1
4
- data.tar.gz: e70098251ff5d8b703f18f595dd41825abc5f1a478688ae69b9a616ed0f8ba06
3
+ metadata.gz: b58a006e571f04d7cd7633ed64ee5c5bb8d465f801f1f7947e3a23c8bfa4150b
4
+ data.tar.gz: 8b9c021c52c06ce56a320885f7b955cb121aaeaa0855a6ba13f0d6284e090c0a
5
5
  SHA512:
6
- metadata.gz: 40a77f4b8edb9c91c10354adb9ccf183dba2b5eac798837ba1ff2dc97c885422f55837e8bc0afc5dce18db1d292e15f0ad7a498cc97f6dcfe7ea039a3a56a394
7
- data.tar.gz: e330088c8a023ec2df272f3ad96b44f03966c994ccc5a051938ae2a8a156c95838e8f7f2ab3274f229d6e67bcb6bdcddc881522638d0f6268ef67107b44d3d6b
6
+ metadata.gz: 07c901962bb580460bbbdabebaeea2541e00d5f79c697d003c5572149c2a8ff9a9f827150c0811bb2c15fa1a7ad18a6d24c37b0f6c7ad5b020eb9d820c5941fa
7
+ data.tar.gz: c7551ad6fb479a050facb082a66fde32b9111db47530c25253e2a3f9a518d77f63a26bd3bf3b5443e71963691391f0eb8e4c6cf05267d11b7cdabcc41dd7cbd8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # sqlite3-ruby Changelog
2
2
 
3
+ ## 1.6.9 / 2023-11-26
4
+
5
+ ### Dependencies
6
+
7
+ - Vendored sqlite is update to [v3.44.2](https://sqlite.org/releaselog/3_44_2.html). @flavorjones
8
+
9
+ ### Added
10
+
11
+ - `Database.new` now accepts a `:default_transaction_mode` option (defaulting to `:deferred`), and `Database#transaction` no longer requires a transaction mode to be specified. This should allow higher-level adapters to more easily choose a transaction mode for a database connection. [#426] @masamitsu-murase
12
+
13
+
3
14
  ## 1.6.8 / 2023-11-01
4
15
 
5
16
  ### Dependencies
data/Gemfile CHANGED
@@ -5,6 +5,6 @@ gemspec
5
5
  gem("minitest", "5.20.0")
6
6
  gem("rake-compiler", "1.2.5")
7
7
  gem("rake-compiler-dock", "1.3.1")
8
- gem("rdoc", "6.5.0")
8
+ gem("rdoc", "6.6.0")
9
9
 
10
- gem("ruby_memcheck", "2.2.0") if Gem::Platform.local.os == "linux"
10
+ gem("ruby_memcheck", "2.2.1") if Gem::Platform.local.os == "linux"
data/dependencies.yml CHANGED
@@ -1,14 +1,14 @@
1
1
  # TODO: stop using symbols here once we no longer support Ruby 2.7 and can rely on symbolize_names
2
2
  :sqlite3:
3
3
  # checksum verified by first checking the published sha3(256) checksum against https://sqlite.org/download.html:
4
- # 6869046465eae886f1a9f2c8debeeba44d34328693aa77a5bd4a3cfed93d6556
4
+ # 6c427f0547e2f7babe636b748dd5d5a1f2f31601adadef7e2805e7d1f7171861
5
5
  #
6
- # $ sha3sum -a 256 ports/archives/sqlite-autoconf-3440000.tar.gz
7
- # 6869046465eae886f1a9f2c8debeeba44d34328693aa77a5bd4a3cfed93d6556 ports/archives/sqlite-autoconf-3440000.tar.gz
6
+ # $ sha3sum -a 256 ports/archives/sqlite-autoconf-3440200.tar.gz
7
+ # 6c427f0547e2f7babe636b748dd5d5a1f2f31601adadef7e2805e7d1f7171861 ports/archives/sqlite-autoconf-3440200.tar.gz
8
8
  #
9
- # $ sha256sum ports/archives/sqlite-autoconf-3440000.tar.gz
10
- # b9cd386e7cd22af6e0d2a0f06d0404951e1bef109e42ea06cc0450e10cd15550 ports/archives/sqlite-autoconf-3440000.tar.gz
11
- :version: "3.44.0"
9
+ # $ sha256sum ports/archives/sqlite-autoconf-3440200.tar.gz
10
+ # 1c6719a148bc41cf0f2bbbe3926d7ce3f5ca09d878f1246fcc20767b175bb407 ports/archives/sqlite-autoconf-3440200.tar.gz
11
+ :version: "3.44.2"
12
12
  :files:
13
- - :url: "https://sqlite.org/2023/sqlite-autoconf-3440000.tar.gz"
14
- :sha256: "b9cd386e7cd22af6e0d2a0f06d0404951e1bef109e42ea06cc0450e10cd15550"
13
+ - :url: "https://sqlite.org/2023/sqlite-autoconf-3440200.tar.gz"
14
+ :sha256: "1c6719a148bc41cf0f2bbbe3926d7ce3f5ca09d878f1246fcc20767b175bb407"
Binary file
Binary file
Binary file
Binary file
@@ -71,12 +71,23 @@ module SQLite3
71
71
 
72
72
  # call-seq: SQLite3::Database.new(file, options = {})
73
73
  #
74
- # Create a new Database object that opens the given file. If utf16
75
- # is +true+, the filename is interpreted as a UTF-16 encoded string.
74
+ # Create a new Database object that opens the given file.
75
+ #
76
+ # Supported permissions +options+:
77
+ # - the default mode is <tt>READWRITE | CREATE</tt>
78
+ # - +:readonly+: boolean (default false), true to set the mode to +READONLY+
79
+ # - +:readwrite+: boolean (default false), true to set the mode to +READWRITE+
80
+ # - +:flags+: set the mode to a combination of SQLite3::Constants::Open flags.
81
+ #
82
+ # Supported encoding +options+:
83
+ # - +:utf16+: boolean (default false), is the filename's encoding UTF-16 (only needed if the filename encoding is not UTF_16LE or BE)
84
+ #
85
+ # Other supported +options+:
86
+ # - +:strict+: boolean (default false), disallow the use of double-quoted string literals (see https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted)
87
+ # - +:results_as_hash+: boolean (default false), return rows as hashes instead of arrays
88
+ # - +:type_translation+: boolean (default false), enable type translation
89
+ # - +:default_transaction_mode+: one of +:deferred+ (default), +:immediate+, or +:exclusive+. If a mode is not specified in a call to #transaction, this will be the default transaction mode.
76
90
  #
77
- # By default, the new database will return result rows as arrays
78
- # (#results_as_hash) and has type translation disabled (#type_translation=).
79
-
80
91
  def initialize file, options = {}, zvfs = nil
81
92
  mode = Constants::Open::READWRITE | Constants::Open::CREATE
82
93
 
@@ -119,6 +130,7 @@ module SQLite3
119
130
  @type_translation = options[:type_translation]
120
131
  @type_translator = make_type_translator @type_translation
121
132
  @readonly = mode & Constants::Open::READONLY != 0
133
+ @default_transaction_mode = options[:default_transaction_mode] || :deferred
122
134
 
123
135
  if block_given?
124
136
  begin
@@ -622,8 +634,10 @@ module SQLite3
622
634
  # by SQLite, so attempting to nest a transaction will result in a runtime
623
635
  # exception.
624
636
  #
625
- # The +mode+ parameter may be either <tt>:deferred</tt> (the default),
637
+ # The +mode+ parameter may be either <tt>:deferred</tt>,
626
638
  # <tt>:immediate</tt>, or <tt>:exclusive</tt>.
639
+ # If `nil` is specified, the default transaction mode, which was
640
+ # passed to #initialize, is used.
627
641
  #
628
642
  # If a block is given, the database instance is yielded to it, and the
629
643
  # transaction is committed when the block terminates. If the block
@@ -634,7 +648,8 @@ module SQLite3
634
648
  # If a block is not given, it is the caller's responsibility to end the
635
649
  # transaction explicitly, either by calling #commit, or by calling
636
650
  # #rollback.
637
- def transaction( mode = :deferred )
651
+ def transaction( mode = nil )
652
+ mode = @default_transaction_mode if mode.nil?
638
653
  execute "begin #{mode.to_s} transaction"
639
654
 
640
655
  if block_given?
@@ -1,11 +1,11 @@
1
1
  module SQLite3
2
2
 
3
- VERSION = "1.6.8"
3
+ VERSION = "1.6.9"
4
4
 
5
5
  module VersionProxy
6
6
  MAJOR = 1
7
7
  MINOR = 6
8
- TINY = 8
8
+ TINY = 9
9
9
  BUILD = nil
10
10
 
11
11
  STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." )
@@ -624,5 +624,45 @@ module SQLite3
624
624
  db.execute("insert into foo values (?)", Float::INFINITY)
625
625
  assert_equal Float::INFINITY, db.execute("select avg(temperature) from foo").first.first
626
626
  end
627
+
628
+ def test_default_transaction_mode
629
+ tf = Tempfile.new 'database_default_transaction_mode'
630
+ SQLite3::Database.new(tf.path) do |db|
631
+ db.execute("create table foo (score int)")
632
+ db.execute("insert into foo values (?)", 1)
633
+ end
634
+
635
+ test_cases = [
636
+ {mode: nil, read: true, write: true},
637
+ {mode: :deferred, read: true, write: true},
638
+ {mode: :immediate, read: true, write: false},
639
+ {mode: :exclusive, read: false, write: false},
640
+ ]
641
+
642
+ test_cases.each do |item|
643
+ db = SQLite3::Database.new tf.path, default_transaction_mode: item[:mode]
644
+ db2 = SQLite3::Database.new tf.path
645
+ db.transaction do
646
+ sql_for_read_test = "select * from foo"
647
+ if item[:read]
648
+ assert_nothing_raised{ db2.execute(sql_for_read_test) }
649
+ else
650
+ assert_raises(SQLite3::BusyException){ db2.execute(sql_for_read_test) }
651
+ end
652
+
653
+ sql_for_write_test = "insert into foo values (2)"
654
+ if item[:write]
655
+ assert_nothing_raised{ db2.execute(sql_for_write_test) }
656
+ else
657
+ assert_raises(SQLite3::BusyException){ db2.execute(sql_for_write_test) }
658
+ end
659
+ end
660
+ ensure
661
+ db.close if db && !db.closed?
662
+ db2.close if db2 && !db2.closed?
663
+ end
664
+ ensure
665
+ tf.unlink if tf
666
+ end
627
667
  end
628
668
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.8
4
+ version: 1.6.9
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Jamis Buck
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2023-11-01 00:00:00.000000000 Z
14
+ date: 2023-11-26 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: |
17
17
  Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org). Precompiled