mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
Merge branch 'development'
This commit is contained in:
commit
2ac5c77353
26 files changed
+380
-166
No files matched your search
@@ -24,7 +24,7 @@ jobs:
|
||||
macOS:
|
||||
name: macOS
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 40
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -60,7 +60,7 @@ jobs:
|
||||
iOS:
|
||||
name: iOS
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 40
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
SPM:
|
||||
name: SPM
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 40
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -132,7 +132,7 @@ jobs:
|
||||
CustomSQLite:
|
||||
name: CustomSQLite
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 40
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -152,7 +152,7 @@ jobs:
|
||||
XCFramework:
|
||||
name: XCFramework
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 40
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
||||
+8
-1
@@ -7,7 +7,7 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
|
||||
|
||||
#### 5.x Releases
|
||||
|
||||
- `5.24.x` Releases - [5.24.0](#5240)
|
||||
- `5.24.x` Releases - [5.24.0](#5240) | [5.24.1](#5241)
|
||||
- `5.23.x` Releases - [5.23.0](#5230)
|
||||
- `5.22.x` Releases - [5.22.0](#5220) | [5.22.1](#5221) | [5.22.2](#5222)
|
||||
- `5.21.x` Releases - [5.21.0](#5210)
|
||||
@@ -91,6 +91,13 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
|
||||
|
||||
---
|
||||
|
||||
## 5.24.1
|
||||
|
||||
Released May 26, 2022 • [diff](https://github.com/groue/GRDB.swift/compare/v5.24.0...v5.24.1)
|
||||
|
||||
- **Fixed**: [#1217](https://github.com/groue/GRDB.swift/pull/1217) by [@GetToSet](https://github.com/GetToSet): Fix doc issue on TableRequest.filter(keys:).
|
||||
- **Fixed**: [#1225](https://github.com/groue/GRDB.swift/pull/1225) by [@groue](https://github.com/groue): Prevent heavy DatabasePool concurrent reads from creating too many threads
|
||||
|
||||
## 5.24.0
|
||||
|
||||
Released May 1, 2022 • [diff](https://github.com/groue/GRDB.swift/compare/v5.23.0...v5.24.0)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GRDB.swift'
|
||||
s.version = '5.24.0'
|
||||
s.version = '5.24.1'
|
||||
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.summary = 'A toolkit for SQLite databases, with a focus on application development.'
|
||||
|
||||
@@ -924,6 +924,9 @@
|
||||
56F5ABDA1D814330001F60CB /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5657AAB81D107001006283EF /* NSData.swift */; };
|
||||
56F5ABDC1D814330001F60CB /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5657AB0E1D10899D006283EF /* URL.swift */; };
|
||||
56F5ABDD1D814330001F60CB /* UUID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A8C22F1D1914540096E9D4 /* UUID.swift */; };
|
||||
56F61DD5283D344E00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DD4283D344E00AF9884 /* getThreadsCount.c */; };
|
||||
56F61DD6283D344E00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DD4283D344E00AF9884 /* getThreadsCount.c */; };
|
||||
56F61DD7283D344E00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DD4283D344E00AF9884 /* getThreadsCount.c */; };
|
||||
56FBFED92210731A00945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED82210731A00945324 /* SQLRequest.swift */; };
|
||||
56FBFEDA2210731A00945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED82210731A00945324 /* SQLRequest.swift */; };
|
||||
56FBFEDB2210731A00945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED82210731A00945324 /* SQLRequest.swift */; };
|
||||
@@ -1646,6 +1649,9 @@
|
||||
56F34FB924B094B6007513FC /* SQLExpressionIsConstantTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLExpressionIsConstantTests.swift; sourceTree = "<group>"; };
|
||||
56F34FC124B0A0B7007513FC /* SQLIdentifyingColumnsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLIdentifyingColumnsTests.swift; sourceTree = "<group>"; };
|
||||
56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultCodeTests.swift; sourceTree = "<group>"; };
|
||||
56F61DD0283D344D00AF9884 /* GRDBTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "GRDBTests-Bridging-Header.h"; path = "GRDBTests/GRDBTests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
56F61DD3283D344E00AF9884 /* getThreadsCount.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = getThreadsCount.h; sourceTree = "<group>"; };
|
||||
56F61DD4283D344E00AF9884 /* getThreadsCount.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getThreadsCount.c; sourceTree = "<group>"; };
|
||||
56FBFED82210731A00945324 /* SQLRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLRequest.swift; sourceTree = "<group>"; };
|
||||
56FDECE11BB32DFD009AD709 /* RowFromStatementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromStatementTests.swift; sourceTree = "<group>"; };
|
||||
56FEB8F6248402E10081AF83 /* DatabaseTraceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseTraceTests.swift; sourceTree = "<group>"; };
|
||||
@@ -1796,6 +1802,8 @@
|
||||
569531361C919DF700CF1A2B /* DatabasePoolFunctionTests.swift */,
|
||||
56EA869D1C932597002BB4DF /* DatabasePoolReadOnlyTests.swift */,
|
||||
563C67B224628BEA00E94EDC /* DatabasePoolTests.swift */,
|
||||
56F61DD3283D344E00AF9884 /* getThreadsCount.h */,
|
||||
56F61DD4283D344E00AF9884 /* getThreadsCount.c */,
|
||||
);
|
||||
name = DatabasePool;
|
||||
sourceTree = "<group>";
|
||||
@@ -2502,6 +2510,7 @@
|
||||
DC37740319C8CBB3004FCF85 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56F61DD0283D344D00AF9884 /* GRDBTests-Bridging-Header.h */,
|
||||
DC37740419C8CBB3004FCF85 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
@@ -2752,17 +2761,18 @@
|
||||
};
|
||||
56E5D7D21B4D3FEE00430942 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
LastSwiftMigration = 1130;
|
||||
LastSwiftMigration = 1340;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
56E5D7F81B4D422D00430942 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
LastSwiftMigration = 1020;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
AAA4DC75230F1E0600C74B15 = {
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
AAA4DD07230F262000C74B15 = {
|
||||
LastSwiftMigration = 1340;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
DC3773F219C8CBB3004FCF85 = {
|
||||
@@ -3432,6 +3442,7 @@
|
||||
56A2383A1B9C74A90082EB20 /* DatabaseQueueInMemoryTests.swift in Sources */,
|
||||
56A5E40A1BA2BCF900707640 /* RecordWithColumnNameManglingTests.swift in Sources */,
|
||||
56677C1A241D217F0050755D /* ValueObservationRecorderTests.swift in Sources */,
|
||||
56F61DD6283D344E00AF9884 /* getThreadsCount.c in Sources */,
|
||||
5653EAF520944B4F00F46237 /* AssociationParallelSQLTests.swift in Sources */,
|
||||
563B06BE2185CCD300B38F35 /* ValueObservationTests.swift in Sources */,
|
||||
56FF455A1D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift in Sources */,
|
||||
@@ -3667,6 +3678,7 @@
|
||||
56DF001D228DDBA300D611F3 /* AssociationPrefetchingCodableRecordTests.swift in Sources */,
|
||||
5653EAD820944B4F00F46237 /* AssociationBelongsToRowScopeTests.swift in Sources */,
|
||||
562205F11E420E47005860AC /* DatabasePoolReleaseMemoryTests.swift in Sources */,
|
||||
56F61DD5283D344E00AF9884 /* getThreadsCount.c in Sources */,
|
||||
56677C19241D217F0050755D /* ValueObservationRecorderTests.swift in Sources */,
|
||||
5653EAF420944B4F00F46237 /* AssociationParallelSQLTests.swift in Sources */,
|
||||
563B06BD2185CCD300B38F35 /* ValueObservationTests.swift in Sources */,
|
||||
@@ -4038,6 +4050,7 @@
|
||||
AAA4DDC0230F262000C74B15 /* DatabaseQueueInMemoryTests.swift in Sources */,
|
||||
AAA4DDC1230F262000C74B15 /* RecordWithColumnNameManglingTests.swift in Sources */,
|
||||
56677C1B241D217F0050755D /* ValueObservationRecorderTests.swift in Sources */,
|
||||
56F61DD7283D344E00AF9884 /* getThreadsCount.c in Sources */,
|
||||
AAA4DDC2230F262000C74B15 /* AssociationParallelSQLTests.swift in Sources */,
|
||||
AAA4DDC3230F262000C74B15 /* ValueObservationTests.swift in Sources */,
|
||||
AAA4DDC4230F262000C74B15 /* RecordUniqueIndexTests.swift in Sources */,
|
||||
@@ -4382,6 +4395,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
@@ -4400,6 +4414,9 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -4407,6 +4424,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
@@ -4427,7 +4445,9 @@
|
||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -4435,6 +4455,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
@@ -4449,6 +4470,9 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -4456,6 +4480,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@@ -4472,7 +4497,9 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -4544,6 +4571,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -4562,6 +4590,9 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = appletvos;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -4569,6 +4600,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -4589,7 +4621,9 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = appletvos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -248,6 +248,11 @@ public struct Configuration {
|
||||
/// Default: .default
|
||||
public var qos: DispatchQoS = .default
|
||||
|
||||
/// The quality of service of read accesses
|
||||
var readQoS: DispatchQoS {
|
||||
targetQueue?.qos ?? self.qos
|
||||
}
|
||||
|
||||
/// A target queue for database accesses.
|
||||
///
|
||||
/// Database connections which are not read-only will prefer
|
||||
@@ -316,17 +321,4 @@ public struct Configuration {
|
||||
return DispatchQueue(label: label, qos: qos)
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a DispatchQueue which has the quality of service of
|
||||
/// read accesses.
|
||||
///
|
||||
/// The returned queue has no target queue, and won't create deadlocks when
|
||||
/// used synchronously from a database access.
|
||||
func makeDispatchQueue(label: String) -> DispatchQueue {
|
||||
if let targetQueue = targetQueue {
|
||||
return DispatchQueue(label: label, qos: targetQueue.qos)
|
||||
} else {
|
||||
return DispatchQueue(label: label, qos: qos)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,14 +57,17 @@ public final class DatabasePool: DatabaseWriter {
|
||||
readerConfiguration.allowsUnsafeTransactions = false
|
||||
|
||||
var readerCount = 0
|
||||
readerPool = Pool(maximumCount: configuration.maximumReaderCount, makeElement: {
|
||||
readerCount += 1 // protected by Pool (TODO: document this protection behavior)
|
||||
return try SerializedDatabase(
|
||||
path: path,
|
||||
configuration: readerConfiguration,
|
||||
defaultLabel: "GRDB.DatabasePool",
|
||||
purpose: "reader.\(readerCount)")
|
||||
})
|
||||
readerPool = Pool(
|
||||
maximumCount: configuration.maximumReaderCount,
|
||||
qos: configuration.readQoS,
|
||||
makeElement: {
|
||||
readerCount += 1 // protected by Pool (TODO: document this protection behavior)
|
||||
return try SerializedDatabase(
|
||||
path: path,
|
||||
configuration: readerConfiguration,
|
||||
defaultLabel: "GRDB.DatabasePool",
|
||||
purpose: "reader.\(readerCount)")
|
||||
})
|
||||
|
||||
// Activate WAL Mode unless readonly
|
||||
if !configuration.readonly {
|
||||
@@ -330,40 +333,33 @@ extension DatabasePool: DatabaseReader {
|
||||
}
|
||||
|
||||
public func asyncRead(_ value: @escaping (Result<Database, Error>) -> Void) {
|
||||
// First async jump in order to grab a reader connection.
|
||||
// Honor configuration dispatching (qos/targetQueue).
|
||||
let label = configuration.identifier(
|
||||
defaultLabel: "GRDB.DatabasePool",
|
||||
purpose: "asyncRead")
|
||||
configuration
|
||||
.makeReaderDispatchQueue(label: label)
|
||||
.async {
|
||||
do {
|
||||
guard let readerPool = self.readerPool else {
|
||||
throw DatabaseError.connectionIsClosed()
|
||||
guard let readerPool = self.readerPool else {
|
||||
value(.failure(DatabaseError(resultCode: .SQLITE_MISUSE, message: "Connection is closed")))
|
||||
return
|
||||
}
|
||||
|
||||
readerPool.asyncGet { result in
|
||||
do {
|
||||
let (reader, releaseReader) = try result.get()
|
||||
// Second async jump because that's how `Pool.async` has to be used.
|
||||
reader.async { db in
|
||||
defer {
|
||||
try? db.commit() // Ignore commit error
|
||||
releaseReader()
|
||||
}
|
||||
let (reader, releaseReader) = try readerPool.get()
|
||||
|
||||
// Second async jump because sync could deadlock if
|
||||
// configuration has a serial targetQueue.
|
||||
reader.async { db in
|
||||
defer {
|
||||
try? db.commit() // Ignore commit error
|
||||
releaseReader()
|
||||
}
|
||||
do {
|
||||
// The block isolation comes from the DEFERRED transaction.
|
||||
try db.beginTransaction(.deferred)
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
do {
|
||||
// The block isolation comes from the DEFERRED transaction.
|
||||
try db.beginTransaction(.deferred)
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
@@ -381,38 +377,31 @@ extension DatabasePool: DatabaseReader {
|
||||
}
|
||||
|
||||
public func asyncUnsafeRead(_ value: @escaping (Result<Database, Error>) -> Void) {
|
||||
// First async jump in order to grab a reader connection.
|
||||
// Honor configuration dispatching (qos/targetQueue).
|
||||
let label = configuration.identifier(
|
||||
defaultLabel: "GRDB.DatabasePool",
|
||||
purpose: "asyncUnsafeRead")
|
||||
configuration
|
||||
.makeReaderDispatchQueue(label: label)
|
||||
.async {
|
||||
do {
|
||||
guard let readerPool = self.readerPool else {
|
||||
throw DatabaseError(resultCode: .SQLITE_MISUSE, message: "Connection is closed")
|
||||
guard let readerPool = self.readerPool else {
|
||||
value(.failure(DatabaseError(resultCode: .SQLITE_MISUSE, message: "Connection is closed")))
|
||||
return
|
||||
}
|
||||
|
||||
readerPool.asyncGet { result in
|
||||
do {
|
||||
let (reader, releaseReader) = try result.get()
|
||||
// Second async jump because that's how `Pool.async` has to be used.
|
||||
reader.async { db in
|
||||
defer {
|
||||
releaseReader()
|
||||
}
|
||||
let (reader, releaseReader) = try readerPool.get()
|
||||
|
||||
// Second async jump because sync could deadlock if
|
||||
// configuration has a serial targetQueue.
|
||||
reader.async { db in
|
||||
defer {
|
||||
releaseReader()
|
||||
}
|
||||
do {
|
||||
// The block isolation comes from the DEFERRED transaction.
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
do {
|
||||
// The block isolation comes from the DEFERRED transaction.
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func unsafeReentrantRead<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
|
||||
+34
-2
@@ -51,13 +51,26 @@ final class Pool<T> {
|
||||
private let itemsSemaphore: DispatchSemaphore // limits the number of elements
|
||||
private let itemsGroup: DispatchGroup // knows when no element is used
|
||||
private let barrierQueue: DispatchQueue
|
||||
private let semaphoreWaitingQueue: DispatchQueue // Inspired by https://khanlou.com/2016/04/the-GCD-handbook/
|
||||
|
||||
init(maximumCount: Int, makeElement: @escaping () throws -> T) {
|
||||
/// Creates a Pool.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - maximumCount: The maximum number of elements.
|
||||
/// - qos: The quality of service of asynchronous accesses.
|
||||
/// - makeElement: A function that creates an element. It is called
|
||||
/// on demand.
|
||||
init(
|
||||
maximumCount: Int,
|
||||
qos: DispatchQoS = .unspecified,
|
||||
makeElement: @escaping () throws -> T)
|
||||
{
|
||||
GRDBPrecondition(maximumCount > 0, "Pool size must be at least 1")
|
||||
self.makeElement = makeElement
|
||||
self.itemsSemaphore = DispatchSemaphore(value: maximumCount)
|
||||
self.itemsGroup = DispatchGroup()
|
||||
self.barrierQueue = DispatchQueue(label: "GRDB.Pool.barrier", attributes: [.concurrent])
|
||||
self.barrierQueue = DispatchQueue(label: "GRDB.Pool.barrier", qos: qos, attributes: [.concurrent])
|
||||
self.semaphoreWaitingQueue = DispatchQueue(label: "GRDB.Pool.wait", qos: qos)
|
||||
}
|
||||
|
||||
/// Returns a tuple (element, release)
|
||||
@@ -87,6 +100,25 @@ final class Pool<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Eventually produces a tuple (element, release), where element is
|
||||
/// intended to be used asynchronously.
|
||||
///
|
||||
/// Client must call release(), only once, after the element has been used.
|
||||
///
|
||||
/// - important: The `execute` argument is executed in a serial dispatch
|
||||
/// queue, so make sure you use the element asynchronously.
|
||||
func asyncGet(_ execute: @escaping (Result<(element: T, release: () -> Void), Error>) -> Void) {
|
||||
// Inspired by https://khanlou.com/2016/04/the-GCD-handbook/
|
||||
// > We wait on the semaphore in the serial queue, which means that
|
||||
// > we’ll have at most one blocked thread when we reach maximum
|
||||
// > executing blocks on the concurrent queue. Any other tasks the user
|
||||
// > enqueues will sit inertly on the serial queue waiting to be
|
||||
// > executed, and won’t cause new threads to be started.
|
||||
semaphoreWaitingQueue.async {
|
||||
execute(Result { try self.get() })
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs a synchronous block with an element. The element turns
|
||||
/// available after the block has executed.
|
||||
func get<U>(block: (T) throws -> U) throws -> U {
|
||||
|
||||
@@ -138,9 +138,11 @@ final class ValueConcurrentObserver<Reducer: ValueReducer> {
|
||||
fetch: reducer._fetch)
|
||||
self.notificationCallbacks = NotificationCallbacks(events: events, onChange: onChange)
|
||||
self.reducer = reducer
|
||||
self.reduceQueue = dbPool.configuration.makeDispatchQueue(label: dbPool.configuration.identifier(
|
||||
defaultLabel: "GRDB",
|
||||
purpose: "ValueObservation"))
|
||||
self.reduceQueue = DispatchQueue(
|
||||
label: dbPool.configuration.identifier(
|
||||
defaultLabel: "GRDB",
|
||||
purpose: "ValueObservation"),
|
||||
qos: dbPool.configuration.readQoS)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,9 +139,11 @@ final class ValueWriteOnlyObserver<Writer: DatabaseWriter, Reducer: ValueReducer
|
||||
fetch: reducer._fetch)
|
||||
self.notificationCallbacks = NotificationCallbacks(events: events, onChange: onChange)
|
||||
self.reducer = reducer
|
||||
self.reduceQueue = writer.configuration.makeDispatchQueue(label: writer.configuration.identifier(
|
||||
defaultLabel: "GRDB",
|
||||
purpose: "ValueObservation"))
|
||||
self.reduceQueue = DispatchQueue(
|
||||
label: writer.configuration.identifier(
|
||||
defaultLabel: "GRDB",
|
||||
purpose: "ValueObservation"),
|
||||
qos: writer.configuration.readQoS)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -535,6 +535,8 @@
|
||||
56F34FC724B0A0C9007513FC /* SQLIdentifyingColumnsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F34FC524B0A0C8007513FC /* SQLIdentifyingColumnsTests.swift */; };
|
||||
56F3E74C1E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */; };
|
||||
56F3E7501E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */; };
|
||||
56F61DEA283D469F00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DE8283D469F00AF9884 /* getThreadsCount.c */; };
|
||||
56F61DEB283D469F00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DE8283D469F00AF9884 /* getThreadsCount.c */; };
|
||||
56FBFED62210731100945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED52210731000945324 /* SQLRequest.swift */; };
|
||||
56FBFED72210731100945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED52210731000945324 /* SQLRequest.swift */; };
|
||||
56FEB8FE248403270081AF83 /* DatabaseTraceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEB8FC248403270081AF83 /* DatabaseTraceTests.swift */; };
|
||||
@@ -1133,6 +1135,8 @@
|
||||
56F34FBD24B094D1007513FC /* SQLExpressionIsConstantTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLExpressionIsConstantTests.swift; sourceTree = "<group>"; };
|
||||
56F34FC524B0A0C8007513FC /* SQLIdentifyingColumnsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLIdentifyingColumnsTests.swift; sourceTree = "<group>"; };
|
||||
56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultCodeTests.swift; sourceTree = "<group>"; };
|
||||
56F61DE8283D469F00AF9884 /* getThreadsCount.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getThreadsCount.c; sourceTree = "<group>"; };
|
||||
56F61DE9283D469F00AF9884 /* getThreadsCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getThreadsCount.h; sourceTree = "<group>"; };
|
||||
56FBFED52210731000945324 /* SQLRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLRequest.swift; sourceTree = "<group>"; };
|
||||
56FDECE11BB32DFD009AD709 /* RowFromStatementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromStatementTests.swift; sourceTree = "<group>"; };
|
||||
56FEB8FC248403270081AF83 /* DatabaseTraceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseTraceTests.swift; sourceTree = "<group>"; };
|
||||
@@ -1262,6 +1266,8 @@
|
||||
569531361C919DF700CF1A2B /* DatabasePoolFunctionTests.swift */,
|
||||
56EA869D1C932597002BB4DF /* DatabasePoolReadOnlyTests.swift */,
|
||||
563C67B624628C0C00E94EDC /* DatabasePoolTests.swift */,
|
||||
56F61DE8283D469F00AF9884 /* getThreadsCount.c */,
|
||||
56F61DE9283D469F00AF9884 /* getThreadsCount.h */,
|
||||
);
|
||||
name = DatabasePool;
|
||||
sourceTree = "<group>";
|
||||
@@ -2138,7 +2144,7 @@
|
||||
};
|
||||
F3BA80401CFB2AD7003DC1BA = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1020;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
F3BA80591CFB2BB2003DC1BA = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
@@ -2146,7 +2152,7 @@
|
||||
};
|
||||
F3BA809A1CFB2F6F003DC1BA = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1020;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -2558,6 +2564,7 @@
|
||||
56419C8724A51D6F004967E1 /* ValueObservationPublisherTests.swift in Sources */,
|
||||
560432A7228F167A009D3FE2 /* AssociationPrefetchingObservationTests.swift in Sources */,
|
||||
5690C33E1D23E7D200E59934 /* FoundationDateTests.swift in Sources */,
|
||||
56F61DEB283D469F00AF9884 /* getThreadsCount.c in Sources */,
|
||||
567A805A1D41350C00C7DCEC /* IndexInfoTests.swift in Sources */,
|
||||
5674A7291F30A9090095F066 /* FetchableRecordDecodableTests.swift in Sources */,
|
||||
56057C5A2291B18E00A7CB10 /* AssociationHasManyRowScopeTests.swift in Sources */,
|
||||
@@ -2928,6 +2935,7 @@
|
||||
56419C8224A51D6E004967E1 /* ValueObservationPublisherTests.swift in Sources */,
|
||||
560432A6228F167A009D3FE2 /* AssociationPrefetchingObservationTests.swift in Sources */,
|
||||
5698AC061D9B9FCF0056AF8C /* QueryInterfaceExtensibilityTests.swift in Sources */,
|
||||
56F61DEA283D469F00AF9884 /* getThreadsCount.c in Sources */,
|
||||
F3BA80FA1CFB3021003DC1BA /* SelectStatementTests.swift in Sources */,
|
||||
5674A7271F30A9090095F066 /* FetchableRecordDecodableTests.swift in Sources */,
|
||||
56057C592291B18E00A7CB10 /* AssociationHasManyRowScopeTests.swift in Sources */,
|
||||
@@ -3237,6 +3245,7 @@
|
||||
baseConfigurationReference = F3BA813B1CFB3770003DC1BA /* GRDBCustomSQLite-Testing.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
@@ -3250,6 +3259,9 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCustomSQLite.GRDBCustomSQLiteiOSTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -3258,6 +3270,7 @@
|
||||
baseConfigurationReference = F3BA813B1CFB3770003DC1BA /* GRDBCustomSQLite-Testing.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@@ -3273,7 +3286,9 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -3339,6 +3354,7 @@
|
||||
baseConfigurationReference = F3BA813B1CFB3770003DC1BA /* GRDBCustomSQLite-Testing.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
@@ -3353,6 +3369,9 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCustomSQLiteOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -3361,6 +3380,7 @@
|
||||
baseConfigurationReference = F3BA813B1CFB3770003DC1BA /* GRDBCustomSQLite-Testing.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
@@ -3377,7 +3397,9 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -577,8 +577,8 @@ ifdef JAZZY
|
||||
--author 'Gwendal Roué' \
|
||||
--author_url https://github.com/groue \
|
||||
--github_url https://github.com/groue/GRDB.swift \
|
||||
--github-file-prefix https://github.com/groue/GRDB.swift/tree/v5.24.0 \
|
||||
--module-version 5.24.0 \
|
||||
--github-file-prefix https://github.com/groue/GRDB.swift/tree/v5.24.1 \
|
||||
--module-version 5.24.1 \
|
||||
--module GRDB \
|
||||
--root-url http://groue.github.io/GRDB.swift/docs/5.24/ \
|
||||
--output Documentation/Reference \
|
||||
|
||||
@@ -35,6 +35,7 @@ let package = Package(
|
||||
"Crash",
|
||||
"Performance",
|
||||
"SPM",
|
||||
"GRDBTests/getThreadsCount.c",
|
||||
])
|
||||
],
|
||||
swiftLanguageVersions: [.v5]
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
---
|
||||
|
||||
**Latest release**: May 1, 2022 • [version 5.24.0](https://github.com/groue/GRDB.swift/tree/v5.24.0) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 4 to GRDB 5](Documentation/GRDB5MigrationGuide.md)
|
||||
**Latest release**: May 26, 2022 • [version 5.24.1](https://github.com/groue/GRDB.swift/tree/v5.24.1) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 4 to GRDB 5](Documentation/GRDB5MigrationGuide.md)
|
||||
|
||||
**Requirements**: iOS 11.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ • SQLite 3.8.5+ • Swift 5.3+ / Xcode 12+
|
||||
|
||||
| Swift version | GRDB version |
|
||||
| -------------- | ----------------------------------------------------------- |
|
||||
| **Swift 5.3+** | **v5.24.0** |
|
||||
| **Swift 5.3+** | **v5.24.1** |
|
||||
| Swift 5.2 | [v5.12.0](https://github.com/groue/GRDB.swift/tree/v5.12.0) |
|
||||
| Swift 5.1 | [v4.14.0](https://github.com/groue/GRDB.swift/tree/v4.14.0) |
|
||||
| Swift 5 | [v4.14.0](https://github.com/groue/GRDB.swift/tree/v4.14.0) |
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.24.0</string>
|
||||
<string>5.24.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -447,6 +447,8 @@
|
||||
565A27CD27871FFF00659A62 /* BackupTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565A27CB27871FFF00659A62 /* BackupTestCase.swift */; };
|
||||
5691D97527257CE40021D540 /* AvailableElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5691D97427257CE40021D540 /* AvailableElements.swift */; };
|
||||
5691D97627257CE40021D540 /* AvailableElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5691D97427257CE40021D540 /* AvailableElements.swift */; };
|
||||
56F61DF0283D484700AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DEE283D484700AF9884 /* getThreadsCount.c */; };
|
||||
56F61DF1283D484700AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DEE283D484700AF9884 /* getThreadsCount.c */; };
|
||||
5B33E6E34F941B4C839A714F /* (null) in Frameworks */ = {isa = PBXBuildFile; };
|
||||
98AB0B01EB11B33719AE412E /* Pods_GRDBTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FE2436BF42B9FCD6552E7076 /* Pods_GRDBTests.framework */; };
|
||||
F2B3C4250D67969FF3948955 /* Pods_GRDBTestsEncrypted.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D5C7999E7D9CE7145687F5D /* Pods_GRDBTestsEncrypted.framework */; };
|
||||
@@ -678,6 +680,9 @@
|
||||
564A2156226B8E18001F64F1 /* GRDBTestsEncrypted.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBTestsEncrypted.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
565A27CB27871FFF00659A62 /* BackupTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackupTestCase.swift; sourceTree = "<group>"; };
|
||||
5691D97427257CE40021D540 /* AvailableElements.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvailableElements.swift; sourceTree = "<group>"; };
|
||||
56F61DEC283D484700AF9884 /* GRDBTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GRDBTests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
56F61DEE283D484700AF9884 /* getThreadsCount.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getThreadsCount.c; sourceTree = "<group>"; };
|
||||
56F61DEF283D484700AF9884 /* getThreadsCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getThreadsCount.h; sourceTree = "<group>"; };
|
||||
6A4788C0F815F6C5E4EBDE12 /* Pods-GRDBTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBTests.debug.xcconfig"; path = "Target Support Files/Pods-GRDBTests/Pods-GRDBTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
7D5C7999E7D9CE7145687F5D /* Pods_GRDBTestsEncrypted.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GRDBTestsEncrypted.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
83BFB5733A86DAA3D0BEE684 /* Pods-GRDBTestsEncrypted.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBTestsEncrypted.debug.xcconfig"; path = "Target Support Files/Pods-GRDBTestsEncrypted/Pods-GRDBTestsEncrypted.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
@@ -768,6 +773,9 @@
|
||||
564A1F1F226B876D001F64F1 /* GRDBTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56F61DEE283D484700AF9884 /* getThreadsCount.c */,
|
||||
56F61DEF283D484700AF9884 /* getThreadsCount.h */,
|
||||
56F61DEC283D484700AF9884 /* GRDBTests-Bridging-Header.h */,
|
||||
564A1F6F226B89D6001F64F1 /* Betty.jpeg */,
|
||||
56419CDA24A54058004967E1 /* InflectionsTests.json */,
|
||||
56419CE724A54058004967E1 /* AnyCursorTests.swift */,
|
||||
@@ -900,11 +908,9 @@
|
||||
56419D0024A5405A004967E1 /* JoinSupportTests.swift */,
|
||||
56419CDC24A54058004967E1 /* MapCursorTests.swift */,
|
||||
56419D0224A5405A004967E1 /* MutablePersistableRecordChangesTests.swift */,
|
||||
56419D3A24A5405F004967E1 /* TableRecordDeleteTests.swift */,
|
||||
56419D2F24A5405E004967E1 /* MutablePersistableRecordEncodableTests.swift */,
|
||||
56419D4424A5405F004967E1 /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */,
|
||||
56419D3B24A5405F004967E1 /* MutablePersistableRecordTests.swift */,
|
||||
56419CD224A54057004967E1 /* TableRecordUpdateTests.swift */,
|
||||
56419CFD24A5405A004967E1 /* NumericOverflowTests.swift */,
|
||||
56419D4F24A54060004967E1 /* OrderedDictionaryTests.swift */,
|
||||
56419D4524A5405F004967E1 /* PersistableRecordTests.swift */,
|
||||
@@ -952,7 +958,9 @@
|
||||
56419D6124A54062004967E1 /* StatementColumnConvertibleFetchTests.swift */,
|
||||
56419D5724A54061004967E1 /* TableDefinitionTests.swift */,
|
||||
56419D4A24A54060004967E1 /* TableRecord+QueryInterfaceRequestTests.swift */,
|
||||
56419D3A24A5405F004967E1 /* TableRecordDeleteTests.swift */,
|
||||
56419CA224A54054004967E1 /* TableRecordTests.swift */,
|
||||
56419CD224A54057004967E1 /* TableRecordUpdateTests.swift */,
|
||||
56419CB624A54055004967E1 /* TransactionObserverSavepointsTests.swift */,
|
||||
56419D0924A5405B004967E1 /* TransactionObserverTests.swift */,
|
||||
56419D2224A5405D004967E1 /* TruncateOptimizationTests.swift */,
|
||||
@@ -1051,10 +1059,10 @@
|
||||
TargetAttributes = {
|
||||
564A1F1C226B876D001F64F1 = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
LastSwiftMigration = 1150;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
564A2095226B8E18001F64F1 = {
|
||||
LastSwiftMigration = 1150;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1243,6 +1251,7 @@
|
||||
56419EAB24A54063004967E1 /* DatabaseValueTests.swift in Sources */,
|
||||
56419D7724A54062004967E1 /* DatabaseCursorTests.swift in Sources */,
|
||||
56419E1524A54062004967E1 /* AssociationChainRowScopesTests.swift in Sources */,
|
||||
56F61DF0283D484700AF9884 /* getThreadsCount.c in Sources */,
|
||||
56419EC724A54063004967E1 /* RecordPrimaryKeyMultipleTests.swift in Sources */,
|
||||
56419DF724A54062004967E1 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
|
||||
56419EB724A54063004967E1 /* MutablePersistableRecordPersistenceConflictPolicyTests.swift in Sources */,
|
||||
@@ -1468,6 +1477,7 @@
|
||||
56419EAC24A54063004967E1 /* DatabaseValueTests.swift in Sources */,
|
||||
56419D7824A54062004967E1 /* DatabaseCursorTests.swift in Sources */,
|
||||
56419E1624A54062004967E1 /* AssociationChainRowScopesTests.swift in Sources */,
|
||||
56F61DF1283D484700AF9884 /* getThreadsCount.c in Sources */,
|
||||
56419EC824A54063004967E1 /* RecordPrimaryKeyMultipleTests.swift in Sources */,
|
||||
56419DF824A54062004967E1 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
|
||||
56419EB824A54063004967E1 /* MutablePersistableRecordPersistenceConflictPolicyTests.swift in Sources */,
|
||||
@@ -1766,6 +1776,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1829,6 +1840,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1900,6 +1912,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1964,6 +1977,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
|
||||
@@ -449,6 +449,8 @@
|
||||
565A27CA27871FE500659A62 /* BackupTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565A27C827871FE500659A62 /* BackupTestCase.swift */; };
|
||||
5691D97227257C930021D540 /* AvailableElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5691D97127257C930021D540 /* AvailableElements.swift */; };
|
||||
5691D97327257C930021D540 /* AvailableElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5691D97127257C930021D540 /* AvailableElements.swift */; };
|
||||
56F61DF6283D4AB100AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DF4283D4AB100AF9884 /* getThreadsCount.c */; };
|
||||
56F61DF7283D4AB100AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DF4283D4AB100AF9884 /* getThreadsCount.c */; };
|
||||
5B33E6E34F941B4C839A714F /* (null) in Frameworks */ = {isa = PBXBuildFile; };
|
||||
E158370AAEED49ECD53CE24A /* Pods_GRDBTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67377FE4CDAD675809F93AD4 /* Pods_GRDBTests.framework */; };
|
||||
F2B3C4250D67969FF3948955 /* Pods_GRDBTestsEncrypted.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D5C7999E7D9CE7145687F5D /* Pods_GRDBTestsEncrypted.framework */; };
|
||||
@@ -681,6 +683,9 @@
|
||||
564A2158226C8F24001F64F1 /* db.SQLCipher3 */ = {isa = PBXFileReference; lastKnownFileType = file; path = db.SQLCipher3; sourceTree = SOURCE_ROOT; };
|
||||
565A27C827871FE500659A62 /* BackupTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackupTestCase.swift; sourceTree = "<group>"; };
|
||||
5691D97127257C930021D540 /* AvailableElements.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvailableElements.swift; sourceTree = "<group>"; };
|
||||
56F61DF2283D4AB100AF9884 /* GRDBTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GRDBTests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
56F61DF4283D4AB100AF9884 /* getThreadsCount.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getThreadsCount.c; sourceTree = "<group>"; };
|
||||
56F61DF5283D4AB100AF9884 /* getThreadsCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getThreadsCount.h; sourceTree = "<group>"; };
|
||||
67377FE4CDAD675809F93AD4 /* Pods_GRDBTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GRDBTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6A4788C0F815F6C5E4EBDE12 /* Pods-GRDBTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBTests.debug.xcconfig"; path = "Target Support Files/Pods-GRDBTests/Pods-GRDBTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
7D5C7999E7D9CE7145687F5D /* Pods_GRDBTestsEncrypted.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GRDBTestsEncrypted.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -771,6 +776,9 @@
|
||||
564A1F1F226B876D001F64F1 /* GRDBTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56F61DF4283D4AB100AF9884 /* getThreadsCount.c */,
|
||||
56F61DF5283D4AB100AF9884 /* getThreadsCount.h */,
|
||||
56F61DF2283D4AB100AF9884 /* GRDBTests-Bridging-Header.h */,
|
||||
564A1F6F226B89D6001F64F1 /* Betty.jpeg */,
|
||||
56419F4E24A54098004967E1 /* InflectionsTests.json */,
|
||||
564A2158226C8F24001F64F1 /* db.SQLCipher3 */,
|
||||
@@ -904,11 +912,9 @@
|
||||
56419F6D24A5409A004967E1 /* JoinSupportTests.swift */,
|
||||
56419F7B24A5409B004967E1 /* MapCursorTests.swift */,
|
||||
56419F4524A54097004967E1 /* MutablePersistableRecordChangesTests.swift */,
|
||||
56419EFF24A54093004967E1 /* TableRecordDeleteTests.swift */,
|
||||
56419F0224A54093004967E1 /* MutablePersistableRecordEncodableTests.swift */,
|
||||
56419F3124A54096004967E1 /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */,
|
||||
56419F0124A54093004967E1 /* MutablePersistableRecordTests.swift */,
|
||||
56419F0624A54093004967E1 /* TableRecordUpdateTests.swift */,
|
||||
56419F0824A54093004967E1 /* NumericOverflowTests.swift */,
|
||||
56419F0324A54093004967E1 /* OrderedDictionaryTests.swift */,
|
||||
56419F1A24A54094004967E1 /* PersistableRecordTests.swift */,
|
||||
@@ -956,7 +962,9 @@
|
||||
56419FA624A5409E004967E1 /* StatementColumnConvertibleFetchTests.swift */,
|
||||
56419F5F24A54099004967E1 /* TableDefinitionTests.swift */,
|
||||
56419F9C24A5409D004967E1 /* TableRecord+QueryInterfaceRequestTests.swift */,
|
||||
56419EFF24A54093004967E1 /* TableRecordDeleteTests.swift */,
|
||||
56419F9024A5409C004967E1 /* TableRecordTests.swift */,
|
||||
56419F0624A54093004967E1 /* TableRecordUpdateTests.swift */,
|
||||
56419F8B24A5409C004967E1 /* TransactionObserverSavepointsTests.swift */,
|
||||
56419F7A24A5409B004967E1 /* TransactionObserverTests.swift */,
|
||||
56419FB624A5409F004967E1 /* TruncateOptimizationTests.swift */,
|
||||
@@ -1055,10 +1063,10 @@
|
||||
TargetAttributes = {
|
||||
564A1F1C226B876D001F64F1 = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
LastSwiftMigration = 1150;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
564A2095226B8E18001F64F1 = {
|
||||
LastSwiftMigration = 1150;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1249,6 +1257,7 @@
|
||||
5641A01824A540A1004967E1 /* FoundationDateComponentsTests.swift in Sources */,
|
||||
5641A01E24A540A1004967E1 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
|
||||
56419FCE24A540A1004967E1 /* AssociationBelongsToSQLDerivationTests.swift in Sources */,
|
||||
56F61DF6283D4AB100AF9884 /* getThreadsCount.c in Sources */,
|
||||
5641A0A024A540A1004967E1 /* SQLRequestTests.swift in Sources */,
|
||||
5641A02224A540A1004967E1 /* ValueObservationFetchTests.swift in Sources */,
|
||||
5641A12624A540A1004967E1 /* DatabasePoolSchemaCacheTests.swift in Sources */,
|
||||
@@ -1474,6 +1483,7 @@
|
||||
5641A01924A540A1004967E1 /* FoundationDateComponentsTests.swift in Sources */,
|
||||
5641A01F24A540A1004967E1 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
|
||||
56419FCF24A540A1004967E1 /* AssociationBelongsToSQLDerivationTests.swift in Sources */,
|
||||
56F61DF7283D4AB100AF9884 /* getThreadsCount.c in Sources */,
|
||||
5641A0A124A540A1004967E1 /* SQLRequestTests.swift in Sources */,
|
||||
5641A02324A540A1004967E1 /* ValueObservationFetchTests.swift in Sources */,
|
||||
5641A12724A540A1004967E1 /* DatabasePoolSchemaCacheTests.swift in Sources */,
|
||||
@@ -1775,6 +1785,7 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1841,6 +1852,7 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1915,6 +1927,7 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1982,6 +1995,7 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Player.fetchCount(db)
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let value = try wait(for: recorder.single, timeout: 1)
|
||||
let value = try wait(for: recorder.single, timeout: 5)
|
||||
XCTAssertEqual(value, 0)
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Row.fetchAll(db, sql: "THIS IS NOT SQL")
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -177,7 +177,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
})
|
||||
|
||||
semaphore.signal()
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
dispatchPrecondition(condition: .onQueue(.main))
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
dispatchPrecondition(condition: .onQueue(queue))
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Player.createTable(db)
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_READONLY)
|
||||
|
||||
@@ -37,7 +37,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
try Player(id: 1, name: "Arthur", score: 1000).insert(db)
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
try wait(for: recorder.single, timeout: 1)
|
||||
try wait(for: recorder.single, timeout: 5)
|
||||
try XCTAssertEqual(writer.read(Player.fetchCount), 1)
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
return try Player.fetchCount(db)
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let count = try wait(for: recorder.single, timeout: 1)
|
||||
let count = try wait(for: recorder.single, timeout: 5)
|
||||
XCTAssertEqual(count, 1)
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
try db.execute(sql: "THIS IS NOT SQL")
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -117,7 +117,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
try db.execute(sql: "THIS IS NOT SQL")
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -160,7 +160,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
})
|
||||
|
||||
semaphore.signal()
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
updates: { db in try Player(id: 1, name: "Arthur", score: 1000).insert(db) },
|
||||
thenRead: { db, _ in try Player.fetchCount(db) })
|
||||
let recorder = publisher.record()
|
||||
let count = try wait(for: recorder.single, timeout: 1)
|
||||
let count = try wait(for: recorder.single, timeout: 5)
|
||||
XCTAssertEqual(count, 1)
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
updates: { _ in },
|
||||
thenRead: { db, _ in try Player.createTable(db) })
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_READONLY)
|
||||
@@ -317,7 +317,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
updates: { db in try db.execute(sql: "THIS IS NOT SQL") },
|
||||
thenRead: { _, _ in XCTFail("Should not read") })
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -349,7 +349,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
},
|
||||
thenRead: { _, _ in XCTFail("Should not read") })
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -379,7 +379,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
updates: { _ in },
|
||||
thenRead: { db, _ in try Row.fetchAll(db, sql: "THIS IS NOT SQL") })
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -421,7 +421,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
.prefix(1)
|
||||
let recorder = publisher.record()
|
||||
scoreSubject.send(0)
|
||||
let count = try wait(for: recorder.single, timeout: 1)
|
||||
let count = try wait(for: recorder.single, timeout: 5)
|
||||
XCTAssertEqual(count, 1)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
try! db.execute(sql: "CREATE TABLE t(a)")
|
||||
expectation.fulfill()
|
||||
})
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
}
|
||||
|
||||
try Test(test)
|
||||
@@ -141,7 +141,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
})
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
}
|
||||
|
||||
try Test(test)
|
||||
@@ -224,7 +224,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
})
|
||||
|
||||
semaphore.signal()
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
})
|
||||
|
||||
semaphore.signal()
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
|
||||
expectation.fulfill()
|
||||
})
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,90 @@ class DatabasePoolTests: GRDBTestCase {
|
||||
try migrator.migrate(dbQueue)
|
||||
}
|
||||
|
||||
func testNumberOfThreads_asyncUnsafeRead() throws {
|
||||
#if SWIFT_PACKAGE
|
||||
// Can't access getThreadsCount() C function
|
||||
throw XCTSkip("Thread count is not available")
|
||||
#else
|
||||
if getThreadsCount() < 0 {
|
||||
throw XCTSkip("Thread count is not available")
|
||||
}
|
||||
|
||||
let pool = try makeDatabasePool()
|
||||
|
||||
// Keep this number big, so that we have a good chance to detect
|
||||
// thread explosion.
|
||||
let numberOfConcurrentReads = 10000
|
||||
|
||||
// Wait for all concurrent reads to end
|
||||
let group = DispatchGroup()
|
||||
|
||||
// The maximum number of threads we could witness
|
||||
var maxThreadCount: CInt = 0
|
||||
let lock = NSLock()
|
||||
|
||||
for _ in (0..<numberOfConcurrentReads) {
|
||||
group.enter()
|
||||
pool.asyncUnsafeRead { result in
|
||||
if case let .failure(error) = result {
|
||||
XCTFail("Unexpected error \(error)")
|
||||
}
|
||||
|
||||
let threadsCount = getThreadsCount()
|
||||
lock.lock()
|
||||
maxThreadCount = max(maxThreadCount, threadsCount)
|
||||
lock.unlock()
|
||||
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
group.wait()
|
||||
XCTAssert(maxThreadCount < 50)
|
||||
#endif
|
||||
}
|
||||
|
||||
func testNumberOfThreads_asyncRead() throws {
|
||||
#if SWIFT_PACKAGE
|
||||
// Can't access getThreadsCount() C function
|
||||
throw XCTSkip("Thread count is not available")
|
||||
#else
|
||||
if getThreadsCount() < 0 {
|
||||
throw XCTSkip("Thread count is not available")
|
||||
}
|
||||
|
||||
let pool = try makeDatabasePool()
|
||||
|
||||
// Keep this number big, so that we have a good chance to detect
|
||||
// thread explosion.
|
||||
let numberOfConcurrentReads = 10000
|
||||
|
||||
// Wait for all concurrent reads to end
|
||||
let group = DispatchGroup()
|
||||
|
||||
// The maximum number of threads we could witness
|
||||
var maxThreadCount: CInt = 0
|
||||
let lock = NSLock()
|
||||
|
||||
for _ in (0..<numberOfConcurrentReads) {
|
||||
group.enter()
|
||||
pool.asyncRead { result in
|
||||
if case let .failure(error) = result {
|
||||
XCTFail("Unexpected error \(error)")
|
||||
}
|
||||
|
||||
let threadsCount = getThreadsCount()
|
||||
lock.lock()
|
||||
maxThreadCount = max(maxThreadCount, threadsCount)
|
||||
lock.unlock()
|
||||
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
group.wait()
|
||||
XCTAssert(maxThreadCount < 50)
|
||||
#endif
|
||||
}
|
||||
|
||||
// MARK: - Closing
|
||||
|
||||
func testClose() throws {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
#include "getThreadsCount.h"
|
||||
@@ -80,7 +80,7 @@ class ValueObservationQueryInterfaceRequestTests: GRDBTestCase {
|
||||
|
||||
let recorder = observation.record(in: dbQueue)
|
||||
try dbQueue.writeWithoutTransaction(performDatabaseModifications)
|
||||
let results = try wait(for: recorder.next(6), timeout: 1)
|
||||
let results = try wait(for: recorder.next(6), timeout: 5)
|
||||
|
||||
XCTAssertNil(results[0])
|
||||
|
||||
@@ -117,7 +117,7 @@ class ValueObservationQueryInterfaceRequestTests: GRDBTestCase {
|
||||
|
||||
let recorder = observation.record(in: dbQueue)
|
||||
try dbQueue.writeWithoutTransaction(performDatabaseModifications)
|
||||
let results = try wait(for: recorder.next(6), timeout: 1)
|
||||
let results = try wait(for: recorder.next(6), timeout: 5)
|
||||
|
||||
XCTAssertEqual(results[0].count, 0)
|
||||
|
||||
|
||||
@@ -422,13 +422,6 @@ extension GRDBTestCase {
|
||||
throws
|
||||
where Reducer.Value: Equatable
|
||||
{
|
||||
#if SQLITE_HAS_CODEC || GRDBCUSTOMSQLITE
|
||||
// debug SQLite builds can be *very* slow
|
||||
let timeout: TimeInterval = 4
|
||||
#else
|
||||
let timeout: TimeInterval = 1
|
||||
#endif
|
||||
|
||||
func test(
|
||||
observation: ValueObservation<Reducer>,
|
||||
scheduling scheduler: ValueObservationScheduler,
|
||||
@@ -455,7 +448,7 @@ extension GRDBTestCase {
|
||||
try writer.writeWithoutTransaction(recordedUpdates)
|
||||
|
||||
let expectation = recorder.next(expectedValues.count)
|
||||
let values = try wait(for: expectation, timeout: timeout)
|
||||
let values = try wait(for: expectation, timeout: 5)
|
||||
XCTAssertEqual(
|
||||
values, expectedValues,
|
||||
"\(#function), \(writer), \(scheduler)", file: file, line: line)
|
||||
@@ -485,7 +478,7 @@ extension GRDBTestCase {
|
||||
}
|
||||
|
||||
let expectation = recorder.next(expectedValues.count)
|
||||
let values = try wait(for: expectation, timeout: timeout)
|
||||
let values = try wait(for: expectation, timeout: 5)
|
||||
XCTAssertEqual(
|
||||
values, expectedValues,
|
||||
"\(#function), \(writer), \(scheduler)", file: file, line: line)
|
||||
@@ -516,14 +509,14 @@ extension GRDBTestCase {
|
||||
if waitForLast {
|
||||
// Optimization!
|
||||
let expectation = recorder.prefix(until: { $0 == lastExpectedValue } )
|
||||
recordedValues = try wait(for: expectation, timeout: timeout)
|
||||
recordedValues = try wait(for: expectation, timeout: 5)
|
||||
} else {
|
||||
// Slow!
|
||||
assertionFailure("Please rewrite your test, because it is too slow: make sure the last expected value is unique.")
|
||||
let expectation = recorder
|
||||
.prefix(expectedValues.count + 2 /* pool may perform double initial fetch */)
|
||||
.inverted
|
||||
recordedValues = try wait(for: expectation, timeout: timeout)
|
||||
recordedValues = try wait(for: expectation, timeout: 5)
|
||||
}
|
||||
|
||||
if scheduler.immediateInitialValue() {
|
||||
@@ -565,14 +558,14 @@ extension GRDBTestCase {
|
||||
if waitForLast {
|
||||
// Optimization!
|
||||
let expectation = recorder.prefix(until: { $0 == lastExpectedValue } )
|
||||
recordedValues = try wait(for: expectation, timeout: timeout)
|
||||
recordedValues = try wait(for: expectation, timeout: 5)
|
||||
} else {
|
||||
// Slow!
|
||||
assertionFailure("Please rewrite your test, because it is too slow: make sure the last expected value is unique.")
|
||||
let expectation = recorder
|
||||
.prefix(expectedValues.count + 2 /* pool may perform double initial fetch */)
|
||||
.inverted
|
||||
recordedValues = try wait(for: expectation, timeout: timeout)
|
||||
recordedValues = try wait(for: expectation, timeout: 5)
|
||||
}
|
||||
|
||||
XCTAssertEqual(recordedValues.first, expectedValues.first)
|
||||
@@ -639,13 +632,6 @@ extension GRDBTestCase {
|
||||
line: UInt)
|
||||
throws
|
||||
{
|
||||
#if SQLITE_HAS_CODEC || GRDBCUSTOMSQLITE
|
||||
// debug SQLite builds can be *very* slow
|
||||
let timeout: TimeInterval = 2
|
||||
#else
|
||||
let timeout: TimeInterval = 1
|
||||
#endif
|
||||
|
||||
func test(
|
||||
observation: ValueObservation<Reducer>,
|
||||
scheduling scheduler: ValueObservationScheduler,
|
||||
@@ -659,7 +645,7 @@ extension GRDBTestCase {
|
||||
scheduling: scheduler,
|
||||
onError: { _ in testErrorDispatching() })
|
||||
|
||||
let (_, error) = try wait(for: recorder.failure(), timeout: timeout)
|
||||
let (_, error) = try wait(for: recorder.failure(), timeout: 5)
|
||||
if let error = error as? Failure {
|
||||
try testFailure(error, writer)
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#include <unistd.h>
|
||||
#include <mach/mach.h>
|
||||
#include "getThreadsCount.h"
|
||||
|
||||
// https://stackoverflow.com/a/21571172/525656
|
||||
int getThreadsCount(void) {
|
||||
thread_array_t threadList;
|
||||
mach_msg_type_number_t threadCount;
|
||||
task_t task;
|
||||
|
||||
kern_return_t kernReturn = task_for_pid(mach_task_self(), getpid(), &task);
|
||||
if (kernReturn != KERN_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
kernReturn = task_threads(task, &threadList, &threadCount);
|
||||
if (kernReturn != KERN_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
vm_deallocate (mach_task_self(), (vm_address_t)threadList, threadCount * sizeof(thread_act_t));
|
||||
|
||||
return threadCount;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef getThreadsCount_h
|
||||
#define getThreadsCount_h
|
||||
|
||||
/// Returns the number of mach threads, or -1 in case of error.
|
||||
int getThreadsCount(void);
|
||||
|
||||
#endif /* getThreadsCount_h */
|
||||
+6
-6
@@ -14,8 +14,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/realm/realm-core",
|
||||
"state" : {
|
||||
"revision" : "dcd3788f75bafb0cc397d145e1651aab3ad4bf0e",
|
||||
"version" : "11.12.0"
|
||||
"revision" : "d97eed3ae7dff2f2e2ffbda83fa8f3b8c445c6ba",
|
||||
"version" : "11.17.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -23,8 +23,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/realm/realm-swift.git",
|
||||
"state" : {
|
||||
"revision" : "628cf20632d65d3a3e90ae8aaf52bce596d7ad8f",
|
||||
"version" : "10.24.2"
|
||||
"revision" : "7f123e48ec12926bb5080e449df360127ee0352d",
|
||||
"version" : "10.26.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -32,8 +32,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/stephencelis/SQLite.swift.git",
|
||||
"state" : {
|
||||
"revision" : "5f5ad81ac0d0a0f3e56e39e646e8423c617df523",
|
||||
"version" : "0.13.2"
|
||||
"revision" : "4d543d811ee644fa4cc4bfa0be996b4dd6ba0f54",
|
||||
"version" : "0.13.3"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user