mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
Merge pull request #1634 from groue/dev/GRDB7-bump-requirements
GRDB 7: Bump requirements (again)
This commit is contained in:
88 files changed
+554
-1083
No files matched your search
+3
-3
@@ -10,10 +10,10 @@ Pod::Spec.new do |s|
|
||||
s.module_name = 'GRDB'
|
||||
|
||||
s.swift_versions = ['5.10']
|
||||
s.ios.deployment_target = '12.0'
|
||||
s.osx.deployment_target = '10.13'
|
||||
s.ios.deployment_target = '13.0'
|
||||
s.osx.deployment_target = '10.15'
|
||||
s.watchos.deployment_target = '7.0'
|
||||
s.tvos.deployment_target = '12.0'
|
||||
s.tvos.deployment_target = '13.0'
|
||||
s.default_subspec = 'standard'
|
||||
|
||||
s.subspec 'standard' do |ss|
|
||||
|
||||
@@ -492,17 +492,15 @@ extension Database {
|
||||
// and throws the user-provided cancelled commit error.
|
||||
try observationBroker?.statementDidFail(statement)
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
switch ResultCode(rawValue: resultCode) {
|
||||
case .SQLITE_INTERRUPT, .SQLITE_ABORT:
|
||||
if suspensionMutex.load().isCancelled {
|
||||
// The only error that a user sees when a Task is cancelled
|
||||
// is CancellationError.
|
||||
throw CancellationError()
|
||||
}
|
||||
default:
|
||||
break
|
||||
switch ResultCode(rawValue: resultCode) {
|
||||
case .SQLITE_INTERRUPT, .SQLITE_ABORT:
|
||||
if suspensionMutex.load().isCancelled {
|
||||
// The only error that a user sees when a Task is cancelled
|
||||
// is CancellationError.
|
||||
throw CancellationError()
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
// Throw statement failure
|
||||
@@ -554,19 +552,7 @@ struct StatementCache {
|
||||
// > time and probably reused many times.
|
||||
//
|
||||
// This looks like a perfect match for cached statements.
|
||||
//
|
||||
// However SQLITE_PREPARE_PERSISTENT was only introduced in
|
||||
// SQLite 3.20.0 http://www.sqlite.org/changes.html#version_3_20
|
||||
#if GRDBCUSTOMSQLITE || GRDBCIPHER
|
||||
let statement = try db.makeStatement(sql: sql, prepFlags: CUnsignedInt(SQLITE_PREPARE_PERSISTENT))
|
||||
#else
|
||||
let statement: Statement
|
||||
if #available(macOS 10.14, *) { // SQLite 3.20+
|
||||
statement = try db.makeStatement(sql: sql, prepFlags: CUnsignedInt(SQLITE_PREPARE_PERSISTENT))
|
||||
} else {
|
||||
statement = try db.makeStatement(sql: sql)
|
||||
}
|
||||
#endif
|
||||
statements[sql] = statement
|
||||
return statement
|
||||
}
|
||||
|
||||
@@ -1199,7 +1199,6 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
/// will throw `CancellationError`, until `uncancel()` is called.
|
||||
///
|
||||
/// This method can be called from any thread.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func cancel() {
|
||||
let needsInterrupt = suspensionMutex.withLock { suspension in
|
||||
if suspension.isCancelled {
|
||||
@@ -1216,7 +1215,6 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
}
|
||||
|
||||
/// Undo `cancel()`.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func uncancel() {
|
||||
suspensionMutex.withLock {
|
||||
$0.isCancelled = false
|
||||
@@ -1320,12 +1318,7 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
break
|
||||
|
||||
case .cancel:
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
throw CancellationError()
|
||||
} else {
|
||||
// GRDB bug: cancellation is a Swift concurrency feature
|
||||
fatalError("Can't cancel without support for Swift concurrency")
|
||||
}
|
||||
throw CancellationError()
|
||||
|
||||
case .abort:
|
||||
// Attempt at releasing an eventual lock with ROLLBACk,
|
||||
|
||||
@@ -351,7 +351,6 @@ extension DatabasePool: DatabaseReader {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func read<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -436,7 +435,6 @@ extension DatabasePool: DatabaseReader {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func unsafeRead<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -803,7 +801,6 @@ extension DatabasePool: DatabaseWriter {
|
||||
try writer.sync(updates)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func writeWithoutTransaction<T: Sendable>(
|
||||
_ updates: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -820,7 +817,6 @@ extension DatabasePool: DatabaseWriter {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func barrierWriteWithoutTransaction<T: Sendable>(
|
||||
_ updates: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#if canImport(Combine)
|
||||
/// A namespace for database Combine publishers.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public enum DatabasePublishers { }
|
||||
#endif
|
||||
@@ -233,7 +233,6 @@ extension DatabaseQueue: DatabaseReader {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func read<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -272,7 +271,6 @@ extension DatabaseQueue: DatabaseReader {
|
||||
try writer.sync(value)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func unsafeRead<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -386,7 +384,6 @@ extension DatabaseQueue: DatabaseWriter {
|
||||
try writer.sync(updates)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func writeWithoutTransaction<T: Sendable>(
|
||||
_ updates: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -398,7 +395,6 @@ extension DatabaseQueue: DatabaseWriter {
|
||||
try writer.sync(updates)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func barrierWriteWithoutTransaction<T: Sendable>(
|
||||
_ updates: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
|
||||
@@ -216,7 +216,6 @@ public protocol DatabaseReader: AnyObject, Sendable {
|
||||
/// - throws: Any ``DatabaseError`` that happens while establishing the
|
||||
/// database access, or the error thrown by `value`, or
|
||||
/// `CancellationError` if the task is cancelled.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func read<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T
|
||||
@@ -323,7 +322,6 @@ public protocol DatabaseReader: AnyObject, Sendable {
|
||||
/// - throws: Any ``DatabaseError`` that happens while establishing the
|
||||
/// database access, or the error thrown by `value`, or
|
||||
/// `CancellationError` if the task is cancelled.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func unsafeRead<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T
|
||||
@@ -535,7 +533,6 @@ extension DatabaseReader {
|
||||
///
|
||||
/// - parameter scheduler: A Combine Scheduler.
|
||||
/// - parameter value: A closure which accesses the database.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func readPublisher<Output>(
|
||||
receiveOn scheduler: some Combine.Scheduler = DispatchQueue.main,
|
||||
value: @escaping @Sendable (Database) throws -> Output
|
||||
@@ -550,7 +547,6 @@ extension DatabaseReader {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension DatabasePublishers {
|
||||
/// A publisher that reads from the database.
|
||||
///
|
||||
@@ -569,7 +565,6 @@ extension DatabasePublishers {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Publisher where Failure == Error {
|
||||
fileprivate func eraseToReadPublisher() -> DatabasePublishers.Read<Output> {
|
||||
.init(upstream: eraseToAnyPublisher())
|
||||
@@ -660,7 +655,6 @@ extension AnyDatabaseReader: DatabaseReader {
|
||||
try base.read(value)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func read<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -678,7 +672,6 @@ extension AnyDatabaseReader: DatabaseReader {
|
||||
try base.unsafeRead(value)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func unsafeRead<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
|
||||
@@ -128,7 +128,6 @@ extension DatabaseRegionObservation {
|
||||
}
|
||||
|
||||
#if canImport(Combine)
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension DatabaseRegionObservation {
|
||||
// MARK: - Publishing Impactful Transactions
|
||||
|
||||
@@ -140,7 +139,6 @@ extension DatabaseRegionObservation {
|
||||
///
|
||||
/// Do not reschedule the publisher with `receive(on:options:)` or any
|
||||
/// `Publisher` method that schedules publisher elements.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func publisher(in writer: some DatabaseWriter) -> DatabasePublishers.DatabaseRegion {
|
||||
DatabasePublishers.DatabaseRegion(self, in: writer)
|
||||
}
|
||||
@@ -186,7 +184,6 @@ private class DatabaseRegionObserver: TransactionObserver {
|
||||
}
|
||||
|
||||
#if canImport(Combine)
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension DatabasePublishers {
|
||||
/// A publisher that tracks transactions that modify a database region.
|
||||
///
|
||||
|
||||
@@ -151,7 +151,6 @@ extension DatabaseSnapshot: DatabaseSnapshotReader {
|
||||
try reader.sync(block)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func read<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -173,7 +172,6 @@ extension DatabaseSnapshot: DatabaseSnapshotReader {
|
||||
// We can't provide this as a default implementation in
|
||||
// `DatabaseSnapshotReader`, because of
|
||||
// <https://github.com/apple/swift/issues/74469>.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func unsafeRead<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
|
||||
@@ -293,7 +293,6 @@ extension DatabaseSnapshotPool: DatabaseSnapshotReader {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func read<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -353,7 +352,6 @@ extension DatabaseSnapshotPool: DatabaseSnapshotReader {
|
||||
// We can't provide this as a default implementation in
|
||||
// `DatabaseSnapshotReader`, because of
|
||||
// <https://github.com/apple/swift/issues/74469>.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func unsafeRead<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
|
||||
@@ -131,7 +131,6 @@ public protocol DatabaseWriter: DatabaseReader {
|
||||
/// - throws: Any ``DatabaseError`` that happens while establishing the
|
||||
/// database access, or the error thrown by `updates`, or
|
||||
/// `CancellationError` if the task is cancelled.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func writeWithoutTransaction<T: Sendable>(
|
||||
_ updates: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T
|
||||
@@ -217,7 +216,6 @@ public protocol DatabaseWriter: DatabaseReader {
|
||||
/// - throws: Any ``DatabaseError`` that happens while establishing the
|
||||
/// database access, or the error thrown by `updates`, or
|
||||
/// `CancellationError` if the task is cancelled.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func barrierWriteWithoutTransaction<T: Sendable>(
|
||||
_ updates: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T
|
||||
@@ -649,7 +647,6 @@ extension DatabaseWriter {
|
||||
/// - throws: Any ``DatabaseError`` that happens while establishing the
|
||||
/// database access, or the error thrown by `updates`, or
|
||||
/// `CancellationError` if the task is cancelled.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func write<T: Sendable>(
|
||||
_ updates: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -666,7 +663,6 @@ extension DatabaseWriter {
|
||||
/// Erase the database: delete all content, drop all tables, etc.
|
||||
///
|
||||
/// - note: [**🔥 EXPERIMENTAL**](https://github.com/groue/GRDB.swift/blob/master/README.md#what-are-experimental-features)
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func erase() async throws {
|
||||
try await writeWithoutTransaction { try $0.erase() }
|
||||
}
|
||||
@@ -677,7 +673,6 @@ extension DatabaseWriter {
|
||||
/// - note: [**🔥 EXPERIMENTAL**](https://github.com/groue/GRDB.swift/blob/master/README.md#what-are-experimental-features)
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html>
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func vacuum() async throws {
|
||||
try await writeWithoutTransaction { try $0.execute(sql: "VACUUM") }
|
||||
}
|
||||
@@ -694,7 +689,6 @@ extension DatabaseWriter {
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html#vacuuminto>
|
||||
///
|
||||
/// - Parameter filePath: file path for new database
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func vacuum(into filePath: String) async throws {
|
||||
try await writeWithoutTransaction {
|
||||
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
|
||||
@@ -709,7 +703,6 @@ extension DatabaseWriter {
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html#vacuuminto>
|
||||
///
|
||||
/// - Parameter filePath: file path for new database
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func vacuum(into filePath: String) async throws {
|
||||
try await writeWithoutTransaction {
|
||||
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
|
||||
@@ -754,7 +747,6 @@ extension DatabaseWriter {
|
||||
///
|
||||
/// - parameter scheduler: A Combine Scheduler.
|
||||
/// - parameter updates: A closure which accesses the database.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func writePublisher<Output>(
|
||||
receiveOn scheduler: some Combine.Scheduler = DispatchQueue.main,
|
||||
updates: @escaping @Sendable (Database) throws -> Output
|
||||
@@ -818,7 +810,6 @@ extension DatabaseWriter {
|
||||
/// - parameter scheduler: A Combine Scheduler.
|
||||
/// - parameter updates: A closure which writes in the database.
|
||||
/// - parameter value: A closure which reads from the database.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func writePublisher<T: Sendable, Output>(
|
||||
receiveOn scheduler: some Combine.Scheduler = DispatchQueue.main,
|
||||
updates: @escaping @Sendable (Database) throws -> T,
|
||||
@@ -848,7 +839,6 @@ extension DatabaseWriter {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension DatabasePublishers {
|
||||
/// A publisher that writes into the database.
|
||||
///
|
||||
@@ -867,7 +857,6 @@ extension DatabasePublishers {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Publisher where Failure == Error {
|
||||
fileprivate func eraseToWritePublisher() -> DatabasePublishers.Write<Output> {
|
||||
.init(upstream: self.eraseToAnyPublisher())
|
||||
@@ -911,7 +900,6 @@ extension AnyDatabaseWriter: DatabaseReader {
|
||||
try base.read(value)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func read<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -929,7 +917,6 @@ extension AnyDatabaseWriter: DatabaseReader {
|
||||
try base.unsafeRead(value)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func unsafeRead<T: Sendable>(
|
||||
_ value: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -964,7 +951,6 @@ extension AnyDatabaseWriter: DatabaseWriter {
|
||||
try base.writeWithoutTransaction(updates)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func writeWithoutTransaction<T: Sendable>(
|
||||
_ updates: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -976,7 +962,6 @@ extension AnyDatabaseWriter: DatabaseWriter {
|
||||
try base.barrierWriteWithoutTransaction(updates)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func barrierWriteWithoutTransaction<T: Sendable>(
|
||||
_ updates: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
|
||||
@@ -244,7 +244,6 @@ final class SerializedDatabase {
|
||||
}
|
||||
|
||||
/// Asynchrously executes the block.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func execute<T: Sendable>(
|
||||
_ block: @escaping @Sendable (Database) throws -> T
|
||||
) async throws -> T {
|
||||
@@ -309,7 +308,6 @@ extension SerializedDatabase: @unchecked Sendable { }
|
||||
|
||||
// MARK: - Task Cancellation Support
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
enum DatabaseAccessCancellationState: @unchecked Sendable {
|
||||
// @unchecked Sendable because database is only accessed from its
|
||||
// dispatch queue.
|
||||
@@ -319,7 +317,6 @@ enum DatabaseAccessCancellationState: @unchecked Sendable {
|
||||
case expired
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
typealias CancellableDatabaseAccess = Mutex<DatabaseAccessCancellationState>
|
||||
|
||||
/// Supports Task cancellation in async database accesses.
|
||||
@@ -341,7 +338,6 @@ typealias CancellableDatabaseAccess = Mutex<DatabaseAccessCancellationState>
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension CancellableDatabaseAccess: DatabaseCancellable {
|
||||
convenience init() {
|
||||
self.init(.notConnected)
|
||||
|
||||
@@ -139,21 +139,9 @@ public final class Statement {
|
||||
authorizer.reset()
|
||||
|
||||
var sqliteStatement: SQLiteStatement? = nil
|
||||
let code: CInt
|
||||
// sqlite3_prepare_v3 was introduced in SQLite 3.20.0 http://www.sqlite.org/changes.html#version_3_20
|
||||
#if GRDBCUSTOMSQLITE || GRDBCIPHER
|
||||
code = sqlite3_prepare_v3(
|
||||
let code = sqlite3_prepare_v3(
|
||||
database.sqliteConnection, statementStart, -1, prepFlags,
|
||||
&sqliteStatement, statementEnd)
|
||||
#else
|
||||
if #available(macOS 10.14, tvOS 12, *) { // SQLite 3.20+
|
||||
code = sqlite3_prepare_v3(
|
||||
database.sqliteConnection, statementStart, -1, prepFlags,
|
||||
&sqliteStatement, statementEnd)
|
||||
} else {
|
||||
code = sqlite3_prepare_v2(database.sqliteConnection, statementStart, -1, &sqliteStatement, statementEnd)
|
||||
}
|
||||
#endif
|
||||
|
||||
guard code == SQLITE_OK else {
|
||||
throw DatabaseError(
|
||||
|
||||
@@ -52,9 +52,7 @@ public struct JSONDumpFormat: Sendable {
|
||||
public static var defaultEncoder: JSONEncoder {
|
||||
// This encoder MUST NOT CHANGE, because some people rely on this format.
|
||||
let encoder = JSONEncoder()
|
||||
if #available(iOS 13.0, macOS 10.15, tvOS 13.0, *) {
|
||||
encoder.outputFormatting = .withoutEscapingSlashes
|
||||
}
|
||||
encoder.outputFormatting = .withoutEscapingSlashes
|
||||
encoder.nonConformingFloatEncodingStrategy = .convertToString(
|
||||
positiveInfinity: "inf",
|
||||
negativeInfinity: "-inf",
|
||||
|
||||
@@ -117,46 +117,6 @@ public struct FTS5 {
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/fts5.html#extending_fts5>
|
||||
public static func api(_ db: Database) -> UnsafePointer<fts5_api> {
|
||||
// Access to FTS5 is one of the rare SQLite api which was broken in
|
||||
// SQLite 3.20.0+, for security reasons:
|
||||
//
|
||||
// Starting SQLite 3.20.0+, we need to use the new sqlite3_bind_pointer api.
|
||||
// The previous way to access FTS5 does not work any longer.
|
||||
//
|
||||
// So let's see which SQLite version we are linked against:
|
||||
|
||||
#if GRDBCUSTOMSQLITE || GRDBCIPHER
|
||||
// GRDB is linked against SQLCipher or a custom SQLite build: SQLite 3.20.0 or more.
|
||||
return api_v2(db, sqlite3_prepare_v3, sqlite3_bind_pointer)
|
||||
#else
|
||||
// GRDB is linked against the system SQLite.
|
||||
if #available(macOS 10.14, tvOS 12, *) { // SQLite 3.20+
|
||||
return api_v2(db, sqlite3_prepare_v3, sqlite3_bind_pointer)
|
||||
} else {
|
||||
return api_v1(db)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private static func api_v1(_ db: Database) -> UnsafePointer<fts5_api> {
|
||||
guard let data = try! Data.fetchOne(db, sql: "SELECT fts5()") else {
|
||||
fatalError("FTS5 is not available")
|
||||
}
|
||||
return data.withUnsafeBytes {
|
||||
$0.bindMemory(to: UnsafePointer<fts5_api>.self).first!
|
||||
}
|
||||
}
|
||||
|
||||
// Technique given by Jordan Rose:
|
||||
// https://forums.swift.org/t/c-interoperability-combinations-of-library-and-os-versions/14029/4
|
||||
private static func api_v2(
|
||||
_ db: Database,
|
||||
// swiftlint:disable:next line_length
|
||||
_ sqlite3_prepare_v3: @convention(c) (OpaquePointer?, UnsafePointer<CChar>?, CInt, CUnsignedInt, UnsafeMutablePointer<OpaquePointer?>?, UnsafeMutablePointer<UnsafePointer<CChar>?>?) -> CInt,
|
||||
// swiftlint:disable:next line_length
|
||||
_ sqlite3_bind_pointer: @convention(c) (OpaquePointer?, CInt, UnsafeMutableRawPointer?, UnsafePointer<CChar>?, (@convention(c) (UnsafeMutableRawPointer?) -> Void)?) -> CInt)
|
||||
-> UnsafePointer<fts5_api>
|
||||
{
|
||||
var statement: SQLiteStatement? = nil
|
||||
var api: UnsafePointer<fts5_api>? = nil
|
||||
let type: StaticString = "fts5_api_ptr"
|
||||
|
||||
@@ -119,7 +119,6 @@ extension PersistableRecord {
|
||||
public func performSave(_ db: Database) throws { preconditionFailure() }
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension QueryInterfaceRequest where RowDecoder: Identifiable, RowDecoder.ID: DatabaseValueConvertible {
|
||||
@available(*, unavailable, message: "selectID() has been removed. You may use selectPrimaryKey(as:) instead.")
|
||||
public func selectID() -> QueryInterfaceRequest<RowDecoder.ID> { preconditionFailure() }
|
||||
@@ -144,13 +143,11 @@ extension SelectionRequest {
|
||||
@available(*, unavailable, renamed: "SQLExpression.AssociativeBinaryOperator")
|
||||
public typealias SQLAssociativeBinaryOperator = SQLExpression.AssociativeBinaryOperator
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Table where RowDecoder: Identifiable, RowDecoder.ID: DatabaseValueConvertible {
|
||||
@available(*, unavailable, message: "selectID() has been removed. You may use selectPrimaryKey(as:) instead.")
|
||||
public func selectID() -> QueryInterfaceRequest<RowDecoder.ID> { preconditionFailure() }
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
|
||||
@available(*, unavailable, message: "selectID() has been removed. You may use selectPrimaryKey(as:) instead.")
|
||||
public static func selectID() -> QueryInterfaceRequest<ID> { preconditionFailure() }
|
||||
|
||||
@@ -312,7 +312,7 @@ extension SQLJSONExpressible {
|
||||
/// Related SQL documentation: <https://www.sqlite.org/json1.html#jex>
|
||||
///
|
||||
/// - parameter path: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public func jsonExtract(atPath path: some SQLExpressible) -> SQLExpression {
|
||||
Database.jsonExtract(self, atPath: path)
|
||||
}
|
||||
@@ -334,7 +334,7 @@ extension SQLJSONExpressible {
|
||||
/// Related SQL documentation: <https://www.sqlite.org/json1.html#jex>
|
||||
///
|
||||
/// - parameter paths: A collection of [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public func jsonExtract(
|
||||
atPaths paths: some Collection<some SQLExpressible>
|
||||
) -> SQLExpression {
|
||||
@@ -385,7 +385,7 @@ extension SQLJSONExpressible {
|
||||
// /// ```
|
||||
// ///
|
||||
// /// Related SQLite documentation: <https://www.sqlite.org/json1.html#jpatch>
|
||||
// @available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
// @available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
// public func jsonPatch(
|
||||
// with patch: some SQLExpressible)
|
||||
// -> ColumnAssignment
|
||||
@@ -408,7 +408,7 @@ extension SQLJSONExpressible {
|
||||
// ///
|
||||
// /// - Parameters:
|
||||
// /// - paths: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
// @available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
// @available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
// public func jsonRemove(atPath path: some SQLExpressible) -> ColumnAssignment {
|
||||
// .init(columnName: name, value: Database.jsonRemove(self, atPath: path))
|
||||
// }
|
||||
@@ -428,7 +428,7 @@ extension SQLJSONExpressible {
|
||||
// ///
|
||||
// /// - Parameters:
|
||||
// /// - paths: A collection of [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
// @available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
// @available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
// public func jsonRemove(
|
||||
// atPaths paths: some Collection<some SQLExpressible>
|
||||
// ) -> ColumnAssignment {
|
||||
|
||||
@@ -431,7 +431,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jmini>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func json(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON", [value.sqlExpression])
|
||||
}
|
||||
@@ -446,7 +446,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jarray>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonArray(
|
||||
_ values: some Collection<some SQLExpressible>
|
||||
) -> SQLExpression {
|
||||
@@ -463,7 +463,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jarray>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonArray(
|
||||
_ values: some Collection<any SQLExpressible>
|
||||
) -> SQLExpression {
|
||||
@@ -481,7 +481,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jarraylen>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonArrayLength(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_ARRAY_LENGTH", [value.sqlExpression])
|
||||
}
|
||||
@@ -501,7 +501,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON array.
|
||||
/// - path: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonArrayLength(
|
||||
_ value: some SQLExpressible,
|
||||
atPath path: some SQLExpressible)
|
||||
@@ -524,7 +524,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - path: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonExtract(_ value: some SQLExpressible, atPath path: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_EXTRACT", [value.sqlExpression, path.sqlExpression])
|
||||
}
|
||||
@@ -543,7 +543,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - paths: A collection of [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonExtract(
|
||||
_ value: some SQLExpressible,
|
||||
atPaths paths: some Collection<some SQLExpressible>
|
||||
@@ -566,7 +566,7 @@ extension Database {
|
||||
/// - value: A JSON value.
|
||||
/// - assignments: A collection of key/value pairs, where keys are
|
||||
/// [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonInsert(
|
||||
_ value: some SQLExpressible,
|
||||
_ assignments: some Collection<(key: String, value: any SQLExpressible)>
|
||||
@@ -591,7 +591,7 @@ extension Database {
|
||||
/// - value: A JSON value.
|
||||
/// - assignments: A collection of key/value pairs, where keys are
|
||||
/// [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonReplace(
|
||||
_ value: some SQLExpressible,
|
||||
_ assignments: some Collection<(key: String, value: any SQLExpressible)>
|
||||
@@ -616,7 +616,7 @@ extension Database {
|
||||
/// - value: A JSON value.
|
||||
/// - assignments: A collection of key/value pairs, where keys are
|
||||
/// [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonSet(
|
||||
_ value: some SQLExpressible,
|
||||
_ assignments: some Collection<(key: String, value: any SQLExpressible)>
|
||||
@@ -649,7 +649,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jobj>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonObject(
|
||||
_ elements: some Collection<(key: String, value: any SQLExpressible)>
|
||||
) -> SQLExpression {
|
||||
@@ -668,7 +668,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jpatch>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonPatch(
|
||||
_ value: some SQLExpressible,
|
||||
with patch: some SQLExpressible)
|
||||
@@ -691,7 +691,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - path: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonRemove(_ value: some SQLExpressible, atPath path: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_REMOVE", [value.sqlExpression, path.sqlExpression])
|
||||
}
|
||||
@@ -710,7 +710,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - paths: A collection of [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonRemove(
|
||||
_ value: some SQLExpressible,
|
||||
atPaths paths: some Collection<some SQLExpressible>
|
||||
@@ -728,7 +728,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jtype>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonType(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_TYPE", [value.sqlExpression])
|
||||
}
|
||||
@@ -747,7 +747,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - path: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonType(_ value: some SQLExpressible, atPath path: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_TYPE", [value.sqlExpression, path.sqlExpression])
|
||||
}
|
||||
@@ -762,7 +762,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jvalid>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonIsValid(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_VALID", [value.sqlExpression])
|
||||
}
|
||||
@@ -780,7 +780,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jquote>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonQuote(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_QUOTE", [value.sqlExpression.jsonBuilderExpression])
|
||||
}
|
||||
@@ -798,7 +798,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jgrouparray>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonGroupArray(
|
||||
_ value: some SQLExpressible,
|
||||
filter: (any SQLSpecificExpressible)? = nil)
|
||||
@@ -828,7 +828,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jgrouparray>
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
public static func jsonGroupObject(
|
||||
key: some SQLExpressible,
|
||||
value: some SQLExpressible,
|
||||
|
||||
@@ -496,7 +496,6 @@ extension DatabaseMigrator {
|
||||
/// - parameter writer: A DatabaseWriter.
|
||||
/// where migrations should apply.
|
||||
/// - parameter scheduler: A Combine Scheduler.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func migratePublisher(
|
||||
_ writer: some DatabaseWriter,
|
||||
receiveOn scheduler: some Combine.Scheduler = DispatchQueue.main)
|
||||
@@ -514,7 +513,6 @@ extension DatabaseMigrator {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension DatabasePublishers {
|
||||
/// A publisher that migrates a database.
|
||||
///
|
||||
|
||||
@@ -646,7 +646,6 @@ extension QueryInterfaceRequest {
|
||||
/// - parameter db: A database connection.
|
||||
/// - returns: A set of deleted ids.
|
||||
/// - throws: A ``DatabaseError`` whenever an SQLite error occurs.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *) // Identifiable
|
||||
public func deleteAndFetchIds(_ db: Database)
|
||||
throws -> Set<RowDecoder.ID>
|
||||
where RowDecoder: TableRecord & Identifiable,
|
||||
|
||||
@@ -631,7 +631,6 @@ extension TableRequest where Self: FilteredRequest, Self: TypedRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension TableRequest
|
||||
where Self: FilteredRequest,
|
||||
Self: TypedRequest,
|
||||
|
||||
@@ -2106,7 +2106,7 @@ extension SQLExpression {
|
||||
}
|
||||
}
|
||||
#else
|
||||
@available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
@available(iOS 16, tvOS 17, watchOS 9, *) // SQLite 3.38+ with exceptions for macOS
|
||||
/// Returns an expression suitable in JSON building contexts.
|
||||
var jsonBuilderExpression: SQLExpression {
|
||||
switch preferredJSONInterpretation {
|
||||
|
||||
@@ -722,7 +722,6 @@ extension Table {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Table where RowDecoder: Identifiable, RowDecoder.ID: DatabaseValueConvertible {
|
||||
/// Returns a request filtered by primary key.
|
||||
///
|
||||
@@ -1545,7 +1544,6 @@ extension Table {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Table
|
||||
where RowDecoder: Identifiable,
|
||||
RowDecoder.ID: DatabaseValueConvertible
|
||||
@@ -1686,7 +1684,6 @@ extension Table {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Table
|
||||
where RowDecoder: Identifiable,
|
||||
RowDecoder.ID: DatabaseValueConvertible
|
||||
|
||||
@@ -129,7 +129,6 @@ public final class TableAlteration {
|
||||
///
|
||||
/// - parameter name: the old name of the column.
|
||||
/// - parameter newName: the new name of the column.
|
||||
@available(iOS 13, tvOS 13, *) // SQLite 3.25+
|
||||
public func rename(column name: String, to newName: String) {
|
||||
_rename(column: name, to: newName)
|
||||
}
|
||||
|
||||
@@ -604,7 +604,6 @@ extension TableRecord {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
|
||||
/// Returns a request filtered by primary key.
|
||||
///
|
||||
|
||||
@@ -216,7 +216,6 @@ extension FetchableRecord where Self: TableRecord {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension FetchableRecord where Self: TableRecord & Identifiable, ID: DatabaseValueConvertible {
|
||||
|
||||
// MARK: Fetching by Single-Column Primary Key
|
||||
@@ -358,7 +357,6 @@ extension FetchableRecord where Self: TableRecord & Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension FetchableRecord where Self: TableRecord & Hashable & Identifiable, ID: DatabaseValueConvertible {
|
||||
/// Returns a set of records identified by their primary keys.
|
||||
///
|
||||
|
||||
@@ -319,7 +319,6 @@ extension TableRecord {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
|
||||
/// Returns whether a record exists for this primary key.
|
||||
///
|
||||
@@ -454,7 +453,6 @@ extension TableRecord {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
|
||||
/// Deletes records identified by their primary keys, and returns the number
|
||||
/// of deleted records.
|
||||
@@ -774,7 +772,6 @@ extension TableRecord where Self: EncodableRecord {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
|
||||
/// Returns an error for a record that does not exist in the database.
|
||||
///
|
||||
|
||||
@@ -17,7 +17,6 @@ import Foundation
|
||||
///
|
||||
/// OnDemandFuture also adds Sendable requirements that avoid
|
||||
/// compiler warnings.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
struct OnDemandFuture<Output, Failure: Error>: Publisher {
|
||||
typealias Promise = @Sendable (Result<Output, Failure>) -> Void
|
||||
typealias Output = Output
|
||||
@@ -36,7 +35,6 @@ struct OnDemandFuture<Output, Failure: Error>: Publisher {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
private class OnDemandFutureSubscription<Downstream: Subscriber>: Subscription, @unchecked Sendable {
|
||||
// @unchecked because `state` is protected with `lock`.
|
||||
typealias Promise = @Sendable (Result<Downstream.Input, Downstream.Failure>) -> Void
|
||||
|
||||
@@ -11,7 +11,6 @@ import Foundation
|
||||
/// This scheduling guarantee is used by GRDB in order to be able
|
||||
/// to make promises on the scheduling of database values without surprising
|
||||
/// the users as in <https://forums.swift.org/t/28631>.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
struct ReceiveValuesOn<Upstream: Publisher, Context: Scheduler>: Publisher {
|
||||
typealias Output = Upstream.Output
|
||||
typealias Failure = Upstream.Failure
|
||||
@@ -30,7 +29,6 @@ struct ReceiveValuesOn<Upstream: Publisher, Context: Scheduler>: Publisher {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
private class ReceiveValuesOnSubscription<Upstream, Context, Downstream>: Subscription, Subscriber
|
||||
where
|
||||
Upstream: Publisher,
|
||||
@@ -211,7 +209,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Publisher {
|
||||
/// Specifies the scheduler on which to receive values from the publisher
|
||||
///
|
||||
|
||||
@@ -292,7 +292,6 @@ public final class SharedValueObservation<Element: Sendable>: @unchecked Sendabl
|
||||
/// print("fresh players: \(players)")
|
||||
/// }
|
||||
/// ```
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func publisher() -> DatabasePublishers.Value<Element> {
|
||||
DatabasePublishers.Value { onError, onChange in
|
||||
self.start(onError: onError, onChange: onChange)
|
||||
@@ -369,7 +368,6 @@ extension SharedValueObservation {
|
||||
/// print("Fresh players: \(players)")
|
||||
/// }
|
||||
/// ```
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func values(bufferingPolicy: AsyncValueObservation<Element>.BufferingPolicy = .unbounded)
|
||||
-> AsyncValueObservation<Element>
|
||||
{
|
||||
|
||||
@@ -179,7 +179,6 @@ extension ValueObservation: Refinable {
|
||||
/// - parameter onChange: The closure to execute on receipt of a
|
||||
/// fresh value.
|
||||
/// - returns: A DatabaseCancellable that can stop the observation.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
@preconcurrency @MainActor public func start(
|
||||
in reader: some DatabaseReader,
|
||||
scheduling scheduler: some ValueObservationMainActorScheduler = .mainActor,
|
||||
@@ -350,7 +349,6 @@ extension ValueObservation {
|
||||
/// fresh values are dispatched on the cooperative thread pool.
|
||||
/// - parameter bufferingPolicy: see the documntation
|
||||
/// of `AsyncThrowingStream`.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func values(
|
||||
in reader: some DatabaseReader,
|
||||
scheduling scheduler: some ValueObservationScheduler = .task,
|
||||
@@ -386,7 +384,6 @@ extension ValueObservation {
|
||||
///
|
||||
/// You build an `AsyncValueObservation` from ``ValueObservation`` or
|
||||
/// ``SharedValueObservation``.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public struct AsyncValueObservation<Element: Sendable>: AsyncSequence {
|
||||
public typealias BufferingPolicy = AsyncThrowingStream<Element, Error>.Continuation.BufferingPolicy
|
||||
public typealias AsyncIterator = Iterator
|
||||
@@ -488,7 +485,6 @@ extension ValueObservation {
|
||||
/// - parameter scheduler: A ValueObservationScheduler. By default, fresh
|
||||
/// values are dispatched asynchronously on the main dispatch queue.
|
||||
/// - returns: A Combine publisher
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func publisher(
|
||||
in reader: some DatabaseReader,
|
||||
scheduling scheduler: some ValueObservationScheduler = .async(onQueue: .main))
|
||||
@@ -505,7 +501,6 @@ extension ValueObservation {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension DatabasePublishers {
|
||||
/// A publisher that publishes the values of a ``ValueObservation``.
|
||||
///
|
||||
|
||||
@@ -182,7 +182,6 @@ extension ValueObservationMainActorScheduler where Self == ImmediateValueObserva
|
||||
// MARK: - TaskValueObservationScheduler
|
||||
|
||||
/// A scheduler that notifies all values on the cooperative thread pool.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public final class TaskValueObservationScheduler: ValueObservationScheduler {
|
||||
typealias Action = @Sendable () -> Void
|
||||
let continuation: AsyncStream<Action>.Continuation
|
||||
@@ -212,7 +211,6 @@ public final class TaskValueObservationScheduler: ValueObservationScheduler {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension ValueObservationScheduler where Self == TaskValueObservationScheduler {
|
||||
/// A scheduler that notifies all values from a new `Task`.
|
||||
public static var task: TaskValueObservationScheduler {
|
||||
@@ -229,7 +227,6 @@ extension ValueObservationScheduler where Self == TaskValueObservationScheduler
|
||||
// MARK: - DelayedMainActorValueObservationScheduler
|
||||
|
||||
/// A scheduler that notifies all values on the cooperative thread pool.
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public final class DelayedMainActorValueObservationScheduler: ValueObservationMainActorScheduler {
|
||||
public func immediateInitialValue() -> Bool {
|
||||
false
|
||||
@@ -240,7 +237,6 @@ public final class DelayedMainActorValueObservationScheduler: ValueObservationMa
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension ValueObservationScheduler where Self == DelayedMainActorValueObservationScheduler {
|
||||
/// A scheduler that notifies all values on the main actor.
|
||||
public static var mainActor: DelayedMainActorValueObservationScheduler {
|
||||
|
||||
+3
-3
@@ -36,9 +36,9 @@ let package = Package(
|
||||
name: "GRDB",
|
||||
defaultLocalization: "en", // for tests
|
||||
platforms: [
|
||||
.iOS(.v12),
|
||||
.macOS(.v10_13),
|
||||
.tvOS(.v12),
|
||||
.iOS(.v13),
|
||||
.macOS(.v10_15),
|
||||
.tvOS(.v13),
|
||||
.watchOS(.v7),
|
||||
],
|
||||
products: [
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
**Latest release**: September 7, 2024 • [version 6.29.3](https://github.com/groue/GRDB.swift/tree/v6.29.3) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 5 to GRDB 6](Documentation/GRDB6MigrationGuide.md)
|
||||
|
||||
**Requirements**: iOS 12.0+ / macOS 10.13+ / tvOS 12.0+ / watchOS 7.0+ • SQLite 3.19.3+ • Swift 6+ / Xcode 16+
|
||||
**Requirements**: iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 7.0+ • SQLite 3.20.0+ • Swift 6+ / Xcode 16+
|
||||
|
||||
**Contact**:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13
|
||||
TVOS_DEPLOYMENT_TARGET = 12.0
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15
|
||||
TVOS_DEPLOYMENT_TARGET = 13.0
|
||||
WATCHOS_DEPLOYMENT_TARGET = 7.0
|
||||
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -enable-upcoming-feature GlobalActorIsolatedTypesUsability
|
||||
@@ -1,6 +1,6 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13
|
||||
TVOS_DEPLOYMENT_TARGET = 12.0
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15
|
||||
TVOS_DEPLOYMENT_TARGET = 13.0
|
||||
WATCHOS_DEPLOYMENT_TARGET = 7.0
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D SQLITE_ENABLE_FTS5
|
||||
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use_frameworks!
|
||||
target 'iOS'
|
||||
platform :ios, '12.0'
|
||||
platform :ios, '13.0'
|
||||
pod 'GRDB.swift', :path => '../../..'
|
||||
|
||||
post_install do |installer|
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -301,7 +301,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
@@ -318,7 +318,7 @@
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBTest;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -335,7 +335,7 @@
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBTest;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
target 'iOS'
|
||||
platform :ios, '12.0'
|
||||
platform :ios, '13.0'
|
||||
pod 'GRDB.swift', :path => '../../..'
|
||||
|
||||
post_install do |installer|
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -282,7 +282,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
|
||||
@@ -1822,7 +1822,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1856,7 +1856,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
platform :macos, '10.13'
|
||||
platform :macos, '10.15'
|
||||
use_frameworks!
|
||||
|
||||
def common
|
||||
@@ -19,7 +19,7 @@ post_install do |installer|
|
||||
target.build_configurations.each do |config|
|
||||
# Workaround for Xcode 14.3+
|
||||
# https://github.com/CocoaPods/CocoaPods/issues/11839
|
||||
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.13'
|
||||
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.15'
|
||||
config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '3'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1828,7 +1828,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1862,7 +1862,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
platform :macos, '10.13'
|
||||
platform :macos, '10.15'
|
||||
use_frameworks!
|
||||
|
||||
def common
|
||||
@@ -19,7 +19,7 @@ post_install do |installer|
|
||||
target.build_configurations.each do |config|
|
||||
# Workaround for Xcode 14.3+
|
||||
# https://github.com/CocoaPods/CocoaPods/issues/11839
|
||||
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.13'
|
||||
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.15'
|
||||
config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '3'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#if canImport(Combine)
|
||||
import XCTest
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectations {
|
||||
/// A publisher expectation which waits for the timeout to expire, or
|
||||
/// the recorded publisher to complete.
|
||||
|
||||
@@ -17,7 +17,6 @@ import XCTest
|
||||
// try wait(for: recorder.finished.inverted, timeout: 1)
|
||||
// }
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectations {
|
||||
/// A publisher expectation which waits for the recorded publisher
|
||||
/// to complete.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#if canImport(Combine)
|
||||
import XCTest
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectations {
|
||||
/// A publisher expectation that fails if the base expectation is fulfilled.
|
||||
///
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#if canImport(Combine)
|
||||
import XCTest
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectations {
|
||||
/// A publisher expectation that transforms the value of a base expectation.
|
||||
///
|
||||
@@ -20,7 +19,6 @@ extension PublisherExpectations {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectation {
|
||||
/// Returns a publisher expectation that transforms the value of the
|
||||
/// base expectation.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#if canImport(Combine)
|
||||
import XCTest
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectations {
|
||||
/// A publisher expectation which waits for the recorded publisher to emit
|
||||
/// `count` elements, or to complete.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#if canImport(Combine)
|
||||
import XCTest
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectations {
|
||||
/// A publisher expectation which waits for the recorded publisher to emit
|
||||
/// one element, or to complete.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#if canImport(Combine)
|
||||
import XCTest
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectations {
|
||||
/// A publisher expectation which waits for the recorded publisher to emit
|
||||
/// `maxLength` elements, or to complete.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectations {
|
||||
/// A publisher expectation which waits for the recorded publisher
|
||||
/// to complete.
|
||||
|
||||
@@ -13,7 +13,6 @@ import XCTest
|
||||
///
|
||||
/// let elements = try wait(for: recorder.elements, timeout: 1)
|
||||
/// XCTAssertEqual(elements, ["foo", "bar", "baz"])
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public class Recorder<Input, Failure: Error>: Subscriber {
|
||||
public typealias Input = Input
|
||||
public typealias Failure = Failure
|
||||
@@ -287,7 +286,6 @@ public class Recorder<Input, Failure: Error>: Subscriber {
|
||||
|
||||
// MARK: - Publisher Expectations
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension PublisherExpectations {
|
||||
/// The type of the publisher expectation returned by `Recorder.completion`.
|
||||
public typealias Completion<Input, Failure: Error> = Map<Recording<Input, Failure>, Subscribers.Completion<Failure>>
|
||||
@@ -302,7 +300,6 @@ extension PublisherExpectations {
|
||||
public typealias Single<Input, Failure: Error> = Map<Elements<Input, Failure>, Input>
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Recorder {
|
||||
/// Returns a publisher expectation which waits for the timeout to expire,
|
||||
/// or the recorded publisher to complete.
|
||||
@@ -584,7 +581,6 @@ extension Recorder {
|
||||
|
||||
// MARK: - Publisher + Recorder
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Publisher {
|
||||
/// Returns a subscribed Recorder.
|
||||
///
|
||||
|
||||
@@ -342,7 +342,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@@ -397,7 +397,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
|
||||
@@ -22,10 +22,6 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testReadPublisher() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -128,10 +124,6 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
// frame #71: 0x00007fff72311cc9 libdyld.dylib`start + 1
|
||||
// frame #72: 0x00007fff72311cc9 libdyld.dylib`start + 1
|
||||
func testReadPublisherError() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(reader: some DatabaseReader) throws {
|
||||
let publisher = reader.readPublisher(value: { db in
|
||||
try Row.fetchAll(db, sql: "THIS IS NOT SQL")
|
||||
@@ -157,10 +149,6 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testReadPublisherIsAsynchronous() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -197,10 +185,6 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testReadPublisherDefaultScheduler() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -237,10 +221,6 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testReadPublisherCustomScheduler() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -278,10 +258,6 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testReadPublisherIsReadonly() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(reader: some DatabaseReader) throws {
|
||||
let publisher = reader.readPublisher(value: { db in
|
||||
try Player.createTable(db)
|
||||
|
||||
@@ -20,10 +20,6 @@ private struct Player: Codable, FetchableRecord, PersistableRecord {
|
||||
class DatabaseRegionObservationPublisherTests : XCTestCase {
|
||||
|
||||
func testChangesNotifications() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -61,10 +57,6 @@ class DatabaseRegionObservationPublisherTests : XCTestCase {
|
||||
// TODO: do the same, but asynchronously. If this is too hard, update the
|
||||
// public API so that users can easily do it.
|
||||
func testPrependInitialDatabaseSync() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
|
||||
@@ -22,10 +22,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testWritePublisher() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -49,10 +45,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testWritePublisherValue() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -76,10 +68,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testWritePublisherError() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
let publisher = writer.writePublisher(updates: { db in
|
||||
try db.execute(sql: "THIS IS NOT SQL")
|
||||
@@ -99,10 +87,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testWritePublisherErrorRollbacksTransaction() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -132,10 +116,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testWritePublisherIsAsynchronous() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -168,10 +148,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testWritePublisherDefaultScheduler() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -206,10 +182,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testWritePublisherCustomScheduler() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -247,10 +219,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// TODO: Fix flaky test with both pool and on-disk queue:
|
||||
// - Expectation timeout
|
||||
func testWriteThenReadPublisher() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -274,10 +242,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testWriteThenReadPublisherIsReadonly() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
let publisher = writer
|
||||
.writePublisher(
|
||||
@@ -299,10 +263,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// MARK: -
|
||||
|
||||
func testWriteThenReadPublisherWriteError() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
let publisher = writer.writePublisher(
|
||||
updates: { db in try db.execute(sql: "THIS IS NOT SQL") },
|
||||
@@ -322,10 +282,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testWriteThenReadPublisherWriteErrorRollbacksTransaction() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -359,10 +315,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// TODO: Fix flaky test with both pool and on-disk queue:
|
||||
// - Expectation timeout
|
||||
func testWriteThenReadPublisherReadError() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
let publisher = writer.writePublisher(
|
||||
updates: { _ in },
|
||||
@@ -386,10 +338,6 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
// Regression test against deadlocks created by concurrent completion
|
||||
// and cancellations triggered by .switchToLatest().prefix(1)
|
||||
func testDeadlockPrevention() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
|
||||
@@ -51,7 +51,6 @@ final class Test<Context> {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
final class AsyncTest<Context> {
|
||||
// Raise the repeatCount in order to help spotting flaky tests.
|
||||
private let repeatCount: Int
|
||||
@@ -100,7 +99,6 @@ final class AsyncTest<Context> {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func assertNoFailure<Failure>(
|
||||
_ completion: Subscribers.Completion<Failure>,
|
||||
file: StaticString = #file,
|
||||
@@ -111,7 +109,6 @@ public func assertNoFailure<Failure>(
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public func assertFailure<Failure, ExpectedFailure>(
|
||||
_ completion: Subscribers.Completion<Failure>,
|
||||
file: StaticString = #file,
|
||||
|
||||
@@ -22,10 +22,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
// MARK: - Default Scheduler
|
||||
|
||||
func testDefaultSchedulerChangesNotifications() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -64,10 +60,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testDefaultSchedulerFirstValueIsEmittedAsynchronously() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -97,10 +89,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testDefaultSchedulerError() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
let publisher = ValueObservation
|
||||
.trackingConstantRegion { try $0.execute(sql: "THIS IS NOT SQL") }
|
||||
@@ -123,10 +111,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
// MARK: - Immediate Scheduler
|
||||
|
||||
func testImmediateSchedulerChangesNotifications() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -165,10 +149,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testImmediateSchedulerEmitsFirstValueSynchronously() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -201,10 +181,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testImmediateSchedulerError() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
let publisher = ValueObservation
|
||||
.trackingConstantRegion { try $0.execute(sql: "THIS IS NOT SQL") }
|
||||
@@ -226,7 +202,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
|
||||
// MARK: - Demand
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
private class DemandSubscriber<Input, Failure: Error>: Subscriber {
|
||||
private var subscription: Subscription?
|
||||
let subject = PassthroughSubject<Input, Failure>()
|
||||
@@ -257,10 +232,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testDemandNoneReceivesNoElement() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -292,10 +263,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testDemandOneReceivesOneElement() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -330,10 +297,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testDemandOneDoesNotReceiveTwoElements() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -372,10 +335,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
}
|
||||
|
||||
func testDemandTwoReceivesTwoElements() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func setUp<Writer: DatabaseWriter>(_ writer: Writer) throws -> Writer {
|
||||
try writer.write(Player.createTable)
|
||||
return writer
|
||||
@@ -418,10 +377,6 @@ class ValueObservationPublisherTests : XCTestCase {
|
||||
|
||||
/// Regression test for https://github.com/groue/GRDB.swift/issues/1194
|
||||
func testIssue1194() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
struct Record: Codable, FetchableRecord, PersistableRecord {
|
||||
var id: Int64
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ import Foundation
|
||||
///
|
||||
/// - ``wait()``
|
||||
/// - ``waitUnlessCancelled()``
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
public final class AsyncSemaphore: @unchecked Sendable {
|
||||
/// `Suspension` is the state of a task waiting for a signal.
|
||||
///
|
||||
|
||||
@@ -175,42 +175,40 @@ class DatabaseCursorTests: GRDBTestCase {
|
||||
// with raw C SQLite3 apis. The faulty line is the call to
|
||||
// sqlite3_set_authorizer during the statement iteration.
|
||||
|
||||
// if #available(OSX 10.14, *) {
|
||||
// var connection: SQLiteConnection? = nil
|
||||
// sqlite3_open_v2(":memory:", &connection, SQLITE_OPEN_READWRITE | SQLITE_OPEN_NOMUTEX, nil)
|
||||
// sqlite3_extended_result_codes(connection, 1)
|
||||
// var connection: SQLiteConnection? = nil
|
||||
// sqlite3_open_v2(":memory:", &connection, SQLITE_OPEN_READWRITE | SQLITE_OPEN_NOMUTEX, nil)
|
||||
// sqlite3_extended_result_codes(connection, 1)
|
||||
//
|
||||
// sqlite3_exec(connection, """
|
||||
// CREATE TABLE user (username TEXT NOT NULL);
|
||||
// CREATE TABLE flagUser (username TEXT NOT NULL);
|
||||
// INSERT INTO flagUser (username) VALUES ('User1');
|
||||
// INSERT INTO flagUser (username) VALUES ('User2');
|
||||
// """, nil, nil, nil)
|
||||
// sqlite3_exec(connection, """
|
||||
// CREATE TABLE user (username TEXT NOT NULL);
|
||||
// CREATE TABLE flagUser (username TEXT NOT NULL);
|
||||
// INSERT INTO flagUser (username) VALUES ('User1');
|
||||
// INSERT INTO flagUser (username) VALUES ('User2');
|
||||
// """, nil, nil, nil)
|
||||
//
|
||||
// var statement: SQLiteStatement? = nil
|
||||
// sqlite3_set_authorizer(connection, { (_, _, _, _, _, _) in SQLITE_OK }, nil)
|
||||
// sqlite3_prepare_v3(connection, """
|
||||
// SELECT * FROM flagUser WHERE (SELECT COUNT(*) FROM user WHERE username = flagUser.username) = 0
|
||||
// """, -1, 0, &statement, nil)
|
||||
// sqlite3_set_authorizer(connection, nil, nil)
|
||||
// while true {
|
||||
// let code = sqlite3_step(statement)
|
||||
// if code == SQLITE_DONE {
|
||||
// break
|
||||
// } else if code == SQLITE_ROW {
|
||||
// // part of the compilation of another statement, here
|
||||
// // reduced to the strict minimum that reproduces
|
||||
// // the error.
|
||||
// sqlite3_set_authorizer(connection, nil, nil)
|
||||
// } else {
|
||||
// print(String(cString: sqlite3_errmsg(connection)))
|
||||
// XCTFail("Error \(code)")
|
||||
// break
|
||||
// }
|
||||
// var statement: SQLiteStatement? = nil
|
||||
// sqlite3_set_authorizer(connection, { (_, _, _, _, _, _) in SQLITE_OK }, nil)
|
||||
// sqlite3_prepare_v3(connection, """
|
||||
// SELECT * FROM flagUser WHERE (SELECT COUNT(*) FROM user WHERE username = flagUser.username) = 0
|
||||
// """, -1, 0, &statement, nil)
|
||||
// sqlite3_set_authorizer(connection, nil, nil)
|
||||
// while true {
|
||||
// let code = sqlite3_step(statement)
|
||||
// if code == SQLITE_DONE {
|
||||
// break
|
||||
// } else if code == SQLITE_ROW {
|
||||
// // part of the compilation of another statement, here
|
||||
// // reduced to the strict minimum that reproduces
|
||||
// // the error.
|
||||
// sqlite3_set_authorizer(connection, nil, nil)
|
||||
// } else {
|
||||
// print(String(cString: sqlite3_errmsg(connection)))
|
||||
// XCTFail("Error \(code)")
|
||||
// break
|
||||
// }
|
||||
// sqlite3_finalize(statement)
|
||||
// sqlite3_close_v2(connection)
|
||||
// }
|
||||
// sqlite3_finalize(statement)
|
||||
// sqlite3_close_v2(connection)
|
||||
}
|
||||
|
||||
// This test passes if it compiles
|
||||
|
||||
@@ -25,7 +25,6 @@ private struct RecordWithData<Strategy: StrategyProvider>: EncodableRecord, Enco
|
||||
var data: Data
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension RecordWithData: Identifiable {
|
||||
var id: Data { data }
|
||||
}
|
||||
@@ -37,7 +36,6 @@ private struct RecordWithOptionalData<Strategy: StrategyProvider>: EncodableReco
|
||||
var data: Data?
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension RecordWithOptionalData: Identifiable {
|
||||
var id: Data? { data }
|
||||
}
|
||||
@@ -154,10 +152,6 @@ extension DatabaseDataEncodingStrategyTests {
|
||||
}
|
||||
|
||||
func testFilterID() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Identifiable not available")
|
||||
}
|
||||
|
||||
try makeDatabaseQueue().write { db in
|
||||
try db.create(table: "t") { $0.primaryKey("id", .blob) }
|
||||
|
||||
@@ -234,10 +228,6 @@ extension DatabaseDataEncodingStrategyTests {
|
||||
}
|
||||
|
||||
func testDeleteID() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Identifiable not available")
|
||||
}
|
||||
|
||||
try makeDatabaseQueue().write { db in
|
||||
try db.create(table: "t") { $0.primaryKey("id", .blob) }
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ private struct RecordWithDate<Strategy: StrategyProvider>: EncodableRecord, Enco
|
||||
var date: Date
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension RecordWithDate: Identifiable {
|
||||
var id: Date { date }
|
||||
}
|
||||
@@ -64,7 +63,6 @@ private struct RecordWithOptionalDate<Strategy: StrategyProvider>: EncodableReco
|
||||
var date: Date?
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension RecordWithOptionalDate: Identifiable {
|
||||
var id: Date? { date }
|
||||
}
|
||||
@@ -264,10 +262,6 @@ extension DatabaseDateEncodingStrategyTests {
|
||||
}
|
||||
|
||||
func testFilterID() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Identifiable not available")
|
||||
}
|
||||
|
||||
try makeDatabaseQueue().write { db in
|
||||
try db.create(table: "t") { $0.primaryKey("id", .datetime) }
|
||||
|
||||
@@ -344,10 +338,6 @@ extension DatabaseDateEncodingStrategyTests {
|
||||
}
|
||||
|
||||
func testDeleteID() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Identifiable not available")
|
||||
}
|
||||
|
||||
try makeDatabaseQueue().write { db in
|
||||
try db.create(table: "t") { $0.primaryKey("id", .datetime) }
|
||||
|
||||
|
||||
@@ -238,10 +238,6 @@ final class DatabaseDumpTests: GRDBTestCase {
|
||||
// MARK: - JSON
|
||||
|
||||
func test_json_value_formatting() throws {
|
||||
guard #available(iOS 13.0, macOS 10.15, tvOS 13.0, *) else {
|
||||
throw XCTSkip("Skip because this test relies on JSONEncoder.OutputFormatting.withoutEscapingSlashes")
|
||||
}
|
||||
|
||||
try makeValuesDatabase().read { db in
|
||||
let stream = TestStream()
|
||||
try db.dumpSQL("SELECT * FROM value ORDER BY name", format: .json(), to: stream)
|
||||
|
||||
@@ -41,10 +41,6 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
}
|
||||
|
||||
func testEmptyMigratorPublisher() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
let migrator = DatabaseMigrator()
|
||||
let publisher = migrator.migratePublisher(writer)
|
||||
@@ -153,10 +149,6 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
}
|
||||
|
||||
func testNonEmptyMigratorPublisher() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
@@ -209,10 +201,6 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
}
|
||||
|
||||
func testEmptyMigratorPublisherIsAsynchronous() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
let migrator = DatabaseMigrator()
|
||||
let expectation = self.expectation(description: "")
|
||||
@@ -235,10 +223,6 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
}
|
||||
|
||||
func testNonEmptyMigratorPublisherIsAsynchronous() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test(writer: some DatabaseWriter) throws {
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("first", migrate: { _ in })
|
||||
@@ -262,10 +246,6 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
}
|
||||
|
||||
func testMigratorPublisherDefaultScheduler() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test<Writer: DatabaseWriter>(writer: Writer) {
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("first", migrate: { _ in })
|
||||
@@ -291,10 +271,6 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
}
|
||||
|
||||
func testMigratorPublisherCustomScheduler() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
func test<Writer: DatabaseWriter>(writer: Writer) {
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("first", migrate: { _ in })
|
||||
|
||||
@@ -49,7 +49,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
#endif
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_ReadCanRead() async throws {
|
||||
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
|
||||
try dbWriter.write { db in
|
||||
@@ -91,7 +90,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
#endif
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_ReadPreventsDatabaseModification() async throws {
|
||||
func test(_ dbReader: some DatabaseReader) async throws {
|
||||
do {
|
||||
@@ -135,7 +133,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
#endif
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_UnsafeReadCanRead() async throws {
|
||||
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
|
||||
try dbWriter.write { db in
|
||||
@@ -347,7 +344,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
|
||||
// MARK: - Task Cancellation
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_read_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
|
||||
func test(_ dbReader: some DatabaseReader) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -383,7 +379,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_read_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbReader: some DatabaseReader) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -420,7 +415,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_statement_execution_from_read_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbReader: some DatabaseReader) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -459,7 +453,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_cursor_iteration_from_read_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbReader: some DatabaseReader) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -502,7 +495,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_unsafeRead_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
|
||||
func test(_ dbReader: some DatabaseReader) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -538,7 +530,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_unsafeRead_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbReader: some DatabaseReader) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -575,7 +566,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_statement_execution_from_unsafeRead_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbReader: some DatabaseReader) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -614,7 +604,6 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_cursor_iteration_from_unsafeRead_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbReader: some DatabaseReader) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
|
||||
@@ -8,10 +8,7 @@ class DatabaseRegionObservationTests: GRDBTestCase {
|
||||
let observation = DatabaseRegionObservation(tracking: .fullDatabase)
|
||||
|
||||
_ = observation.start(in: writer, onError: { _ in }, onChange: { _ in })
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
_ = observation.publisher(in: writer)
|
||||
}
|
||||
_ = observation.publisher(in: writer)
|
||||
}
|
||||
|
||||
func testDatabaseRegionObservation_FullDatabase() throws {
|
||||
|
||||
@@ -229,7 +229,6 @@ final class DatabaseSnapshotPoolTests: GRDBTestCase {
|
||||
try XCTAssertEqual(dbPool.read(counter.value), 2)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_read_async() async throws {
|
||||
let dbPool = try makeDatabasePool()
|
||||
let counter = try Counter(dbPool: dbPool) // 0
|
||||
|
||||
@@ -26,7 +26,6 @@ private struct RecordWithUUID<Strategy: StrategyProvider>: EncodableRecord, Enco
|
||||
var uuid: UUID
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension RecordWithUUID: Identifiable {
|
||||
var id: UUID { uuid }
|
||||
}
|
||||
@@ -39,7 +38,6 @@ private struct RecordWithOptionalUUID<Strategy: StrategyProvider>: EncodableReco
|
||||
var uuid: UUID?
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension RecordWithOptionalUUID: Identifiable {
|
||||
var id: UUID? { uuid }
|
||||
}
|
||||
@@ -190,10 +188,6 @@ extension DatabaseUUIDEncodingStrategyTests {
|
||||
}
|
||||
|
||||
func testFilterID() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Identifiable not available")
|
||||
}
|
||||
|
||||
try makeDatabaseQueue().write { db in
|
||||
try db.create(table: "t") { $0.primaryKey("id", .blob) }
|
||||
let uuids = [
|
||||
@@ -309,10 +303,6 @@ extension DatabaseUUIDEncodingStrategyTests {
|
||||
}
|
||||
|
||||
func testDeleteID() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Identifiable not available")
|
||||
}
|
||||
|
||||
try makeDatabaseQueue().write { db in
|
||||
try db.create(table: "t") { $0.primaryKey("id", .blob) }
|
||||
let uuids = [
|
||||
|
||||
@@ -275,7 +275,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try DatabaseQueue().backup(to: dbQueue)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_write() async throws {
|
||||
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
|
||||
try dbWriter.write { db in
|
||||
@@ -295,7 +294,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(setup(makeDatabasePool()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_writeWithoutTransaction() async throws {
|
||||
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
|
||||
try dbWriter.write { db in
|
||||
@@ -318,7 +316,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(setup(makeDatabasePool()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_barrierWriteWithoutTransaction() async throws {
|
||||
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
|
||||
try dbWriter.write { db in
|
||||
@@ -341,7 +338,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(setup(makeDatabasePool()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_erase() async throws {
|
||||
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
|
||||
try dbWriter.write { db in
|
||||
@@ -359,7 +355,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(setup(makeDatabasePool()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_vacuum() async throws {
|
||||
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
|
||||
try dbWriter.write { db in
|
||||
@@ -406,7 +401,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
}
|
||||
|
||||
/// A test related to <https://github.com/groue/GRDB.swift/issues/1456>
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncWriteThenRead() async throws {
|
||||
/// An async read performed after an async write should see the write.
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
@@ -430,7 +424,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
|
||||
// MARK: - Task Cancellation
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_writeWithoutTransaction_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -461,7 +454,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_writeWithoutTransaction_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -493,7 +485,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_statement_execution_from_writeWithoutTransaction_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -527,7 +518,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_cursor_iteration_from_writeWithoutTransaction_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -565,7 +555,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_write_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -596,7 +585,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_write_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -628,7 +616,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_statement_execution_from_write_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -662,7 +649,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_cursor_iteration_from_write_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -700,7 +686,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_barrierWriteWithoutTransaction_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -731,7 +716,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_barrierWriteWithoutTransaction_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -763,7 +747,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_statement_execution_from_barrierWriteWithoutTransaction_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
@@ -797,7 +780,6 @@ class DatabaseWriterTests : GRDBTestCase {
|
||||
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_cursor_iteration_from_barrierWriteWithoutTransaction_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) async throws {
|
||||
let semaphore = AsyncSemaphore(value: 0)
|
||||
|
||||
@@ -9,7 +9,7 @@ final class JSONColumnTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -51,7 +51,7 @@ final class JSONColumnTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON_EXTRACT is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON_EXTRACT is not available")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -44,7 +44,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -105,7 +105,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -281,7 +281,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -316,7 +316,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -392,7 +392,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -435,7 +435,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -470,7 +470,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -525,7 +525,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -580,7 +580,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -635,7 +635,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -738,7 +738,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -821,7 +821,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -904,7 +904,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -947,7 +947,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -990,7 +990,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -1025,7 +1025,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -1060,7 +1060,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -1103,7 +1103,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -1138,7 +1138,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -1185,7 +1185,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -1216,7 +1216,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -1282,7 +1282,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -1309,7 +1309,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#else
|
||||
guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
throw XCTSkip("JSON support is not available")
|
||||
}
|
||||
#endif
|
||||
@@ -1397,7 +1397,7 @@ final class JSONExpressionsTests: GRDBTestCase {
|
||||
// throw XCTSkip("JSON support is not available")
|
||||
// }
|
||||
// #else
|
||||
// guard #available(iOS 16, macOS 10.15, tvOS 17, watchOS 9, *) else {
|
||||
// guard #available(iOS 16, tvOS 17, watchOS 9, *) else {
|
||||
// throw XCTSkip("JSON support is not available")
|
||||
// }
|
||||
// #endif
|
||||
|
||||
@@ -92,7 +92,6 @@ private struct FlatModel: FetchableRecord {
|
||||
self.t5count = row.scopes[Scopes.suffix]!["t5count"]
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
static func modernAll() -> some FetchRequest<FlatModel> {
|
||||
all()
|
||||
}
|
||||
@@ -138,7 +137,6 @@ private struct CodableFlatModel: FetchableRecord, Codable {
|
||||
var t3: T3?
|
||||
var t5count: Int
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
static func modernAll() -> some FetchRequest<CodableFlatModel> {
|
||||
all()
|
||||
}
|
||||
@@ -186,7 +184,6 @@ private struct CodableNestedModel: FetchableRecord, Codable {
|
||||
var t3: T3?
|
||||
var t5count: Int
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
static func modernAll() -> some FetchRequest<CodableNestedModel> {
|
||||
all()
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ private class MinimalNonOptionalPrimaryKeySingle: Record, Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension MinimalNonOptionalPrimaryKeySingle: Identifiable { }
|
||||
|
||||
class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
@@ -473,20 +472,18 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let cursor = try MinimalNonOptionalPrimaryKeySingle.fetchCursor(db, ids: ids)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let cursor = try MinimalNonOptionalPrimaryKeySingle.fetchCursor(db, ids: ids)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let cursor = try MinimalNonOptionalPrimaryKeySingle.fetchCursor(db, ids: ids)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let cursor = try MinimalNonOptionalPrimaryKeySingle.fetchCursor(db, ids: ids)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,19 +509,17 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -550,19 +545,17 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -585,12 +578,10 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let fetchedRecord = try MinimalNonOptionalPrimaryKeySingle.fetchOne(db, id: record.id)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
|
||||
}
|
||||
do {
|
||||
let fetchedRecord = try MinimalNonOptionalPrimaryKeySingle.fetchOne(db, id: record.id)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -613,17 +604,15 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
_ = try MinimalNonOptionalPrimaryKeySingle.find(db, key: "missing")
|
||||
XCTFail("Expected RecordError")
|
||||
} catch RecordError.recordNotFound(databaseTableName: "minimalSingles", key: ["id": "missing".databaseValue]) { }
|
||||
|
||||
do {
|
||||
let fetchedRecord = try MinimalNonOptionalPrimaryKeySingle.find(db, id: record.id)
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
|
||||
}
|
||||
do {
|
||||
_ = try MinimalNonOptionalPrimaryKeySingle.find(db, key: "missing")
|
||||
XCTFail("Expected RecordError")
|
||||
} catch RecordError.recordNotFound(databaseTableName: "minimalSingles", key: ["id": "missing".databaseValue]) { }
|
||||
|
||||
do {
|
||||
let fetchedRecord = try MinimalNonOptionalPrimaryKeySingle.find(db, id: record.id)
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -653,20 +642,18 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let cursor = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchCursor(db)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let cursor = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchCursor(db)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let cursor = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchCursor(db)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let cursor = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchCursor(db)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -692,19 +679,17 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -730,19 +715,17 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [String] = []
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id, record2.id]
|
||||
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -765,12 +748,10 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let fetchedRecord = try MinimalNonOptionalPrimaryKeySingle.filter(id: record.id).fetchOne(db)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
|
||||
}
|
||||
do {
|
||||
let fetchedRecord = try MinimalNonOptionalPrimaryKeySingle.filter(id: record.id).fetchOne(db)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ class MinimalRowID : Record, Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension MinimalRowID: Identifiable { }
|
||||
|
||||
class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
@@ -507,20 +506,18 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let cursor = try MinimalRowID.fetchCursor(db, ids: ids)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let cursor = try MinimalRowID.fetchCursor(db, ids: ids)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let cursor = try MinimalRowID.fetchCursor(db, ids: ids)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let cursor = try MinimalRowID.fetchCursor(db, ids: ids)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -546,19 +543,17 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try MinimalRowID.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try MinimalRowID.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try MinimalRowID.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try MinimalRowID.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -584,19 +579,17 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try MinimalRowID.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try MinimalRowID.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try MinimalRowID.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try MinimalRowID.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -619,15 +612,13 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let fetchedRecord = try MinimalRowID.fetchOne(db, id: record.id!)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(MinimalRowID.fetchOne(db, id: nil))
|
||||
}
|
||||
do {
|
||||
let fetchedRecord = try MinimalRowID.fetchOne(db, id: record.id!)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(MinimalRowID.fetchOne(db, id: nil))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -650,20 +641,18 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
_ = try MinimalRowID.find(db, id: -1)
|
||||
XCTFail("Expected RecordError")
|
||||
} catch RecordError.recordNotFound(databaseTableName: "minimalRowIDs", key: ["id": (-1).databaseValue]) { }
|
||||
|
||||
do {
|
||||
let fetchedRecord = try MinimalRowID.find(db, id: record.id!)
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(MinimalRowID.fetchOne(db, id: nil))
|
||||
}
|
||||
do {
|
||||
_ = try MinimalRowID.find(db, id: -1)
|
||||
XCTFail("Expected RecordError")
|
||||
} catch RecordError.recordNotFound(databaseTableName: "minimalRowIDs", key: ["id": (-1).databaseValue]) { }
|
||||
|
||||
do {
|
||||
let fetchedRecord = try MinimalRowID.find(db, id: record.id!)
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(MinimalRowID.fetchOne(db, id: nil))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -693,20 +682,18 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let cursor = try MinimalRowID.filter(ids: ids).fetchCursor(db)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let cursor = try MinimalRowID.filter(ids: ids).fetchCursor(db)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let cursor = try MinimalRowID.filter(ids: ids).fetchCursor(db)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let cursor = try MinimalRowID.filter(ids: ids).fetchCursor(db)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -732,19 +719,17 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -770,19 +755,17 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -805,15 +788,13 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let fetchedRecord = try MinimalRowID.filter(id: record.id!).fetchOne(db)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(MinimalRowID.filter(id: nil).fetchOne(db))
|
||||
}
|
||||
do {
|
||||
let fetchedRecord = try MinimalRowID.filter(id: record.id!).fetchOne(db)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(MinimalRowID.filter(id: nil).fetchOne(db))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ class MinimalSingle: Record, Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension MinimalSingle: Identifiable {
|
||||
/// Test non-optional ID type
|
||||
var id: String { UUID! }
|
||||
@@ -531,20 +530,18 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let cursor = try MinimalSingle.fetchCursor(db, ids: UUIDs)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let cursor = try MinimalSingle.fetchCursor(db, ids: UUIDs)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let cursor = try MinimalSingle.fetchCursor(db, ids: UUIDs)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let cursor = try MinimalSingle.fetchCursor(db, ids: UUIDs)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -572,19 +569,17 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let fetchedRecords = try MinimalSingle.fetchAll(db, ids: UUIDs)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let fetchedRecords = try MinimalSingle.fetchAll(db, ids: UUIDs)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let fetchedRecords = try MinimalSingle.fetchAll(db, ids: UUIDs)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let fetchedRecords = try MinimalSingle.fetchAll(db, ids: UUIDs)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -612,19 +607,17 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let fetchedRecords = try MinimalSingle.fetchSet(db, ids: UUIDs)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let fetchedRecords = try MinimalSingle.fetchSet(db, ids: UUIDs)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let fetchedRecords = try MinimalSingle.fetchSet(db, ids: UUIDs)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let fetchedRecords = try MinimalSingle.fetchSet(db, ids: UUIDs)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -648,12 +641,10 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let fetchedRecord = try MinimalSingle.fetchOne(db, id: record.UUID!)!
|
||||
XCTAssertTrue(fetchedRecord.UUID == record.UUID)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
|
||||
}
|
||||
do {
|
||||
let fetchedRecord = try MinimalSingle.fetchOne(db, id: record.UUID!)!
|
||||
XCTAssertTrue(fetchedRecord.UUID == record.UUID)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -677,17 +668,15 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
_ = try MinimalSingle.find(db, id: "missing")
|
||||
XCTFail("Expected RecordError")
|
||||
} catch RecordError.recordNotFound(databaseTableName: "minimalSingles", key: ["UUID": "missing".databaseValue]) { }
|
||||
|
||||
do {
|
||||
let fetchedRecord = try MinimalSingle.find(db, id: record.UUID!)
|
||||
XCTAssertTrue(fetchedRecord.UUID == record.UUID)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
|
||||
}
|
||||
do {
|
||||
_ = try MinimalSingle.find(db, id: "missing")
|
||||
XCTFail("Expected RecordError")
|
||||
} catch RecordError.recordNotFound(databaseTableName: "minimalSingles", key: ["UUID": "missing".databaseValue]) { }
|
||||
|
||||
do {
|
||||
let fetchedRecord = try MinimalSingle.find(db, id: record.UUID!)
|
||||
XCTAssertTrue(fetchedRecord.UUID == record.UUID)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -719,20 +708,18 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let cursor = try MinimalSingle.filter(ids: UUIDs).fetchCursor(db)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let cursor = try MinimalSingle.filter(ids: UUIDs).fetchCursor(db)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let cursor = try MinimalSingle.filter(ids: UUIDs).fetchCursor(db)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let cursor = try MinimalSingle.filter(ids: UUIDs).fetchCursor(db)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -760,19 +747,17 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -800,19 +785,17 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
do {
|
||||
let UUIDs: [String] = []
|
||||
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let UUIDs = [record1.UUID!, record2.UUID!]
|
||||
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -836,12 +819,10 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let fetchedRecord = try MinimalSingle.filter(id: record.UUID!).fetchOne(db)!
|
||||
XCTAssertTrue(fetchedRecord.UUID == record.UUID)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
|
||||
}
|
||||
do {
|
||||
let fetchedRecord = try MinimalSingle.filter(id: record.UUID!).fetchOne(db)!
|
||||
XCTAssertTrue(fetchedRecord.UUID == record.UUID)
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@ private class Person : Record, Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Person: Identifiable { }
|
||||
|
||||
class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
@@ -599,20 +598,18 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let cursor = try Person.fetchCursor(db, ids: ids)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let cursor = try Person.fetchCursor(db, ids: ids)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let cursor = try Person.fetchCursor(db, ids: ids)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let cursor = try Person.fetchCursor(db, ids: ids)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -638,19 +635,17 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try Person.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try Person.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try Person.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try Person.fetchAll(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -676,19 +671,17 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try Person.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try Person.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try Person.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try Person.fetchSet(db, ids: ids)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -714,18 +707,16 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let fetchedRecord = try Person.fetchOne(db, id: record.id!)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertTrue(fetchedRecord.name == record.name)
|
||||
XCTAssertTrue(fetchedRecord.age == record.age)
|
||||
XCTAssertTrue(abs(fetchedRecord.creationDate.timeIntervalSince(record.creationDate)) < 1e-3) // ISO-8601 is precise to the millisecond.
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(Person.fetchOne(db, id: nil))
|
||||
}
|
||||
do {
|
||||
let fetchedRecord = try Person.fetchOne(db, id: record.id!)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertTrue(fetchedRecord.name == record.name)
|
||||
XCTAssertTrue(fetchedRecord.age == record.age)
|
||||
XCTAssertTrue(abs(fetchedRecord.creationDate.timeIntervalSince(record.creationDate)) < 1e-3) // ISO-8601 is precise to the millisecond.
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(Person.fetchOne(db, id: nil))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -751,23 +742,21 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
_ = try Person.find(db, id: -1)
|
||||
XCTFail("Expected RecordError")
|
||||
} catch RecordError.recordNotFound(databaseTableName: "persons", key: ["rowid": (-1).databaseValue]) { }
|
||||
|
||||
do {
|
||||
let fetchedRecord = try Person.find(db, id: record.id!)
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertTrue(fetchedRecord.name == record.name)
|
||||
XCTAssertTrue(fetchedRecord.age == record.age)
|
||||
XCTAssertTrue(abs(fetchedRecord.creationDate.timeIntervalSince(record.creationDate)) < 1e-3) // ISO-8601 is precise to the millisecond.
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(Person.fetchOne(db, id: nil))
|
||||
}
|
||||
do {
|
||||
_ = try Person.find(db, id: -1)
|
||||
XCTFail("Expected RecordError")
|
||||
} catch RecordError.recordNotFound(databaseTableName: "persons", key: ["rowid": (-1).databaseValue]) { }
|
||||
|
||||
do {
|
||||
let fetchedRecord = try Person.find(db, id: record.id!)
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertTrue(fetchedRecord.name == record.name)
|
||||
XCTAssertTrue(fetchedRecord.age == record.age)
|
||||
XCTAssertTrue(abs(fetchedRecord.creationDate.timeIntervalSince(record.creationDate)) < 1e-3) // ISO-8601 is precise to the millisecond.
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(Person.fetchOne(db, id: nil))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -797,20 +786,18 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let cursor = try Person.filter(ids: ids).fetchCursor(db)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let cursor = try Person.filter(ids: ids).fetchCursor(db)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let cursor = try Person.filter(ids: ids).fetchCursor(db)
|
||||
try XCTAssertNil(cursor.next())
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let cursor = try Person.filter(ids: ids).fetchCursor(db)
|
||||
let fetchedRecords = try [cursor.next()!, cursor.next()!]
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -836,19 +823,17 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try Person.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try Person.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try Person.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try Person.filter(ids: ids).fetchAll(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -874,19 +859,17 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try Person.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try Person.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
do {
|
||||
let ids: [Int64] = []
|
||||
let fetchedRecords = try Person.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 0)
|
||||
}
|
||||
|
||||
do {
|
||||
let ids = [record1.id!, record2.id!]
|
||||
let fetchedRecords = try Person.filter(ids: ids).fetchSet(db)
|
||||
XCTAssertEqual(fetchedRecords.count, 2)
|
||||
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -912,18 +895,16 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
let fetchedRecord = try Person.filter(id: record.id!).fetchOne(db)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertTrue(fetchedRecord.name == record.name)
|
||||
XCTAssertTrue(fetchedRecord.age == record.age)
|
||||
XCTAssertTrue(abs(fetchedRecord.creationDate.timeIntervalSince(record.creationDate)) < 1e-3) // ISO-8601 is precise to the millisecond.
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(Person.filter(id: nil).fetchOne(db))
|
||||
}
|
||||
do {
|
||||
let fetchedRecord = try Person.filter(id: record.id!).fetchOne(db)!
|
||||
XCTAssertTrue(fetchedRecord.id == record.id)
|
||||
XCTAssertTrue(fetchedRecord.name == record.name)
|
||||
XCTAssertTrue(fetchedRecord.age == record.age)
|
||||
XCTAssertTrue(abs(fetchedRecord.creationDate.timeIntervalSince(record.creationDate)) < 1e-3) // ISO-8601 is precise to the millisecond.
|
||||
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
|
||||
}
|
||||
do {
|
||||
try XCTAssertNil(Person.filter(id: nil).fetchOne(db))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,10 +120,6 @@ class SharedValueObservationTests: GRDBTestCase {
|
||||
|
||||
#if canImport(Combine)
|
||||
func test_immediate_publisher() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write { db in
|
||||
try db.create(table: "player") { t in
|
||||
@@ -397,10 +393,6 @@ class SharedValueObservationTests: GRDBTestCase {
|
||||
|
||||
#if canImport(Combine)
|
||||
func test_async_publisher() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write { db in
|
||||
try db.create(table: "player") { t in
|
||||
@@ -525,7 +517,6 @@ class SharedValueObservationTests: GRDBTestCase {
|
||||
XCTAssertEqual(log.flush(), [])
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_task_observationLifetime() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write { db in
|
||||
@@ -622,10 +613,6 @@ class SharedValueObservationTests: GRDBTestCase {
|
||||
|
||||
#if canImport(Combine)
|
||||
func test_task_publisher() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write { db in
|
||||
try db.create(table: "player") { t in
|
||||
@@ -656,7 +643,6 @@ class SharedValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
#endif
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func test_task_whileObserved() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write { db in
|
||||
@@ -753,10 +739,6 @@ class SharedValueObservationTests: GRDBTestCase {
|
||||
|
||||
#if canImport(Combine)
|
||||
func test_error_recovery_observationLifetime() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write { db in
|
||||
try db.create(table: "player") { t in
|
||||
@@ -811,10 +793,6 @@ class SharedValueObservationTests: GRDBTestCase {
|
||||
|
||||
#if canImport(Combine)
|
||||
func test_error_recovery_whileObserved() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Combine is not available")
|
||||
}
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write { db in
|
||||
try db.create(table: "player") { t in
|
||||
@@ -867,7 +845,6 @@ class SharedValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
#endif
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_mainQueue() async throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try await dbQueue.write { db in
|
||||
@@ -887,7 +864,6 @@ class SharedValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_task() async throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try await dbQueue.write { db in
|
||||
|
||||
@@ -805,11 +805,6 @@ class TableDefinitionTests: GRDBTestCase {
|
||||
guard sqlite3_libversion_number() >= 3025000 else {
|
||||
throw XCTSkip("ALTER TABLE RENAME COLUMN is not available")
|
||||
}
|
||||
#if !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
guard #available(iOS 13, tvOS 13, *) else {
|
||||
throw XCTSkip("ALTER TABLE RENAME COLUMN is not available")
|
||||
}
|
||||
#endif
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(table: "test") { t in
|
||||
@@ -833,11 +828,6 @@ class TableDefinitionTests: GRDBTestCase {
|
||||
guard sqlite3_libversion_number() >= 3025000 else {
|
||||
throw XCTSkip("ALTER TABLE RENAME COLUMN is not available")
|
||||
}
|
||||
#if !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
guard #available(iOS 13, tvOS 13, *) else {
|
||||
throw XCTSkip("ALTER TABLE RENAME COLUMN is not available")
|
||||
}
|
||||
#endif
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(table: "test") { t in
|
||||
|
||||
@@ -357,10 +357,6 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testExistsIdentifiable() throws {
|
||||
guard #available(iOS 13, macOS 10.15, tvOS 13, *) else {
|
||||
throw XCTSkip("Identifiable is not available")
|
||||
}
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inTransaction { db in
|
||||
struct Player: TableRecord, Identifiable {
|
||||
|
||||
@@ -6,7 +6,6 @@ private struct Hacker : TableRecord {
|
||||
var id: Int64? // Optional
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Hacker: Identifiable { }
|
||||
|
||||
private struct Person : Codable, PersistableRecord, FetchableRecord, Hashable {
|
||||
@@ -16,7 +15,6 @@ private struct Person : Codable, PersistableRecord, FetchableRecord, Hashable {
|
||||
var email: String
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Person: Identifiable { }
|
||||
|
||||
private struct Citizenship : TableRecord {
|
||||
@@ -46,23 +44,23 @@ class TableRecordDeleteTests: GRDBTestCase {
|
||||
XCTAssertTrue(deleted)
|
||||
XCTAssertEqual(try Hacker.fetchCount(db), 0)
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [1, "Arthur"])
|
||||
try XCTAssertFalse(Hacker.deleteOne(db, id: nil))
|
||||
deleted = try Hacker.deleteOne(db, id: 1)
|
||||
XCTAssertTrue(deleted)
|
||||
XCTAssertEqual(try Hacker.fetchCount(db), 0)
|
||||
|
||||
do {
|
||||
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [1, "Arthur"])
|
||||
try XCTAssertFalse(Hacker.deleteOne(db, id: nil))
|
||||
deleted = try Hacker.deleteOne(db, id: 1)
|
||||
XCTAssertTrue(deleted)
|
||||
XCTAssertEqual(try Hacker.fetchCount(db), 0)
|
||||
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [2, "Barbara"])
|
||||
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [3, "Craig"])
|
||||
let deletedCount = try Hacker.deleteAll(db, keys: [2, 3, 4])
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"hackers\" WHERE \"rowid\" IN (2, 3, 4)")
|
||||
XCTAssertEqual(deletedCount, 2)
|
||||
XCTAssertEqual(try Hacker.fetchCount(db), 1)
|
||||
}
|
||||
|
||||
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [1, "Arthur"])
|
||||
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [2, "Barbara"])
|
||||
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [3, "Craig"])
|
||||
let deletedCount = try Hacker.deleteAll(db, keys: [2, 3, 4])
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"hackers\" WHERE \"rowid\" IN (2, 3, 4)")
|
||||
XCTAssertEqual(deletedCount, 2)
|
||||
XCTAssertEqual(try Hacker.fetchCount(db), 1)
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [2, "Barbara"])
|
||||
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [3, "Craig"])
|
||||
let deletedCount = try Hacker.deleteAll(db, ids: [2, 3, 4])
|
||||
@@ -85,22 +83,22 @@ class TableRecordDeleteTests: GRDBTestCase {
|
||||
XCTAssertTrue(deleted)
|
||||
XCTAssertEqual(try Person.fetchCount(db), 0)
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [1, "Arthur", "arthur@example.com"])
|
||||
deleted = try Person.deleteOne(db, id: 1)
|
||||
XCTAssertTrue(deleted)
|
||||
XCTAssertEqual(try Person.fetchCount(db), 0)
|
||||
|
||||
do {
|
||||
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [1, "Arthur", "arthur@example.com"])
|
||||
deleted = try Person.deleteOne(db, id: 1)
|
||||
XCTAssertTrue(deleted)
|
||||
XCTAssertEqual(try Person.fetchCount(db), 0)
|
||||
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [2, "Barbara", "barbara@example.com"])
|
||||
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [3, "Craig", "craig@example.com"])
|
||||
let deletedCount = try Person.deleteAll(db, keys: [2, 3, 4])
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (2, 3, 4)")
|
||||
XCTAssertEqual(deletedCount, 2)
|
||||
XCTAssertEqual(try Person.fetchCount(db), 1)
|
||||
}
|
||||
|
||||
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [1, "Arthur", "arthur@example.com"])
|
||||
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [2, "Barbara", "barbara@example.com"])
|
||||
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [3, "Craig", "craig@example.com"])
|
||||
let deletedCount = try Person.deleteAll(db, keys: [2, 3, 4])
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (2, 3, 4)")
|
||||
XCTAssertEqual(deletedCount, 2)
|
||||
XCTAssertEqual(try Person.fetchCount(db), 1)
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [2, "Barbara", "barbara@example.com"])
|
||||
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [3, "Craig", "craig@example.com"])
|
||||
let deletedCount = try Person.deleteAll(db, ids: [2, 3, 4])
|
||||
@@ -189,15 +187,13 @@ class TableRecordDeleteTests: GRDBTestCase {
|
||||
|
||||
try Person.filter(keys: [1, 2]).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (1, 2)")
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
try Person.filter(id: 1).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" = 1")
|
||||
|
||||
try Person.filter(ids: [1, 2]).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (1, 2)")
|
||||
}
|
||||
|
||||
|
||||
try Person.filter(id: 1).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" = 1")
|
||||
|
||||
try Person.filter(ids: [1, 2]).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (1, 2)")
|
||||
|
||||
try Person.filter(sql: "id = 1").deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE id = 1")
|
||||
|
||||
@@ -279,13 +275,11 @@ class TableRecordDeleteTests: GRDBTestCase {
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (1, 2) RETURNING *")
|
||||
|
||||
#if GRDBCUSTOMSQLITE || GRDBCIPHER
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
_ = try Person.filter(id: 1).deleteAndFetchCursor(db).next()
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" = 1 RETURNING *")
|
||||
|
||||
_ = try Person.filter(ids: [1, 2]).deleteAndFetchCursor(db).next()
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (1, 2) RETURNING *")
|
||||
}
|
||||
_ = try Person.filter(id: 1).deleteAndFetchCursor(db).next()
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" = 1 RETURNING *")
|
||||
|
||||
_ = try Person.filter(ids: [1, 2]).deleteAndFetchCursor(db).next()
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (1, 2) RETURNING *")
|
||||
#else
|
||||
_ = try Person.filter(id: 1).deleteAndFetchCursor(db).next()
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" = 1 RETURNING *")
|
||||
@@ -364,7 +358,6 @@ class TableRecordDeleteTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *) // Identifiable
|
||||
func testRequestDeleteAndFetchIds() throws {
|
||||
#if GRDBCUSTOMSQLITE || GRDBCIPHER
|
||||
guard sqlite3_libversion_number() >= 3035000 else {
|
||||
|
||||
@@ -17,7 +17,6 @@ private struct Player: Codable, PersistableRecord, FetchableRecord, Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
extension Player: Identifiable { }
|
||||
|
||||
private enum Columns: String, ColumnExpression {
|
||||
@@ -56,18 +55,16 @@ class TableRecordUpdateTests: GRDBTestCase {
|
||||
UPDATE "player" SET "score" = 0 WHERE "id" IN (1, 2)
|
||||
""")
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
try Player.filter(id: 1).updateAll(db, assignment)
|
||||
XCTAssertEqual(self.lastSQLQuery, """
|
||||
try Player.filter(id: 1).updateAll(db, assignment)
|
||||
XCTAssertEqual(self.lastSQLQuery, """
|
||||
UPDATE "player" SET "score" = 0 WHERE "id" = 1
|
||||
""")
|
||||
|
||||
try Player.filter(ids: [1, 2]).updateAll(db, assignment)
|
||||
XCTAssertEqual(self.lastSQLQuery, """
|
||||
|
||||
try Player.filter(ids: [1, 2]).updateAll(db, assignment)
|
||||
XCTAssertEqual(self.lastSQLQuery, """
|
||||
UPDATE "player" SET "score" = 0 WHERE "id" IN (1, 2)
|
||||
""")
|
||||
}
|
||||
|
||||
|
||||
try Player.filter(sql: "id = 1").updateAll(db, assignment)
|
||||
XCTAssertEqual(self.lastSQLQuery, """
|
||||
UPDATE "player" SET "score" = 0 WHERE id = 1
|
||||
|
||||
@@ -117,7 +117,7 @@ class TableTests: GRDBTestCase {
|
||||
""")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
struct Player: Identifiable { var id: Int64 }
|
||||
let t = Table<Player>("player")
|
||||
|
||||
@@ -129,7 +129,7 @@ class TableTests: GRDBTestCase {
|
||||
""")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
struct Player: Identifiable { var id: Int64? }
|
||||
let t = Table<Player>("player")
|
||||
|
||||
@@ -806,7 +806,7 @@ class TableTests: GRDBTestCase {
|
||||
""")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
// Non-optional ID
|
||||
struct Country: Identifiable { var id: String }
|
||||
|
||||
@@ -821,7 +821,7 @@ class TableTests: GRDBTestCase {
|
||||
""")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
// Optional ID
|
||||
struct Country: Identifiable { var id: String? }
|
||||
|
||||
@@ -920,7 +920,7 @@ class TableTests: GRDBTestCase {
|
||||
""")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
// Non-optional ID
|
||||
struct Country: Identifiable { var id: String }
|
||||
|
||||
@@ -930,7 +930,7 @@ class TableTests: GRDBTestCase {
|
||||
""")
|
||||
}
|
||||
|
||||
if #available(iOS 13, macOS 10.15, tvOS 13, *) {
|
||||
do {
|
||||
// Optional ID
|
||||
struct Country: Identifiable { var id: String? }
|
||||
|
||||
|
||||
@@ -105,7 +105,6 @@ class ValueObservationRegionRecordingTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testTupleObservation() throws {
|
||||
// Here we just test that user can destructure an observed tuple.
|
||||
// I'm completely paranoid about tuple destructuring - I can't wrap my
|
||||
@@ -120,7 +119,6 @@ class ValueObservationRegionRecordingTests: GRDBTestCase {
|
||||
onChange: { (int: Int, string: String) in }) // <- destructure
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testVaryingRegionTrackingImmediateScheduling() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write {
|
||||
|
||||
@@ -5,7 +5,6 @@ import Dispatch
|
||||
class ValueObservationTests: GRDBTestCase {
|
||||
// Test passes if it compiles.
|
||||
// See <https://github.com/groue/GRDB.swift/issues/1541>
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testStartFromAnyDatabaseReader(reader: any DatabaseReader) {
|
||||
_ = ValueObservation
|
||||
.trackingConstantRegion { _ in }
|
||||
@@ -14,7 +13,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
// Test passes if it compiles.
|
||||
// See <https://github.com/groue/GRDB.swift/issues/1541>
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testStartFromAnyDatabaseWriter(writer: any DatabaseWriter) {
|
||||
_ = ValueObservation
|
||||
.trackingConstantRegion { _ in }
|
||||
@@ -23,7 +21,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
// Test passes if it compiles.
|
||||
// See <https://github.com/groue/GRDB.swift/issues/1541>
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testValuesFromAnyDatabaseWriter(writer: any DatabaseWriter) {
|
||||
func observe<T>(
|
||||
fetch: @escaping @Sendable (Database) throws -> T
|
||||
@@ -55,7 +52,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
try test(makeDatabasePool())
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testErrorCompletesTheObservation() throws {
|
||||
struct TestError: Error { }
|
||||
|
||||
@@ -105,7 +101,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
try test(makeDatabasePool())
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testViewOptimization() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write {
|
||||
@@ -143,7 +138,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testPragmaTableOptimization() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write {
|
||||
@@ -179,7 +173,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
// MARK: - Constant Explicit Region
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testTrackingExplicitRegion() throws {
|
||||
class TestStream: TextOutputStream {
|
||||
private var stringsMutex: Mutex<[String]> = Mutex([])
|
||||
@@ -620,7 +613,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
// MARK: - Cancellation
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testCancellableLifetime() throws {
|
||||
// We need something to change
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
@@ -666,7 +658,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
XCTAssertEqual(changesCountMutex.load(), 2)
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testCancellableExplicitCancellation() throws {
|
||||
// We need something to change
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
@@ -804,7 +795,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
try test(makeDatabasePool())
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testIssue1550() throws {
|
||||
func test(_ writer: some DatabaseWriter) throws {
|
||||
try writer.write { try $0.execute(sql: "CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT)") }
|
||||
@@ -852,7 +842,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
try test(makeDatabasePool())
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testIssue1209() throws {
|
||||
func test(_ dbWriter: some DatabaseWriter) throws {
|
||||
try dbWriter.write {
|
||||
@@ -903,7 +892,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
// MARK: - Main Actor
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
@MainActor func test_mainActor_observation() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.write { db in
|
||||
@@ -939,7 +927,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
// MARK: - Async Await
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_values_prefix() async throws {
|
||||
func test(_ writer: some DatabaseWriter) async throws {
|
||||
// We need something to change
|
||||
@@ -977,7 +964,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
try await AsyncTest(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_values_break() async throws {
|
||||
func test(_ writer: some DatabaseWriter) async throws {
|
||||
// We need something to change
|
||||
@@ -1019,7 +1005,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
try await AsyncTest(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
|
||||
}
|
||||
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testAsyncAwait_values_cancelled() async throws {
|
||||
func test(_ writer: some DatabaseWriter) async throws {
|
||||
// We need something to change
|
||||
@@ -1201,7 +1186,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
// Regression test for <https://github.com/groue/GRDB.swift/issues/1362>
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testIssue1362() throws {
|
||||
func test(_ writer: some DatabaseWriter) throws {
|
||||
try writer.write { try $0.execute(sql: "CREATE TABLE s(id INTEGER PRIMARY KEY AUTOINCREMENT)") }
|
||||
@@ -1292,7 +1276,6 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
// Regression test for <https://github.com/groue/GRDB.swift/issues/1383>
|
||||
@available(iOS 13, macOS 10.15, tvOS 13, *)
|
||||
func testIssue1383_async() throws {
|
||||
do {
|
||||
let dbPool = try makeDatabasePool(filename: "test")
|
||||
|
||||
@@ -364,7 +364,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
@@ -416,7 +416,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
@@ -5,6 +5,12 @@ import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "SPM",
|
||||
platforms: [
|
||||
.iOS(.v13),
|
||||
.macOS(.v10_15),
|
||||
.tvOS(.v13),
|
||||
.watchOS(.v7),
|
||||
],
|
||||
dependencies: [
|
||||
.package(name: "GRDB", path: "../../.."),
|
||||
],
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@@ -241,7 +241,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
|
||||
Reference in new issue
Block a user