sqlite3 1.6.8 → 1.6.9

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: 4edc147f2c98a1e5411f949a9d229486eb467efe74f7858efb67db50fe056b08
4
- data.tar.gz: ec9c24173dffbfbc298343e1c95e5a84eba8d3ec90d92087ece26047e3aa0e3d
3
+ metadata.gz: 44cf9f498b2ad5a38a26dcfb8b1405ed92fccf4f331be3d910d48cc7b176d92c
4
+ data.tar.gz: 5856db0fd089afe701de5a3a4205e418e19b2f0fb734b7ed49bfb13bf7585769
5
5
  SHA512:
6
- metadata.gz: ae37be2054d191f3ca36fb3366d47bee75b1c19eba0d3152fa885197163544450439bab2a918acd7cc48db894110f38d422cd539eec460fce6ac8ce2a7661261
7
- data.tar.gz: 4b2f1c06083f9d8120905bcafd7ad28b70e12a7a0226288ed6f05580e97d2a0f17618c3ed2aebafde892887c98681334c5aa7089d1f39c0df35b2d22828ccafc
6
+ metadata.gz: 6016e63314ad5cf530d21aa8c08182ede4c1bf4734d83a36b925b304ababc0903becb2b43901f103c61b767fa35b4f4a1b6e35b77f1424039a22f8747ef8afd9
7
+ data.tar.gz: 4fefeab32c7a0c0060dc12330b398d5aeaec0972446b3dd65b63d76dfc6cd1bfa370af238d47a9b6d756e11192a20e8dfc639a4a757d7fdb3f657a7aef99715e
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"
@@ -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: ruby
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
  - !ruby/object:Gem::Dependency
17
17
  name: mini_portile2
@@ -81,7 +81,7 @@ files:
81
81
  - lib/sqlite3/translator.rb
82
82
  - lib/sqlite3/value.rb
83
83
  - lib/sqlite3/version.rb
84
- - ports/archives/sqlite-autoconf-3440000.tar.gz
84
+ - ports/archives/sqlite-autoconf-3440200.tar.gz
85
85
  - test/helper.rb
86
86
  - test/test_backup.rb
87
87
  - test/test_collation.rb