mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-22 04:00:39 +00:00
Merge pull request #1826 from groue/dev/snapshot-cleanup
Simplify the compiler checks for the availability of SQLite snapshots
This commit is contained in:
72 files changed
+398
-360
No files matched your search
+24
-24
@@ -1,4 +1,4 @@
|
||||
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md
|
||||
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
|
||||
|
||||
name: "GRDB CI"
|
||||
|
||||
@@ -40,17 +40,17 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_16.1.app"
|
||||
runsOn: macOS-14
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
destination: "platform=macOS"
|
||||
name: "macOS"
|
||||
- xcode: "Xcode_16.1.app"
|
||||
runsOn: macOS-14
|
||||
destination: "OS=18.1,name=iPhone 16 Pro"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
destination: "OS=18.5,name=iPhone 16 Pro"
|
||||
name: "iOS"
|
||||
- xcode: "Xcode_16.1.app"
|
||||
runsOn: macOS-14
|
||||
destination: "OS=18.1,name=Apple TV"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
destination: "OS=18.5,name=Apple TV"
|
||||
name: "tvOS"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
@@ -66,9 +66,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_16.1.app"
|
||||
runsOn: macOS-14
|
||||
name: "Xcode 16.1"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
name: "Xcode 16.4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: ${{ matrix.name }}
|
||||
@@ -83,9 +83,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_16.1.app"
|
||||
runsOn: macOS-14
|
||||
name: "Xcode 16.1"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
name: "Xcode 16.4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: ${{ matrix.name }}
|
||||
@@ -100,9 +100,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_16.1.app"
|
||||
runsOn: macOS-14
|
||||
name: "Xcode 16.1"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
name: "Xcode 16.4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: ${{ matrix.name }}
|
||||
@@ -117,9 +117,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_16.1.app"
|
||||
runsOn: macOS-14
|
||||
name: "Xcode 16.1"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
name: "Xcode 16.4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: ${{ matrix.name }}
|
||||
@@ -134,9 +134,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_16.1.app"
|
||||
runsOn: macOS-14
|
||||
name: "Xcode 16.1"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
name: "Xcode 16.4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: ${{ matrix.name }}
|
||||
|
||||
@@ -2,4 +2,4 @@ version: 1
|
||||
builder:
|
||||
configs:
|
||||
- documentation_targets: [GRDB]
|
||||
swift_version: 6.0
|
||||
swift_version: 6.1
|
||||
@@ -382,7 +382,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 6.0;
|
||||
SWIFT_VERSION = 6.1;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -411,7 +411,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 6.0;
|
||||
SWIFT_VERSION = 6.1;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
@@ -427,7 +427,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 6.0;
|
||||
SWIFT_VERSION = 6.1;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GRDBDemo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/GRDBDemo";
|
||||
};
|
||||
@@ -444,7 +444,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 6.0;
|
||||
SWIFT_VERSION = 6.1;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GRDBDemo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/GRDBDemo";
|
||||
};
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ Pod::Spec.new do |s|
|
||||
s.source = { :git => 'https://github.com/groue/GRDB.swift.git', :tag => "v#{s.version}" }
|
||||
s.module_name = 'GRDB'
|
||||
|
||||
s.swift_versions = ['6']
|
||||
s.swift_versions = ['6.1']
|
||||
s.ios.deployment_target = '13.0'
|
||||
s.osx.deployment_target = '10.15'
|
||||
s.watchos.deployment_target = '7.0'
|
||||
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
|
||||
ss.framework = 'Foundation'
|
||||
ss.library = 'sqlite3'
|
||||
ss.xcconfig = {
|
||||
'OTHER_SWIFT_FLAGS' => '$(inherited) -D SQLITE_ENABLE_FTS5',
|
||||
'OTHER_SWIFT_FLAGS' => '$(inherited) -D SQLITE_ENABLE_FTS5 -D GRDBFRAMEWORK',
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
#if !canImport(Darwin)
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
extension Database {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// A custom SQL function or aggregate.
|
||||
|
||||
@@ -684,7 +684,7 @@ extension DatabasePool: DatabaseReader {
|
||||
|
||||
// MARK: - WAL Snapshot Transactions
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
/// Returns a long-lived WAL snapshot transaction on a reader connection.
|
||||
func walSnapshotTransaction() throws -> WALSnapshotTransaction {
|
||||
guard let readerPool else {
|
||||
@@ -950,7 +950,7 @@ extension DatabasePool {
|
||||
purpose: "snapshot.\(databaseSnapshotCountMutex.increment())")
|
||||
}
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
/// Creates a database snapshot that allows concurrent accesses to an
|
||||
/// unchanging database content, as it exists at the moment the snapshot
|
||||
/// is created.
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// A database connection that allows concurrent accesses to an unchanging
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
+7
-4
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// A key that is used to decode a value in a row
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
#if canImport(string_h)
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// A type that can decode itself from the low-level C interface to
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#if !os(Linux)
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
extension Optional: StatementBinding where Wrapped: StatementBinding {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
// MARK: - Value Types
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
extension Database {
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// An instance of WALSnapshot records the state of a WAL mode database for some
|
||||
@@ -16,18 +19,6 @@ import SQLite3
|
||||
/// actual observation. This class has no other purpose, and is not intended to
|
||||
/// become public.
|
||||
///
|
||||
/// It does not work with SQLCipher, because SQLCipher does not support
|
||||
/// `SQLITE_ENABLE_SNAPSHOT` correctly: we have linker errors.
|
||||
/// See <https://github.com/ericsink/SQLitePCL.raw/issues/452>.
|
||||
///
|
||||
/// With custom SQLite builds, it only works if `SQLITE_ENABLE_SNAPSHOT`
|
||||
/// is defined.
|
||||
///
|
||||
/// With system SQLite, it works because the SDK exposes the C apis and
|
||||
/// since XCode 14.
|
||||
///
|
||||
/// Yes, this is an awfully complex logic.
|
||||
///
|
||||
/// See <https://www.sqlite.org/c3ref/snapshot.html>.
|
||||
final class WALSnapshot: @unchecked Sendable {
|
||||
// @unchecked because sqlite3_snapshot has no threading requirements.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
/// A long-live read-only WAL transaction.
|
||||
///
|
||||
/// `WALSnapshotTransaction` **takes ownership** of its reader
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// A format that prints one line per database row, formatting values
|
||||
|
||||
+7
-4
@@ -1,11 +1,14 @@
|
||||
#if SQLITE_ENABLE_FTS5
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#if SQLITE_ENABLE_FTS5
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// A type that implements a custom tokenizer for the ``FTS5`` full-text engine.
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#if SQLITE_ENABLE_FTS5
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#if SQLITE_ENABLE_FTS5
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -519,20 +522,16 @@ private struct SingleValueRowDecoder<R: FetchableRecord>: SingleValueDecodingCon
|
||||
func decode(_ type: Int16.Type) throws -> Int16 { try columnDecoder.decode(type) }
|
||||
func decode(_ type: Int32.Type) throws -> Int32 { try columnDecoder.decode(type) }
|
||||
func decode(_ type: Int64.Type) throws -> Int64 { try columnDecoder.decode(type) }
|
||||
#if compiler(>=6)
|
||||
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
|
||||
func decode(_ type: Int128.Type) throws -> Int128 { try columnDecoder.decode(type) }
|
||||
#endif
|
||||
func decode(_ type: UInt.Type) throws -> UInt { try columnDecoder.decode(type) }
|
||||
func decode(_ type: UInt8.Type) throws -> UInt8 { try columnDecoder.decode(type) }
|
||||
func decode(_ type: UInt16.Type) throws -> UInt16 { try columnDecoder.decode(type) }
|
||||
func decode(_ type: UInt32.Type) throws -> UInt32 { try columnDecoder.decode(type) }
|
||||
func decode(_ type: UInt64.Type) throws -> UInt64 { try columnDecoder.decode(type) }
|
||||
#if compiler(>=6)
|
||||
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
|
||||
func decode(_ type: UInt128.Type) throws -> UInt128 { try columnDecoder.decode(type) }
|
||||
#endif
|
||||
|
||||
|
||||
func decode<T>(_ type: T.Type) throws -> T where T: Decodable {
|
||||
if let type = T.self as? any FetchableRecord.Type {
|
||||
// Prefer FetchableRecord decoding over Decodable.
|
||||
|
||||
@@ -276,7 +276,7 @@ extension ValueConcurrentObserver {
|
||||
}
|
||||
}
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
extension ValueConcurrentObserver {
|
||||
/// Synchronously starts the observation, and returns the initial value.
|
||||
///
|
||||
|
||||
+23
-2
@@ -1,11 +1,26 @@
|
||||
// swift-tools-version:6.0
|
||||
// swift-tools-version:6.1
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import Foundation
|
||||
import PackageDescription
|
||||
|
||||
let darwinPlatforms: [Platform] = [
|
||||
.iOS,
|
||||
.macOS,
|
||||
.macCatalyst,
|
||||
.tvOS,
|
||||
.visionOS,
|
||||
.watchOS,
|
||||
]
|
||||
var swiftSettings: [SwiftSetting] = [
|
||||
.define("SQLITE_ENABLE_FTS5"),
|
||||
// Until Xcode has proper support for package traits, we must enable
|
||||
// SQLITE_ENABLE_SNAPSHOT by default so that Xcode projects that build
|
||||
// a Darwin app can depend on GRDB and profit from WAL snapshots.
|
||||
// Package traits who want to disable snapshots must set SQLITE_DISABLE_SNAPSHOT.
|
||||
// TODO: when Xcode support traits, remove all mentions of SQLITE_DISABLE_SNAPSHOT and update as below:
|
||||
// .define("SQLITE_ENABLE_SNAPSHOT", .when(platforms: darwinPlatforms, traits: ["GRDBSQLite"])),
|
||||
.define("SQLITE_ENABLE_SNAPSHOT"),
|
||||
]
|
||||
var cSettings: [CSetting] = []
|
||||
var dependencies: [PackageDescription.Package.Dependency] = []
|
||||
@@ -41,6 +56,10 @@ let package = Package(
|
||||
.library(name: "GRDB", targets: ["GRDB"]),
|
||||
.library(name: "GRDB-dynamic", type: .dynamic, targets: ["GRDB"]),
|
||||
],
|
||||
traits: [
|
||||
"GRDBSQLite",
|
||||
.default(enabledTraits: ["GRDBSQLite"]),
|
||||
],
|
||||
dependencies: dependencies,
|
||||
targets: [
|
||||
.systemLibrary(
|
||||
@@ -48,7 +67,9 @@ let package = Package(
|
||||
providers: [.apt(["libsqlite3-dev"])]),
|
||||
.target(
|
||||
name: "GRDB",
|
||||
dependencies: ["GRDBSQLite"],
|
||||
dependencies: [
|
||||
.target(name: "GRDBSQLite", condition: .when(traits: ["GRDBSQLite"])),
|
||||
],
|
||||
path: "GRDB",
|
||||
resources: [.copy("PrivacyInfo.xcprivacy")],
|
||||
cSettings: cSettings,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://developer.apple.com/swift/"><img alt="Swift 6" src="https://img.shields.io/badge/swift-6-orange.svg?style=flat"></a>
|
||||
<a href="https://developer.apple.com/swift/"><img alt="Swift 6.1" src="https://img.shields.io/badge/swift-6.1-orange.svg?style=flat"></a>
|
||||
<a href="https://github.com/groue/GRDB.swift/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/groue/GRDB.swift.svg?maxAge=2592000"></a>
|
||||
<a href="https://github.com/groue/GRDB.swift/actions/workflows/CI.yml"><img alt="CI Status" src="https://github.com/groue/GRDB.swift/actions/workflows/CI.yml/badge.svg?branch=master"></a>
|
||||
</p>
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
**Latest release**: October 2, 2025 • [version 7.8.0](https://github.com/groue/GRDB.swift/tree/v7.8.0) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 6 to GRDB 7](Documentation/GRDB7MigrationGuide.md)
|
||||
|
||||
**Requirements**: iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 7.0+ • SQLite 3.20.0+ • Swift 6+ / Xcode 16+
|
||||
**Requirements**: iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 7.0+ • SQLite 3.20.0+ • Swift 6.1+ / Xcode 16.3+
|
||||
|
||||
**Contact**:
|
||||
|
||||
|
||||
@@ -13,4 +13,4 @@ OTHER_CFLAGS = -DUSING_BUILTIN_SQLITE -DGRDBCUSTOMSQLITE $(CUSTOM_SQLLIBRARY_CFL
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "GRDBCUSTOMSQLITE=1"
|
||||
OTHER_SWIFT_FLAGS = -D USING_BUILTIN_SQLITE -D GRDBCUSTOMSQLITE $(CUSTOM_OTHER_SWIFT_FLAGS)
|
||||
HEADER_SEARCH_PATHS = $(SRCROOT)/SQLiteCustom/src
|
||||
SWIFT_VERSION = 6.0
|
||||
SWIFT_VERSION = 6.1
|
||||
@@ -3,7 +3,8 @@ INFOPLIST_FILE = Support/Info.plist
|
||||
PRODUCT_NAME = GRDB
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.$(PRODUCT_NAME:rfc1034identifier)
|
||||
MODULEMAP_FILE = $(SRCROOT)/Support/module.modulemap
|
||||
SWIFT_VERSION = 6.0
|
||||
SWIFT_VERSION = 6.1
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D GRDBFRAMEWORK
|
||||
|
||||
// Slow compilation hunt:
|
||||
// OTHER_SWIFT_FLAGS = $(inherited) -Xfrontend -warn-long-expression-type-checking=100 -Xfrontend -warn-long-function-bodies=100
|
||||
|
||||
@@ -2,7 +2,7 @@ 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
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_SNAPSHOT
|
||||
|
||||
//// Compile with all opt-in APIs
|
||||
//GCC_PREPROCESSOR_DEFINITIONS = $(inherited) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
// Tests still use the Swift 5 language mode.
|
||||
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -D GRDBFRAMEWORK
|
||||
OTHER_SWIFT_FLAGS = $(inherited) -enable-upcoming-feature GlobalActorIsolatedTypesUsability
|
||||
@@ -40,7 +40,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() }
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() }
|
||||
#endif
|
||||
}
|
||||
@@ -141,7 +141,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshot() }
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshotPool() }
|
||||
#endif
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() }
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() }
|
||||
#endif
|
||||
}
|
||||
@@ -213,7 +213,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() }
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() }
|
||||
#endif
|
||||
}
|
||||
@@ -250,7 +250,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() }
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() }
|
||||
#endif
|
||||
}
|
||||
@@ -274,7 +274,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
|
||||
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshot() }
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshotPool() }
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ class AssociationAggregateTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=6.1)
|
||||
func testAggregateWithGroup_swift61() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.read { db in
|
||||
@@ -139,7 +138,6 @@ class AssociationAggregateTests: GRDBTestCase {
|
||||
""")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func testAnnotatedWithHasManyDefaultAverage() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
@@ -296,7 +294,6 @@ class AssociationAggregateTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=6.1)
|
||||
func testAnnotatedWithHasManyDefaultMax_Swift61() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.read { db in
|
||||
@@ -333,7 +330,6 @@ class AssociationAggregateTests: GRDBTestCase {
|
||||
XCTAssertEqual(teamInfos[3].maxPlayerScore, 0)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func testAnnotatedWithHasManyDefaultMaxJoiningRequired() throws {
|
||||
// It is important to have an explicit test for this technique because
|
||||
|
||||
@@ -53,14 +53,12 @@ private extension QueryInterfaceRequest<Player> {
|
||||
.order { [teamAlias[Team.Columns.name], $0.name] }
|
||||
}
|
||||
|
||||
#if compiler(>=6.1)
|
||||
func orderedByTeamName_swift61() -> QueryInterfaceRequest<Player> {
|
||||
let teamAlias = TableAlias<Team>()
|
||||
return self
|
||||
.joining(optional: PlayerWithOptionalTeam.team.aliased(teamAlias))
|
||||
.order { [teamAlias.name, $0.name] }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Test support for Decodable records
|
||||
@@ -190,7 +188,6 @@ class AssociationBelongsToDecodableRecordTests: GRDBTestCase {
|
||||
XCTAssertEqual(records[0].team.name, "Reds")
|
||||
}
|
||||
|
||||
#if compiler(>=6.1)
|
||||
func testRequestRefining_swift61() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let request = Player
|
||||
@@ -212,5 +209,4 @@ class AssociationBelongsToDecodableRecordTests: GRDBTestCase {
|
||||
XCTAssertEqual(records[0].team.id, 1)
|
||||
XCTAssertEqual(records[0].team.name, "Reds")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -119,7 +119,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase {
|
||||
JOIN "b" ON "b"."id" = "a"."bid"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let aAlias = TableAlias<A>()
|
||||
let request = A
|
||||
@@ -135,7 +134,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase {
|
||||
JOIN "b" ON "b"."id" = "a"."bid"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +176,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase {
|
||||
JOIN "b" ON ("b"."id" = "a"."bid") AND ("b"."id" IN ("a"."id", "b"."id", 42))
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let alias = TableAlias<A>()
|
||||
let request = A
|
||||
@@ -191,7 +188,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase {
|
||||
JOIN "b" ON ("b"."id" = "a"."bid") AND ("b"."id" IN ("a"."id", "b"."id", 42))
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
do {
|
||||
let request = A.including(required: A.b.filter(key: ["id": 1]))
|
||||
try assertEqualSQL(db, request, """
|
||||
@@ -237,7 +233,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase {
|
||||
WHERE "b"."name" IS NOT NULL
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let bAlias = TableAlias<B>()
|
||||
let request = A
|
||||
@@ -250,7 +245,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase {
|
||||
WHERE "b"."name" IS NOT NULL
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ class AssociationHasOneSQLDerivationTests: GRDBTestCase {
|
||||
JOIN "b" ON "b"."aid" = "a"."id"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let aAlias = TableAlias<A>()
|
||||
let request = A
|
||||
@@ -135,7 +134,6 @@ class AssociationHasOneSQLDerivationTests: GRDBTestCase {
|
||||
JOIN "b" ON "b"."aid" = "a"."id"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +209,6 @@ class AssociationHasOneSQLDerivationTests: GRDBTestCase {
|
||||
WHERE "b"."name" IS NOT NULL
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let bAlias = TableAlias<B>()
|
||||
let request = A
|
||||
@@ -224,7 +221,6 @@ class AssociationHasOneSQLDerivationTests: GRDBTestCase {
|
||||
WHERE "b"."name" IS NOT NULL
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,6 @@ class AssociationHasOneThroughSQLDerivationTests: GRDBTestCase {
|
||||
JOIN "c" ON "c"."id" = "b"."cId"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let aAlias = TableAlias<A>()
|
||||
let request = A
|
||||
@@ -155,7 +154,6 @@ class AssociationHasOneThroughSQLDerivationTests: GRDBTestCase {
|
||||
JOIN "c" ON "c"."id" = "b"."cId"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +236,6 @@ class AssociationHasOneThroughSQLDerivationTests: GRDBTestCase {
|
||||
WHERE "c"."name" IS NOT NULL
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let cAlias = TableAlias<C>()
|
||||
let request = A
|
||||
@@ -252,7 +249,6 @@ class AssociationHasOneThroughSQLDerivationTests: GRDBTestCase {
|
||||
WHERE "c"."name" IS NOT NULL
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import XCTest
|
||||
|
||||
@@ -130,7 +130,6 @@ class AssociationTableAliasTestsSQLTests : GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=6.1)
|
||||
func testTableAliasBasics_swift61() throws {
|
||||
// A table reference qualifies all unqualified selectables, expressions, and orderings
|
||||
|
||||
@@ -208,7 +207,6 @@ class AssociationTableAliasTestsSQLTests : GRDBTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func testRecursiveRelationDepth1() throws {
|
||||
// A.include(A.parent)
|
||||
|
||||
@@ -101,7 +101,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
LEFT JOIN "cte" ON "t"."id" > "cte"."id"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let cte = CommonTableExpression<T>(named: "cte", request: T.all())
|
||||
let request = T.all()
|
||||
@@ -114,7 +113,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
LEFT JOIN "cte" ON "t"."id" > "cte"."id"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
|
||||
// Include SQL request as a CTE
|
||||
do {
|
||||
@@ -131,7 +129,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" = "cte"."id"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let cte = CommonTableExpression(
|
||||
named: "cte",
|
||||
@@ -146,7 +143,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" = "cte"."id"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
|
||||
// Include a filtered SQL request as a CTE
|
||||
do {
|
||||
@@ -180,7 +176,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" = "cte"."id"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let cte = CommonTableExpression(
|
||||
named: "cte",
|
||||
@@ -196,7 +191,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" = "cte"."id"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
|
||||
// Include SQL request as a CTE (custom column name)
|
||||
do {
|
||||
@@ -214,7 +208,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" = "cte"."id"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let cte = CommonTableExpression(
|
||||
named: "cte",
|
||||
@@ -230,7 +223,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" = "cte"."id"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
|
||||
// Include SQL request as a CTE (empty ON clause)
|
||||
do {
|
||||
@@ -261,7 +253,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" > "cte"."id"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let cte = CommonTableExpression<T>(named: "cte", request: T.all())
|
||||
let request = T.all()
|
||||
@@ -274,7 +265,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" > "cte"."id"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
|
||||
// Include filtered CTE
|
||||
do {
|
||||
@@ -336,7 +326,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" > "cte"."id"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let cte = CommonTableExpression<T>(named: "cte", request: T.all())
|
||||
let request = T.all()
|
||||
@@ -350,7 +339,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON "t"."id" > "cte"."id"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
|
||||
// Include one CTE twice with same key but different condition (last condition wins)
|
||||
do {
|
||||
@@ -366,7 +354,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON ("t"."id" + "cte"."id") = 1
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let cte = CommonTableExpression<T>(named: "cte", request: T.all())
|
||||
let request = T.all()
|
||||
@@ -380,7 +367,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" ON ("t"."id" + "cte"."id") = 1
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
|
||||
// Include one CTE twice with different keys
|
||||
do {
|
||||
@@ -397,7 +383,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" "cte2" ON "t"."id" < "cte2"."id"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let cte = CommonTableExpression<T>(named: "cte", request: T.all())
|
||||
let request = T.all()
|
||||
@@ -412,7 +397,6 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
JOIN "cte" "cte2" ON "t"."id" < "cte2"."id"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
|
||||
// Chain CTE includes
|
||||
do {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import XCTest
|
||||
|
||||
@@ -40,7 +40,7 @@ class DatabaseAbortedTransactionTests : GRDBTestCase {
|
||||
try test(makeDatabaseQueue())
|
||||
try test(makeDatabasePool())
|
||||
try test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -85,7 +85,7 @@ class DatabaseAbortedTransactionTests : GRDBTestCase {
|
||||
try test(makeDatabaseQueue())
|
||||
try test(makeDatabasePool())
|
||||
try test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class DatabaseConfigurationTests: GRDBTestCase {
|
||||
try pool.makeSnapshot().read { _ in }
|
||||
XCTAssertEqual(connectionCountMutex.load(), 5)
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try pool.makeSnapshotPool().read { _ in }
|
||||
XCTAssertEqual(connectionCountMutex.load(), 6)
|
||||
#endif
|
||||
@@ -74,7 +74,7 @@ class DatabaseConfigurationTests: GRDBTestCase {
|
||||
XCTFail("Expected TestError")
|
||||
} catch is TestError { }
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
do {
|
||||
errorMutex.store(TestError())
|
||||
_ = try pool.makeSnapshotPool()
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import XCTest
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import XCTest
|
||||
@@ -50,7 +53,7 @@ class DatabasePoolTests: GRDBTestCase {
|
||||
XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal"))
|
||||
XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm"))
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// A non-empty wal file makes sure ValueObservation can use wal snapshots.
|
||||
// See <https://github.com/groue/GRDB.swift/issues/1383>
|
||||
let walURL = URL(fileURLWithPath: dbPool.path + "-wal")
|
||||
@@ -74,7 +77,7 @@ class DatabasePoolTests: GRDBTestCase {
|
||||
XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal"))
|
||||
XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm"))
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// A non-empty wal file makes sure ValueObservation can use wal snapshots.
|
||||
// See <https://github.com/groue/GRDB.swift/issues/1383>
|
||||
let walURL = URL(fileURLWithPath: dbPool.path + "-wal")
|
||||
@@ -100,7 +103,7 @@ class DatabasePoolTests: GRDBTestCase {
|
||||
XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal"))
|
||||
XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm"))
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// A non-empty wal file makes sure ValueObservation can use wal snapshots.
|
||||
// See <https://github.com/groue/GRDB.swift/issues/1383>
|
||||
let walURL = URL(fileURLWithPath: dbPool.path + "-wal")
|
||||
@@ -123,7 +126,7 @@ class DatabasePoolTests: GRDBTestCase {
|
||||
XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal"))
|
||||
XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm"))
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// A non-empty wal file makes sure ValueObservation can use wal snapshots.
|
||||
// See <https://github.com/groue/GRDB.swift/issues/1383>
|
||||
let walURL = URL(fileURLWithPath: dbPool.path + "-wal")
|
||||
|
||||
@@ -46,7 +46,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(setup(makeDatabaseQueue()))
|
||||
try test(setup(makeDatabasePool()))
|
||||
try test(setup(makeDatabasePool()).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(setup(makeDatabasePool()).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -68,7 +68,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(setup(makeDatabaseQueue()))
|
||||
try await test(setup(makeDatabasePool()))
|
||||
try await test(setup(makeDatabasePool()).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(setup(makeDatabasePool()).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -87,7 +87,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(makeDatabaseQueue())
|
||||
try test(makeDatabasePool())
|
||||
try test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(setup(makeDatabaseQueue()))
|
||||
try test(setup(makeDatabasePool()))
|
||||
try test(setup(makeDatabasePool()).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(setup(makeDatabasePool()).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -152,7 +152,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(setup(makeDatabaseQueue()))
|
||||
try await test(setup(makeDatabasePool()))
|
||||
try await test(setup(makeDatabasePool()).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(setup(makeDatabasePool()).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(setup(makeDatabaseQueue()))
|
||||
try test(setup(makeDatabasePool()))
|
||||
try test(setup(makeDatabasePool()).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(setup(makeDatabasePool()).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -196,7 +196,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(makeDatabaseQueue())
|
||||
try test(makeDatabasePool())
|
||||
try test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -243,7 +243,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(makeDatabaseQueue())
|
||||
try test(makeDatabasePool())
|
||||
try test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -272,7 +272,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(makeDatabaseQueue())
|
||||
try test(makeDatabasePool())
|
||||
try test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -292,7 +292,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(makeDatabaseQueue())
|
||||
try test(makeDatabasePool())
|
||||
try test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -312,7 +312,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(makeDatabaseQueue())
|
||||
try test(makeDatabasePool())
|
||||
try test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -339,7 +339,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try test(setup(makeDatabaseQueue(configuration: Configuration())))
|
||||
try test(setup(makeDatabasePool(configuration: Configuration())))
|
||||
try test(setup(makeDatabasePool(configuration: Configuration())).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(setup(makeDatabasePool(configuration: Configuration())).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -358,7 +358,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -375,7 +375,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -410,7 +410,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
try await test(AnyDatabaseReader(makeDatabaseQueue()))
|
||||
@@ -443,7 +443,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
try await test(AnyDatabaseReader(makeDatabaseQueue()))
|
||||
@@ -481,7 +481,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
try await test(AnyDatabaseReader(makeDatabaseQueue()))
|
||||
@@ -523,7 +523,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
try await test(AnyDatabaseReader(makeDatabaseQueue()))
|
||||
@@ -558,7 +558,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
try await test(AnyDatabaseReader(makeDatabaseQueue()))
|
||||
@@ -591,7 +591,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
try await test(AnyDatabaseReader(makeDatabaseQueue()))
|
||||
@@ -629,7 +629,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
try await test(AnyDatabaseReader(makeDatabaseQueue()))
|
||||
@@ -671,7 +671,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
try await test(AnyDatabaseReader(makeDatabaseQueue()))
|
||||
@@ -719,7 +719,7 @@ class DatabaseReaderTests : GRDBTestCase {
|
||||
try await test(makeDatabaseQueue())
|
||||
try await test(makeDatabasePool())
|
||||
try await test(makeDatabasePool().makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try await test(makeDatabasePool().makeSnapshotPool())
|
||||
#endif
|
||||
try await test(AnyDatabaseReader(makeDatabaseQueue()))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -271,8 +274,3 @@ struct AnyValueReducerFetcher<Fetched>: _ValueReducerFetcher {
|
||||
try _fetch(db)
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(<6.1)
|
||||
// XCTestExpectation is Sendable starting Xcode 16.3 beta.
|
||||
extension XCTestExpectation: @unchecked Sendable { }
|
||||
#endif
|
||||
@@ -481,7 +481,6 @@ class QueryInterfaceExpressionsTests: GRDBTestCase {
|
||||
SELECT * FROM "team" WHERE EXISTS (SELECT * FROM "player" WHERE "teamID" = "team"."id")
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let teamAlias = TableAlias<Team>()
|
||||
let player = Player.filter { $0.teamID == teamAlias.id }
|
||||
@@ -490,7 +489,6 @@ class QueryInterfaceExpressionsTests: GRDBTestCase {
|
||||
SELECT * FROM "team" WHERE EXISTS (SELECT * FROM "player" WHERE "teamID" = "team"."id")
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -415,7 +415,6 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
JOIN "author" ON "author"."id" = "book"."authorId"
|
||||
""")
|
||||
}
|
||||
#if compiler(>=6.1)
|
||||
do {
|
||||
let alias = TableAlias<Author>()
|
||||
let request = Book
|
||||
@@ -435,7 +434,6 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
JOIN "author" ON "author"."id" = "book"."authorId"
|
||||
""")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,11 +910,9 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order { $0.age }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\"")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(\.age)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\"")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(Columns.age.asc)),
|
||||
@@ -924,11 +920,9 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order { $0.age.asc }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(\.age.asc)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(Columns.age.desc)),
|
||||
@@ -936,11 +930,9 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order { $0.age.desc }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(\.age.desc)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(Columns.age, Columns.name.desc)),
|
||||
@@ -963,11 +955,9 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order { $0.age.ascNullsLast }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(\.age.ascNullsLast)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(Columns.age.descNullsFirst)),
|
||||
@@ -975,11 +965,9 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order { $0.age.descNullsFirst }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(\.age.descNullsFirst)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST")
|
||||
#endif
|
||||
#elseif !GRDBCIPHER
|
||||
if #available(iOS 14, macOS 10.16, tvOS 14, *) {
|
||||
XCTAssertEqual(
|
||||
@@ -988,11 +976,9 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order { $0.age.ascNullsLast }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(\.age.ascNullsLast)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(Columns.age.descNullsFirst)),
|
||||
@@ -1000,11 +986,9 @@ class QueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order { $0.age.descNullsFirst }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, tableRequest.order(\.age.descNullsFirst)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST")
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import XCTest
|
||||
|
||||
@@ -303,11 +303,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order { $0.age }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\"")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(\.age)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\"")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(Columns.age.asc)),
|
||||
@@ -315,11 +313,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order { $0.age.asc }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(\.age.asc)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(Columns.age.desc)),
|
||||
@@ -327,11 +323,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order { $0.age.desc }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(\.age.desc)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(Columns.age, Columns.name.desc)),
|
||||
@@ -354,11 +348,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order { $0.age.ascNullsLast }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(\.age.ascNullsLast)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(Columns.age.descNullsFirst)),
|
||||
@@ -366,11 +358,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order { $0.age.descNullsFirst }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(\.age.descNullsFirst)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST")
|
||||
#endif
|
||||
#elseif !GRDBCIPHER
|
||||
if #available(iOS 14, macOS 10.16, tvOS 14, *) {
|
||||
XCTAssertEqual(
|
||||
@@ -379,11 +369,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order { $0.age.ascNullsLast }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(\.age.ascNullsLast)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST")
|
||||
#endif
|
||||
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(Columns.age.descNullsFirst)),
|
||||
@@ -391,11 +379,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order { $0.age.descNullsFirst }),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST")
|
||||
#if compiler(>=6.1)
|
||||
XCTAssertEqual(
|
||||
sql(dbQueue, Reader.order(\.age.descNullsFirst)),
|
||||
"SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST")
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if SWIFT_PACKAGE
|
||||
import GRDBSQLite
|
||||
#elseif GRDBCIPHER
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
// #elseif SomeTrait
|
||||
// import ...
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import XCTest
|
||||
|
||||
@@ -55,7 +55,7 @@ class ValueObservationPrintTests: GRDBTestCase {
|
||||
try test(makeDatabaseQueue(filename: "test", configuration: config))
|
||||
try test(makeDatabasePool(filename: "test", configuration: config))
|
||||
try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class ValueObservationPrintTests: GRDBTestCase {
|
||||
try test(makeDatabaseQueue(filename: "test", configuration: config))
|
||||
try test(makeDatabasePool(filename: "test", configuration: config))
|
||||
try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class ValueObservationPrintTests: GRDBTestCase {
|
||||
try test(makeDatabaseQueue(filename: "test", configuration: config))
|
||||
try test(makeDatabasePool(filename: "test", configuration: config))
|
||||
try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class ValueObservationPrintTests: GRDBTestCase {
|
||||
try test(makeDatabaseQueue(filename: "test", configuration: config))
|
||||
try test(makeDatabasePool(filename: "test", configuration: config))
|
||||
try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot())
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool())
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
let expectedCounts: [Int]
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// Optimization available
|
||||
expectedCounts = [0, 1]
|
||||
#else
|
||||
@@ -516,7 +516,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
let expectedCounts: [Int]
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// Optimization available
|
||||
expectedCounts = [0, 1]
|
||||
#else
|
||||
@@ -543,7 +543,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
// MARK: - Snapshot Observation
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
func testDatabaseSnapshotPoolObservation() throws {
|
||||
let dbPool = try makeDatabasePool()
|
||||
try dbPool.write { try $0.execute(sql: "CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT)") }
|
||||
@@ -952,11 +952,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
XCTAssertEqual(counts.sorted(), counts)
|
||||
|
||||
// Observation was ended
|
||||
#if compiler(>=5.8)
|
||||
await fulfillment(of: [cancellationExpectation], timeout: 2)
|
||||
#else
|
||||
wait(for: [cancellationExpectation], timeout: 2)
|
||||
#endif
|
||||
}
|
||||
|
||||
try await AsyncTest(test).run { try DatabaseQueue() }
|
||||
@@ -993,11 +989,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
XCTAssertEqual(counts.sorted(), counts)
|
||||
|
||||
// Observation was ended
|
||||
#if compiler(>=5.8)
|
||||
await fulfillment(of: [cancellationExpectation], timeout: 2)
|
||||
#else
|
||||
wait(for: [cancellationExpectation], timeout: 2)
|
||||
#endif
|
||||
}
|
||||
|
||||
try await AsyncTest(test).run { try DatabaseQueue() }
|
||||
@@ -1043,11 +1035,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
XCTAssertEqual(cancelledValue, "cancelled loop")
|
||||
|
||||
// Make sure observation was cancelled as well
|
||||
#if compiler(>=5.8)
|
||||
await fulfillment(of: [cancellationExpectation], timeout: 2)
|
||||
#else
|
||||
wait(for: [cancellationExpectation], timeout: 2)
|
||||
#endif
|
||||
}
|
||||
|
||||
try await AsyncTest(test).run { try DatabaseQueue() }
|
||||
@@ -1077,7 +1065,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
let initialValueExpectation = self.expectation(description: "initialValue")
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
initialValueExpectation.assertForOverFulfill = true
|
||||
#else
|
||||
// ValueObservation on DatabasePool will notify the first value twice
|
||||
@@ -1135,7 +1123,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
let initialValueExpectation = self.expectation(description: "")
|
||||
#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER)
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
initialValueExpectation.assertForOverFulfill = true
|
||||
#else
|
||||
// ValueObservation on DatabasePool will notify the first value twice
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// swift-tools-version:6.0
|
||||
// swift-tools-version:6.1
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Swift 6 mode
|
||||
SWIFT_VERSION = 6.0
|
||||
SWIFT_VERSION = 6.1
|
||||
|
||||
// Recommended settings
|
||||
// SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
|
||||
Reference in new issue
Block a user