mirror of
https://github.com/groue/GRDB.swift
synced 2026-12-06 05:28:44 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
578b9a5275 | ||
|
|
63304b3d12 | ||
|
|
39f6ca0035 | ||
|
|
5e3c62c963 | ||
|
|
6966600223 | ||
|
|
e028cbb6d5 | ||
|
|
8b3c3f48a8 | ||
|
|
2d84e72097 | ||
|
|
d91fe7b633 | ||
|
|
090df10831 | ||
|
|
f21037bb69 | ||
|
|
f3041bcc9a | ||
|
|
67b1225dfa | ||
|
|
23f2e0371e | ||
|
|
a3d8df222f | ||
|
|
632ef3707c | ||
|
|
79dc099e6d | ||
|
|
75035fb40c | ||
|
|
b4887b661c | ||
|
|
e8835af363 | ||
|
|
1fabe08332 | ||
|
|
c2e3638e8d | ||
|
|
71abced420 | ||
|
|
ac00046b07 | ||
|
|
38b5204713 | ||
|
|
4b173dece5 | ||
|
|
8ce2c09b52 | ||
|
|
8125574f8f | ||
|
|
8974360cac | ||
|
|
6e48cc1524 | ||
|
|
a1ea75ca34 | ||
|
|
81d2f21093 | ||
|
|
fd73a31abc | ||
|
|
1583ac0c08 | ||
|
|
cafbecd8af | ||
|
|
78c36612b7 | ||
|
|
a95385c740 | ||
|
|
a58ebf7c48 | ||
|
|
13623575ff | ||
|
|
87c5f913b8 | ||
|
|
41172d7967 | ||
|
|
820bc87cfe | ||
|
|
2901acfb41 | ||
|
|
681460a415 |
No files matched your search
@@ -1,6 +1,45 @@
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
## 2.4.0
|
||||
|
||||
Released December 3, 2017 • [diff](https://github.com/groue/GRDB.swift/compare/v2.3.1...v2.4.0)
|
||||
|
||||
**New**
|
||||
|
||||
- [#280](https://github.com/groue/GRDB.swift/pull/280): It is now possible to add an untyped column to an existing table.
|
||||
|
||||
```swift
|
||||
try db.alter(table: "players") { t in
|
||||
t.add(column: "score")
|
||||
}
|
||||
```
|
||||
|
||||
- [#281](https://github.com/groue/GRDB.swift/pull/280): The `Database.dropFTS4SynchronizationTriggers` & `Database.dropFTS5SynchronizationTriggers` method help cleaning up synchronized full-text table ([documentation](https://github.com/groue/GRDB.swift/blob/master/README.md#deleting-synchronized-full-text-tables))
|
||||
|
||||
**Breaking Change**
|
||||
|
||||
- [#282](https://github.com/groue/GRDB.swift/issues/282) This version comes with a breaking change that affects users who manually embed the GRDBCipher and GRDBCustom frameworks in their projects. This change does not affect users of the GRDB framework, or users of GRDBCipher through CocoaPods. Now, instead of embedding the GRDB.xcodeproj project, you have to embed the GRDBCipher.xcodeproj or GRDBCustom.xcodeproj. Please have a look at the updated [Encryption](https://github.com/groue/GRDB.swift/blob/master/README.md#encryption) and [Custom SQLite Builds](https://github.com/groue/GRDB.swift/blob/master/Documentation/CustomSQLiteBuilds.md) documentation chapters.
|
||||
|
||||
|
||||
## 2.3.1
|
||||
|
||||
Released November 8, 2017 • [diff](https://github.com/groue/GRDB.swift/compare/v2.3.0...v2.3.1)
|
||||
|
||||
**Fixed**
|
||||
|
||||
- GRDB 2.2.0 has introduced a fix in the way [transaction observers](https://github.com/groue/GRDB.swift/blob/master/README.md#transactionobserver-protocol) are notified of empty deferred transactions (`BEGIN; COMMIT;`). That fix was incomplete, and inconsistent.
|
||||
|
||||
Now all transactions are notified, without any exception, including:
|
||||
|
||||
```swift
|
||||
try db.execute("BEGIN; COMMIT;")
|
||||
try db.execute("SAVEPOINT foo; RELEASE SAVEPOINT foo;")
|
||||
```
|
||||
|
||||
[Rationale](https://github.com/groue/GRDB.swift/commit/820bc87cfeee701743da852f3634e2c695e911ee#diff-3e791e9db648cd302590c9b86c70757fR376)
|
||||
|
||||
|
||||
## 2.3.0
|
||||
|
||||
Released November 5, 2017 • [diff](https://github.com/groue/GRDB.swift/compare/v2.2.0...v2.3.0)
|
||||
|
||||
@@ -15,7 +15,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
|
||||
|
||||
```sh
|
||||
cd [GRDB directory]
|
||||
git checkout v2.3.0
|
||||
git checkout v2.4.0
|
||||
git submodule update --init SQLiteCustom/src
|
||||
````
|
||||
|
||||
@@ -60,7 +60,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
|
||||
# !! MODIFY THESE TO MATCH YOUR PROJECT HIERARCHY !!
|
||||
#######################################################
|
||||
|
||||
# The path to the folder containing GRDB.xcodeproj:
|
||||
# The path to the folder containing GRDBCustom.xcodeproj:
|
||||
GRDB_SOURCE_PATH="${PROJECT_DIR}/GRDB"
|
||||
|
||||
# The path to your custom "SQLiteLib-USER.xcconfig":
|
||||
@@ -107,7 +107,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
|
||||
|
||||
Modify the top of `GRDBCustomSQLite-INSTALL.sh` file so that it contains correct paths.
|
||||
|
||||
5. Embed the `GRDB.xcodeproj` project in your own project.
|
||||
5. Embed the `GRDBCustom.xcodeproj` project in your own project.
|
||||
|
||||
6. Add the `GRDBCustomSQLiteOSX` or `GRDBCustomSQLiteiOS` target in the **Target Dependencies** section of the **Build Phases** tab of your **application target**.
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ Build a `value BETWEEN min AND max` expression from Swift ranges:
|
||||
|
||||
#### The COUNT Function
|
||||
|
||||
Build a `COUNT(...)` expression from the [count](http://groue.github.io/GRDB.swift/docs/2.3/Functions.html) and [count(distinct:)](http://groue.github.io/GRDB.swift/docs/2.3/Functions.html) functions:
|
||||
Build a `COUNT(...)` expression from the [count](http://groue.github.io/GRDB.swift/docs/2.4/Functions.html) and [count(distinct:)](http://groue.github.io/GRDB.swift/docs/2.4/Functions.html) functions:
|
||||
|
||||
```swift
|
||||
// SQLExpression: COUNT(email)
|
||||
@@ -588,4 +588,4 @@ You may want to compare it to another protocol, SQLSpecificExpressible, which ha
|
||||
|
||||
> :point_up: **Note**: whenever you extend GRDB with a Swift function, method, or operator, you should generally make sure that its signature contains at least one GRDB-specific type. In the `cast` function, it is Database.ColumnType.
|
||||
|
||||
**If SQLExpressionLiteral reveals too limited for your purpose**, you may have to implement a new type that adopts the [SQLExpression](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/SQLExpression.html) protocol.
|
||||
**If SQLExpressionLiteral reveals too limited for your purpose**, you may have to implement a new type that adopts the [SQLExpression](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/SQLExpression.html) protocol.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GRDB.swift'
|
||||
s.version = '2.3.0'
|
||||
s.version = '2.4.0'
|
||||
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.summary = 'A Swift application toolkit for SQLite databases.'
|
||||
|
||||
+8
-3599
File diff suppressed because it is too large.
Load diff
+6
@@ -26,6 +26,12 @@
|
||||
<FileRef
|
||||
location = "group:GRDB.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:GRDBCustom.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:GRDBCipher.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Tests/Performance/GRDBProfiling/GRDBProfiling.xcodeproj">
|
||||
</FileRef>
|
||||
|
||||
@@ -211,7 +211,7 @@ extension Database {
|
||||
bytesNoCopy: UnsafeMutableRawPointer(mutating: statementEnd!),
|
||||
count: statementStart + sqlCodeUnits.count - statementEnd! - 1,
|
||||
deallocator: .none)
|
||||
remainingSQL = String(data: remainingData, encoding: .utf8)!.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
remainingSQL = String(data: remainingData, encoding: .utf8)!.trimmingCharacters(in: statementSeparatorCharacterSet)
|
||||
}
|
||||
|
||||
guard remainingSQL.isEmpty else {
|
||||
@@ -228,12 +228,12 @@ extension Database {
|
||||
observationBroker.updateStatementWillExecute(statement)
|
||||
}
|
||||
|
||||
func updateStatementDidExecute(_ statement: UpdateStatement) {
|
||||
func updateStatementDidExecute(_ statement: UpdateStatement) throws {
|
||||
if statement.invalidatesDatabaseSchemaCache {
|
||||
clearSchemaCache()
|
||||
}
|
||||
|
||||
observationBroker.updateStatementDidExecute(statement)
|
||||
try observationBroker.updateStatementDidExecute(statement)
|
||||
}
|
||||
|
||||
func updateStatementDidFail(_ statement: UpdateStatement) throws {
|
||||
|
||||
@@ -8,6 +8,9 @@ import Foundation
|
||||
/// A raw SQLite statement, suitable for the SQLite C API.
|
||||
public typealias SQLiteStatement = OpaquePointer
|
||||
|
||||
/// Statements are separated by semicolons and white spaces
|
||||
let statementSeparatorCharacterSet = CharacterSet(charactersIn: ";").union(.whitespacesAndNewlines)
|
||||
|
||||
/// An error emitted when one tries to compile an empty statement.
|
||||
struct EmptyStatementError : Error {
|
||||
}
|
||||
@@ -35,10 +38,9 @@ public class Statement {
|
||||
public var sql: String {
|
||||
// trim white space and semicolumn for homogeneous output
|
||||
return String(cString: sqlite3_sql(sqliteStatement))
|
||||
.trimmingCharacters(in: CharacterSet(charactersIn: ";").union(.whitespacesAndNewlines))
|
||||
.trimmingCharacters(in: statementSeparatorCharacterSet)
|
||||
}
|
||||
|
||||
/// The database
|
||||
unowned let database: Database
|
||||
|
||||
/// Creates a prepared statement.
|
||||
@@ -73,9 +75,6 @@ public class Statement {
|
||||
}
|
||||
|
||||
guard let statement = sqliteStatement else {
|
||||
// Sanity check: verify that the string contains only whitespace
|
||||
assert(String(data: Data(bytesNoCopy: UnsafeMutableRawPointer(mutating: statementStart), count: statementEnd.pointee! - statementStart, deallocator: .none), encoding: .utf8)!.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
|
||||
|
||||
// I wish we could simply return nil, and make this initializer failable.
|
||||
//
|
||||
// Unfortunately, there is a Swift bug with failable+throwing initializers:
|
||||
@@ -510,7 +509,7 @@ public final class UpdateStatement : Statement, AuthorizedStatement {
|
||||
|
||||
case SQLITE_DONE:
|
||||
database.authorizer = nil
|
||||
database.updateStatementDidExecute(self)
|
||||
try database.updateStatementDidExecute(self)
|
||||
return
|
||||
|
||||
case let code:
|
||||
|
||||
@@ -250,45 +250,24 @@ class DatabaseObservationBroker {
|
||||
}
|
||||
}
|
||||
|
||||
func updateStatementDidExecute(_ statement: UpdateStatement) {
|
||||
func updateStatementDidExecute(_ statement: UpdateStatement) throws {
|
||||
// Wait for next statement
|
||||
activeTransactionObservations = []
|
||||
|
||||
// Has statement any effect on transaction/savepoints?
|
||||
if let transactionEffect = statement.transactionEffect {
|
||||
// Statement has modified transaction/savepoint state
|
||||
switch transactionEffect {
|
||||
case .beginTransaction:
|
||||
break
|
||||
|
||||
case .commitTransaction:
|
||||
if case .none = self.transactionState {
|
||||
// A COMMIT statement has ended an empty deferred
|
||||
// transaction. For SQLite, no transaction has ever begun:
|
||||
case .commitTransaction: // 1. A COMMIT statement has been executed
|
||||
if case .none = self.transactionState { // 2. sqlite3_commit_hook was not triggered
|
||||
// 1+2 mean that an empty deferred transaction has been completed:
|
||||
//
|
||||
// BEGIN DEFERRED TRANSACTION
|
||||
// COMMIT
|
||||
// BEGIN DEFERRED TRANSACTION; COMMIT
|
||||
//
|
||||
// We don't need to tell transaction observers about it.
|
||||
//
|
||||
// But we have to take care of the .nextTransaction
|
||||
// observation extent. In the sample code below, the
|
||||
// observer must not be notified of the second transaction,
|
||||
// because this is the intent of the programmer:
|
||||
//
|
||||
// // Register an observer for next transaction only
|
||||
// let observer = Observer()
|
||||
// dbQueue.add(transactionObserver:observer, extent: .nextTransaction)
|
||||
//
|
||||
// try dbQueue.inTransaction(.deferred) { db in
|
||||
// return .commit
|
||||
// }
|
||||
//
|
||||
// // Must not notify observer
|
||||
// try dbQueue.inTransaction(.deferred) { db in
|
||||
// try db.execute("...")
|
||||
// return .commit
|
||||
// }
|
||||
emptyDeferredTransactionDidCommit()
|
||||
// This special case has a dedicated handling:
|
||||
return try emptyDeferredTransactionDidCommit()
|
||||
}
|
||||
|
||||
case .rollbackTransaction:
|
||||
@@ -297,17 +276,22 @@ class DatabaseObservationBroker {
|
||||
case .beginSavepoint(let name):
|
||||
savepointStack.savepointDidBegin(name)
|
||||
|
||||
case .releaseSavepoint(let name):
|
||||
case .releaseSavepoint(let name): // 1. A RELEASE SAVEPOINT statement has been executed
|
||||
savepointStack.savepointDidRelease(name)
|
||||
|
||||
if case .none = self.transactionState, // 2. sqlite3_commit_hook was not triggered
|
||||
!database.isInsideTransaction // 3. database is no longer inside a transaction
|
||||
{
|
||||
// 1+2+3 mean that an empty deferred transaction has been completed:
|
||||
//
|
||||
// SAVEPOINT foo; RELEASE SAVEPOINT foo
|
||||
//
|
||||
// This special case has a dedicated handling:
|
||||
return try emptyDeferredTransactionDidCommit()
|
||||
}
|
||||
|
||||
if savepointStack.isEmpty {
|
||||
// Notify buffered events
|
||||
let eventsBuffer = savepointStack.eventsBuffer
|
||||
savepointStack.clear()
|
||||
for (event, observations) in eventsBuffer {
|
||||
for observation in observations {
|
||||
event.send(to: observation)
|
||||
}
|
||||
}
|
||||
notifyBufferedEvents()
|
||||
}
|
||||
|
||||
case .rollbackSavepoint(let name):
|
||||
@@ -358,10 +342,15 @@ class DatabaseObservationBroker {
|
||||
}
|
||||
}
|
||||
|
||||
// Called from sqlite3_commit_hook
|
||||
// Called from sqlite3_commit_hook and emptyDeferredTransactionDidCommit()
|
||||
private func databaseWillCommit() throws {
|
||||
// Time to send all buffered events
|
||||
|
||||
notifyBufferedEvents()
|
||||
for observation in transactionObservations {
|
||||
try observation.databaseWillCommit()
|
||||
}
|
||||
}
|
||||
|
||||
private func notifyBufferedEvents() {
|
||||
let eventsBuffer = savepointStack.eventsBuffer
|
||||
savepointStack.clear()
|
||||
|
||||
@@ -370,10 +359,6 @@ class DatabaseObservationBroker {
|
||||
event.send(to: observation)
|
||||
}
|
||||
}
|
||||
|
||||
for observation in transactionObservations {
|
||||
try observation.databaseWillCommit()
|
||||
}
|
||||
}
|
||||
|
||||
// Called from updateStatementDidExecute
|
||||
@@ -387,11 +372,45 @@ class DatabaseObservationBroker {
|
||||
}
|
||||
|
||||
// Called from updateStatementDidExecute
|
||||
private func emptyDeferredTransactionDidCommit() {
|
||||
for observation in transactionObservations {
|
||||
observation.emptyDeferredTransactionDidCommit(database)
|
||||
private func emptyDeferredTransactionDidCommit() throws {
|
||||
// A statement that ends a transaction has been executed. But for
|
||||
// SQLite, no transaction at all has started, and sqlite3_commit_hook
|
||||
// was not triggered:
|
||||
//
|
||||
// try db.execute("BEGIN DEFERRED TRANSACTION")
|
||||
// try db.execute("COMMIT") // <- no sqlite3_commit_hook callback invocation
|
||||
//
|
||||
// Should we tell transaction observers of this transaction, or not?
|
||||
// The code says that a transaction was open, but SQLite says the
|
||||
// opposite. How do we lift this ambiguity? Should we notify of
|
||||
// *transactions expressed in the code*, or *SQLite transactions* only?
|
||||
//
|
||||
// If we would notify of SQLite transactions only, then we'd notify of
|
||||
// all transactions expressed in the code, but empty deferred
|
||||
// transaction. This means that we'd make an exception. And exceptions
|
||||
// are the recipe for both surprise and confusion.
|
||||
//
|
||||
// For example, is the code below expected to print "did commit"?
|
||||
//
|
||||
// db.afterNextTransactionCommit { _ in print("did commit") }
|
||||
// try db.inTransaction {
|
||||
// performSomeTask(db)
|
||||
// return .commit
|
||||
// }
|
||||
//
|
||||
// Yes it is. And the only way to make it reliably print "did commit" is
|
||||
// to behave consistently, regardless of the implementation of the
|
||||
// `performSomeTask` function. Even if the `performSomeTask` is empty,
|
||||
// even if we actually execute an empty deferred transaction.
|
||||
//
|
||||
// For better or for worse, let's simulate a transaction:
|
||||
do {
|
||||
try databaseWillCommit()
|
||||
databaseDidCommit()
|
||||
} catch {
|
||||
databaseDidRollback(notifyTransactionObservers: true)
|
||||
throw error
|
||||
}
|
||||
cleanupTransactionObservations()
|
||||
}
|
||||
|
||||
// Called from updateStatementDidExecute or updateStatementDidFails
|
||||
@@ -591,16 +610,6 @@ final class TransactionObservation {
|
||||
}
|
||||
}
|
||||
|
||||
func emptyDeferredTransactionDidCommit(_ db: Database) {
|
||||
switch extent {
|
||||
case .observerLifetime, .databaseLifetime:
|
||||
break
|
||||
case .nextTransaction:
|
||||
// Observer most not get any further notification.
|
||||
strongObserver = nil
|
||||
}
|
||||
}
|
||||
|
||||
func databaseDidRollback(_ db: Database) {
|
||||
switch extent {
|
||||
case .observerLifetime, .databaseLifetime:
|
||||
|
||||
+16
-4
@@ -111,16 +111,16 @@ public struct FTS4 : VirtualTableModule {
|
||||
let oldRowID = "old.\(rowIDColumn.quotedDatabaseIdentifier)"
|
||||
|
||||
try db.execute("""
|
||||
CREATE TRIGGER \("__\(contentTable)_bu".quotedDatabaseIdentifier) BEFORE UPDATE ON \(content) BEGIN
|
||||
CREATE TRIGGER \("__\(tableName)_bu".quotedDatabaseIdentifier) BEFORE UPDATE ON \(content) BEGIN
|
||||
DELETE FROM \(ftsTable) WHERE docid=\(oldRowID);
|
||||
END;
|
||||
CREATE TRIGGER \("__\(contentTable)_bd".quotedDatabaseIdentifier) BEFORE DELETE ON \(content) BEGIN
|
||||
CREATE TRIGGER \("__\(tableName)_bd".quotedDatabaseIdentifier) BEFORE DELETE ON \(content) BEGIN
|
||||
DELETE FROM \(ftsTable) WHERE docid=\(oldRowID);
|
||||
END;
|
||||
CREATE TRIGGER \("__\(contentTable)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
|
||||
CREATE TRIGGER \("__\(tableName)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
|
||||
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES(\(newContentColumns));
|
||||
END;
|
||||
CREATE TRIGGER \("__\(contentTable)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
|
||||
CREATE TRIGGER \("__\(tableName)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
|
||||
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES(\(newContentColumns));
|
||||
END;
|
||||
""")
|
||||
@@ -313,3 +313,15 @@ public final class FTS4ColumnDefinition {
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
extension Database {
|
||||
/// Deletes the synchronization triggers for a synchronized FTS4 table
|
||||
public func dropFTS4SynchronizationTriggers(forTable tableName: String) throws {
|
||||
try execute("""
|
||||
DROP TRIGGER IF EXISTS \("__\(tableName)_bu".quotedDatabaseIdentifier);
|
||||
DROP TRIGGER IF EXISTS \("__\(tableName)_bd".quotedDatabaseIdentifier);
|
||||
DROP TRIGGER IF EXISTS \("__\(tableName)_au".quotedDatabaseIdentifier);
|
||||
DROP TRIGGER IF EXISTS \("__\(tableName)_ai".quotedDatabaseIdentifier);
|
||||
""")
|
||||
}
|
||||
}
|
||||
+14
-3
@@ -111,13 +111,13 @@
|
||||
.joined(separator: ", ")
|
||||
|
||||
try db.execute("""
|
||||
CREATE TRIGGER \("__\(contentTable)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
|
||||
CREATE TRIGGER \("__\(tableName)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
|
||||
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES (\(newContentColumns));
|
||||
END;
|
||||
CREATE TRIGGER \("__\(contentTable)_ad".quotedDatabaseIdentifier) AFTER DELETE ON \(content) BEGIN
|
||||
CREATE TRIGGER \("__\(tableName)_ad".quotedDatabaseIdentifier) AFTER DELETE ON \(content) BEGIN
|
||||
INSERT INTO \(ftsTable)(\(ftsTable), \(ftsColumns)) VALUES('delete', \(oldContentColumns));
|
||||
END;
|
||||
CREATE TRIGGER \("__\(contentTable)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
|
||||
CREATE TRIGGER \("__\(tableName)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
|
||||
INSERT INTO \(ftsTable)(\(ftsTable), \(ftsColumns)) VALUES('delete', \(oldContentColumns));
|
||||
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES (\(newContentColumns));
|
||||
END;
|
||||
@@ -319,4 +319,15 @@
|
||||
/// The FTS5 rank column
|
||||
public static let rank = Column("rank")
|
||||
}
|
||||
|
||||
extension Database {
|
||||
/// Deletes the synchronization triggers for a synchronized FTS5 table
|
||||
public func dropFTS5SynchronizationTriggers(forTable tableName: String) throws {
|
||||
try execute("""
|
||||
DROP TRIGGER IF EXISTS \("__\(tableName)_ai".quotedDatabaseIdentifier);
|
||||
DROP TRIGGER IF EXISTS \("__\(tableName)_ad".quotedDatabaseIdentifier);
|
||||
DROP TRIGGER IF EXISTS \("__\(tableName)_au".quotedDatabaseIdentifier);
|
||||
""")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -495,7 +495,7 @@ public final class TableAlteration {
|
||||
/// - returns: An ColumnDefinition that allows you to refine the
|
||||
/// column definition.
|
||||
@discardableResult
|
||||
public func add(column name: String, _ type: Database.ColumnType) -> ColumnDefinition {
|
||||
public func add(column name: String, _ type: Database.ColumnType? = nil) -> ColumnDefinition {
|
||||
let column = ColumnDefinition(name: name, type: type)
|
||||
addedColumns.append(column)
|
||||
return column
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GRDBCipher'
|
||||
s.version = '2.3.0'
|
||||
s.version = '2.4.0'
|
||||
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.summary = 'A Swift application toolkit for SQLite databases.'
|
||||
|
||||
Executable
+3107
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:GRDBCipher.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
+37
-7
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0910"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -17,7 +17,35 @@
|
||||
BlueprintIdentifier = "560FC5191CB003810014AA8E"
|
||||
BuildableName = "GRDBCipher.framework"
|
||||
BlueprintName = "GRDBCipherOSX"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "560FC55D1CB00B880014AA8E"
|
||||
BuildableName = "GRDBCipherOSXTests.xctest"
|
||||
BlueprintName = "GRDBCipherOSXTests"
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "567156191CB16729007DC145"
|
||||
BuildableName = "GRDBCipherOSXEncryptedTests.xctest"
|
||||
BlueprintName = "GRDBCipherOSXEncryptedTests"
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
@@ -26,6 +54,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
@@ -35,7 +64,7 @@
|
||||
BlueprintIdentifier = "560FC55D1CB00B880014AA8E"
|
||||
BuildableName = "GRDBCipherOSXTests.xctest"
|
||||
BlueprintName = "GRDBCipherOSXTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
@@ -45,7 +74,7 @@
|
||||
BlueprintIdentifier = "567156191CB16729007DC145"
|
||||
BuildableName = "GRDBCipherOSXEncryptedTests.xctest"
|
||||
BlueprintName = "GRDBCipherOSXEncryptedTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
@@ -55,7 +84,7 @@
|
||||
BlueprintIdentifier = "560FC5191CB003810014AA8E"
|
||||
BuildableName = "GRDBCipher.framework"
|
||||
BlueprintName = "GRDBCipherOSX"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@@ -65,6 +94,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
@@ -77,7 +107,7 @@
|
||||
BlueprintIdentifier = "560FC5191CB003810014AA8E"
|
||||
BuildableName = "GRDBCipher.framework"
|
||||
BlueprintName = "GRDBCipherOSX"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@@ -95,7 +125,7 @@
|
||||
BlueprintIdentifier = "560FC5191CB003810014AA8E"
|
||||
BuildableName = "GRDBCipher.framework"
|
||||
BlueprintName = "GRDBCipherOSX"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
+36
-15
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0910"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -17,7 +17,35 @@
|
||||
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
|
||||
BuildableName = "GRDBCipher.framework"
|
||||
BlueprintName = "GRDBCipheriOS"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56AFCA841CB1ABC800F48B96"
|
||||
BuildableName = "GRDBCipheriOSEncryptedTests.xctest"
|
||||
BlueprintName = "GRDBCipheriOSEncryptedTests"
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56AFCA2B1CB1AA9900F48B96"
|
||||
BuildableName = "GRDBCipheriOSTests.xctest"
|
||||
BlueprintName = "GRDBCipheriOSTests"
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
@@ -26,6 +54,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
@@ -35,7 +64,7 @@
|
||||
BlueprintIdentifier = "56AFCA2B1CB1AA9900F48B96"
|
||||
BuildableName = "GRDBCipheriOSTests.xctest"
|
||||
BlueprintName = "GRDBCipheriOSTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
@@ -45,7 +74,7 @@
|
||||
BlueprintIdentifier = "56AFCA841CB1ABC800F48B96"
|
||||
BuildableName = "GRDBCipheriOSEncryptedTests.xctest"
|
||||
BlueprintName = "GRDBCipheriOSEncryptedTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
@@ -55,7 +84,7 @@
|
||||
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
|
||||
BuildableName = "GRDBCipher.framework"
|
||||
BlueprintName = "GRDBCipheriOS"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@@ -65,6 +94,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
@@ -77,7 +107,7 @@
|
||||
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
|
||||
BuildableName = "GRDBCipher.framework"
|
||||
BlueprintName = "GRDBCipheriOS"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCipher.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@@ -89,15 +119,6 @@
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
|
||||
BuildableName = "GRDBCipher.framework"
|
||||
BlueprintName = "GRDBCipheriOS"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
Executable
+2462
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:GRDBCustom.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
+19
-21
@@ -17,7 +17,21 @@
|
||||
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLite.framework"
|
||||
BlueprintName = "GRDBCustomSQLiteOSX"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "F3BA809A1CFB2F6F003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLiteOSXTests.xctest"
|
||||
BlueprintName = "GRDBCustomSQLiteOSXTests"
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
@@ -26,6 +40,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
@@ -35,7 +50,7 @@
|
||||
BlueprintIdentifier = "F3BA809A1CFB2F6F003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLiteOSXTests.xctest"
|
||||
BlueprintName = "GRDBCustomSQLiteOSXTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
@@ -45,7 +60,7 @@
|
||||
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLite.framework"
|
||||
BlueprintName = "GRDBCustomSQLiteOSX"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@@ -55,21 +70,13 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLite.framework"
|
||||
BlueprintName = "GRDBCustomSQLiteOSX"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
@@ -79,15 +86,6 @@
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLite.framework"
|
||||
BlueprintName = "GRDBCustomSQLiteOSX"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
+19
-5
@@ -17,7 +17,21 @@
|
||||
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLite.framework"
|
||||
BlueprintName = "GRDBCustomSQLiteiOS"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "F3BA80401CFB2AD7003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLiteiOSTests.xctest"
|
||||
BlueprintName = "GRDBCustomSQLiteiOSTests"
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
@@ -36,7 +50,7 @@
|
||||
BlueprintIdentifier = "F3BA80401CFB2AD7003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLiteiOSTests.xctest"
|
||||
BlueprintName = "GRDBCustomSQLiteiOSTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
@@ -46,7 +60,7 @@
|
||||
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLite.framework"
|
||||
BlueprintName = "GRDBCustomSQLiteiOS"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@@ -69,7 +83,7 @@
|
||||
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLite.framework"
|
||||
BlueprintName = "GRDBCustomSQLiteiOS"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@@ -87,7 +101,7 @@
|
||||
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
|
||||
BuildableName = "GRDBCustomSQLite.framework"
|
||||
BlueprintName = "GRDBCustomSQLiteiOS"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
ReferencedContainer = "container:GRDBCustom.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
@@ -0,0 +1,29 @@
|
||||
> ℹ We use Github issues for bug reports, feature requests, general support, and questions about the library.
|
||||
>
|
||||
> Please fill out this template when filing an issue, and remove this header before submitting.
|
||||
|
||||
## What did you do?
|
||||
|
||||
> Please replace this with what you did.
|
||||
|
||||
## What did you expect to happen?
|
||||
|
||||
> Please replace this with what you expected to happen.
|
||||
|
||||
## What happened instead?
|
||||
|
||||
> Please replace this with of what happened instead.
|
||||
|
||||
## Environment
|
||||
|
||||
**GRDB flavor(s):** (GRDB, GRDBCipher, GRDBCustom?)
|
||||
**GRDB version:**
|
||||
**Installation method:** (CocoaPods, SPM, manual?)
|
||||
**Xcode version:**
|
||||
**Swift version:**
|
||||
**Platform(s) running GRDB:** (iOS, macOS, watchOS?)
|
||||
**macOS version running Xcode:**
|
||||
|
||||
## Demo Project
|
||||
|
||||
> Please link to or upload a project we can download that reproduces the issue.
|
||||
@@ -130,7 +130,7 @@ test_framework_GRDBiOS_minTarget:
|
||||
|
||||
test_framework_GRDBCustomSQLiteOSX: SQLiteCustom
|
||||
$(XCODEBUILD) \
|
||||
-project GRDB.xcodeproj \
|
||||
-project GRDBCustom.xcodeproj \
|
||||
-scheme GRDBCustomSQLiteOSX \
|
||||
$(TEST_ACTIONS) \
|
||||
$(XCPRETTY)
|
||||
@@ -139,7 +139,7 @@ test_framework_GRDBCustomSQLiteiOS: test_framework_GRDBCustomSQLiteiOS_maxTarget
|
||||
|
||||
test_framework_GRDBCustomSQLiteiOS_maxTarget: SQLiteCustom
|
||||
$(XCODEBUILD) \
|
||||
-project GRDB.xcodeproj \
|
||||
-project GRDBCustom.xcodeproj \
|
||||
-scheme GRDBCustomSQLiteiOS \
|
||||
-destination $(MAX_IOS_DESTINATION) \
|
||||
$(TEST_ACTIONS) \
|
||||
@@ -147,7 +147,7 @@ test_framework_GRDBCustomSQLiteiOS_maxTarget: SQLiteCustom
|
||||
|
||||
test_framework_GRDBCustomSQLiteiOS_minTarget: SQLiteCustom
|
||||
$(XCODEBUILD) \
|
||||
-project GRDB.xcodeproj \
|
||||
-project GRDBCustom.xcodeproj \
|
||||
-scheme GRDBCustomSQLiteiOS \
|
||||
-destination $(MIN_IOS_DESTINATION) \
|
||||
$(TEST_ACTIONS) \
|
||||
@@ -155,7 +155,7 @@ test_framework_GRDBCustomSQLiteiOS_minTarget: SQLiteCustom
|
||||
|
||||
test_framework_GRDBCipherOSX: SQLCipher
|
||||
$(XCODEBUILD) \
|
||||
-project GRDB.xcodeproj \
|
||||
-project GRDBCipher.xcodeproj \
|
||||
-scheme GRDBCipherOSX \
|
||||
$(TEST_ACTIONS) \
|
||||
$(XCPRETTY)
|
||||
@@ -164,7 +164,7 @@ test_framework_GRDBCipheriOS: test_framework_GRDBCipheriOS_maxTarget test_framew
|
||||
|
||||
test_framework_GRDBCipheriOS_maxTarget: SQLCipher
|
||||
$(XCODEBUILD) \
|
||||
-project GRDB.xcodeproj \
|
||||
-project GRDBCipher.xcodeproj \
|
||||
-scheme GRDBCipheriOS \
|
||||
-destination $(MAX_IOS_DESTINATION) \
|
||||
$(TEST_ACTIONS) \
|
||||
@@ -172,13 +172,14 @@ test_framework_GRDBCipheriOS_maxTarget: SQLCipher
|
||||
|
||||
test_framework_GRDBCipheriOS_minTarget: SQLCipher
|
||||
$(XCODEBUILD) \
|
||||
-project GRDB.xcodeproj \
|
||||
-project GRDBCipher.xcodeproj \
|
||||
-scheme GRDBCipheriOS \
|
||||
-destination $(MIN_IOS_DESTINATION) \
|
||||
$(TEST_ACTIONS) \
|
||||
$(XCPRETTY)
|
||||
|
||||
test_SPM:
|
||||
# Add sanitizers when available: https://twitter.com/simjp/status/929140877540278272
|
||||
$(SWIFT) package clean
|
||||
$(SWIFT) build
|
||||
$(SWIFT) build -c release
|
||||
@@ -295,10 +296,10 @@ 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/v2.3.0 \
|
||||
--module-version 2.3 \
|
||||
--github-file-prefix https://github.com/groue/GRDB.swift/tree/v2.4.0 \
|
||||
--module-version 2.4 \
|
||||
--module GRDB \
|
||||
--root-url http://groue.github.io/GRDB.swift/docs/2.3/ \
|
||||
--root-url http://groue.github.io/GRDB.swift/docs/2.4/ \
|
||||
--output Documentation/Reference \
|
||||
--podspec GRDB.swift.podspec
|
||||
else
|
||||
|
||||
@@ -3,7 +3,7 @@ GRDB 2 [](ht
|
||||
|
||||
### A toolkit for SQLite databases, with a focus on application development
|
||||
|
||||
**Latest release**: November 5, 2017 • version 2.3.0 • [CHANGELOG](CHANGELOG.md)
|
||||
**Latest release**: December 3, 2017 • version 2.4.0 • [CHANGELOG](CHANGELOG.md)
|
||||
|
||||
**Requirements**: iOS 8.0+ / OSX 10.9+ / watchOS 2.0+ • Swift 4.0 / Xcode 9+
|
||||
|
||||
@@ -14,7 +14,7 @@ GRDB 2 [](ht
|
||||
| Swift 3 | [v1.0](https://github.com/groue/GRDB.swift/tree/v1.0) |
|
||||
| Swift 3.1 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) |
|
||||
| Swift 3.2 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) |
|
||||
| **Swift 4** | **v2.3.0** |
|
||||
| **Swift 4** | **v2.4.0** |
|
||||
|
||||
Follow [@groue](http://twitter.com/groue) on Twitter for release announcements and usage tips.
|
||||
|
||||
@@ -197,7 +197,7 @@ Documentation
|
||||
|
||||
**Reference**
|
||||
|
||||
- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/2.3/index.html) (generated by [Jazzy](https://github.com/realm/jazzy))
|
||||
- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/2.4/index.html) (generated by [Jazzy](https://github.com/realm/jazzy))
|
||||
|
||||
**Getting Started**
|
||||
|
||||
@@ -265,7 +265,7 @@ The [Swift Package Manager](https://swift.org/package-manager/) automates the di
|
||||
```swift
|
||||
let package = Package(
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/groue/GRDB.swift.git", from: "2.3.0")
|
||||
.package(url: "https://github.com/groue/GRDB.swift.git", from: "2.4.0")
|
||||
]
|
||||
)
|
||||
```
|
||||
@@ -282,7 +282,7 @@ If you decide to use Carthage despite this warning, and get any Carthage-related
|
||||
|
||||
## Manually
|
||||
|
||||
1. [Download](https://github.com/groue/GRDB.swift/releases/tag/v2.3.0) a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the `git checkout v2.3.0` command.
|
||||
1. [Download](https://github.com/groue/GRDB.swift/releases/tag/v2.4.0) a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the `git checkout v2.4.0` command.
|
||||
|
||||
2. Embed the `GRDB.xcodeproj` project in your own project.
|
||||
|
||||
@@ -379,7 +379,7 @@ let dbQueue = try DatabaseQueue(
|
||||
configuration: config)
|
||||
```
|
||||
|
||||
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html) for more details.
|
||||
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html) for more details.
|
||||
|
||||
|
||||
## Database Pools
|
||||
@@ -460,7 +460,7 @@ let dbPool = try DatabasePool(
|
||||
configuration: config)
|
||||
```
|
||||
|
||||
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html) for more details.
|
||||
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html) for more details.
|
||||
|
||||
|
||||
Database pools are more memory-hungry than database queues. See [Memory Management](#memory-management) for more information.
|
||||
@@ -650,7 +650,7 @@ Both arrays and cursors can iterate over database results. How do you choose one
|
||||
- Cursors can not be used on any thread: you must consume them in a protected database queue.
|
||||
- Cursors iterate database results in a lazy fashion, and don't consume much memory.
|
||||
- Cursors can be iterated only one time.
|
||||
- Cursors are granted with direct access to SQLite: you can especially expect the best performance from cursors of raw database rows and some primitive types like `Int`, `String`, or `Bool` that adopt the [StatementColumnConvertible](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/StatementColumnConvertible.html) protocol.
|
||||
- Cursors are granted with direct access to SQLite: you can especially expect the best performance from cursors of raw database rows and some primitive types like `Int`, `String`, or `Bool` that adopt the [StatementColumnConvertible](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/StatementColumnConvertible.html) protocol.
|
||||
|
||||
If you don't see, or don't care about the difference, use arrays. If you care about memory and performance, use cursors when appropriate.
|
||||
|
||||
@@ -663,7 +663,7 @@ Date.fetchCursor(...) // DatabaseValueCursor<Date>
|
||||
Player.fetchCursor(...) // RecordCursor<Player>
|
||||
```
|
||||
|
||||
All cursor types adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift. As such, cursors come with many methods: `contains`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `map`, `reduce`:
|
||||
All cursor types adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift. As such, cursors come with many methods: `contains`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `map`, `reduce`:
|
||||
|
||||
```swift
|
||||
// Iterate all Github links
|
||||
@@ -734,7 +734,7 @@ let rows = try Row.fetchAll(db,
|
||||
arguments: ["name": "Arthur"])
|
||||
```
|
||||
|
||||
See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments.
|
||||
See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments.
|
||||
|
||||
Unlike row arrays that contain copies of the database rows, row cursors are close to the SQLite metal, and require a little care:
|
||||
|
||||
@@ -1005,7 +1005,7 @@ GRDB ships with built-in support for the following value types:
|
||||
|
||||
- Generally speaking, all types that adopt the [DatabaseValueConvertible](#custom-value-types) protocol.
|
||||
|
||||
Values can be used as [statement arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html):
|
||||
Values can be used as [statement arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
let url: URL = ...
|
||||
@@ -1397,7 +1397,7 @@ try dbQueue.inDatabase { db in
|
||||
}
|
||||
```
|
||||
|
||||
The `?` and colon-prefixed keys like `:name` in the SQL query are the statement arguments. You set them with arrays or dictionaries (arguments are actually of type [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html), which happens to adopt the ExpressibleByArrayLiteral and ExpressibleByDictionaryLiteral protocols).
|
||||
The `?` and colon-prefixed keys like `:name` in the SQL query are the statement arguments. You set them with arrays or dictionaries (arguments are actually of type [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html), which happens to adopt the ExpressibleByArrayLiteral and ExpressibleByDictionaryLiteral protocols).
|
||||
|
||||
```swift
|
||||
updateStatement.arguments = ["name": "Arthur", "score": 1000]
|
||||
@@ -1659,7 +1659,7 @@ row["consumed"] // "Hello"
|
||||
row["produced"] // nil
|
||||
```
|
||||
|
||||
Row adapters are values that adopt the [RowAdapter](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/RowAdapter.html) protocol. You can implement your own custom adapters ([**:fire: EXPERIMENTAL**](#what-are-experimental-features)), or use one of the four built-in adapters:
|
||||
Row adapters are values that adopt the [RowAdapter](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/RowAdapter.html) protocol. You can implement your own custom adapters ([**:fire: EXPERIMENTAL**](#what-are-experimental-features)), or use one of the four built-in adapters:
|
||||
|
||||
|
||||
### ColumnMapping
|
||||
@@ -1786,8 +1786,8 @@ Before jumping in the low-level wagon, here is the list of all SQLite APIs used
|
||||
- `sqlite3_aggregate_context`, `sqlite3_create_function_v2`, `sqlite3_result_blob`, `sqlite3_result_double`, `sqlite3_result_error`, `sqlite3_result_error_code`, `sqlite3_result_int64`, `sqlite3_result_null`, `sqlite3_result_text`, `sqlite3_user_data`, `sqlite3_value_blob`, `sqlite3_value_bytes`, `sqlite3_value_double`, `sqlite3_value_int64`, `sqlite3_value_text`, `sqlite3_value_type`: see [Custom SQL Functions and Aggregates](#custom-sql-functions-and-aggregates)
|
||||
- `sqlite3_backup_finish`, `sqlite3_backup_init`, `sqlite3_backup_step`: see [Backup](#backup)
|
||||
- `sqlite3_bind_blob`, `sqlite3_bind_double`, `sqlite3_bind_int64`, `sqlite3_bind_null`, `sqlite3_bind_parameter_count`, `sqlite3_bind_parameter_name`, `sqlite3_bind_text`, `sqlite3_clear_bindings`, `sqlite3_column_blob`, `sqlite3_column_bytes`, `sqlite3_column_count`, `sqlite3_column_double`, `sqlite3_column_int64`, `sqlite3_column_name`, `sqlite3_column_text`, `sqlite3_column_type`, `sqlite3_exec`, `sqlite3_finalize`, `sqlite3_prepare_v2`, `sqlite3_reset`, `sqlite3_step`: see [Executing Updates](#executing-updates), [Fetch Queries](#fetch-queries), [Prepared Statements](#prepared-statements), [Values](#values)
|
||||
- `sqlite3_busy_handler`, `sqlite3_busy_timeout`: see [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html)
|
||||
- `sqlite3_changes`, `sqlite3_total_changes`: see [Database.changesCount and Database.totalChangesCount](http://groue.github.io/GRDB.swift/docs/2.3/Classes/Database.html)
|
||||
- `sqlite3_busy_handler`, `sqlite3_busy_timeout`: see [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html)
|
||||
- `sqlite3_changes`, `sqlite3_total_changes`: see [Database.changesCount and Database.totalChangesCount](http://groue.github.io/GRDB.swift/docs/2.4/Classes/Database.html)
|
||||
- `sqlite3_close`, `sqlite3_close_v2`, `sqlite3_next_stmt`, `sqlite3_open_v2`: see [Database Connections](#database-connections)
|
||||
- `sqlite3_commit_hook`, `sqlite3_rollback_hook`, `sqlite3_update_hook`: see [TransactionObserver Protocol](#transactionobserver-protocol), [FetchedRecordsController](#fetchedrecordscontroller)
|
||||
- `sqlite3_config`: see [Error Log](#error-log)
|
||||
@@ -1798,9 +1798,9 @@ Before jumping in the low-level wagon, here is the list of all SQLite APIs used
|
||||
- `sqlite3_last_insert_rowid`: see [Executing Updates](#executing-updates)
|
||||
- `sqlite3_preupdate_count`, `sqlite3_preupdate_depth`, `sqlite3_preupdate_hook`, `sqlite3_preupdate_new`, `sqlite3_preupdate_old`: see [Support for SQLite Pre-Update Hooks](#support-for-sqlite-pre-update-hooks)
|
||||
- `sqlite3_set_authorizer`: **reserved by GRDB**
|
||||
- `sqlite3_sql`: see [Statement.sql](http://groue.github.io/GRDB.swift/docs/2.3/Classes/Statement.html)
|
||||
- `sqlite3_trace`: see [Configuration.trace](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html)
|
||||
- `sqlite3_wal_checkpoint_v2`: see [DatabasePool.checkpoint](http://groue.github.io/GRDB.swift/docs/2.3/Classes/DatabasePool.html)
|
||||
- `sqlite3_sql`: see [Statement.sql](http://groue.github.io/GRDB.swift/docs/2.4/Classes/Statement.html)
|
||||
- `sqlite3_trace`: see [Configuration.trace](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html)
|
||||
- `sqlite3_wal_checkpoint_v2`: see [DatabasePool.checkpoint](http://groue.github.io/GRDB.swift/docs/2.4/Classes/DatabasePool.html)
|
||||
|
||||
|
||||
Records
|
||||
@@ -2125,7 +2125,7 @@ try Place.fetchAll(db, "SELECT ...", arguments:...) // [Place]
|
||||
try Place.fetchOne(db, "SELECT ...", arguments:...) // Place?
|
||||
```
|
||||
|
||||
See [fetching methods](#fetching-methods) for information about the `fetchCursor`, `fetchAll` and `fetchOne` methods. See [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html) for more information about the query arguments.
|
||||
See [fetching methods](#fetching-methods) for information about the `fetchCursor`, `fetchAll` and `fetchOne` methods. See [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html) for more information about the query arguments.
|
||||
|
||||
|
||||
## TableMapping Protocol
|
||||
@@ -2439,15 +2439,18 @@ try player.insert(db)
|
||||
GRDB provides default implementations for [`RowConvertible.init(row:)`](#rowconvertible-protocol) and [`Persistable.encode(to:)`](#persistable-protocol) for record types that also adopt an archival protocol (`Codable`, `Encodable` or `Decodable`). When all their properties are themselves codable, Swift generates the archiving methods, and you don't need to write them down:
|
||||
|
||||
```swift
|
||||
// This is just enough...
|
||||
struct Player: RowConvertible, Persistable, Codable {
|
||||
static let databaseTableName = "players"
|
||||
|
||||
// Declare a plain Codable struct or class...
|
||||
struct Player: Codable {
|
||||
let name: String
|
||||
let score: Int
|
||||
}
|
||||
|
||||
// ... so that you can save and fetch players:
|
||||
// Adopt Record protocols...
|
||||
extension Player: RowConvertible, Persistable {
|
||||
static let databaseTableName = "players"
|
||||
}
|
||||
|
||||
// ...and you can save and fetch players:
|
||||
try dbQueue.inDatabase { db in
|
||||
try Player(name: "Arthur", score: 100).insert(db)
|
||||
let players = try Player.fetchAll(db)
|
||||
@@ -2462,22 +2465,20 @@ struct Place: RowConvertible, Persistable, Codable {
|
||||
static let databaseTableName = "places"
|
||||
|
||||
var title: String
|
||||
var coordinate: CLLocationCoordinate2D // <- Not a simple value
|
||||
var coordinate: CLLocationCoordinate2D // <- Not a simple value!
|
||||
}
|
||||
```
|
||||
|
||||
Make it flat, as below, and you'll be granted with all Codable and GRDB advantages:
|
||||
|
||||
```swift
|
||||
struct Place: RowConvertible, Persistable, Codable {
|
||||
static let databaseTableName = "places"
|
||||
|
||||
// Stored properties are all plain values:
|
||||
struct Place: Codable {
|
||||
// Stored properties are plain values:
|
||||
var title: String
|
||||
var latitude: CLLocationDegrees
|
||||
var longitude: CLLocationDegrees
|
||||
|
||||
// Complex properties are computed properties:
|
||||
// Complex property is computed:
|
||||
var coordinate: CLLocationCoordinate2D {
|
||||
get {
|
||||
return CLLocationCoordinate2D(
|
||||
@@ -2490,19 +2491,26 @@ struct Place: RowConvertible, Persistable, Codable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Free database support!
|
||||
extension Place: RowConvertible, Persistable {
|
||||
static let databaseTableName = "places"
|
||||
}
|
||||
```
|
||||
|
||||
As documented with the [Persistable](#persistable-protocol) protocol, have you struct records use MutablePersistable instead of Persistable when they store their automatically incremented row id:
|
||||
As documented with the [Persistable](#persistable-protocol) protocol, have your struct records use MutablePersistable instead of Persistable when they store their automatically incremented row id:
|
||||
|
||||
```swift
|
||||
struct Place: RowConvertible, MutablePersistable, Codable {
|
||||
static let databaseTableName = "places"
|
||||
|
||||
struct Place: Codable {
|
||||
var id: Int64? // <- the row id
|
||||
var title: String
|
||||
var latitude: CLLocationDegrees
|
||||
var longitude: CLLocationDegrees
|
||||
var coordinate: CLLocationCoordinate2D { ... }
|
||||
}
|
||||
|
||||
extension Place: RowConvertible, MutablePersistable {
|
||||
static let databaseTableName = "places"
|
||||
|
||||
mutating func didInsert(with rowID: Int64, for column: String?) {
|
||||
// Update id after insertion
|
||||
@@ -3181,7 +3189,7 @@ Player // SELECT * FROM players
|
||||
```
|
||||
|
||||
|
||||
Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html):
|
||||
Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
// SELECT DATE(creationDate), COUNT(*) FROM players WHERE name = 'Arthur' GROUP BY date(creationDate)
|
||||
@@ -3650,9 +3658,9 @@ try request.fetchOne(db) // Player?
|
||||
|
||||
**To build custom requests**, you can create your own type that adopts the protocols, or derive requests from other requests, or use one of the built-in concrete types:
|
||||
|
||||
- [SQLRequest](http://groue.github.io/GRDB.swift/docs/2.3/Structs/SQLRequest.html): a Request built from raw SQL
|
||||
- [AnyRequest](http://groue.github.io/GRDB.swift/docs/2.3/Structs/AnyRequest.html): a type-erased Request
|
||||
- [AnyTypedRequest](http://groue.github.io/GRDB.swift/docs/2.3/Structs/AnyTypedRequest.html): a type-erased TypedRequest
|
||||
- [SQLRequest](http://groue.github.io/GRDB.swift/docs/2.4/Structs/SQLRequest.html): a Request built from raw SQL
|
||||
- [AnyRequest](http://groue.github.io/GRDB.swift/docs/2.4/Structs/AnyRequest.html): a type-erased Request
|
||||
- [AnyTypedRequest](http://groue.github.io/GRDB.swift/docs/2.4/Structs/AnyTypedRequest.html): a type-erased TypedRequest
|
||||
|
||||
Use the `asRequest(of:)` method to define the type fetched by the request:
|
||||
|
||||
@@ -4082,7 +4090,7 @@ let pattern = FTS3Pattern(matchingAnyTokenIn: "") // nil
|
||||
let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
|
||||
```
|
||||
|
||||
FTS3Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html):
|
||||
FTS3Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
let documents = try Document.fetchAll(db,
|
||||
@@ -4295,7 +4303,7 @@ let pattern = FTS5Pattern(matchingAnyTokenIn: "") // nil
|
||||
let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
|
||||
```
|
||||
|
||||
FTS5Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html):
|
||||
FTS5Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
let documents = try Document.fetchAll(db,
|
||||
@@ -4355,13 +4363,49 @@ try db.create(virtualTable: "books_ft", using: FTS4()) { t in // or FTS5()
|
||||
}
|
||||
```
|
||||
|
||||
The eventual content already present in the regular table is indexed, and every insert, update or delete that happens in the regular table is automatically applied to the full-text index by the mean of SQL triggers.
|
||||
The eventual content already present in the regular table is indexed, and every insert, update or delete that happens in the regular table is automatically applied to the full-text index.
|
||||
|
||||
For more information, see the SQLite documentation about external content tables: [FTS4](https://www.sqlite.org/fts3.html#_external_content_fts4_tables_), [FTS5](https://sqlite.org/fts5.html#external_content_tables).
|
||||
|
||||
See also [WWDC Companion](https://github.com/groue/WWDCCompanion), a sample app that uses external content tables to store, display, and let the user search the WWDC sessions.
|
||||
|
||||
|
||||
#### Deleting Synchronized Full-Text Tables
|
||||
|
||||
Synchronization of full-text tables with their content table happens by the mean of SQL triggers.
|
||||
|
||||
SQLite automatically deletes those triggers when the content (not full-text) table is dropped.
|
||||
|
||||
However, those triggers remain after the full-text table has been dropped. Unless they are dropped too, they will prevent future insertion, updates, and deletions in the content table, and the creation of a new full-text table.
|
||||
|
||||
To drop those triggers, use the `dropFTS4SynchronizationTriggers` or `dropFTS5SynchronizationTriggers` methods:
|
||||
|
||||
```swift
|
||||
// Create tables
|
||||
try db.create(table: "books") { t in
|
||||
...
|
||||
}
|
||||
try db.create(virtualTable: "books_ft", using: FTS4()) { t in
|
||||
t.synchronize(withTable: "books")
|
||||
...
|
||||
}
|
||||
|
||||
// Drop full-text table
|
||||
try db.drop(table: "books_ft")
|
||||
try db.dropFTS4SynchronizationTriggers(forTable: "books_ft")
|
||||
```
|
||||
|
||||
> :warning: **Warning**: there was a bug in GRDB up to version 2.3.1 included, which created triggers with a wrong name. If it is possible that the full-text table was created by an old version of GRDB, then delete the synchronization triggers **twice**: once with the name of the deleted full-text table, and once with the name of the content table:
|
||||
>
|
||||
> ```swift
|
||||
> // Drop full-text table
|
||||
> try db.drop(table: "books_ft")
|
||||
> try db.dropFTS4SynchronizationTriggers(forTable: "books_ft")
|
||||
> try db.dropFTS4SynchronizationTriggers(forTable: "books") // Support for GRDB <= 2.3.1
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
#### Querying External Content Full-Text Tables
|
||||
|
||||
When you need to perform a full-text search, and the external content table contains all the data you need, you can simply query the full-text table.
|
||||
@@ -4496,19 +4540,6 @@ try dbQueue.inTransaction { db in
|
||||
}
|
||||
```
|
||||
|
||||
> :point_up: **Note**: for SQLite, empty [deferred](#transaction-kinds) transactions are no transaction at all. In this case, the transaction callback is never executed:
|
||||
>
|
||||
> ```swift
|
||||
> // Empty deferred transaction
|
||||
> dbQueue.inTransaction { db in
|
||||
> db.afterNextTransactionCommit { db in
|
||||
> // Never executed
|
||||
> print("success")
|
||||
> }
|
||||
> return .commit
|
||||
> }
|
||||
> ```
|
||||
|
||||
|
||||
### TransactionObserver Protocol
|
||||
|
||||
@@ -4627,15 +4658,6 @@ do {
|
||||
> :point_up: **Note**: all callbacks are called in a protected dispatch queue, and serialized with all database updates.
|
||||
>
|
||||
> :point_up: **Note**: the databaseDidChange(with:) and databaseWillCommit() callbacks must not touch the SQLite database. This limitation does not apply to databaseDidCommit and databaseDidRollback which can use their database argument.
|
||||
>
|
||||
> :point_up: **Note**: for SQLite, empty [deferred](#transaction-kinds) transactions are no transaction at all. In this case, transaction observers are not notified:
|
||||
>
|
||||
> ```swift
|
||||
> // Empty deferred transaction does not notify transaction observers
|
||||
> dbQueue.inTransaction { db in
|
||||
> return .commit
|
||||
> }
|
||||
> ```
|
||||
|
||||
|
||||
[FetchedRecordsController](#fetchedrecordscontroller) and [RxGRDB](http://github.com/RxSwiftCommunity/RxGRDB) are based on the TransactionObserver protocol.
|
||||
@@ -4737,16 +4759,6 @@ dbQueue.inDatabase { db in
|
||||
|
||||
- `.databaseLifetime` has the database retain and notify the observer until the database connection is closed.
|
||||
|
||||
> :point_up: **Note**: for SQLite, empty [deferred](#transaction-kinds) transactions are no transaction at all. In this case, an observer added with the `.nextTransaction` extent is never notified of any transaction:
|
||||
>
|
||||
> ```swift
|
||||
> // Empty deferred transaction
|
||||
> dbQueue.inTransaction { db in
|
||||
> // Observer is never notified of any transaction
|
||||
> db.add(transactionObserver: observer, extent: .nextTransaction)
|
||||
> return .commit
|
||||
> }
|
||||
> ```
|
||||
|
||||
#### Support for SQLite Pre-Update Hooks
|
||||
|
||||
@@ -5118,11 +5130,11 @@ Alternatively, perform a manual installation of GRDB and SQLCipher:
|
||||
|
||||
```sh
|
||||
cd [GRDB directory]
|
||||
git checkout v2.3.0
|
||||
git checkout v2.4.0
|
||||
git submodule update --init SQLCipher/src
|
||||
```
|
||||
|
||||
2. Embed the `GRDB.xcodeproj` project in your own project.
|
||||
2. Embed the `GRDBCipher.xcodeproj` project in your own project.
|
||||
|
||||
3. Add the `GRDBCipherOSX` or `GRDBCipheriOS` target in the **Target Dependencies** section of the **Build Phases** tab of your application target.
|
||||
|
||||
@@ -5225,7 +5237,7 @@ DROP TABLE students;
|
||||
--' WHERE id = 1
|
||||
```
|
||||
|
||||
To avoid those problems, **never embed raw values in your SQL queries**. The only correct technique is to provide [arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html) to your SQL queries:
|
||||
To avoid those problems, **never embed raw values in your SQL queries**. The only correct technique is to provide [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html) to your SQL queries:
|
||||
|
||||
```swift
|
||||
// Good
|
||||
@@ -5804,7 +5816,7 @@ try dbPool.write { db in
|
||||
|
||||
### DatabaseWriter and DatabaseReader Protocols
|
||||
|
||||
Both DatabaseQueue and DatabasePool adopt the [DatabaseReader](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/DatabaseWriter.html) protocols.
|
||||
Both DatabaseQueue and DatabasePool adopt the [DatabaseReader](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/DatabaseWriter.html) protocols.
|
||||
|
||||
These protocols provide a unified API that lets you write safe concurrent code that targets both classes.
|
||||
|
||||
@@ -5812,7 +5824,7 @@ However, database queues are not database pools, and DatabaseReader and Database
|
||||
|
||||
- Pools are less forgiving than queues when one overlooks a transaction (see [concurrency rule 3](#guarantees-and-rules)).
|
||||
- DatabaseWriter.readFromCurrentState is synchronous, or asynchronous, depending on whether it is run by a queue or a pool (see [advanced DatabasePool](#advanced-databasepool)). It thus requires higher libDispatch skills, and more complex synchronization code.
|
||||
- The definition of "current state" in DatabaseWriter.readFromCurrentState is [delicate](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/DatabaseWriter.html#/s:FP4GRDB14DatabaseWriter20readFromCurrentStateFzFCS_8DatabaseT_T_).
|
||||
- The definition of "current state" in DatabaseWriter.readFromCurrentState is [delicate](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/DatabaseWriter.html#/s:FP4GRDB14DatabaseWriter20readFromCurrentStateFzFCS_8DatabaseT_T_).
|
||||
|
||||
DatabaseReader and DatabaseWriter are not a tool for applications that hesitate between DatabaseQueue and DatabasePool, and look for a common API. As seen above, the protocols actually make applications harder to write correctly. Instead, they target generic code that has *both* queues and pools in mind. The built-in AnyDatabaseReader and AnyDatabaseWriter type erasers serve the same purpose.
|
||||
|
||||
@@ -5899,7 +5911,7 @@ If you absolutely need multiple connections, then:
|
||||
- Read about [isolation in SQLite](https://www.sqlite.org/isolation.html)
|
||||
- Learn about [locks and transactions](https://www.sqlite.org/lang_transaction.html)
|
||||
- Become a master of the [WAL mode](https://www.sqlite.org/wal.html)
|
||||
- Prepare to setup a [busy handler](https://www.sqlite.org/c3ref/busy_handler.html) with [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html)
|
||||
- Prepare to setup a [busy handler](https://www.sqlite.org/c3ref/busy_handler.html) with [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html)
|
||||
- [Ask questions](https://github.com/groue/GRDB.swift/issues)
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.3.0</string>
|
||||
<string>2.4.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
- [ ] REGEXP https://www.sqlite.org/lang_expr.html
|
||||
- [ ] CASE x WHEN w1 THEN r1 WHEN w2 THEN r2 ELSE r3 END https://www.sqlite.org/lang_expr.html
|
||||
- [ ] Write regression tests for #156 and #157
|
||||
- [ ] Truncate optimization: tests for drop temp table, drop view, drop temp view
|
||||
- [ ] "Documents" and "Application Support" directories: see https://github.com/ccgus/fmdb/commit/7ebbfd055c48d75dfb0119abbd9b5fc2f9001b9f#diff-2f831b88cf9e6758355acd8f88f7d996R16
|
||||
|
||||
GRDB 3.0
|
||||
|
||||
- [ ] Rename Request to DatabaseRequest, SQLiteRequest, SQLRequest, because Request is a bad name: https://github.com/swift-server/http/pull/7#issuecomment-308448528
|
||||
- [ ] Rename Request to FetchRequest, because Request is a bad name: https://github.com/swift-server/http/pull/7#issuecomment-308448528
|
||||
- [ ] Rename RowConvertible, TableMapping, MutablePersistable and Persistable so that their names contain Record: FetchableRecord, TableRecord, MutablePersistableRecord, PersistableRecord?
|
||||
- [ ] Not sure: Consider introducing RowDecodable and RowEncodable on top of FetchableRecord and MutablePersistableRecord. This would allow keeping fetching and persistence methods private in some files.
|
||||
|
||||
Not sure
|
||||
|
||||
|
||||
@@ -7,147 +7,70 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
56288F841FD4256C0091310B /* GRDBCipher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56288F7D1FD424A40091310B /* GRDBCipher.framework */; };
|
||||
56288F851FD4256C0091310B /* GRDBCipher.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56288F7D1FD424A40091310B /* GRDBCipher.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
56B0372B1E8E31D0003B6DA4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0372A1E8E31D0003B6DA4 /* AppDelegate.swift */; };
|
||||
56B0372D1E8E31D0003B6DA4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0372C1E8E31D0003B6DA4 /* ViewController.swift */; };
|
||||
56B037301E8E31D0003B6DA4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B0372E1E8E31D0003B6DA4 /* Main.storyboard */; };
|
||||
56B037321E8E31D0003B6DA4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 56B037311E8E31D0003B6DA4 /* Assets.xcassets */; };
|
||||
56B037351E8E31D0003B6DA4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B037331E8E31D0003B6DA4 /* LaunchScreen.storyboard */; };
|
||||
56B0373D1E8E3219003B6DA4 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0373C1E8E3219003B6DA4 /* Database.swift */; };
|
||||
56B037791E8E328C003B6DA4 /* GRDBCipher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */; };
|
||||
56B0377A1E8E328C003B6DA4 /* GRDBCipher.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
56B0377F1E8E32B9003B6DA4 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0377E1E8E32B9003B6DA4 /* Person.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
56B037551E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
56288F761FD424A40091310B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = DC3773F319C8CBB3004FCF85;
|
||||
remoteInfo = GRDBOSX;
|
||||
};
|
||||
56B037571E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 56E5D7F91B4D422D00430942;
|
||||
remoteInfo = GRDBOSXTests;
|
||||
};
|
||||
56B037591E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 560C981A1C0E22D300BF8471;
|
||||
remoteInfo = GRDBOSXPerformanceTests;
|
||||
};
|
||||
56B0375B1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 56553C181C3E906C00522B5C;
|
||||
remoteInfo = GRDBOSXCrashTests;
|
||||
};
|
||||
56B0375D1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 560FC54D1CB003810014AA8E;
|
||||
remoteInfo = GRDBCipherOSX;
|
||||
};
|
||||
56B0375F1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
56288F781FD424A40091310B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 560FC5B01CB00B880014AA8E;
|
||||
remoteInfo = GRDBCipherOSXTests;
|
||||
};
|
||||
56B037611E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
56288F7A1FD424A40091310B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 5671566C1CB16729007DC145;
|
||||
remoteInfo = GRDBCipherOSXEncryptedTests;
|
||||
};
|
||||
56B037631E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
56288F7C1FD424A40091310B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F3BA805A1CFB2BB2003DC1BA;
|
||||
remoteInfo = GRDBCustomSQLiteOSX;
|
||||
};
|
||||
56B037651E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F3BA809B1CFB2F6F003DC1BA;
|
||||
remoteInfo = GRDBCustomSQLiteOSXTests;
|
||||
};
|
||||
56B037671E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 56E5D7CA1B4D3FED00430942;
|
||||
remoteInfo = GRDBiOS;
|
||||
};
|
||||
56B037691E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 56E5D7D31B4D3FEE00430942;
|
||||
remoteInfo = GRDBiOSTests;
|
||||
};
|
||||
56B0376B1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 56AFCA231CB1A8BB00F48B96;
|
||||
remoteInfo = GRDBCipheriOS;
|
||||
};
|
||||
56B0376D1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
56288F7E1FD424A40091310B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 56AFCA7F1CB1AA9900F48B96;
|
||||
remoteInfo = GRDBCipheriOSTests;
|
||||
};
|
||||
56B0376F1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
56288F801FD424A40091310B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 56AFCAD71CB1ABC800F48B96;
|
||||
remoteInfo = GRDBCipheriOSEncryptedTests;
|
||||
};
|
||||
56B037711E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
56288F821FD424AD0091310B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F3BA7FFE1CFB25E4003DC1BA;
|
||||
remoteInfo = GRDBCustomSQLiteiOS;
|
||||
};
|
||||
56B037731E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = F3BA80411CFB2AD7003DC1BA;
|
||||
remoteInfo = GRDBCustomSQLiteiOSTests;
|
||||
};
|
||||
56B037751E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 565490A01D5A4798005622CB;
|
||||
remoteInfo = GRDBWatchOS;
|
||||
};
|
||||
56B037771E8E3263003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 56AFC9EE1CB1A8BB00F48B96;
|
||||
remoteInfo = GRDBCipheriOS;
|
||||
};
|
||||
56B0377B1E8E328C003B6DA4 /* PBXContainerItemProxy */ = {
|
||||
56288F861FD4256C0091310B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 56AFC9EE1CB1A8BB00F48B96;
|
||||
remoteInfo = GRDBCipheriOS;
|
||||
@@ -161,7 +84,7 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
56B0377A1E8E328C003B6DA4 /* GRDBCipher.framework in Embed Frameworks */,
|
||||
56288F851FD4256C0091310B /* GRDBCipher.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -177,7 +100,7 @@
|
||||
56B037341E8E31D0003B6DA4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
56B037361E8E31D0003B6DA4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
56B0373C1E8E3219003B6DA4 /* Database.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Database.swift; sourceTree = "<group>"; };
|
||||
56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDB.xcodeproj; path = ../../../GRDB.xcodeproj; sourceTree = "<group>"; };
|
||||
56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDBCipher.xcodeproj; path = ../../../GRDBCipher.xcodeproj; sourceTree = "<group>"; };
|
||||
56B0377E1E8E32B9003B6DA4 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -186,17 +109,30 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
56B037791E8E328C003B6DA4 /* GRDBCipher.framework in Frameworks */,
|
||||
56288F841FD4256C0091310B /* GRDBCipher.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
56288F6E1FD424A40091310B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56288F771FD424A40091310B /* GRDBCipher.framework */,
|
||||
56288F791FD424A40091310B /* GRDBCipherOSXTests.xctest */,
|
||||
56288F7B1FD424A40091310B /* GRDBCipherOSXEncryptedTests.xctest */,
|
||||
56288F7D1FD424A40091310B /* GRDBCipher.framework */,
|
||||
56288F7F1FD424A40091310B /* GRDBCipheriOSTests.xctest */,
|
||||
56288F811FD424A40091310B /* GRDBCipheriOSEncryptedTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56B0371E1E8E31D0003B6DA4 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */,
|
||||
56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */,
|
||||
56B037291E8E31D0003B6DA4 /* GRDBiOS */,
|
||||
56B037281E8E31D0003B6DA4 /* Products */,
|
||||
);
|
||||
@@ -225,30 +161,6 @@
|
||||
path = GRDBiOS;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56B0373F1E8E3250003B6DA4 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B037561E8E3250003B6DA4 /* GRDB.framework */,
|
||||
56B037581E8E3250003B6DA4 /* GRDBOSXTests.xctest */,
|
||||
56B0375A1E8E3250003B6DA4 /* GRDBOSXPerformanceTests.xctest */,
|
||||
56B0375C1E8E3250003B6DA4 /* GRDBOSXCrashTests.xctest */,
|
||||
56B0375E1E8E3250003B6DA4 /* GRDBCipher.framework */,
|
||||
56B037601E8E3250003B6DA4 /* GRDBCipherOSXTests.xctest */,
|
||||
56B037621E8E3250003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */,
|
||||
56B037641E8E3250003B6DA4 /* GRDBCustomSQLite.framework */,
|
||||
56B037661E8E3250003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */,
|
||||
56B037681E8E3250003B6DA4 /* GRDB.framework */,
|
||||
56B0376A1E8E3250003B6DA4 /* GRDBiOSTests.xctest */,
|
||||
56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */,
|
||||
56B0376E1E8E3250003B6DA4 /* GRDBCipheriOSTests.xctest */,
|
||||
56B037701E8E3250003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */,
|
||||
56B037721E8E3250003B6DA4 /* GRDBCustomSQLite.framework */,
|
||||
56B037741E8E3250003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */,
|
||||
56B037761E8E3250003B6DA4 /* GRDB.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -264,8 +176,8 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
56B037781E8E3263003B6DA4 /* PBXTargetDependency */,
|
||||
56B0377C1E8E328C003B6DA4 /* PBXTargetDependency */,
|
||||
56288F831FD424AD0091310B /* PBXTargetDependency */,
|
||||
56288F871FD4256C0091310B /* PBXTargetDependency */,
|
||||
);
|
||||
name = GRDBiOS;
|
||||
productName = GRDBiOS;
|
||||
@@ -279,7 +191,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0830;
|
||||
LastUpgradeCheck = 0830;
|
||||
LastUpgradeCheck = 0910;
|
||||
ORGANIZATIONNAME = "Gwendal Roué";
|
||||
TargetAttributes = {
|
||||
56B037261E8E31D0003B6DA4 = {
|
||||
@@ -302,8 +214,8 @@
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 56B0373F1E8E3250003B6DA4 /* Products */;
|
||||
ProjectRef = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
|
||||
ProductGroup = 56288F6E1FD424A40091310B /* Products */;
|
||||
ProjectRef = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
@@ -314,123 +226,46 @@
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
56B037561E8E3250003B6DA4 /* GRDB.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = GRDB.framework;
|
||||
remoteRef = 56B037551E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037581E8E3250003B6DA4 /* GRDBOSXTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBOSXTests.xctest;
|
||||
remoteRef = 56B037571E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B0375A1E8E3250003B6DA4 /* GRDBOSXPerformanceTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBOSXPerformanceTests.xctest;
|
||||
remoteRef = 56B037591E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B0375C1E8E3250003B6DA4 /* GRDBOSXCrashTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBOSXCrashTests.xctest;
|
||||
remoteRef = 56B0375B1E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B0375E1E8E3250003B6DA4 /* GRDBCipher.framework */ = {
|
||||
56288F771FD424A40091310B /* GRDBCipher.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = GRDBCipher.framework;
|
||||
remoteRef = 56B0375D1E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
remoteRef = 56288F761FD424A40091310B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037601E8E3250003B6DA4 /* GRDBCipherOSXTests.xctest */ = {
|
||||
56288F791FD424A40091310B /* GRDBCipherOSXTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBCipherOSXTests.xctest;
|
||||
remoteRef = 56B0375F1E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
remoteRef = 56288F781FD424A40091310B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037621E8E3250003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */ = {
|
||||
56288F7B1FD424A40091310B /* GRDBCipherOSXEncryptedTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBCipherOSXEncryptedTests.xctest;
|
||||
remoteRef = 56B037611E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
remoteRef = 56288F7A1FD424A40091310B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037641E8E3250003B6DA4 /* GRDBCustomSQLite.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = GRDBCustomSQLite.framework;
|
||||
remoteRef = 56B037631E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037661E8E3250003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBCustomSQLiteOSXTests.xctest;
|
||||
remoteRef = 56B037651E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037681E8E3250003B6DA4 /* GRDB.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = GRDB.framework;
|
||||
remoteRef = 56B037671E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B0376A1E8E3250003B6DA4 /* GRDBiOSTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBiOSTests.xctest;
|
||||
remoteRef = 56B037691E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */ = {
|
||||
56288F7D1FD424A40091310B /* GRDBCipher.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = GRDBCipher.framework;
|
||||
remoteRef = 56B0376B1E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
remoteRef = 56288F7C1FD424A40091310B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B0376E1E8E3250003B6DA4 /* GRDBCipheriOSTests.xctest */ = {
|
||||
56288F7F1FD424A40091310B /* GRDBCipheriOSTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBCipheriOSTests.xctest;
|
||||
remoteRef = 56B0376D1E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
remoteRef = 56288F7E1FD424A40091310B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037701E8E3250003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */ = {
|
||||
56288F811FD424A40091310B /* GRDBCipheriOSEncryptedTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBCipheriOSEncryptedTests.xctest;
|
||||
remoteRef = 56B0376F1E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037721E8E3250003B6DA4 /* GRDBCustomSQLite.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = GRDBCustomSQLite.framework;
|
||||
remoteRef = 56B037711E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037741E8E3250003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBCustomSQLiteiOSTests.xctest;
|
||||
remoteRef = 56B037731E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
56B037761E8E3250003B6DA4 /* GRDB.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = GRDB.framework;
|
||||
remoteRef = 56B037751E8E3250003B6DA4 /* PBXContainerItemProxy */;
|
||||
remoteRef = 56288F801FD424A40091310B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
@@ -463,15 +298,15 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
56B037781E8E3263003B6DA4 /* PBXTargetDependency */ = {
|
||||
56288F831FD424AD0091310B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = GRDBCipheriOS;
|
||||
targetProxy = 56B037771E8E3263003B6DA4 /* PBXContainerItemProxy */;
|
||||
targetProxy = 56288F821FD424AD0091310B /* PBXContainerItemProxy */;
|
||||
};
|
||||
56B0377C1E8E328C003B6DA4 /* PBXTargetDependency */ = {
|
||||
56288F871FD4256C0091310B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = GRDBCipheriOS;
|
||||
targetProxy = 56B0377B1E8E328C003B6DA4 /* PBXContainerItemProxy */;
|
||||
targetProxy = 56288F861FD4256C0091310B /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
@@ -505,7 +340,9 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@@ -513,7 +350,11 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -536,7 +377,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -555,7 +396,9 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@@ -563,7 +406,11 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -580,7 +427,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
@@ -598,7 +445,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOS;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -612,7 +459,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOS;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -635,6 +482,7 @@
|
||||
56B0373B1E8E31D0003B6DA4 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
LastUpgradeVersion = "0910"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@@ -45,6 +46,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -9,7 +9,41 @@ import XCTest
|
||||
|
||||
class DatabaseAfterNextTransactionCommitTests: GRDBTestCase {
|
||||
|
||||
func testDatabaseAfterNextTransactionCommit() throws {
|
||||
func testTransactionCompletions() throws {
|
||||
// implicit transaction
|
||||
try assertTransaction(start: "", end: "CREATE TABLE t(a)", isNotifiedAs: .commit)
|
||||
|
||||
// explicit commit
|
||||
try assertTransaction(start: "BEGIN DEFERRED TRANSACTION", end: "COMMIT", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "BEGIN DEFERRED TRANSACTION; CREATE TABLE t(a)", end: "COMMIT", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "BEGIN IMMEDIATE TRANSACTION", end: "COMMIT", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "BEGIN IMMEDIATE TRANSACTION; CREATE TABLE t(a)", end: "COMMIT", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "BEGIN EXCLUSIVE TRANSACTION", end: "COMMIT", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "BEGIN EXCLUSIVE TRANSACTION; CREATE TABLE t(a)", end: "COMMIT", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "SAVEPOINT test", end: "COMMIT", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "SAVEPOINT test; CREATE TABLE t(a)", end: "COMMIT", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "SAVEPOINT test; ROLLBACK TRANSACTION TO SAVEPOINT test", end: "RELEASE SAVEPOINT test", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "SAVEPOINT test; CREATE TABLE t(a); ROLLBACK TRANSACTION TO SAVEPOINT test", end: "RELEASE SAVEPOINT test", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "SAVEPOINT test", end: "RELEASE SAVEPOINT test", isNotifiedAs: .commit)
|
||||
try assertTransaction(start: "SAVEPOINT test; CREATE TABLE t(a)", end: "RELEASE SAVEPOINT test", isNotifiedAs: .commit)
|
||||
|
||||
// explicit rollback
|
||||
try assertTransaction(start: "BEGIN DEFERRED TRANSACTION", end: "ROLLBACK", isNotifiedAs: .rollback)
|
||||
try assertTransaction(start: "BEGIN DEFERRED TRANSACTION; CREATE TABLE t(a)", end: "ROLLBACK", isNotifiedAs: .rollback)
|
||||
try assertTransaction(start: "BEGIN IMMEDIATE TRANSACTION", end: "ROLLBACK", isNotifiedAs: .rollback)
|
||||
try assertTransaction(start: "BEGIN IMMEDIATE TRANSACTION; CREATE TABLE t(a)", end: "ROLLBACK", isNotifiedAs: .rollback)
|
||||
try assertTransaction(start: "BEGIN EXCLUSIVE TRANSACTION", end: "ROLLBACK", isNotifiedAs: .rollback)
|
||||
try assertTransaction(start: "BEGIN EXCLUSIVE TRANSACTION; CREATE TABLE t(a)", end: "ROLLBACK", isNotifiedAs: .rollback)
|
||||
try assertTransaction(start: "SAVEPOINT test", end: "ROLLBACK", isNotifiedAs: .rollback)
|
||||
try assertTransaction(start: "SAVEPOINT test; CREATE TABLE t(a)", end: "ROLLBACK", isNotifiedAs: .rollback)
|
||||
}
|
||||
|
||||
func assertTransaction(start startSQL: String, end endSQL: String, isNotifiedAs expectedCompletion: Database.TransactionCompletion) throws {
|
||||
try assertTransaction_registerBefore(start: startSQL, end: endSQL, isNotifiedAs: expectedCompletion)
|
||||
try assertTransaction_registerBetween(start: startSQL, end: endSQL, isNotifiedAs: expectedCompletion)
|
||||
}
|
||||
|
||||
func assertTransaction_registerBefore(start startSQL: String, end endSQL: String, isNotifiedAs expectedCompletion: Database.TransactionCompletion) throws {
|
||||
class Witness { }
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
@@ -26,29 +60,39 @@ class DatabaseAfterNextTransactionCommitTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
XCTAssertNotNil(deallocationWitness)
|
||||
XCTAssertEqual(transactionCount, 0)
|
||||
|
||||
try db.inTransaction {
|
||||
try db.execute("CREATE TABLE t(a)")
|
||||
return .commit
|
||||
try db.execute(startSQL)
|
||||
try db.execute(endSQL)
|
||||
switch expectedCompletion {
|
||||
case .commit:
|
||||
XCTAssertEqual(transactionCount, 1, "\(startSQL); \(endSQL)")
|
||||
case .rollback:
|
||||
XCTAssertEqual(transactionCount, 0, "\(startSQL); \(endSQL)")
|
||||
}
|
||||
XCTAssertEqual(transactionCount, 1)
|
||||
XCTAssertNil(deallocationWitness)
|
||||
|
||||
try db.inTransaction {
|
||||
try db.execute("DROP TABLE t")
|
||||
try db.execute("DROP TABLE IF EXISTS t; CREATE TABLE t(a); ")
|
||||
return .commit
|
||||
}
|
||||
XCTAssertEqual(transactionCount, 1)
|
||||
switch expectedCompletion {
|
||||
case .commit:
|
||||
XCTAssertEqual(transactionCount, 1, "\(startSQL); \(endSQL)")
|
||||
case .rollback:
|
||||
XCTAssertEqual(transactionCount, 0, "\(startSQL); \(endSQL)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabaseAfterNextTransactionWithEmptyDeferredTransaction() throws {
|
||||
func assertTransaction_registerBetween(start startSQL: String, end endSQL: String, isNotifiedAs expectedCompletion: Database.TransactionCompletion) throws {
|
||||
class Witness { }
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
var transactionCount = 0
|
||||
try db.execute(startSQL)
|
||||
|
||||
weak var deallocationWitness: Witness? = nil
|
||||
do {
|
||||
let witness = Witness()
|
||||
@@ -60,51 +104,27 @@ class DatabaseAfterNextTransactionCommitTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
XCTAssertNotNil(deallocationWitness)
|
||||
XCTAssertEqual(transactionCount, 0)
|
||||
|
||||
try db.inTransaction(.deferred) { .commit }
|
||||
XCTAssertEqual(transactionCount, 0)
|
||||
try db.execute(endSQL)
|
||||
switch expectedCompletion {
|
||||
case .commit:
|
||||
XCTAssertEqual(transactionCount, 1, "\(startSQL); \(endSQL)")
|
||||
case .rollback:
|
||||
XCTAssertEqual(transactionCount, 0, "\(startSQL); \(endSQL)")
|
||||
}
|
||||
XCTAssertNil(deallocationWitness)
|
||||
|
||||
try db.inTransaction {
|
||||
try db.execute("CREATE TABLE t(a)")
|
||||
try db.execute("DROP TABLE IF EXISTS t; CREATE TABLE t(a); ")
|
||||
return .commit
|
||||
}
|
||||
XCTAssertEqual(transactionCount, 0)
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabaseAfterNextTransactionCommitWithRollback() throws {
|
||||
class Witness { }
|
||||
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
var transactionCount = 0
|
||||
weak var deallocationWitness: Witness? = nil
|
||||
do {
|
||||
let witness = Witness()
|
||||
deallocationWitness = witness
|
||||
db.afterNextTransactionCommit { _ in
|
||||
// use witness
|
||||
withExtendedLifetime(witness, { })
|
||||
transactionCount += 1
|
||||
}
|
||||
switch expectedCompletion {
|
||||
case .commit:
|
||||
XCTAssertEqual(transactionCount, 1, "\(startSQL); \(endSQL)")
|
||||
case .rollback:
|
||||
XCTAssertEqual(transactionCount, 0, "\(startSQL); \(endSQL)")
|
||||
}
|
||||
|
||||
XCTAssertEqual(transactionCount, 0)
|
||||
|
||||
try db.inTransaction {
|
||||
try db.execute("CREATE TABLE t(a)")
|
||||
return .rollback
|
||||
}
|
||||
XCTAssertEqual(transactionCount, 0)
|
||||
XCTAssertNil(deallocationWitness)
|
||||
|
||||
try db.inTransaction {
|
||||
try db.execute("CREATE TABLE t(a)")
|
||||
return .commit
|
||||
}
|
||||
XCTAssertEqual(transactionCount, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testDeferredTransactionConcurrency() throws {
|
||||
let dbQueue1 = try makeDatabaseQueue()
|
||||
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
#if GRDBCIPHER_USE_ENCRYPTION
|
||||
// Work around SQLCipher bug when two connections are open to the
|
||||
// same empty database: make sure the database is not empty before
|
||||
@@ -48,7 +48,7 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
try db.execute("CREATE TABLE SQLCipherWorkAround (foo INTEGER)")
|
||||
}
|
||||
#endif
|
||||
let dbQueue2 = try makeDatabaseQueue()
|
||||
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN DEFERRED TRANSACTION
|
||||
@@ -118,8 +118,8 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testExclusiveTransactionConcurrency() throws {
|
||||
let dbQueue1 = try makeDatabaseQueue()
|
||||
let dbQueue2 = try makeDatabaseQueue()
|
||||
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN EXCLUSIVE TRANSACTION
|
||||
@@ -174,8 +174,8 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testImmediateTransactionConcurrency() throws {
|
||||
let dbQueue1 = try makeDatabaseQueue()
|
||||
let dbQueue2 = try makeDatabaseQueue()
|
||||
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN IMMEDIATE TRANSACTION
|
||||
@@ -230,7 +230,7 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testBusyCallback() throws {
|
||||
let dbQueue1 = try makeDatabaseQueue()
|
||||
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
#if GRDBCIPHER_USE_ENCRYPTION
|
||||
// Work around SQLCipher bug when two connections are open to the
|
||||
// same empty database: make sure the database is not empty before
|
||||
@@ -239,7 +239,7 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
try db.execute("CREATE TABLE SQLCipherWorkAround (foo INTEGER)")
|
||||
}
|
||||
#endif
|
||||
let dbQueue2 = try makeDatabaseQueue()
|
||||
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
|
||||
// Queue 1 Queue 2
|
||||
// BEGIN EXCLUSIVE TRANSACTION
|
||||
@@ -293,7 +293,7 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testReaderDuringDefaultTransaction() throws {
|
||||
let dbQueue1 = try makeDatabaseQueue()
|
||||
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
#if GRDBCIPHER_USE_ENCRYPTION
|
||||
// Work around SQLCipher bug when two connections are open to the
|
||||
// same empty database: make sure the database is not empty before
|
||||
@@ -302,7 +302,7 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
try db.execute("CREATE TABLE SQLCipherWorkAround (foo INTEGER)")
|
||||
}
|
||||
#endif
|
||||
let dbQueue2 = try makeDatabaseQueue()
|
||||
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
|
||||
// Here we test that a reader can read while a writer is writing.
|
||||
|
||||
@@ -359,7 +359,7 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testReaderInDeferredTransactionDuringDefaultTransaction() throws {
|
||||
let dbQueue1 = try makeDatabaseQueue()
|
||||
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
#if GRDBCIPHER_USE_ENCRYPTION
|
||||
// Work around SQLCipher bug when two connections are open to the
|
||||
// same empty database: make sure the database is not empty before
|
||||
@@ -368,7 +368,7 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
try db.execute("CREATE TABLE SQLCipherWorkAround (foo INTEGER)")
|
||||
}
|
||||
#endif
|
||||
let dbQueue2 = try makeDatabaseQueue()
|
||||
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
|
||||
// The `SELECT * FROM stuffs` statement of Queue 2 prevents Queue 1
|
||||
// from committing with SQLITE_BUSY.
|
||||
|
||||
@@ -12,12 +12,12 @@ class DatabaseQueueReadOnlyTests : GRDBTestCase {
|
||||
func testReadOnlyDatabaseCanNotBeModified() throws {
|
||||
// Create database
|
||||
do {
|
||||
_ = try makeDatabaseQueue()
|
||||
_ = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
}
|
||||
|
||||
// Open it again, readonly
|
||||
dbConfiguration.readonly = true
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
let statement = try dbQueue.inDatabase { db in
|
||||
try db.makeUpdateStatement("CREATE TABLE items (id INTEGER PRIMARY KEY)")
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPassphraseToDatabaseQueueWithPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -16,7 +16,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 1)
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPassphraseToDatabaseQueueWithoutPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -36,7 +36,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
do {
|
||||
dbConfiguration.passphrase = nil
|
||||
do {
|
||||
_ = try makeDatabaseQueue()
|
||||
_ = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
|
||||
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
|
||||
@@ -49,7 +49,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPassphraseToDatabaseQueueWithWrongPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -59,7 +59,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
do {
|
||||
dbConfiguration.passphrase = "wrong"
|
||||
do {
|
||||
_ = try makeDatabaseQueue()
|
||||
_ = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
|
||||
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
|
||||
@@ -72,7 +72,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPassphraseToDatabaseQueueWithNewPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -81,7 +81,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.change(passphrase: "newSecret")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("INSERT INTO data (value) VALUES (2)")
|
||||
@@ -93,7 +93,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "newSecret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 2)
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPassphraseToDatabasePoolWithPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -112,7 +112,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.read { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 1)
|
||||
}
|
||||
@@ -122,7 +122,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPassphraseToDatabasePoolWithoutPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -132,7 +132,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
do {
|
||||
dbConfiguration.passphrase = nil
|
||||
do {
|
||||
_ = try makeDatabasePool()
|
||||
_ = try makeDatabasePool(filename: "test.sqlite")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
|
||||
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
|
||||
@@ -145,7 +145,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPassphraseToDatabasePoolWithWrongPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -155,7 +155,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
do {
|
||||
dbConfiguration.passphrase = "wrong"
|
||||
do {
|
||||
_ = try makeDatabasePool()
|
||||
_ = try makeDatabasePool(filename: "test.sqlite")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
|
||||
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
|
||||
@@ -168,7 +168,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPassphraseToDatabasePoolWithNewPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -177,7 +177,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.change(passphrase: "newSecret")
|
||||
try dbPool.write { db in
|
||||
try db.execute("INSERT INTO data (value) VALUES (2)")
|
||||
@@ -187,7 +187,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "newSecret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.read { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 2)
|
||||
}
|
||||
@@ -197,7 +197,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabasePoolWithPassphraseToDatabasePoolWithPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.write { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -206,7 +206,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.read { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 1)
|
||||
}
|
||||
@@ -216,7 +216,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabasePoolWithPassphraseToDatabasePoolWithoutPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.write { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -226,7 +226,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
do {
|
||||
dbConfiguration.passphrase = nil
|
||||
do {
|
||||
_ = try makeDatabasePool()
|
||||
_ = try makeDatabasePool(filename: "test.sqlite")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
|
||||
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
|
||||
@@ -239,7 +239,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabasePoolWithPassphraseToDatabasePoolWithWrongPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.write { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -249,7 +249,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
do {
|
||||
dbConfiguration.passphrase = "wrong"
|
||||
do {
|
||||
_ = try makeDatabasePool()
|
||||
_ = try makeDatabasePool(filename: "test.sqlite")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
|
||||
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
|
||||
@@ -263,7 +263,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.write { db in
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
try db.execute("INSERT INTO data (value) VALUES (1)")
|
||||
@@ -272,7 +272,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.change(passphrase: "newSecret")
|
||||
try dbPool.write { db in
|
||||
try db.execute("INSERT INTO data (value) VALUES (2)")
|
||||
@@ -282,7 +282,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "newSecret"
|
||||
let dbPool = try makeDatabasePool()
|
||||
let dbPool = try makeDatabasePool(filename: "test.sqlite")
|
||||
try dbPool.read { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 2)
|
||||
}
|
||||
@@ -292,7 +292,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPragmaPassphraseToDatabaseQueueWithPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = nil
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("PRAGMA key = 'secret'")
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
@@ -302,7 +302,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 1)
|
||||
}
|
||||
@@ -312,7 +312,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
func testDatabaseQueueWithPragmaPassphraseToDatabaseQueueWithoutPassphrase() throws {
|
||||
do {
|
||||
dbConfiguration.passphrase = nil
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("PRAGMA key = 'secret'")
|
||||
try db.execute("CREATE TABLE data (value INTEGER)")
|
||||
@@ -323,7 +323,7 @@ class EncryptionTests: GRDBTestCase {
|
||||
do {
|
||||
dbConfiguration.passphrase = nil
|
||||
do {
|
||||
_ = try makeDatabaseQueue()
|
||||
_ = try makeDatabaseQueue(filename: "test.sqlite")
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
|
||||
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
|
||||
|
||||
@@ -229,4 +229,63 @@ class FTS4TableBuilderTests: GRDBTestCase {
|
||||
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM ft_documents WHERE ft_documents MATCH ?", arguments: ["bar"])!, 1)
|
||||
}
|
||||
}
|
||||
|
||||
func testFTS4SynchronizationCleanup() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(table: "documents") { t in
|
||||
t.column("id", .integer).primaryKey()
|
||||
t.column("content", .text)
|
||||
}
|
||||
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
|
||||
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
|
||||
t.synchronize(withTable: "documents")
|
||||
t.column("content")
|
||||
}
|
||||
|
||||
try db.drop(table: "ft_documents")
|
||||
try db.dropFTS4SynchronizationTriggers(forTable: "ft_documents")
|
||||
|
||||
// It is possible to modify the content table
|
||||
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
|
||||
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
|
||||
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
|
||||
|
||||
// It is possible to recreate the FT table
|
||||
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
|
||||
t.synchronize(withTable: "documents")
|
||||
t.column("content")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFTS4SynchronizationCleanupWithLegacySupport() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(table: "documents") { t in
|
||||
t.column("id", .integer).primaryKey()
|
||||
t.column("content", .text)
|
||||
}
|
||||
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
|
||||
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
|
||||
t.synchronize(withTable: "documents")
|
||||
t.column("content")
|
||||
}
|
||||
|
||||
try db.drop(table: "ft_documents")
|
||||
try db.dropFTS4SynchronizationTriggers(forTable: "documents") // legacy GRDB <= 2.3.1
|
||||
try db.dropFTS4SynchronizationTriggers(forTable: "ft_documents")
|
||||
|
||||
// It is possible to modify the content table
|
||||
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
|
||||
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
|
||||
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
|
||||
|
||||
// It is possible to recreate the FT table
|
||||
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
|
||||
t.synchronize(withTable: "documents")
|
||||
t.column("content")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,5 +219,64 @@ class FTS5TableBuilderTests: GRDBTestCase {
|
||||
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM ft_documents WHERE ft_documents MATCH ?", arguments: ["bar"])!, 1)
|
||||
}
|
||||
}
|
||||
|
||||
func testFTS5SynchronizationCleanup() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(table: "documents") { t in
|
||||
t.column("id", .integer).primaryKey()
|
||||
t.column("content", .text)
|
||||
}
|
||||
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
|
||||
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
|
||||
t.synchronize(withTable: "documents")
|
||||
t.column("content")
|
||||
}
|
||||
|
||||
try db.drop(table: "ft_documents")
|
||||
try db.dropFTS5SynchronizationTriggers(forTable: "ft_documents")
|
||||
|
||||
// It is possible to modify the content table
|
||||
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
|
||||
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
|
||||
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
|
||||
|
||||
// It is possible to recreate the FT table
|
||||
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
|
||||
t.synchronize(withTable: "documents")
|
||||
t.column("content")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testFTS5SynchronizationCleanupWithLegacySupport() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.create(table: "documents") { t in
|
||||
t.column("id", .integer).primaryKey()
|
||||
t.column("content", .text)
|
||||
}
|
||||
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
|
||||
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
|
||||
t.synchronize(withTable: "documents")
|
||||
t.column("content")
|
||||
}
|
||||
|
||||
try db.drop(table: "ft_documents")
|
||||
try db.dropFTS5SynchronizationTriggers(forTable: "documents") // legacy GRDB <= 2.3.1
|
||||
try db.dropFTS5SynchronizationTriggers(forTable: "ft_documents")
|
||||
|
||||
// It is possible to modify the content table
|
||||
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
|
||||
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
|
||||
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
|
||||
|
||||
// It is possible to recreate the FT table
|
||||
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
|
||||
t.synchronize(withTable: "documents")
|
||||
t.column("content")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -17,18 +17,18 @@ class GRDBTestCase: XCTestCase {
|
||||
var dbConfiguration: Configuration!
|
||||
|
||||
// Builds a database queue based on dbConfiguration
|
||||
func makeDatabaseQueue(filename: String = "db.sqlite") throws -> DatabaseQueue {
|
||||
func makeDatabaseQueue(filename: String? = nil) throws -> DatabaseQueue {
|
||||
try FileManager.default.createDirectory(atPath: dbDirectoryPath, withIntermediateDirectories: true, attributes: nil)
|
||||
let dbPath = (dbDirectoryPath as NSString).appendingPathComponent(filename)
|
||||
let dbPath = (dbDirectoryPath as NSString).appendingPathComponent(filename ?? ProcessInfo.processInfo.globallyUniqueString)
|
||||
let dbQueue = try DatabaseQueue(path: dbPath, configuration: dbConfiguration)
|
||||
try setup(dbQueue)
|
||||
return dbQueue
|
||||
}
|
||||
|
||||
// Builds a database pool based on dbConfiguration
|
||||
func makeDatabasePool(filename: String = "db.sqlite") throws -> DatabasePool {
|
||||
func makeDatabasePool(filename: String? = nil) throws -> DatabasePool {
|
||||
try FileManager.default.createDirectory(atPath: dbDirectoryPath, withIntermediateDirectories: true, attributes: nil)
|
||||
let dbPath = (dbDirectoryPath as NSString).appendingPathComponent(filename)
|
||||
let dbPath = (dbDirectoryPath as NSString).appendingPathComponent(filename ?? ProcessInfo.processInfo.globallyUniqueString)
|
||||
let dbPool = try DatabasePool(path: dbPath, configuration: dbConfiguration)
|
||||
try setup(dbPool)
|
||||
return dbPool
|
||||
|
||||
@@ -10,9 +10,9 @@ import XCTest
|
||||
class SchedulingWatchdogTests: GRDBTestCase {
|
||||
|
||||
func testSchedulingWatchdog() throws {
|
||||
let dbQueue1 = try makeDatabaseQueue(filename: "db1")
|
||||
let dbQueue2 = try makeDatabaseQueue(filename: "db2")
|
||||
let dbQueue3 = try makeDatabaseQueue(filename: "db3")
|
||||
let dbQueue1 = try makeDatabaseQueue()
|
||||
let dbQueue2 = try makeDatabaseQueue()
|
||||
let dbQueue3 = try makeDatabaseQueue()
|
||||
|
||||
var db1: Database! = nil
|
||||
var db2: Database! = nil
|
||||
@@ -51,8 +51,8 @@ class SchedulingWatchdogTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testDatabaseQueueFromDatabaseQueue() throws {
|
||||
let dbQueue1 = try makeDatabaseQueue(filename: "db1")
|
||||
let dbQueue2 = try makeDatabaseQueue(filename: "db2")
|
||||
let dbQueue1 = try makeDatabaseQueue()
|
||||
let dbQueue2 = try makeDatabaseQueue()
|
||||
try dbQueue1.inDatabase { db1 in
|
||||
try db1.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
|
||||
try db1.execute("INSERT INTO items (id) VALUES (NULL)")
|
||||
@@ -71,8 +71,8 @@ class SchedulingWatchdogTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testDatabaseQueueFromDatabasePool() throws {
|
||||
let dbPool1 = try makeDatabasePool(filename: "db1")
|
||||
let dbQueue2 = try makeDatabaseQueue(filename: "db2")
|
||||
let dbPool1 = try makeDatabasePool()
|
||||
let dbQueue2 = try makeDatabaseQueue()
|
||||
try dbPool1.write { db1 in
|
||||
try db1.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
|
||||
try db1.execute("INSERT INTO items (id) VALUES (NULL)")
|
||||
@@ -91,8 +91,8 @@ class SchedulingWatchdogTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testDatabasePoolFromDatabaseQueue() throws {
|
||||
let dbQueue1 = try makeDatabaseQueue(filename: "db1")
|
||||
let dbPool2 = try makeDatabasePool(filename: "db2")
|
||||
let dbQueue1 = try makeDatabaseQueue()
|
||||
let dbPool2 = try makeDatabasePool()
|
||||
try dbQueue1.inDatabase { db1 in
|
||||
try db1.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
|
||||
try db1.execute("INSERT INTO items (id) VALUES (NULL)")
|
||||
@@ -111,8 +111,8 @@ class SchedulingWatchdogTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
func testDatabasePoolFromDatabasePool() throws {
|
||||
let dbPool1 = try makeDatabasePool(filename: "db1")
|
||||
let dbPool2 = try makeDatabasePool(filename: "db2")
|
||||
let dbPool1 = try makeDatabasePool()
|
||||
let dbPool2 = try makeDatabasePool()
|
||||
try dbPool1.write { db1 in
|
||||
try db1.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
|
||||
try db1.execute("INSERT INTO items (id) VALUES (NULL)")
|
||||
|
||||
@@ -462,14 +462,16 @@ class TableDefinitionTests: GRDBTestCase {
|
||||
t.add(column: "b", .text)
|
||||
t.add(column: "c", .integer).notNull().defaults(to: 1)
|
||||
t.add(column: "d", .text).references("alt")
|
||||
t.add(column: "e")
|
||||
}
|
||||
|
||||
assertEqualSQL(sqlQueries[sqlQueries.count - 3], "ALTER TABLE \"test\" ADD COLUMN \"b\" TEXT")
|
||||
assertEqualSQL(sqlQueries[sqlQueries.count - 2], "ALTER TABLE \"test\" ADD COLUMN \"c\" INTEGER NOT NULL DEFAULT 1")
|
||||
assertEqualSQL(sqlQueries[sqlQueries.count - 1], "ALTER TABLE \"test\" ADD COLUMN \"d\" TEXT REFERENCES \"alt\"(\"rowid\")")
|
||||
assertEqualSQL(sqlQueries[sqlQueries.count - 4], "ALTER TABLE \"test\" ADD COLUMN \"b\" TEXT")
|
||||
assertEqualSQL(sqlQueries[sqlQueries.count - 3], "ALTER TABLE \"test\" ADD COLUMN \"c\" INTEGER NOT NULL DEFAULT 1")
|
||||
assertEqualSQL(sqlQueries[sqlQueries.count - 2], "ALTER TABLE \"test\" ADD COLUMN \"d\" TEXT REFERENCES \"alt\"(\"rowid\")")
|
||||
assertEqualSQL(sqlQueries[sqlQueries.count - 1], "ALTER TABLE \"test\" ADD COLUMN \"e\"")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testDropTable() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -28,7 +28,7 @@ class UpdateStatementTests : GRDBTestCase {
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Arthur');").execute()
|
||||
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Barbara')\n \t").execute()
|
||||
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Craig');").execute()
|
||||
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Craig'); ; ;").execute()
|
||||
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Daniel');\n \t").execute()
|
||||
return .commit
|
||||
}
|
||||
@@ -182,6 +182,19 @@ class UpdateStatementTests : GRDBTestCase {
|
||||
XCTAssertEqual(index, 3 + 3)
|
||||
}
|
||||
|
||||
func testExecuteNothing() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("")
|
||||
try db.execute(" ")
|
||||
try db.execute(";")
|
||||
try db.execute(";;")
|
||||
try db.execute(" \n;\t; ")
|
||||
try db.execute("-- comment")
|
||||
try db.execute("-- comment\\n; -----ignored")
|
||||
}
|
||||
}
|
||||
|
||||
func testExecuteMultipleStatement() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
@@ -209,6 +222,24 @@ class UpdateStatementTests : GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testExecuteMultipleStatementWithPlentyOfSemicolonsAndWhiteSpaceAndComments() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute("""
|
||||
;;
|
||||
CREATE TABLE wines ( -- create a table
|
||||
name TEXT, -- the name
|
||||
color INT);
|
||||
;\t;
|
||||
-- create another table
|
||||
CREATE TABLE books (name TEXT, age INT); \
|
||||
\t; ;
|
||||
""")
|
||||
XCTAssertTrue(try db.tableExists("wines"))
|
||||
XCTAssertTrue(try db.tableExists("books"))
|
||||
}
|
||||
}
|
||||
|
||||
func testExecuteMultipleStatementWithNamedArguments() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inTransaction { db in
|
||||
|
||||
Reference in new issue
Block a user