Merge branch 'development'

This commit is contained in:
Gwendal Roué committed 2023-12-01 08:21:27 +01:00
commit eacbdf23af
6 files changed
+43 -9

No files matched your search

+7
View File
@@ -7,6 +7,7 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
#### 6.x Releases
- `6.23.x` Releases - [6.23.0](#6230)
- `6.22.x` Releases - [6.22.0](#6220)
- `6.21.x` Releases - [6.21.0](#6210)
- `6.20.x` Releases - [6.20.0](#6200) - [6.20.1](#6201) - [6.20.2](#6202)
@@ -120,6 +121,12 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
---
## 6.23.0
Released December 1, 2023
- **New**: [#1462](https://github.com/groue/GRDB.swift/pull/1462) Temporary read-only access
## 6.22.0
Released November 26, 2023
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'GRDB.swift'
s.version = '6.22.0'
s.version = '6.23.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A toolkit for SQLite databases, with a focus on application development.'
+32 -4
View File
@@ -60,6 +60,7 @@ let SQLITE_TRANSIENT = unsafeBitCast(OpaquePointer(bitPattern: -1), to: sqlite3_
/// - ``inSavepoint(_:)``
/// - ``inTransaction(_:_:)``
/// - ``isInsideTransaction``
/// - ``readOnly(_:)``
/// - ``rollback()``
/// - ``transactionDate``
/// - ``TransactionCompletion``
@@ -772,11 +773,38 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
}
}
/// Grants read-only access in the wrapped closure.
func readOnly<T>(_ block: () throws -> T) throws -> T {
/// Executes read-only database operations, and returns their result
/// after they have finished executing.
///
/// Attempts to write throw a ``DatabaseError`` with
/// resultCode `SQLITE_READONLY`.
///
/// For example:
///
/// ```swift
/// try dbQueue.write do { db in
/// // Write OK
/// try Player(...).insert(db)
///
/// try db.readOnly {
/// // Read OK
/// let players = try Player.fetchAll(db)
///
/// // Throws SQLITE_READONLY
/// try Player(...).insert(db)
/// }
/// }
/// ```
///
/// This method is reentrant.
///
/// - parameter value: A closure that reads from the database.
/// - throws: A ``DatabaseError`` whenever an SQLite error occurs, or the
/// error thrown by `value`.
public func readOnly<T>(_ value: () throws -> T) throws -> T {
try beginReadOnly()
return try throwingFirstError(
execute: block,
execute: value,
finally: endReadOnly)
}
@@ -1225,7 +1253,7 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
/// For example:
///
/// ```swift
/// try dbQueue.writeWithoutTransaction do {
/// try dbQueue.writeWithoutTransaction do { db in
/// try db.inTransaction {
/// try db.execute(sql: "INSERT ...")
/// return .commit
+1 -1
View File
@@ -15,7 +15,7 @@
<a href="https://github.com/groue/GRDB.swift/actions/workflows/CI.yml"><img alt="CI Status" src="https://github.com/groue/GRDB.swift/actions/workflows/CI.yml/badge.svg?branch=master"></a>
</p>
**Latest release**: November 26, 2023 • [version 6.22.0](https://github.com/groue/GRDB.swift/tree/v6.22.0) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 5 to GRDB 6](Documentation/GRDB6MigrationGuide.md)
**Latest release**: December 1, 2023 • [version 6.23.0](https://github.com/groue/GRDB.swift/tree/v6.23.0) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 5 to GRDB 6](Documentation/GRDB6MigrationGuide.md)
**Requirements**: iOS 11.0+ / macOS 10.13+ / tvOS 11.0+ / watchOS 4.0+ &bull; SQLite 3.19.3+ &bull; Swift 5.7+ / Xcode 14+
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>6.22.0</string>
<string>6.23.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+1 -2
View File
@@ -1,5 +1,5 @@
import XCTest
@testable import GRDB
import GRDB
class DatabaseTests : GRDBTestCase {
@@ -520,7 +520,6 @@ class DatabaseTests : GRDBTestCase {
}
}
// Test an internal API
func testReadOnly() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in