diff --git a/docs/4.2/Classes.html b/docs/4.2/Classes.html index 3d79dc9ad..2f854be18 100644 --- a/docs/4.2/Classes.html +++ b/docs/4.2/Classes.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1049,7 +1049,7 @@ cursor.

- Show on GitHub + Show on GitHub
@@ -1075,11 +1075,11 @@ cursor.

You don’t create a database directly. Instead, you use a DatabaseQueue, or a DatabasePool:

-
let dbQueue = DatabaseQueue(...)
+
let dbQueue = DatabaseQueue(...)
 
 // The Database is the `db` in the closure:
-try dbQueue.write { db in
-    try Player(...).insert(db)
+try dbQueue.write { db in
+    try Player(...).insert(db)
 }
 
@@ -1094,7 +1094,7 @@ a DatabasePool:

@@ -1129,7 +1129,7 @@ a DatabasePool:

@@ -1164,7 +1164,7 @@ a DatabasePool:

@@ -1199,7 +1199,7 @@ a DatabasePool:

@@ -1234,7 +1234,7 @@ a DatabasePool:

@@ -1272,7 +1272,7 @@ underlying database reader.

@@ -1312,7 +1312,7 @@ moment it was created.

@@ -1343,7 +1343,7 @@ moment it was created.

A cursor of database values extracted from a single column. For example:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let urls: DatabaseValueCursor<URL> = try URL.fetchCursor(db, sql: "SELECT url FROM link")
     while let url = urls.next() { // URL
         print(url)
@@ -1361,7 +1361,7 @@ For example:

@@ -1381,7 +1381,7 @@ For example:

A cursor of optional database values extracted from a single column. For example:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let urls: NullableDatabaseValueCursor<URL> = try Optional<URL>.fetchCursor(db, sql: "SELECT url FROM link")
     while let url = urls.next() { // URL?
         print(url)
@@ -1399,7 +1399,7 @@ For example:

@@ -1423,11 +1423,11 @@ For example:

A future database value, returned by the DatabaseWriter.concurrentRead(_:) method.

-
let futureCount: Future<Int> = try writer.writeWithoutTransaction { db in
-    try Player(...).insert()
+
let futureCount: Future<Int> = try writer.writeWithoutTransaction { db in
+    try Player(...).insert()
 
     // Count players concurrently
-    return writer.concurrentRead { db in
+    return writer.concurrentRead { db in
         return try Player.fetchCount()
     }
 }
@@ -1446,7 +1446,7 @@ method.

@@ -1480,7 +1480,7 @@ underlying database writer.

@@ -1517,7 +1517,7 @@ underlying database writer.

@@ -1547,7 +1547,7 @@ underlying database writer.

A cursor of database rows. For example:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let rows: RowCursor = try Row.fetchCursor(db, sql: "SELECT * FROM player")
 }
 
@@ -1563,7 +1563,7 @@ underlying database writer.

@@ -1601,7 +1601,7 @@ and SelectStatement that fetches rows.

@@ -1633,7 +1633,7 @@ and SelectStatement that fetches rows.

A subclass of Statement that fetches database rows.

You create SelectStatement with the Database.makeSelectStatement() method:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let statement = try db.makeSelectStatement(sql: "SELECT COUNT(*) FROM player WHERE score > ?")
     let moreThanTwentyCount = try Int.fetchOne(statement, arguments: [20])!
     let moreThanThirtyCount = try Int.fetchOne(statement, arguments: [30])!
@@ -1651,7 +1651,7 @@ and SelectStatement that fetches rows.

@@ -1683,7 +1683,7 @@ and SelectStatement that fetches rows.

A subclass of Statement that executes SQL queries.

You create UpdateStatement with the Database.makeUpdateStatement() method:

-
try dbQueue.inTransaction { db in
+
try dbQueue.inTransaction { db in
     let statement = try db.makeUpdateStatement(sql: "INSERT INTO player (name) VALUES (?)")
     try statement.execute(arguments: ["Arthur"])
     try statement.execute(arguments: ["Barbara"])
@@ -1702,7 +1702,7 @@ and SelectStatement that fetches rows.

@@ -1726,7 +1726,7 @@ and SelectStatement that fetches rows.

A cursor of database values extracted from a single column. For example:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let names: ColumnCursor<String> = try String.fetchCursor(db, sql: "SELECT name FROM player")
     while let name = names.next() { // String
         print(name)
@@ -1744,7 +1744,7 @@ For example:

@@ -1764,7 +1764,7 @@ For example:

A cursor of optional database values extracted from a single column. For example:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let emails: FastNullableDatabaseValueCursor<String> =
         try Optional<String>.fetchCursor(db, sql: "SELECT email FROM player")
     while let email = emails.next() { // String?
@@ -1784,7 +1784,7 @@ For example:

@@ -1810,7 +1810,7 @@ For example:

You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

-
try db.create(virtualTable: "document", using: FTS3()) { t in // t is FTS3TableDefinition
+
try db.create(virtualTable: "document", using: FTS3()) { t in // t is FTS3TableDefinition
     t.column("content")
 }
 
@@ -1826,7 +1826,7 @@ For example:

@@ -1852,7 +1852,7 @@ For example:

You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

-
try db.create(virtualTable: "document", using: FTS4()) { t in // t is FTS4TableDefinition
+
try db.create(virtualTable: "document", using: FTS4()) { t in // t is FTS4TableDefinition
     t.column("content")
 }
 
@@ -1870,7 +1870,7 @@ For example:

@@ -1892,7 +1892,7 @@ For example:

virtual table.

You get instances of this class when you create an FTS4 table:

-
try db.create(virtualTable: "document", using: FTS4()) { t in
+
try db.create(virtualTable: "document", using: FTS4()) { t in
     t.column("content")      // FTS4ColumnDefinition
 }
 
@@ -1910,7 +1910,7 @@ virtual table.

@@ -1936,7 +1936,7 @@ virtual table.

You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

-
try db.create(virtualTable: "document", using: FTS5()) { t in // t is FTS5TableDefinition
+
try db.create(virtualTable: "document", using: FTS5()) { t in // t is FTS5TableDefinition
     t.column("content")
 }
 
@@ -1965,7 +1965,7 @@ virtual table.

virtual table.

You get instances of this class when you create an FTS5 table:

-
try db.create(virtualTable: "document", using: FTS5()) { t in
+
try db.create(virtualTable: "document", using: FTS5()) { t in
     t.column("content")      // FTS5ColumnDefinition
 }
 
@@ -2016,7 +2016,7 @@ virtual table.

@@ -2060,7 +2060,7 @@ virtual table.

@@ -2100,7 +2100,7 @@ virtual table.

@@ -2144,7 +2144,7 @@ virtual table.

@@ -2174,8 +2174,8 @@ virtual table.

A cursor of records. For example:

-
struct Player : FetchableRecord { ... }
-try dbQueue.read { db in
+
struct Player : FetchableRecord { ... }
+try dbQueue.read { db in
     let players: RecordCursor<Player> = try Player.fetchCursor(db, sql: "SELECT * FROM player")
 }
 
@@ -2190,7 +2190,7 @@ virtual table.

@@ -2229,7 +2229,7 @@ more information.

@@ -2272,7 +2272,7 @@ designed to be subclassed.

@@ -2282,7 +2282,7 @@ designed to be subclassed.

diff --git a/docs/4.2/Classes/AnyCursor.html b/docs/4.2/Classes/AnyCursor.html index 6db7a456d..29bb16aa7 100644 --- a/docs/4.2/Classes/AnyCursor.html +++ b/docs/4.2/Classes/AnyCursor.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1048,7 +1048,7 @@ the base cursor’s element type

@@ -1079,7 +1079,7 @@ on the base iterator’s element type

@@ -1110,7 +1110,7 @@ on the base sequence’s element type

@@ -1140,7 +1140,7 @@ on the base sequence’s element type

@@ -1150,7 +1150,7 @@ on the base sequence’s element type

diff --git a/docs/4.2/Classes/AnyDatabaseReader.html b/docs/4.2/Classes/AnyDatabaseReader.html index 38a17751d..f5be6b10d 100644 --- a/docs/4.2/Classes/AnyDatabaseReader.html +++ b/docs/4.2/Classes/AnyDatabaseReader.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1046,7 +1046,7 @@ underlying database reader.

@@ -1056,7 +1056,7 @@ underlying database reader.

diff --git a/docs/4.2/Classes/AnyDatabaseWriter.html b/docs/4.2/Classes/AnyDatabaseWriter.html index c023adfb4..cab1b4f94 100644 --- a/docs/4.2/Classes/AnyDatabaseWriter.html +++ b/docs/4.2/Classes/AnyDatabaseWriter.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1046,7 +1046,7 @@ underlying database writer.

@@ -1056,7 +1056,7 @@ underlying database writer.

diff --git a/docs/4.2/Classes/ColumnDefinition.html b/docs/4.2/Classes/ColumnDefinition.html index 7497aee6d..7936bcda0 100644 --- a/docs/4.2/Classes/ColumnDefinition.html +++ b/docs/4.2/Classes/ColumnDefinition.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1103,7 +1103,7 @@

Self so that you can further refine the column definition.

@@ -1164,7 +1164,7 @@

Self so that you can further refine the column definition.

@@ -1225,7 +1225,7 @@

Self so that you can further refine the column definition.

@@ -1266,7 +1266,7 @@

Self so that you can further refine the column definition.

@@ -1286,7 +1286,7 @@

Adds a CHECK constraint on the column.

try db.create(table: "player") { t in
-    t.column("name", .text).check { length($0) > 0 }
+    t.column("name", .text).check { length($0) > 0 }
 }
 
@@ -1327,7 +1327,7 @@ represents the defined column, and returns the expression to check.

Self so that you can further refine the column definition.

@@ -1387,7 +1387,7 @@ represents the defined column, and returns the expression to check.

Self so that you can further refine the column definition.

@@ -1447,7 +1447,7 @@ represents the defined column, and returns the expression to check.

Self so that you can further refine the column definition.

@@ -1507,7 +1507,7 @@ represents the defined column, and returns the expression to check.

Self so that you can further refine the column definition.

@@ -1566,7 +1566,7 @@ represents the defined column, and returns the expression to check.

Self so that you can further refine the column definition.

@@ -1625,7 +1625,7 @@ represents the defined column, and returns the expression to check.

Self so that you can further refine the column definition.

@@ -1671,7 +1671,7 @@ represents the defined column, and returns the expression to check.

Self so that you can further refine the column definition.

@@ -1681,7 +1681,7 @@ represents the defined column, and returns the expression to check.

diff --git a/docs/4.2/Classes/Database.html b/docs/4.2/Classes/Database.html index 312d25d97..7ea4b6d2c 100644 --- a/docs/4.2/Classes/Database.html +++ b/docs/4.2/Classes/Database.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,11 +1016,11 @@

You don’t create a database directly. Instead, you use a DatabaseQueue, or a DatabasePool:

-
let dbQueue = DatabaseQueue(...)
+
let dbQueue = DatabaseQueue(...)
 
 // The Database is the `db` in the closure:
-try dbQueue.write { db in
-    try Player(...).insert(db)
+try dbQueue.write { db in
+    try Player(...).insert(db)
 }
 
@@ -1060,7 +1060,7 @@ a DatabasePool:

@@ -1108,12 +1108,12 @@ for debugging.

Declaration

Swift

-
public static var logError: Database.LogErrorFunction? { get set }
+
public static var logError: Database.LogErrorFunction? { get set }
@@ -1143,7 +1143,7 @@ for debugging.

@@ -1184,12 +1184,12 @@ returns zero.

Declaration

Swift

-
public var lastInsertedRowID: Int64 { get }
+
public var lastInsertedRowID: Int64 { get }
@@ -1217,12 +1217,12 @@ successful INSERT, UPDATE or DELETE statement.

Declaration

Swift

-
public var changesCount: Int { get }
+
public var changesCount: Int { get }
@@ -1251,12 +1251,12 @@ opened.

Declaration

Swift

-
public var totalChangesCount: Int { get }
+
public var totalChangesCount: Int { get }
@@ -1281,12 +1281,12 @@ opened.

Declaration

Swift

-
public var isInsideTransaction: Bool { get }
+
public var isInsideTransaction: Bool { get }
@@ -1330,7 +1330,7 @@ modified by another connection.

@@ -1360,7 +1360,7 @@ modified by another connection.

@@ -1394,7 +1394,7 @@ modified by another connection.

@@ -1426,7 +1426,7 @@ modified by another connection.

@@ -1456,7 +1456,7 @@ modified by another connection.

@@ -1486,7 +1486,7 @@ modified by another connection.

@@ -1525,7 +1525,7 @@ table has no explicit primary key, the result is the hidden @@ -1562,7 +1562,7 @@ table(_:hasUniqueKey:) instead.

@@ -1597,7 +1597,7 @@ if the columns are the primary key, or if there is a unique index on them.

@@ -1627,7 +1627,7 @@ if the columns are the primary key, or if there is a unique index on them.

@@ -1666,7 +1666,7 @@ if the columns are the primary key, or if there is a unique index on them.

@@ -1739,7 +1739,7 @@ if the columns are the primary key, or if there is a unique index on them.

A SelectStatement.

@@ -1804,7 +1804,7 @@ contain values for its eventual arguments.

An UpdateStatement.

@@ -1866,7 +1866,7 @@ contain values for its eventual arguments.

An UpdateStatement.

@@ -1931,7 +1931,7 @@ contain values for its eventual arguments.

An UpdateStatement.

@@ -1973,7 +1973,7 @@ contain values for its eventual arguments.

Declaration

Swift

-
public func execute(sql: String, arguments: StatementArguments = StatementArguments()) throws
+
public func execute(sql: String, arguments: StatementArguments = StatementArguments()) throws
@@ -2009,7 +2009,7 @@ contain values for its eventual arguments.

@@ -2028,11 +2028,11 @@ contain values for its eventual arguments.

Executes one or several SQL statements, separated by semi-colons.

-
try db.execute(literal: SQLLiteral(
+
try db.execute(literal: SQLLiteral(
     sql: "INSERT INTO player (name) VALUES (:name)",
     arguments: ["name": "Arthur"]))
 
-try db.execute(literal: SQLLiteral(sql: """
+try db.execute(literal: SQLLiteral(sql: """
     INSERT INTO player (name) VALUES (?);
     INSERT INTO player (name) VALUES (?);
     INSERT INTO player (name) VALUES (?);
@@ -2084,7 +2084,7 @@ without any risk of syntax errors or SQL injection:

@@ -2114,8 +2114,8 @@ without any risk of syntax errors or SQL injection:

Add or redefine an SQL function.

-
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
-    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
+
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
+    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
         return nil
     }
     return int + 1
@@ -2134,7 +2134,7 @@ without any risk of syntax errors or SQL injection:

@@ -2164,7 +2164,7 @@ without any risk of syntax errors or SQL injection:

@@ -2194,7 +2194,7 @@ without any risk of syntax errors or SQL injection:

Add or redefine a collation.

-
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
+
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
     return (string1 as NSString).localizedStandardCompare(string2)
 }
 db.add(collation: collation)
@@ -2211,7 +2211,7 @@ without any risk of syntax errors or SQL injection:

@@ -2241,7 +2241,7 @@ without any risk of syntax errors or SQL injection:

@@ -2271,8 +2271,8 @@ without any risk of syntax errors or SQL injection:

Executes a block inside a database transaction.

-
try dbQueue.inDatabase do {
-    try db.inTransaction {
+
try dbQueue.inDatabase do {
+    try db.inTransaction {
         try db.execute(sql: "INSERT ...")
         return .commit
     }
@@ -2334,7 +2334,7 @@ for more information.

@@ -2353,8 +2353,8 @@ for more information.

Executes a block inside a savepoint.

-
try dbQueue.inDatabase do {
-    try db.inSavepoint {
+
try dbQueue.inDatabase do {
+    try db.inSavepoint {
         try db.execute(sql: "INSERT ...")
         return .commit
     }
@@ -2401,7 +2401,7 @@ either .commit or .rollback.

@@ -2458,7 +2458,7 @@ for more information.

@@ -2488,7 +2488,7 @@ for more information.

@@ -2518,7 +2518,7 @@ for more information.

@@ -2552,7 +2552,7 @@ for more information.

@@ -2586,8 +2586,8 @@ remains locked for more than the specified duration.

To set the busy mode of a database, use Configuration:

// Wait 1 second before failing with SQLITE_BUSY
-let configuration = Configuration(busyMode: .timeout(1))
-let dbQueue = DatabaseQueue(path: "...", configuration: configuration)
+let configuration = Configuration(busyMode: .timeout(1))
+let dbQueue = DatabaseQueue(path: "...", configuration: configuration)
 

Relevant SQLite documentation:

@@ -2610,7 +2610,7 @@ remains locked for more than the specified duration.

@@ -2641,7 +2641,7 @@ remains locked for more than the specified duration.

@@ -2674,7 +2674,7 @@ remains locked for more than the specified duration.

@@ -2712,7 +2712,7 @@ remains locked for more than the specified duration.

@@ -2745,7 +2745,7 @@ remains locked for more than the specified duration.

@@ -2778,7 +2778,7 @@ remains locked for more than the specified duration.

@@ -2808,7 +2808,7 @@ remains locked for more than the specified duration.

@@ -2839,7 +2839,7 @@ remains locked for more than the specified duration.

@@ -2870,7 +2870,7 @@ remains locked for more than the specified duration.

@@ -2947,7 +2947,7 @@ is deallocated).

@@ -2977,7 +2977,7 @@ is deallocated).

@@ -2997,8 +2997,8 @@ is deallocated).

Registers a closure to be executed after the next or current transaction completion.

-
try dbQueue.write { db in
-    db.afterNextTransactionCommit { _ in
+
try dbQueue.write { db in
+    db.afterNextTransactionCommit { _ in
         print("success")
     }
     ...
@@ -3020,7 +3020,7 @@ dispatch queue, serialized will all database updates.

@@ -3053,7 +3053,7 @@ dispatch queue, serialized will all database updates.

@@ -3087,7 +3087,7 @@ dispatch queue, serialized will all database updates.

@@ -3255,7 +3255,7 @@ already exists.

@@ -3362,7 +3362,7 @@ already exists.

@@ -3399,7 +3399,7 @@ already exists.

@@ -3471,7 +3471,7 @@ already exists.

@@ -3508,7 +3508,7 @@ already exists.

@@ -3650,7 +3650,7 @@ query.

@@ -3669,7 +3669,7 @@ query.

Creates a partial index.

-
try db.create(index: "playerByEmail", on: "player", columns: ["email"], condition: Column("email") != nil)
+
try db.create(index: "playerByEmail", on: "player", columns: ["email"], condition: Column("email") != nil)
 

See https://www.sqlite.org/lang_createindex.html, and @@ -3772,7 +3772,7 @@ query.

@@ -3809,7 +3809,7 @@ query.

@@ -3849,7 +3849,7 @@ has changed.

@@ -3889,7 +3889,7 @@ has changed.

@@ -3984,7 +3984,7 @@ already exists.

@@ -4014,7 +4014,7 @@ argument: refer to this module’s documentation.

Use this method to create full-text tables using the FTS3, FTS4, or FTS5 modules:

-
try db.create(virtualTable: "book", using: FTS4()) { t in
+
try db.create(virtualTable: "book", using: FTS4()) { t in
     t.column("title")
     t.column("author")
     t.column("body")
@@ -4100,7 +4100,7 @@ already exists.

@@ -4110,7 +4110,7 @@ already exists.

diff --git a/docs/4.2/Classes/Database/BusyMode.html b/docs/4.2/Classes/Database/BusyMode.html index d2312f2b2..b2b31a0e8 100644 --- a/docs/4.2/Classes/Database/BusyMode.html +++ b/docs/4.2/Classes/Database/BusyMode.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1028,8 +1028,8 @@ remains locked for more than the specified duration.

To set the busy mode of a database, use Configuration:

// Wait 1 second before failing with SQLITE_BUSY
-let configuration = Configuration(busyMode: .timeout(1))
-let dbQueue = DatabaseQueue(path: "...", configuration: configuration)
+let configuration = Configuration(busyMode: .timeout(1))
+let dbQueue = DatabaseQueue(path: "...", configuration: configuration)
 

Relevant SQLite documentation:

@@ -1071,7 +1071,7 @@ tries to access the locked database.

@@ -1102,7 +1102,7 @@ locked for more than the specified duration (in seconds).

@@ -1133,7 +1133,7 @@ See https://www.sqlite. @@ -1143,7 +1143,7 @@ See https://www.sqlite. diff --git a/docs/4.2/Classes/Database/CheckpointMode.html b/docs/4.2/Classes/Database/CheckpointMode.html index 85ee48afb..f13518009 100644 --- a/docs/4.2/Classes/Database/CheckpointMode.html +++ b/docs/4.2/Classes/Database/CheckpointMode.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1103,7 +1103,7 @@ @@ -1133,7 +1133,7 @@ @@ -1143,7 +1143,7 @@ diff --git a/docs/4.2/Classes/Database/CollationName.html b/docs/4.2/Classes/Database/CollationName.html index ddb8a890c..0aebb2141 100644 --- a/docs/4.2/Classes/Database/CollationName.html +++ b/docs/4.2/Classes/Database/CollationName.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Classes/Database/ColumnType.html b/docs/4.2/Classes/Database/ColumnType.html index 8f724d0b8..02dd0adab 100644 --- a/docs/4.2/Classes/Database/ColumnType.html +++ b/docs/4.2/Classes/Database/ColumnType.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1050,7 +1050,7 @@ @@ -1080,7 +1080,7 @@ @@ -1110,7 +1110,7 @@ @@ -1140,7 +1140,7 @@ @@ -1170,7 +1170,7 @@ @@ -1200,7 +1200,7 @@ @@ -1230,7 +1230,7 @@ @@ -1260,7 +1260,7 @@ @@ -1290,7 +1290,7 @@ @@ -1300,7 +1300,7 @@ diff --git a/docs/4.2/Classes/Database/ConflictResolution.html b/docs/4.2/Classes/Database/ConflictResolution.html index 18d2614e8..b164be0be 100644 --- a/docs/4.2/Classes/Database/ConflictResolution.html +++ b/docs/4.2/Classes/Database/ConflictResolution.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1135,7 +1135,7 @@ @@ -1165,7 +1165,7 @@ @@ -1175,7 +1175,7 @@ diff --git a/docs/4.2/Classes/Database/ForeignKeyAction.html b/docs/4.2/Classes/Database/ForeignKeyAction.html index e1a84421d..350a110cd 100644 --- a/docs/4.2/Classes/Database/ForeignKeyAction.html +++ b/docs/4.2/Classes/Database/ForeignKeyAction.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Classes/Database/TransactionCompletion.html b/docs/4.2/Classes/Database/TransactionCompletion.html index 17ac6c9d6..516ea72d5 100644 --- a/docs/4.2/Classes/Database/TransactionCompletion.html +++ b/docs/4.2/Classes/Database/TransactionCompletion.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/Classes/Database/TransactionKind.html b/docs/4.2/Classes/Database/TransactionKind.html index 42730d741..bee5922e3 100644 --- a/docs/4.2/Classes/Database/TransactionKind.html +++ b/docs/4.2/Classes/Database/TransactionKind.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1103,7 +1103,7 @@ @@ -1113,7 +1113,7 @@ diff --git a/docs/4.2/Classes/Database/TransactionObservationExtent.html b/docs/4.2/Classes/Database/TransactionObservationExtent.html index 3d3d158e9..d36a62db0 100644 --- a/docs/4.2/Classes/Database/TransactionObservationExtent.html +++ b/docs/4.2/Classes/Database/TransactionObservationExtent.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1115,7 +1115,7 @@ diff --git a/docs/4.2/Classes/DatabaseCollation.html b/docs/4.2/Classes/DatabaseCollation.html index c661c4960..20de7e417 100644 --- a/docs/4.2/Classes/DatabaseCollation.html +++ b/docs/4.2/Classes/DatabaseCollation.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1062,7 +1062,7 @@

Creates a collation.

-
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
+
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
     return (string1 as NSString).localizedStandardCompare(string2)
 }
 db.add(collation: collation)
@@ -1110,7 +1110,7 @@
                         
                       
@@ -1164,7 +1164,7 @@ connections.

@@ -1207,7 +1207,7 @@ connections.

@@ -1250,7 +1250,7 @@ connections.

@@ -1293,7 +1293,7 @@ connections.

@@ -1336,7 +1336,7 @@ connections.

@@ -1346,7 +1346,7 @@ connections.

diff --git a/docs/4.2/Classes/DatabaseFunction.html b/docs/4.2/Classes/DatabaseFunction.html index 69f7f66e1..ce79b41c5 100644 --- a/docs/4.2/Classes/DatabaseFunction.html +++ b/docs/4.2/Classes/DatabaseFunction.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1038,12 +1038,12 @@

Declaration

Swift

-
public var name: String { get }
+
public var name: String { get }
@@ -1062,8 +1062,8 @@

Returns an SQL function.

-
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
-    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
+
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
+    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
         return nil
     }
     return int + 1
@@ -1149,7 +1149,7 @@ not nil.

@@ -1168,7 +1168,7 @@ not nil.

Returns an SQL aggregate function.

-
struct MySum : DatabaseAggregate {
+
struct MySum : DatabaseAggregate {
     var sum: Int = 0
 
     mutating func step(_ dbValues: [DatabaseValue]) {
@@ -1177,15 +1177,15 @@ not nil.

} } - func finalize() -> DatabaseValueConvertible? { + func finalize() -> DatabaseValueConvertible? { return sum } } -let dbQueue = DatabaseQueue() -let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self) +let dbQueue = DatabaseQueue() +let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self) dbQueue.add(function: fn) -try dbQueue.write { db in +try dbQueue.write { db in try db.execute(sql: "CREATE TABLE test(i)") try db.execute(sql: "INSERT INTO test(i) VALUES (1)") try db.execute(sql: "INSERT INTO test(i) VALUES (2)") @@ -1270,7 +1270,7 @@ not nil.

@@ -1307,7 +1307,7 @@ String property.

This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s capitalized:

-
let nameColumn = Column("name")
+
let nameColumn = Column("name")
 let request = Player.select(nameColumn.capitalized)
 let names = try String.fetchAll(dbQueue, request)   // [String]
 
@@ -1322,7 +1322,7 @@ capitalized:

@@ -1348,7 +1348,7 @@ String property.

This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s lowercased:

-
let nameColumn = Column("name")
+
let nameColumn = Column("name")
 let request = Player.select(nameColumn.lowercased())
 let names = try String.fetchAll(dbQueue, request)   // [String]
 
@@ -1363,7 +1363,7 @@ lowercased:

@@ -1389,7 +1389,7 @@ String property.

This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s uppercased:

-
let nameColumn = Column("name")
+
let nameColumn = Column("name")
 let request = Player.select(nameColumn.uppercased())
 let names = try String.fetchAll(dbQueue, request)   // [String]
 
@@ -1404,7 +1404,7 @@ uppercased:

@@ -1441,7 +1441,7 @@ localizedCapitalized String property.

This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s localizedCapitalized:

-
let nameColumn = Column("name")
+
let nameColumn = Column("name")
 let request = Player.select(nameColumn.localizedCapitalized)
 let names = try String.fetchAll(dbQueue, request)   // [String]
 
@@ -1457,7 +1457,7 @@ localizedCapitalized:

@@ -1483,7 +1483,7 @@ localizedLowercased String property.

This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s localizedLowercased:

-
let nameColumn = Column("name")
+
let nameColumn = Column("name")
 let request = Player.select(nameColumn.localizedLowercased)
 let names = try String.fetchAll(dbQueue, request)   // [String]
 
@@ -1499,7 +1499,7 @@ localizedLowercased:

@@ -1525,7 +1525,7 @@ localizedUppercased String property.

This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s localizedUppercased:

-
let nameColumn = Column("name")
+
let nameColumn = Column("name")
 let request = Player.select(nameColumn.localizedUppercased)
 let names = try String.fetchAll(dbQueue, request)   // [String]
 
@@ -1541,7 +1541,7 @@ localizedUppercased:

@@ -1584,7 +1584,7 @@ localizedUppercased:

@@ -1594,7 +1594,7 @@ localizedUppercased:

diff --git a/docs/4.2/Classes/DatabaseFuture.html b/docs/4.2/Classes/DatabaseFuture.html index 22b1bc434..c9a0ec1c8 100644 --- a/docs/4.2/Classes/DatabaseFuture.html +++ b/docs/4.2/Classes/DatabaseFuture.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1014,11 +1014,11 @@

A future database value, returned by the DatabaseWriter.concurrentRead(_:) method.

-
let futureCount: Future<Int> = try writer.writeWithoutTransaction { db in
-    try Player(...).insert()
+
let futureCount: Future<Int> = try writer.writeWithoutTransaction { db in
+    try Player(...).insert()
 
     // Count players concurrently
-    return writer.concurrentRead { db in
+    return writer.concurrentRead { db in
         return try Player.fetchCount()
     }
 }
@@ -1062,7 +1062,7 @@ method.

@@ -1072,7 +1072,7 @@ method.

diff --git a/docs/4.2/Classes/DatabasePool.html b/docs/4.2/Classes/DatabasePool.html index f1fa32e99..395e88be4 100644 --- a/docs/4.2/Classes/DatabasePool.html +++ b/docs/4.2/Classes/DatabasePool.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,12 +1045,12 @@

Declaration

Swift

-
public var path: String { get }
+
public var path: String { get }
@@ -1074,12 +1074,12 @@

Declaration

Swift

-
public var configuration: Configuration { get }
+
public var configuration: Configuration { get }
@@ -1109,7 +1109,7 @@

Opens the SQLite database at path path.

-
let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
+
let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
 

Database connections get closed when the database pool gets deallocated.

@@ -1124,7 +1124,7 @@

Declaration

Swift

-
public init(path: String, configuration: Configuration = Configuration()) throws
+
public init(path: String, configuration: Configuration = Configuration()) throws
@@ -1160,7 +1160,7 @@ @@ -1224,7 +1224,7 @@ more information.

@@ -1269,7 +1269,7 @@ more information.

@@ -1307,7 +1307,7 @@ enters background. @@ -1338,21 +1338,21 @@ enters background.

Synchronously executes a read-only block in a protected dispatch queue, and returns its result. The block is wrapped in a deferred transaction.

-
let players = try dbPool.read { db in
+
let players = try dbPool.read { db in
     try Player.fetchAll(...)
 }
 

The block is completely isolated. Eventual concurrent database updates are not visible inside the block:

-
try dbPool.read { db in
+
try dbPool.read { db in
     // Those two values are guaranteed to be equal, even if the
     // `wine` table is modified between the two requests:
     let count1 = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
     let count2 = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
 }
 
-try dbPool.read { db in
+try dbPool.read { db in
     // Now this value may be different:
     let count = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
 }
@@ -1395,7 +1395,7 @@ happen while establishing the read access to the database.
                         
                       
@@ -1414,11 +1414,11 @@ happen while establishing the read access to the database.

Asynchronously executes a read-only block in a protected dispatch queue.

-
let players = try dbQueue.asyncRead { result in
-    do {
+
let players = try dbQueue.asyncRead { result in
+    do {
         let db = try result.get()
         let count = try Player.fetchCount(db)
-    } catch {
+    } catch {
         // Handle error
     }
 }
@@ -1457,7 +1457,7 @@ DatabaseError of resultCode SQLITE_READONLY.

@@ -1480,7 +1480,7 @@ and returns its result.

The block argument is not isolated: eventual concurrent database updates are visible inside the block:

-
try dbPool.unsafeRead { db in
+
try dbPool.unsafeRead { db in
     // Those two values may be different because some other thread
     // may have inserted or deleted a wine between the two requests:
     let count1 = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
@@ -1489,7 +1489,7 @@ are visible inside the block:

Cursor iteration is safe, though:

-
try dbPool.unsafeRead { db in
+
try dbPool.unsafeRead { db in
     // No concurrent update can mess with this iteration:
     let rows = try Row.fetchCursor(db, sql: "SELECT ...")
     while let row = try rows.next() { ... }
@@ -1533,7 +1533,7 @@ happen while establishing the read access to the database.
                         
                       
                       
                     
                   
@@ -1556,7 +1556,7 @@ and returns its result.

The block argument is not isolated: eventual concurrent database updates are visible inside the block:

-
try dbPool.unsafeReentrantRead { db in
+
try dbPool.unsafeReentrantRead { db in
     // Those two values may be different because some other thread
     // may have inserted or deleted a wine between the two requests:
     let count1 = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
@@ -1565,7 +1565,7 @@ are visible inside the block:

Cursor iteration is safe, though:

-
try dbPool.unsafeReentrantRead { db in
+
try dbPool.unsafeReentrantRead { db in
     // No concurrent update can mess with this iteration:
     let rows = try Row.fetchCursor(db, sql: "SELECT ...")
     while let row = try rows.next() { ... }
@@ -1610,7 +1610,7 @@ happen while establishing the read access to the database.
                         
                       
                       
                     
                   
@@ -1639,7 +1639,7 @@ happen while establishing the read access to the database.
                         
                       
                       
                     
                   
@@ -1671,23 +1671,23 @@ are established.

In the example below, the number of players is fetched concurrently with the player insertion. Yet the future is guaranteed to return zero:

-
try writer.asyncWriteWithoutTransaction { db in
+
try writer.asyncWriteWithoutTransaction { db in
     // Delete all players
     try Player.deleteAll()
 
     // Count players concurrently
-    writer.asyncConcurrentRead { result in
-        do {
+    writer.asyncConcurrentRead { result in
+        do {
             let db = try result.get()
             // Guaranteed to be zero
             let count = try Player.fetchCount(db)
-        } catch {
+        } catch {
             // Handle error
         }
     }
 
     // Insert a player
-    try Player(...).insert(db)
+    try Player(...).insert(db)
 }
 
@@ -1720,7 +1720,7 @@ the player insertion. Yet the future is guaranteed to return zero:

@@ -1794,7 +1794,7 @@ in a transaction.

@@ -1826,7 +1826,7 @@ has completed.

of the database until the transaction has completed.

This method is not reentrant.

-
try dbPool.writeInTransaction { db in
+
try dbPool.writeInTransaction { db in
     db.execute(...)
     return .commit
 }
@@ -1885,7 +1885,7 @@ for more information.

@@ -1925,7 +1925,7 @@ dangerous concurrency practices.

@@ -1959,7 +1959,7 @@ in a transaction.

@@ -1989,14 +1989,14 @@ in a transaction.

Add or redefine an SQL function.

-
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
-    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
+
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
+    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
         return nil
     }
     return int + 1
 }
 dbPool.add(function: fn)
-try dbPool.read { db in
+try dbPool.read { db in
     try Int.fetchOne(db, sql: "SELECT succ(1)") // 2
 }
 
@@ -2011,7 +2011,7 @@ in a transaction.

@@ -2041,7 +2041,7 @@ in a transaction.

@@ -2071,11 +2071,11 @@ in a transaction.

Add or redefine a collation.

-
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
+
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
     return (string1 as NSString).localizedStandardCompare(string2)
 }
 dbPool.add(collation: collation)
-try dbPool.write { db in
+try dbPool.write { db in
     try db.execute(sql: "CREATE TABLE file (name TEXT COLLATE LOCALIZED_STANDARD")
 }
 
@@ -2090,7 +2090,7 @@ in a transaction.

@@ -2120,7 +2120,7 @@ in a transaction.

@@ -2150,7 +2150,7 @@ in a transaction.

Add a custom FTS5 tokenizer.

-
class MyTokenizer : FTS5CustomTokenizer { ... }
+
class MyTokenizer : FTS5CustomTokenizer { ... }
 dbPool.add(tokenizer: MyTokenizer.self)
 
@@ -2189,19 +2189,19 @@ moment it was created.

When you want to control the latest committed changes seen by a snapshot, create it from the pool’s writer protected dispatch queue:

-
let snapshot1 = try dbPool.write { db -> DatabaseSnapshot in
+
let snapshot1 = try dbPool.write { db -> DatabaseSnapshot in
     try Player.deleteAll()
     return try dbPool.makeSnapshot()
 }
 // <- Other threads may modify the database here
 let snapshot2 = try dbPool.makeSnapshot()
 
-try snapshot1.read { db in
+try snapshot1.read { db in
     // Guaranteed to be zero
     try Player.fetchCount(db)
 }
 
-try snapshot2.read { db in
+try snapshot2.read { db in
     // Could be anything
     try Player.fetchCount(db)
 }
@@ -2210,8 +2210,8 @@ snapshot, create it from the pool’s writer protected dispatch queue:

It is forbidden to create a snapshot from the writer protected dispatch queue when a transaction is opened, though, because it is likely a programmer error:

-
try dbPool.write { db in
-    try db.inTransaction {
+
try dbPool.write { db in
+    try db.inTransaction {
         try Player.deleteAll()
         // fatal error: makeSnapshot() must not be called from inside a transaction
         let snapshot = try dbPool.makeSnapshot()
@@ -2222,11 +2222,11 @@ programmer error:

To avoid this fatal error, create the snapshot before or after the transaction:

-
try dbPool.writeWithoutTransaction { db in
+
try dbPool.writeWithoutTransaction { db in
     // OK
     let snapshot = try dbPool.makeSnapshot()
 
-    try db.inTransaction {
+    try db.inTransaction {
         try Player.deleteAll()
         return .commit
     }
@@ -2251,7 +2251,7 @@ number of reader connections in the pool.

@@ -2261,7 +2261,7 @@ number of reader connections in the pool.

diff --git a/docs/4.2/Classes/DatabaseQueue.html b/docs/4.2/Classes/DatabaseQueue.html index 26df3251d..5aafd886a 100644 --- a/docs/4.2/Classes/DatabaseQueue.html +++ b/docs/4.2/Classes/DatabaseQueue.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,12 +1045,12 @@

Declaration

Swift

-
public var configuration: Configuration { get }
+
public var configuration: Configuration { get }
@@ -1075,12 +1075,12 @@

Declaration

Swift

-
public var path: String { get }
+
public var path: String { get }
@@ -1110,7 +1110,7 @@

Opens the SQLite database at path path.

-
let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
+
let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
 

Database connections get closed when the database queue gets deallocated.

@@ -1125,7 +1125,7 @@

Declaration

Swift

-
public init(path: String, configuration: Configuration = Configuration()) throws
+
public init(path: String, configuration: Configuration = Configuration()) throws
@@ -1161,7 +1161,7 @@ @@ -1180,7 +1180,7 @@

Opens an in-memory SQLite database.

-
let dbQueue = DatabaseQueue()
+
let dbQueue = DatabaseQueue()
 

Database memory is released when the database queue gets deallocated.

@@ -1190,7 +1190,7 @@

Declaration

Swift

-
public init(configuration: Configuration = Configuration())
+
public init(configuration: Configuration = Configuration())
@@ -1214,7 +1214,7 @@ @@ -1259,7 +1259,7 @@ @@ -1297,7 +1297,7 @@ enters background. @@ -1328,7 +1328,7 @@ enters background.

Synchronously executes a read-only block in a protected dispatch queue, and returns its result.

-
let players = try dbQueue.read { db in
+
let players = try dbQueue.read { db in
     try Player.fetchAll(db)
 }
 
@@ -1373,7 +1373,7 @@ DatabaseError of resultCode SQLITE_READONLY.

@@ -1392,11 +1392,11 @@ DatabaseError of resultCode SQLITE_READONLY.

Asynchronously executes a read-only block in a protected dispatch queue.

-
let players = try dbQueue.asyncRead { result in
-    do {
+
let players = try dbQueue.asyncRead { result in
+    do {
         let db = try result.get()
         let count = try Player.fetchCount(db)
-    } catch {
+    } catch {
         // Handle error
     }
 }
@@ -1435,7 +1435,7 @@ DatabaseError of resultCode SQLITE_READONLY.

@@ -1464,7 +1464,7 @@ DatabaseError of resultCode SQLITE_READONLY.

@@ -1504,7 +1504,7 @@ also rollbacked, but no error is thrown.

transaction has completed.

This method is not reentrant.

-
try dbQueue.writeInTransaction { db in
+
try dbQueue.writeInTransaction { db in
     db.execute(...)
     return .commit
 }
@@ -1563,7 +1563,7 @@ for more information.

@@ -1623,7 +1623,7 @@ are completed.

@@ -1644,8 +1644,8 @@ are completed.

Synchronously executes database updates in a protected dispatch queue, outside of any transaction, and returns the result.

// INSERT INTO player ...
-let players = try dbQueue.inDatabase { db in
-    try Player(...).insert(db)
+let players = try dbQueue.inDatabase { db in
+    try Player(...).insert(db)
 }
 
@@ -1685,7 +1685,7 @@ outside of any transaction, and returns the result.

@@ -1706,8 +1706,8 @@ outside of any transaction, and returns the result.

Synchronously executes database updates in a protected dispatch queue, and returns the result.

// INSERT INTO player ...
-try dbQueue.unsafeReentrantWrite { db in
-    try Player(...).insert(db)
+try dbQueue.unsafeReentrantWrite { db in
+    try Player(...).insert(db)
 }
 
@@ -1724,7 +1724,7 @@ concurrency practices.

@@ -1755,7 +1755,7 @@ outside of any transaction.

@@ -1785,14 +1785,14 @@ outside of any transaction.

Add or redefine an SQL function.

-
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
-    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
+
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
+    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
         return nil
     }
     return int + 1
 }
 dbQueue.add(function: fn)
-try dbQueue.read { db in
+try dbQueue.read { db in
     try Int.fetchOne(db, sql: "SELECT succ(1)") // 2
 }
 
@@ -1807,7 +1807,7 @@ outside of any transaction.

@@ -1837,7 +1837,7 @@ outside of any transaction.

@@ -1867,11 +1867,11 @@ outside of any transaction.

Add or redefine a collation.

-
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
+
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
     return (string1 as NSString).localizedStandardCompare(string2)
 }
 dbQueue.add(collation: collation)
-try dbQueue.write { db in
+try dbQueue.write { db in
     try db.execute(sql: "CREATE TABLE file (name TEXT COLLATE LOCALIZED_STANDARD")
 }
 
@@ -1886,7 +1886,7 @@ outside of any transaction.

@@ -1916,7 +1916,7 @@ outside of any transaction.

@@ -1926,7 +1926,7 @@ outside of any transaction.

diff --git a/docs/4.2/Classes/DatabaseSnapshot.html b/docs/4.2/Classes/DatabaseSnapshot.html index 3808e6639..bbb7d30cd 100644 --- a/docs/4.2/Classes/DatabaseSnapshot.html +++ b/docs/4.2/Classes/DatabaseSnapshot.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,12 +1043,12 @@ moment it was created.

Declaration

Swift

-
public var configuration: Configuration { get }
+
public var configuration: Configuration { get }
@@ -1079,7 +1079,7 @@ moment it was created.

Synchronously executes a read-only block that takes a database connection, and returns its result.

-
let players = try snapshot.read { db in
+
let players = try snapshot.read { db in
     try Player.fetchAll(...)
 }
 
@@ -1118,7 +1118,7 @@ connection, and returns its result.

@@ -1137,11 +1137,11 @@ connection, and returns its result.

Asynchronously executes a read-only block in a protected dispatch queue.

-
let players = try snapshot.asyncRead { result in
-    do {
+
let players = try snapshot.asyncRead { result in
+    do {
         let db = try result.get()
         let count = try Player.fetchCount(db)
-    } catch {
+    } catch {
         // Handle error
     }
 }
@@ -1176,7 +1176,7 @@ connection, and returns its result.

@@ -1216,7 +1216,7 @@ connection, and returns its result.

@@ -1245,7 +1245,7 @@ connection, and returns its result.

@@ -1285,7 +1285,7 @@ connection, and returns its result.

@@ -1314,7 +1314,7 @@ connection, and returns its result.

@@ -1358,7 +1358,7 @@ connection, and returns its result.

@@ -1387,7 +1387,7 @@ connection, and returns its result.

@@ -1397,7 +1397,7 @@ connection, and returns its result.

diff --git a/docs/4.2/Classes/FTS3TableDefinition.html b/docs/4.2/Classes/FTS3TableDefinition.html index 2b5f66093..ef7be7f40 100644 --- a/docs/4.2/Classes/FTS3TableDefinition.html +++ b/docs/4.2/Classes/FTS3TableDefinition.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,7 +1016,7 @@

You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

-
try db.create(virtualTable: "document", using: FTS3()) { t in // t is FTS3TableDefinition
+
try db.create(virtualTable: "document", using: FTS3()) { t in // t is FTS3TableDefinition
     t.column("content")
 }
 
@@ -1039,7 +1039,7 @@

The virtual table tokenizer

-
try db.create(virtualTable: "document", using: FTS3()) { t in
+
try db.create(virtualTable: "document", using: FTS3()) { t in
     t.tokenizer = .porter
 }
 
@@ -1056,7 +1056,7 @@
@@ -1075,7 +1075,7 @@

Appends a table column.

-
try db.create(virtualTable: "document", using: FTS3()) { t in
+
try db.create(virtualTable: "document", using: FTS3()) { t in
     t.column("content")
 }
 
@@ -1109,7 +1109,7 @@
@@ -1119,7 +1119,7 @@ diff --git a/docs/4.2/Classes/FTS4ColumnDefinition.html b/docs/4.2/Classes/FTS4ColumnDefinition.html index 5771c0896..67a7b1892 100644 --- a/docs/4.2/Classes/FTS4ColumnDefinition.html +++ b/docs/4.2/Classes/FTS4ColumnDefinition.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,7 +1016,7 @@ virtual table.

You get instances of this class when you create an FTS4 table:

-
try db.create(virtualTable: "document", using: FTS4()) { t in
+
try db.create(virtualTable: "document", using: FTS4()) { t in
     t.column("content")      // FTS4ColumnDefinition
 }
 
@@ -1041,7 +1041,7 @@ virtual table.

Excludes the column from the full-text index.

-
try db.create(virtualTable: "document", using: FTS4()) { t in
+
try db.create(virtualTable: "document", using: FTS4()) { t in
     t.column("a")
     t.column("b").notIndexed()
 }
@@ -1065,7 +1065,7 @@ virtual table.

Self so that you can further refine the column definition.

@@ -1084,7 +1084,7 @@ virtual table.

Uses the column as the Int32 language id hidden column.

-
try db.create(virtualTable: "document", using: FTS4()) { t in
+
try db.create(virtualTable: "document", using: FTS4()) { t in
     t.column("a")
     t.column("lid").asLanguageId()
 }
@@ -1107,7 +1107,7 @@ virtual table.

Self so that you can further refine the column definition.

@@ -1117,7 +1117,7 @@ virtual table.

diff --git a/docs/4.2/Classes/FTS4TableDefinition.html b/docs/4.2/Classes/FTS4TableDefinition.html index c1898baf9..a5d1f0fb4 100644 --- a/docs/4.2/Classes/FTS4TableDefinition.html +++ b/docs/4.2/Classes/FTS4TableDefinition.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,7 +1016,7 @@

You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

-
try db.create(virtualTable: "document", using: FTS4()) { t in // t is FTS4TableDefinition
+
try db.create(virtualTable: "document", using: FTS4()) { t in // t is FTS4TableDefinition
     t.column("content")
 }
 
@@ -1041,7 +1041,7 @@

The virtual table tokenizer

-
try db.create(virtualTable: "document", using: FTS4()) { t in
+
try db.create(virtualTable: "document", using: FTS4()) { t in
     t.tokenizer = .porter
 }
 
@@ -1058,7 +1058,7 @@
@@ -1092,12 +1092,12 @@ established with the

Swift

-
public var content: String? { get set }
+
public var content: String? { get set }
@@ -1129,7 +1129,7 @@ established with the - Show on GitHub + Show on GitHub @@ -1161,7 +1161,7 @@ established with the - Show on GitHub + Show on GitHub @@ -1193,7 +1193,7 @@ established with the - Show on GitHub + Show on GitHub @@ -1213,7 +1213,7 @@ established with the

Support for the FTS5 prefix option

// CREATE VIRTUAL TABLE document USING FTS4(content, prefix='2 4');
-db.create(virtualTable: "document", using:FTS4()) { t in
+db.create(virtualTable: "document", using:FTS4()) { t in
     t.prefixes = [2, 4]
     t.column("content")
 }
@@ -1231,7 +1231,7 @@ established with the 
-                        Show on GitHub
+                        Show on GitHub
                       
                     
                   
@@ -1250,7 +1250,7 @@ established with the 
                       
                     
                   
@@ -1322,7 +1322,7 @@ full-text table is kept up to date with the external table.

@@ -1332,7 +1332,7 @@ full-text table is kept up to date with the external table.

diff --git a/docs/4.2/Classes/FTS5ColumnDefinition.html b/docs/4.2/Classes/FTS5ColumnDefinition.html index 3a70a3c40..400408065 100644 --- a/docs/4.2/Classes/FTS5ColumnDefinition.html +++ b/docs/4.2/Classes/FTS5ColumnDefinition.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1010,7 +1010,7 @@ virtual table.

You get instances of this class when you create an FTS5 table:

-
try db.create(virtualTable: "document", using: FTS5()) { t in
+
try db.create(virtualTable: "document", using: FTS5()) { t in
     t.column("content")      // FTS5ColumnDefinition
 }
 
@@ -1035,7 +1035,7 @@ virtual table.

Excludes the column from the full-text index.

-
try db.create(virtualTable: "document", using: FTS5()) { t in
+
try db.create(virtualTable: "document", using: FTS5()) { t in
     t.column("a")
     t.column("b").notIndexed()
 }
@@ -1052,7 +1052,7 @@ virtual table.

diff --git a/docs/4.2/Classes/FTS5TableDefinition.html b/docs/4.2/Classes/FTS5TableDefinition.html index 6e51ea535..923a003d1 100644 --- a/docs/4.2/Classes/FTS5TableDefinition.html +++ b/docs/4.2/Classes/FTS5TableDefinition.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1010,7 +1010,7 @@

You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

-
try db.create(virtualTable: "document", using: FTS5()) { t in // t is FTS5TableDefinition
+
try db.create(virtualTable: "document", using: FTS5()) { t in // t is FTS5TableDefinition
     t.column("content")
 }
 
@@ -1035,7 +1035,7 @@

The virtual table tokenizer

-
try db.create(virtualTable: "document", using: FTS5()) { t in
+
try db.create(virtualTable: "document", using: FTS5()) { t in
     t.tokenizer = .porter()
 }
 
@@ -1179,7 +1179,7 @@ established with the

Appends a table column.

-
try db.create(virtualTable: "document", using: FTS5()) { t in
+
try db.create(virtualTable: "document", using: FTS5()) { t in
     t.column("content")
 }
 
@@ -1219,7 +1219,7 @@ full-text table is kept up to date with the external table.

diff --git a/docs/4.2/Classes/FetchedRecordsController.html b/docs/4.2/Classes/FetchedRecordsController.html index 74cad8960..c0ff8c2dc 100644 --- a/docs/4.2/Classes/FetchedRecordsController.html +++ b/docs/4.2/Classes/FetchedRecordsController.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1059,7 +1059,7 @@ its eventual arguments.

public convenience init(
     _ databaseWriter: DatabaseWriter,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil,
     queue: DispatchQueue = .main,
     isSameRecord: ((Record, Record) -> Bool)? = nil) throws
@@ -1153,7 +1153,7 @@ same identity. For example, they have the same id.

@@ -1173,8 +1173,8 @@ same identity. For example, they have the same id.

Creates a fetched records controller initialized from a fetch request from the Query Interface.

-
let request = Wine.order(Column("name"))
-let controller = FetchedRecordsController(
+
let request = Wine.order(Column("name"))
+let controller = FetchedRecordsController(
     dbQueue,
     request: request,
     isSameRecord: { (wine1, wine2) in wine1.id == wine2.id })
@@ -1257,7 +1257,7 @@ same identity. For example, they have the same id.

@@ -1293,7 +1293,7 @@ main queue unless stated otherwise in the controller’s initializer).

@@ -1337,7 +1337,7 @@ to changes.

@@ -1369,7 +1369,7 @@ to changes.

@@ -1405,7 +1405,7 @@ main queue unless stated otherwise in the controller’s initializer).

@@ -1436,14 +1436,14 @@ main queue unless stated otherwise in the controller’s initializer).

Swift

public func setRequest(
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws
@@ -1523,7 +1523,7 @@ removed, moved, or updated.

@@ -1621,7 +1621,7 @@ removed, moved, or updated.

@@ -1662,7 +1662,7 @@ main queue unless stated otherwise in the controller’s initializer).

@@ -1699,7 +1699,7 @@ after the didChange callback has completed.

@@ -1749,7 +1749,7 @@ main queue unless stated otherwise in the controller’s initializer).

@@ -1805,7 +1805,7 @@ has an id primary key, this initializer is equivalent to:

public convenience init(
     _ databaseWriter: DatabaseWriter,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil,
     queue: DispatchQueue = .main) throws
@@ -1883,7 +1883,7 @@ used from this queue.

@@ -1903,8 +1903,8 @@ used from this queue.

Creates a fetched records controller initialized from a fetch request from the Query Interface.

-
let request = Wine.order(Column("name"))
-let controller = FetchedRecordsController(
+
let request = Wine.order(Column("name"))
+let controller = FetchedRecordsController(
     dbQueue,
     request: request)
 
@@ -1980,7 +1980,7 @@ used from this queue.

@@ -2043,7 +2043,7 @@ records, a fatal error is raised.

@@ -2090,7 +2090,7 @@ records. In this case, there is a single empty section.

@@ -2136,7 +2136,7 @@ records. In this case, there is a single empty section.

if record could not be found.

@@ -2146,7 +2146,7 @@ if record could not be found.

diff --git a/docs/4.2/Classes/Record.html b/docs/4.2/Classes/Record.html index 436807b51..c5e613d09 100644 --- a/docs/4.2/Classes/Record.html +++ b/docs/4.2/Classes/Record.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1051,7 +1051,7 @@ designed to be subclassed.

@@ -1081,7 +1081,7 @@ designed to be subclassed.

@@ -1114,8 +1114,8 @@ designed to be subclassed.

This table name is required by the insert, update, save, delete, and exists methods.

-
class Player : Record {
-    override class var databaseTableName: String {
+
class Player : Record {
+    override class var databaseTableName: String {
         return "player"
     }
 }
@@ -1128,7 +1128,7 @@ and exists methods.

Declaration

Swift

-
open class var databaseTableName: String { get }
+
open class var databaseTableName: String { get }
@@ -1137,7 +1137,7 @@ and exists methods.

The name of a database table.

@@ -1173,12 +1173,12 @@ even if a row was actually inserted without any conflict.

Declaration

Swift

-
open class var persistenceConflictPolicy: PersistenceConflictPolicy { get }
+
open class var persistenceConflictPolicy: PersistenceConflictPolicy { get }
@@ -1205,9 +1205,9 @@ even if a row was actually inserted without any conflict.

You can override this property and provide an explicit list of columns:

-
class RestrictedPlayer : Record {
+
class RestrictedPlayer : Record {
     override static var databaseSelection: [SQLSelectable] {
-        return [Column("id"), Column("name")]
+        return [Column("id"), Column("name")]
     }
 }
 
@@ -1216,9 +1216,9 @@ of columns:

You can also add extra columns such as the rowid column:

-
class ExtendedPlayer : Player {
+
class ExtendedPlayer : Player {
     override static var databaseSelection: [SQLSelectable] {
-        return [AllColumns(), Column.rowID]
+        return [AllColumns(), Column.rowID]
     }
 }
 
@@ -1236,7 +1236,7 @@ of columns:

@@ -1260,7 +1260,7 @@ of columns:

the columns of the database table (see Record.databaseTableName()).

Primary key columns, if any, must be included.

-
class Player : Record {
+
class Player : Record {
     var id: Int64?
     var name: String?
 
@@ -1284,7 +1284,7 @@ the container.

@@ -1309,7 +1309,7 @@ dispatch queue, with the inserted RowID and the eventual INTEGER PRIMARY KEY column name.

The implementation of the base Record class does nothing.

-
class Player : Record {
+
class Player : Record {
     var id: Int64?
     var name: String?
 
@@ -1360,7 +1360,7 @@ INTEGER PRIMARY KEY column name.

@@ -1409,7 +1409,7 @@ INTEGER PRIMARY KEY column name.

A copy of self.

@@ -1460,12 +1460,12 @@ of the record.

Declaration

Swift

-
public var hasDatabaseChanges: Bool { get set }
+
public var hasDatabaseChanges: Bool { get set }
@@ -1503,7 +1503,7 @@ are nil.

@@ -1577,7 +1577,7 @@ before the insertion.

@@ -1650,7 +1650,7 @@ match any row in the database and record could not be updated. @@ -1729,7 +1729,7 @@ match any row in the database and record could not be updated.

Whether the record had changes.

@@ -1798,7 +1798,7 @@ thrown by update(). @@ -1859,7 +1859,7 @@ thrown by update().

Whether a database row was deleted.

@@ -1869,7 +1869,7 @@ thrown by update(). diff --git a/docs/4.2/Classes/Row.html b/docs/4.2/Classes/Row.html index 4da6b1ae2..8f7d49bbe 100644 --- a/docs/4.2/Classes/Row.html +++ b/docs/4.2/Classes/Row.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1087,7 +1087,7 @@ @@ -1128,7 +1128,7 @@ @@ -1158,7 +1158,7 @@ @@ -1191,7 +1191,7 @@ adopt DatabaseValueConvertible.

@@ -1225,7 +1225,7 @@ want to keep a specific one: row.copy().

@@ -1269,7 +1269,7 @@ of column-value pairs in self.

@@ -1301,7 +1301,7 @@ of column-value pairs in self.

@@ -1347,12 +1347,12 @@ contains a non-null value.

Declaration

Swift

-
public var containsNonNullValue: Bool { get }
+
public var containsNonNullValue: Bool { get }
@@ -1389,7 +1389,7 @@ values.

@@ -1418,12 +1418,12 @@ righmost column.

Declaration

Swift

-
public subscript(index: Int) -> DatabaseValueConvertible? { get }
+
public subscript(index: Int) -> DatabaseValueConvertible? { get }
@@ -1456,12 +1456,12 @@ fail, a fatal error is raised.

Swift

@inlinable
-public subscript<Value>(index: Int) -> Value? where Value : DatabaseValueConvertible { get }
+public subscript<Value>(index: Int) -> Value? where Value : DatabaseValueConvertible { get }
@@ -1498,12 +1498,12 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions

Swift

@inlinable
-public subscript<Value>(index: Int) -> Value? where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
+public subscript<Value>(index: Int) -> Value? where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
@@ -1535,12 +1535,12 @@ SQLite value can not be converted to Value.

Swift

@inlinable
-public subscript<Value>(index: Int) -> Value where Value : DatabaseValueConvertible { get }
+public subscript<Value>(index: Int) -> Value where Value : DatabaseValueConvertible { get }
@@ -1576,12 +1576,12 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions

Swift

@inlinable
-public subscript<Value>(index: Int) -> Value where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
+public subscript<Value>(index: Int) -> Value where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
@@ -1612,12 +1612,12 @@ the same name, the leftmost column is considered.

Declaration

Swift

-
public subscript(columnName: String) -> DatabaseValueConvertible? { get }
+
public subscript(columnName: String) -> DatabaseValueConvertible? { get }
@@ -1650,12 +1650,12 @@ nil. Otherwise the SQLite value is converted to the requested type

Swift

@inlinable
-public subscript<Value>(columnName: String) -> Value? where Value : DatabaseValueConvertible { get }
+public subscript<Value>(columnName: String) -> Value? where Value : DatabaseValueConvertible { get }
@@ -1692,12 +1692,12 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions

Swift

@inlinable
-public subscript<Value>(columnName: String) -> Value? where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
+public subscript<Value>(columnName: String) -> Value? where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
@@ -1731,12 +1731,12 @@ SQLite value can not be converted to Value.

Swift

@inlinable
-public subscript<Value>(columnName: String) -> Value where Value : DatabaseValueConvertible { get }
+public subscript<Value>(columnName: String) -> Value where Value : DatabaseValueConvertible { get }
@@ -1774,12 +1774,12 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions

Swift

@inlinable
-public subscript<Value>(columnName: String) -> Value where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
+public subscript<Value>(columnName: String) -> Value where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
@@ -1811,12 +1811,12 @@ the same name, the leftmost column is considered.

Swift

@inlinable
-public subscript<Column>(column: Column) -> DatabaseValueConvertible? where Column : ColumnExpression { get }
+public subscript<Column>(column: Column) -> DatabaseValueConvertible? where Column : ColumnExpression { get }
@@ -1849,12 +1849,12 @@ nil. Otherwise the SQLite value is converted to the requested type

Swift

@inlinable
-public subscript<Value, Column>(column: Column) -> Value? where Value : DatabaseValueConvertible, Column : ColumnExpression { get }
+public subscript<Value, Column>(column: Column) -> Value? where Value : DatabaseValueConvertible, Column : ColumnExpression { get }
@@ -1900,7 +1900,7 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions @@ -1934,12 +1934,12 @@ SQLite value can not be converted to Value.

Swift

@inlinable
-public subscript<Value, Column>(column: Column) -> Value where Value : DatabaseValueConvertible, Column : ColumnExpression { get }
+public subscript<Value, Column>(column: Column) -> Value where Value : DatabaseValueConvertible, Column : ColumnExpression { get }
@@ -1986,7 +1986,7 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions @@ -2025,7 +2025,7 @@ than the row’s lifetime.

@@ -2065,7 +2065,7 @@ than the row’s lifetime.

@@ -2105,7 +2105,7 @@ than the row’s lifetime.

@@ -2149,7 +2149,7 @@ of column-value pairs in self.

@@ -2184,7 +2184,7 @@ of column-value pairs in self.

let request = Book.including(required: Book.author)
 let row = try Row.fetchOne(db, request)!
 
-print(Book(row: row).title)
+print(Book(row: row).title)
 // Prints "Moby-Dick"
 
 let author: Author = row["author"]
@@ -2196,7 +2196,7 @@ of column-value pairs in self.

let request = Book.including(required: Book.author.including(required: Author.country))
 let row = try Row.fetchOne(db, request)!
 
-print(Book(row: row).title)
+print(Book(row: row).title)
 // Prints "Moby-Dick"
 
 let country: Country = row["country"]
@@ -2215,12 +2215,12 @@ for more information.

Declaration

Swift

-
public subscript<Record>(scope: String) -> Record where Record : FetchableRecord { get }
+
public subscript<Record>(scope: String) -> Record where Record : FetchableRecord { get }
@@ -2244,7 +2244,7 @@ for more information.

let request = Book.including(optional: Book.author)
 let row = try Row.fetchOne(db, request)!
 
-print(Book(row: row).title)
+print(Book(row: row).title)
 // Prints "Moby-Dick"
 
 let author: Author? = row["author"]
@@ -2256,7 +2256,7 @@ for more information.

let request = Book.including(optional: Book.author.including(optional: Author.country))
 let row = try Row.fetchOne(db, request)!
 
-print(Book(row: row).title)
+print(Book(row: row).title)
 // Prints "Moby-Dick"
 
 let country: Country? = row["country"]
@@ -2275,12 +2275,12 @@ for more information.

Declaration

Swift

-
public subscript<Record>(scope: String) -> Record? where Record : FetchableRecord { get }
+
public subscript<Record>(scope: String) -> Record? where Record : FetchableRecord { get }
@@ -2304,7 +2304,7 @@ for more information.

let request = Author.including(all: Author.books)
 let row = try Row.fetchOne(db, request)!
 
-print(Author(row: row).name)
+print(Author(row: row).name)
 // Prints "Herman Melville"
 
 let books: [Book] = row["books"]
@@ -2326,7 +2326,7 @@ for more information.

@@ -2350,7 +2350,7 @@ for more information.

let request = Author.including(all: Author.books)
 let row = try Row.fetchOne(db, request)!
 
-print(Author(row: row).name)
+print(Author(row: row).name)
 // Prints "Herman Melville"
 
 let books: Set<Book> = row["books"]
@@ -2363,12 +2363,12 @@ for more information.

Declaration

Swift

-
public subscript<Record>(key: String) -> Set<Record> where Record : FetchableRecord, Record : Hashable { get }
+
public subscript<Record>(key: String) -> Set<Record> where Record : FetchableRecord, Record : Hashable { get }
@@ -2401,10 +2401,10 @@ for more information.

For example:

// Define a tree of nested scopes
-let adapter = ScopeAdapter([
-    "foo": RangeRowAdapter(0..<1),
-    "bar": RangeRowAdapter(1..<2).addingScopes([
-        "baz" : RangeRowAdapter(2..<3)])])
+let adapter = ScopeAdapter([
+    "foo": RangeRowAdapter(0..<1),
+    "bar": RangeRowAdapter(1..<2).addingScopes([
+        "baz" : RangeRowAdapter(2..<3)])])
 
 // Fetch
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
@@ -2423,12 +2423,12 @@ for more information.

Declaration

Swift

-
public var scopes: ScopesView { get }
+
public var scopes: ScopesView { get }
@@ -2450,10 +2450,10 @@ for more information.

For example:

// Define a tree of nested scopes
-let adapter = ScopeAdapter([
-    "foo": RangeRowAdapter(0..<1),
-    "bar": RangeRowAdapter(1..<2).addingScopes([
-        "baz" : RangeRowAdapter(2..<3)])])
+let adapter = ScopeAdapter([
+    "foo": RangeRowAdapter(0..<1),
+    "bar": RangeRowAdapter(1..<2).addingScopes([
+        "baz" : RangeRowAdapter(2..<3)])])
 
 // Fetch
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
@@ -2471,12 +2471,12 @@ for more information.

Declaration

Swift

-
public var scopesTree: ScopesTreeView { get }
+
public var scopesTree: ScopesTreeView { get }
@@ -2500,9 +2500,9 @@ for more information.

adapted rows, such as rows fetched from joined requests.

let row = ...
 // Failure because row equality tests for row scopes:
-XCTAssertEqual(row, ["id": 1, "name": "foo"])
+XCTAssertEqual(row, ["id": 1, "name": "foo"])
 // Success:
-XCTAssertEqual(row.unscoped, ["id": 1, "name": "foo"])
+XCTAssertEqual(row.unscoped, ["id": 1, "name": "foo"])
 
@@ -2510,12 +2510,12 @@ adapted rows, such as rows fetched from joined requests.

Declaration

Swift

-
public var unscoped: Row { get }
+
public var unscoped: Row { get }
@@ -2543,12 +2543,12 @@ adapted rows, such as rows fetched from joined requests.

Declaration

Swift

-
public var unadapted: Row { get }
+
public var unadapted: Row { get }
@@ -2677,7 +2677,7 @@ elements are undefined.

A cursor over fetched rows.

@@ -2766,7 +2766,7 @@ elements are undefined.

An array of rows.

@@ -2855,7 +2855,7 @@ elements are undefined.

An optional row.

@@ -2918,7 +2918,7 @@ elements are undefined.

public static func fetchCursor(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> RowCursor
@@ -2984,7 +2984,7 @@ elements are undefined.

A cursor over fetched rows.

@@ -3004,7 +3004,7 @@ elements are undefined.

Returns an array of rows fetched from an SQL query.

let rows = try Row.fetchAll(db, sql: "SELECT id, name FROM player") // [Row]
-for row in rows {
+for row in rows {
     let id: Int64 = row[0]
     let name: String = row[1]
 }
@@ -3023,7 +3023,7 @@ elements are undefined.

public static func fetchAll(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> [Row]
@@ -3089,7 +3089,7 @@ elements are undefined.

An array of rows.

@@ -3109,7 +3109,7 @@ elements are undefined.

Returns a single row fetched from an SQL query.

let row = try Row.fetchOne(db, sql: "SELECT id, name FROM player") // Row?
-if let row = row {
+if let row = row {
     let id: Int64 = row[0]
     let name: String = row[1]
 }
@@ -3128,7 +3128,7 @@ elements are undefined.

public static func fetchOne(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> Row?
@@ -3194,7 +3194,7 @@ elements are undefined.

An optional row.

@@ -3295,7 +3295,7 @@ elements are undefined.

A cursor over fetched rows.

@@ -3368,7 +3368,7 @@ elements are undefined.

An array of rows.

@@ -3441,7 +3441,7 @@ elements are undefined.

An optional row.

@@ -3487,7 +3487,7 @@ duplicated columns names are allowed.

@@ -3528,7 +3528,7 @@ duplicated columns names are allowed.

@@ -3563,10 +3563,10 @@ dictionary.

For example:

// Define a tree of nested scopes
-let adapter = ScopeAdapter([
-    "foo": RangeRowAdapter(0..<1),
-    "bar": RangeRowAdapter(1..<2).addingScopes([
-        "baz" : RangeRowAdapter(2..<3)])])
+let adapter = ScopeAdapter([
+    "foo": RangeRowAdapter(0..<1),
+    "bar": RangeRowAdapter(1..<2).addingScopes([
+        "baz" : RangeRowAdapter(2..<3)])])
 
 // Fetch
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
@@ -3591,7 +3591,7 @@ dictionary.

@@ -3624,10 +3624,10 @@ dictionary.

For example:

// Define a tree of nested scopes
-let adapter = ScopeAdapter([
-    "foo": RangeRowAdapter(0..<1),
-    "bar": RangeRowAdapter(1..<2).addingScopes([
-        "baz" : RangeRowAdapter(2..<3)])])
+let adapter = ScopeAdapter([
+    "foo": RangeRowAdapter(0..<1),
+    "bar": RangeRowAdapter(1..<2).addingScopes([
+        "baz" : RangeRowAdapter(2..<3)])])
 
 // Fetch
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
@@ -3651,7 +3651,7 @@ dictionary.

@@ -3705,7 +3705,7 @@ dictionary.

@@ -3715,7 +3715,7 @@ dictionary.

diff --git a/docs/4.2/Classes/Row/PrefetchedRowsView.html b/docs/4.2/Classes/Row/PrefetchedRowsView.html index 36e62325f..f8c02ee42 100644 --- a/docs/4.2/Classes/Row/PrefetchedRowsView.html +++ b/docs/4.2/Classes/Row/PrefetchedRowsView.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1050,12 +1050,12 @@

Declaration

Swift

-
public var isEmpty: Bool { get }
+
public var isEmpty: Bool { get }
@@ -1093,7 +1093,7 @@ @@ -1140,7 +1140,7 @@ available, too.

@@ -1150,7 +1150,7 @@ available, too.

diff --git a/docs/4.2/Classes/Row/ScopesTreeView.html b/docs/4.2/Classes/Row/ScopesTreeView.html index e4604faec..151c43863 100644 --- a/docs/4.2/Classes/Row/ScopesTreeView.html +++ b/docs/4.2/Classes/Row/ScopesTreeView.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,10 +1016,10 @@

For example:

// Define a tree of nested scopes
-let adapter = ScopeAdapter([
-    "foo": RangeRowAdapter(0..<1),
-    "bar": RangeRowAdapter(1..<2).addingScopes([
-        "baz" : RangeRowAdapter(2..<3)])])
+let adapter = ScopeAdapter([
+    "foo": RangeRowAdapter(0..<1),
+    "bar": RangeRowAdapter(1..<2).addingScopes([
+        "baz" : RangeRowAdapter(2..<3)])])
 
 // Fetch
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
@@ -1061,7 +1061,7 @@
                         
                       
                       
                     
                   
@@ -1112,12 +1112,12 @@
                         

Declaration

Swift

-
public subscript(name: String) -> Row? { get }
+
public subscript(name: String) -> Row? { get }
@@ -1127,7 +1127,7 @@ diff --git a/docs/4.2/Classes/Row/ScopesView.html b/docs/4.2/Classes/Row/ScopesView.html index 5f642de51..746209d11 100644 --- a/docs/4.2/Classes/Row/ScopesView.html +++ b/docs/4.2/Classes/Row/ScopesView.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1018,10 +1018,10 @@ dictionary.

For example:

// Define a tree of nested scopes
-let adapter = ScopeAdapter([
-    "foo": RangeRowAdapter(0..<1),
-    "bar": RangeRowAdapter(1..<2).addingScopes([
-        "baz" : RangeRowAdapter(2..<3)])])
+let adapter = ScopeAdapter([
+    "foo": RangeRowAdapter(0..<1),
+    "bar": RangeRowAdapter(1..<2).addingScopes([
+        "baz" : RangeRowAdapter(2..<3)])])
 
 // Fetch
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
@@ -1063,7 +1063,7 @@ dictionary.

@@ -1088,12 +1088,12 @@ dictionary.

Declaration

Swift

-
public var names: Dictionary<String, LayoutedRowAdapter>.Keys { get }
+
public var names: Dictionary<String, LayoutedRowAdapter>.Keys { get }
@@ -1119,12 +1119,12 @@ scope is not defined.

Declaration

Swift

-
public subscript(name: String) -> Row? { get }
+
public subscript(name: String) -> Row? { get }
@@ -1134,7 +1134,7 @@ scope is not defined.

diff --git a/docs/4.2/Classes/RowCursor.html b/docs/4.2/Classes/RowCursor.html index 66a593328..80ecebae5 100644 --- a/docs/4.2/Classes/RowCursor.html +++ b/docs/4.2/Classes/RowCursor.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1013,7 +1013,7 @@

A cursor of database rows. For example:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let rows: RowCursor = try Row.fetchCursor(db, sql: "SELECT * FROM player")
 }
 
@@ -1047,7 +1047,7 @@ @@ -1057,7 +1057,7 @@ diff --git a/docs/4.2/Classes/SelectStatement.html b/docs/4.2/Classes/SelectStatement.html index dc3906cf6..d5fa7a819 100644 --- a/docs/4.2/Classes/SelectStatement.html +++ b/docs/4.2/Classes/SelectStatement.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1015,7 +1015,7 @@

A subclass of Statement that fetches database rows.

You create SelectStatement with the Database.makeSelectStatement() method:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let statement = try db.makeSelectStatement(sql: "SELECT COUNT(*) FROM player WHERE score > ?")
     let moreThanTwentyCount = try Int.fetchOne(statement, arguments: [20])!
     let moreThanThirtyCount = try Int.fetchOne(statement, arguments: [30])!
@@ -1051,7 +1051,7 @@
                         
                       
                       
                     
                   
@@ -1076,12 +1076,12 @@
                         

Declaration

Swift

-
public var columnCount: Int { get }
+
public var columnCount: Int { get }
@@ -1111,7 +1111,7 @@ @@ -1142,7 +1142,7 @@ case-insensitive way.

@@ -1152,7 +1152,7 @@ case-insensitive way.

diff --git a/docs/4.2/Classes/Statement.html b/docs/4.2/Classes/Statement.html index 2047297ac..d04e136f8 100644 --- a/docs/4.2/Classes/Statement.html +++ b/docs/4.2/Classes/Statement.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1046,7 +1046,7 @@ and SelectStatement that fetches rows.

@@ -1071,12 +1071,12 @@ and SelectStatement that fetches rows.

Declaration

Swift

-
public var sql: String { get }
+
public var sql: String { get }
@@ -1112,12 +1112,12 @@ and SelectStatement that fetches rows.

Declaration

Swift

-
public var arguments: StatementArguments { get set }
+
public var arguments: StatementArguments { get set }
@@ -1148,7 +1148,7 @@ statement arguments.

@@ -1178,7 +1178,7 @@ statement arguments.

@@ -1188,7 +1188,7 @@ statement arguments.

diff --git a/docs/4.2/Classes/TableAlias.html b/docs/4.2/Classes/TableAlias.html index e83aa1274..22e7b2868 100644 --- a/docs/4.2/Classes/TableAlias.html +++ b/docs/4.2/Classes/TableAlias.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1071,12 +1071,12 @@ joined queries.

Declaration

Swift

-
public subscript(selectable: SQLSelectable) -> SQLSelectable { get }
+
public subscript(selectable: SQLSelectable) -> SQLSelectable { get }
@@ -1102,12 +1102,12 @@ joined queries.

Declaration

Swift

-
public subscript(expression: SQLExpression) -> SQLExpression { get }
+
public subscript(expression: SQLExpression) -> SQLExpression { get }
@@ -1117,7 +1117,7 @@ joined queries.

diff --git a/docs/4.2/Classes/TableAlteration.html b/docs/4.2/Classes/TableAlteration.html index 9d6a663e4..dc918bfcd 100644 --- a/docs/4.2/Classes/TableAlteration.html +++ b/docs/4.2/Classes/TableAlteration.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1095,7 +1095,7 @@ column definition.

@@ -1105,7 +1105,7 @@ column definition.

diff --git a/docs/4.2/Classes/TableDefinition.html b/docs/4.2/Classes/TableDefinition.html index 224977311..4db43b1f0 100644 --- a/docs/4.2/Classes/TableDefinition.html +++ b/docs/4.2/Classes/TableDefinition.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1102,7 +1102,7 @@ inserted in between.

Self so that you can further refine the column definition.

@@ -1175,7 +1175,7 @@ inserted in between.

column definition.

@@ -1246,7 +1246,7 @@ column definition.

@@ -1316,7 +1316,7 @@ column definition.

@@ -1443,7 +1443,7 @@ See https://www.sq @@ -1465,8 +1465,8 @@ See https://www.sq
try db.create(table: "player") { t in
     t.column("personalPhone", .text)
     t.column("workPhone", .text)
-    let personalPhone = Column("personalPhone")
-    let workPhone = Column("workPhone")
+    let personalPhone = Column("personalPhone")
+    let workPhone = Column("workPhone")
     t.check(personalPhone != nil || workPhone != nil)
 }
 
@@ -1502,7 +1502,7 @@ See
https://www.sq @@ -1559,7 +1559,7 @@ See https://www.sq @@ -1569,7 +1569,7 @@ See https://www.sq diff --git a/docs/4.2/Classes/UpdateStatement.html b/docs/4.2/Classes/UpdateStatement.html index 08033642c..c92626fd2 100644 --- a/docs/4.2/Classes/UpdateStatement.html +++ b/docs/4.2/Classes/UpdateStatement.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1015,7 +1015,7 @@

A subclass of Statement that executes SQL queries.

You create UpdateStatement with the Database.makeUpdateStatement() method:

-
try dbQueue.inTransaction { db in
+
try dbQueue.inTransaction { db in
     let statement = try db.makeUpdateStatement(sql: "INSERT INTO player (name) VALUES (?)")
     try statement.execute(arguments: ["Arthur"])
     try statement.execute(arguments: ["Barbara"])
@@ -1076,7 +1076,7 @@
                         
                       
                       
                     
                   
@@ -1086,7 +1086,7 @@
           
         
         
       
diff --git a/docs/4.2/Enums.html b/docs/4.2/Enums.html
index 73655b5db..9f159cae2 100644
--- a/docs/4.2/Enums.html
+++ b/docs/4.2/Enums.html
@@ -14,7 +14,7 @@
     
     
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1046,7 +1046,7 @@ more information.

@@ -1088,7 +1088,7 @@ more information.

@@ -1121,7 +1121,7 @@ more information.

adopt the standard Encodable protocol encode their date properties.

For example:

-
struct Player: EncodableRecord, Encodable {
+
struct Player: EncodableRecord, Encodable {
     static let databaseDateEncodingStrategy: DatabaseDateEncodingStrategy = .timeIntervalSince1970
 
     var name: String
@@ -1140,7 +1140,7 @@ adopt the standard Encodable protocol encode their date properties.

@@ -1173,7 +1173,7 @@ adopt the standard Encodable protocol encode their date properties.

adopt the standard Encodable protocol encode their UUID properties.

For example:

-
struct Player: EncodableProtocol, Encodable {
+
struct Player: EncodableProtocol, Encodable {
     static let databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy = .string
 
     // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
@@ -1192,7 +1192,7 @@ adopt the standard Encodable protocol encode their UUID properties.

@@ -1225,7 +1225,7 @@ adopt the standard Encodable protocol encode their UUID properties.

adopt the standard Decodable protocol decode their date properties.

For example:

-
struct Player: FetchableRecord, Decodable {
+
struct Player: FetchableRecord, Decodable {
     static let databaseDateDecodingStrategy: DatabaseDateDecodingStrategy = .timeIntervalSince1970
 
     var name: String
@@ -1244,7 +1244,7 @@ adopt the standard Decodable protocol decode their date properties.

@@ -1289,7 +1289,7 @@ column names, and values the old values that have been changed.

@@ -1324,7 +1324,7 @@ column names, and values the old values that have been changed.

@@ -1367,7 +1367,7 @@ of fresh values to your application.

@@ -1402,7 +1402,7 @@ of fresh values to your application.

@@ -1412,7 +1412,7 @@ of fresh values to your application.

diff --git a/docs/4.2/Enums/DatabaseDateDecodingStrategy.html b/docs/4.2/Enums/DatabaseDateDecodingStrategy.html index 558a6e95f..4a639af65 100644 --- a/docs/4.2/Enums/DatabaseDateDecodingStrategy.html +++ b/docs/4.2/Enums/DatabaseDateDecodingStrategy.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,7 +1016,7 @@ adopt the standard Decodable protocol decode their date properties.

For example:

-
struct Player: FetchableRecord, Decodable {
+
struct Player: FetchableRecord, Decodable {
     static let databaseDateDecodingStrategy: DatabaseDateDecodingStrategy = .timeIntervalSince1970
 
     var name: String
@@ -1069,7 +1069,7 @@ Missing components are assumed to be zero:

@@ -1100,7 +1100,7 @@ midnight UTC on 1 January 2001

@@ -1131,7 +1131,7 @@ midnight UTC on 1 January 1970

@@ -1162,7 +1162,7 @@ midnight UTC on 1 January 1970

@@ -1192,7 +1192,7 @@ midnight UTC on 1 January 1970

@@ -1222,7 +1222,7 @@ midnight UTC on 1 January 1970

@@ -1256,7 +1256,7 @@ error, and react accordingly).

@@ -1266,7 +1266,7 @@ error, and react accordingly).

diff --git a/docs/4.2/Enums/DatabaseDateEncodingStrategy.html b/docs/4.2/Enums/DatabaseDateEncodingStrategy.html index 19759f158..d65243de7 100644 --- a/docs/4.2/Enums/DatabaseDateEncodingStrategy.html +++ b/docs/4.2/Enums/DatabaseDateEncodingStrategy.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,7 +1016,7 @@ adopt the standard Encodable protocol encode their date properties.

For example:

-
struct Player: EncodableRecord, Encodable {
+
struct Player: EncodableRecord, Encodable {
     static let databaseDateEncodingStrategy: DatabaseDateEncodingStrategy = .timeIntervalSince1970
 
     var name: String
@@ -1056,7 +1056,7 @@ UTC time zone.

@@ -1087,7 +1087,7 @@ midnight UTC on 1 January 2001

@@ -1118,7 +1118,7 @@ midnight UTC on 1 January 1970

@@ -1149,7 +1149,7 @@ midnight UTC on 1 January 1970

@@ -1180,7 +1180,7 @@ midnight UTC on 1 January 1970

@@ -1210,7 +1210,7 @@ midnight UTC on 1 January 1970

@@ -1240,7 +1240,7 @@ midnight UTC on 1 January 1970

@@ -1270,7 +1270,7 @@ midnight UTC on 1 January 1970

@@ -1280,7 +1280,7 @@ midnight UTC on 1 January 1970

diff --git a/docs/4.2/Enums/DatabaseEventKind.html b/docs/4.2/Enums/DatabaseEventKind.html index 1bc6b9c54..ec105017f 100644 --- a/docs/4.2/Enums/DatabaseEventKind.html +++ b/docs/4.2/Enums/DatabaseEventKind.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1044,7 +1044,7 @@ more information.

@@ -1074,7 +1074,7 @@ more information.

@@ -1104,7 +1104,7 @@ more information.

@@ -1140,12 +1140,12 @@ more information.

Declaration

Swift

-
public var tableName: String { get }
+
public var tableName: String { get }
@@ -1155,7 +1155,7 @@ more information.

diff --git a/docs/4.2/Enums/DatabaseUUIDEncodingStrategy.html b/docs/4.2/Enums/DatabaseUUIDEncodingStrategy.html index 5fcb34c52..971aafb78 100644 --- a/docs/4.2/Enums/DatabaseUUIDEncodingStrategy.html +++ b/docs/4.2/Enums/DatabaseUUIDEncodingStrategy.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,7 +1016,7 @@ adopt the standard Encodable protocol encode their UUID properties.

For example:

-
struct Player: EncodableProtocol, Encodable {
+
struct Player: EncodableProtocol, Encodable {
     static let databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy = .string
 
     // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
@@ -1055,7 +1055,7 @@ adopt the standard Encodable protocol encode their UUID properties.

@@ -1085,7 +1085,7 @@ adopt the standard Encodable protocol encode their UUID properties.

@@ -1095,7 +1095,7 @@ adopt the standard Encodable protocol encode their UUID properties.

diff --git a/docs/4.2/Enums/FetchedRecordChange.html b/docs/4.2/Enums/FetchedRecordChange.html index b063f0a75..ead3295ae 100644 --- a/docs/4.2/Enums/FetchedRecordChange.html +++ b/docs/4.2/Enums/FetchedRecordChange.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1046,7 +1046,7 @@ column names, and values the old values that have been changed.

@@ -1076,7 +1076,7 @@ column names, and values the old values that have been changed.

@@ -1108,7 +1108,7 @@ have been changed.

@@ -1140,7 +1140,7 @@ been changed.

@@ -1175,12 +1175,12 @@ been changed.

Declaration

Swift

-
public var description: String { get }
+
public var description: String { get }
@@ -1190,7 +1190,7 @@ been changed.

diff --git a/docs/4.2/Enums/PersistenceError.html b/docs/4.2/Enums/PersistenceError.html index b78a273d9..b74fe24ce 100644 --- a/docs/4.2/Enums/PersistenceError.html +++ b/docs/4.2/Enums/PersistenceError.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1049,7 +1049,7 @@ found in the database.

@@ -1059,7 +1059,7 @@ found in the database.

diff --git a/docs/4.2/Enums/SQLLogicalBinaryOperator.html b/docs/4.2/Enums/SQLLogicalBinaryOperator.html index ede296b87..b7cfaae3e 100644 --- a/docs/4.2/Enums/SQLLogicalBinaryOperator.html +++ b/docs/4.2/Enums/SQLLogicalBinaryOperator.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/Enums/ValueReducers.html b/docs/4.2/Enums/ValueReducers.html index fedb16f5f..712e6698e 100644 --- a/docs/4.2/Enums/ValueReducers.html +++ b/docs/4.2/Enums/ValueReducers.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1053,7 +1053,7 @@ @@ -1098,7 +1098,7 @@ @@ -1144,7 +1144,7 @@ @@ -1191,7 +1191,7 @@ @@ -1239,7 +1239,7 @@ @@ -1288,7 +1288,7 @@ @@ -1338,7 +1338,7 @@ @@ -1348,7 +1348,7 @@ diff --git a/docs/4.2/Enums/ValueReducers/Combine2.html b/docs/4.2/Enums/ValueReducers/Combine2.html index cac37a60f..cc3c11c32 100644 --- a/docs/4.2/Enums/ValueReducers/Combine2.html +++ b/docs/4.2/Enums/ValueReducers/Combine2.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1044,7 +1044,7 @@ @@ -1073,7 +1073,7 @@ @@ -1102,7 +1102,7 @@ @@ -1131,7 +1131,7 @@ @@ -1141,7 +1141,7 @@ diff --git a/docs/4.2/Enums/ValueReducers/Combine3.html b/docs/4.2/Enums/ValueReducers/Combine3.html index 56fd71c98..8f206f6fb 100644 --- a/docs/4.2/Enums/ValueReducers/Combine3.html +++ b/docs/4.2/Enums/ValueReducers/Combine3.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1074,7 +1074,7 @@ @@ -1103,7 +1103,7 @@ @@ -1132,7 +1132,7 @@ @@ -1142,7 +1142,7 @@ diff --git a/docs/4.2/Enums/ValueReducers/Combine4.html b/docs/4.2/Enums/ValueReducers/Combine4.html index 8b1fc2d36..a25b3ca42 100644 --- a/docs/4.2/Enums/ValueReducers/Combine4.html +++ b/docs/4.2/Enums/ValueReducers/Combine4.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1046,7 +1046,7 @@ @@ -1075,7 +1075,7 @@ @@ -1104,7 +1104,7 @@ @@ -1133,7 +1133,7 @@ @@ -1143,7 +1143,7 @@ diff --git a/docs/4.2/Enums/ValueReducers/Combine5.html b/docs/4.2/Enums/ValueReducers/Combine5.html index 09218c800..7ce895040 100644 --- a/docs/4.2/Enums/ValueReducers/Combine5.html +++ b/docs/4.2/Enums/ValueReducers/Combine5.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1047,7 +1047,7 @@ @@ -1076,7 +1076,7 @@ @@ -1105,7 +1105,7 @@ @@ -1134,7 +1134,7 @@ @@ -1144,7 +1144,7 @@ diff --git a/docs/4.2/Enums/ValueReducers/Combine6.html b/docs/4.2/Enums/ValueReducers/Combine6.html index 33e47a54a..e21ff061b 100644 --- a/docs/4.2/Enums/ValueReducers/Combine6.html +++ b/docs/4.2/Enums/ValueReducers/Combine6.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1048,7 +1048,7 @@ @@ -1077,7 +1077,7 @@ @@ -1106,7 +1106,7 @@ @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Enums/ValueReducers/Combine7.html b/docs/4.2/Enums/ValueReducers/Combine7.html index 8287d6efb..8b8226470 100644 --- a/docs/4.2/Enums/ValueReducers/Combine7.html +++ b/docs/4.2/Enums/ValueReducers/Combine7.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1049,7 +1049,7 @@ @@ -1078,7 +1078,7 @@ @@ -1107,7 +1107,7 @@ @@ -1136,7 +1136,7 @@ @@ -1146,7 +1146,7 @@ diff --git a/docs/4.2/Enums/ValueReducers/Combine8.html b/docs/4.2/Enums/ValueReducers/Combine8.html index b4d790f6d..0182f3dc7 100644 --- a/docs/4.2/Enums/ValueReducers/Combine8.html +++ b/docs/4.2/Enums/ValueReducers/Combine8.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1050,7 +1050,7 @@ @@ -1079,7 +1079,7 @@ @@ -1108,7 +1108,7 @@ @@ -1137,7 +1137,7 @@ @@ -1147,7 +1147,7 @@ diff --git a/docs/4.2/Enums/ValueScheduling.html b/docs/4.2/Enums/ValueScheduling.html index 89b296328..a1357c098 100644 --- a/docs/4.2/Enums/ValueScheduling.html +++ b/docs/4.2/Enums/ValueScheduling.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1057,8 +1057,8 @@ is also notified on the main queue, but asynchronously:

When the database changes, fresh values are asynchronously notified on the main queue:

// Eventually prints "fresh players" on the main queue
-try dbQueue.write { db in
-    try Player(...).insert(db)
+try dbQueue.write { db in
+    try Player(...).insert(db)
 }
 
@@ -1072,7 +1072,7 @@ the main queue:

@@ -1105,7 +1105,7 @@ is true.

@@ -1150,7 +1150,7 @@ unspecified queues.

@@ -1160,7 +1160,7 @@ unspecified queues.

diff --git a/docs/4.2/Extensions.html b/docs/4.2/Extensions.html index 0c500ab7c..93fbb7d90 100644 --- a/docs/4.2/Extensions.html +++ b/docs/4.2/Extensions.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -2101,7 +2101,7 @@ and arrays of optional DatabaseValueConvertible:

@@ -2184,7 +2184,7 @@ and arrays of optional DatabaseValueConvertible:

@@ -2313,7 +2313,7 @@ and arrays of optional DatabaseValueConvertible:

diff --git a/docs/4.2/Extensions/Array.html b/docs/4.2/Extensions/Array.html index 6e5572f09..82e781075 100644 --- a/docs/4.2/Extensions/Array.html +++ b/docs/4.2/Extensions/Array.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1032,7 +1032,7 @@

Creates an array containing the elements of a cursor.

let cursor = try String.fetchCursor(db, sql: "SELECT 'foo' UNION ALL SELECT 'bar'")
-let strings = try Array(cursor) // ["foo", "bar"]
+let strings = try Array(cursor) // ["foo", "bar"]
 
@@ -1046,7 +1046,7 @@ @@ -1056,7 +1056,7 @@ diff --git a/docs/4.2/Extensions/Bool.html b/docs/4.2/Extensions/Bool.html index 5972ad36a..3056f4e5d 100644 --- a/docs/4.2/Extensions/Bool.html +++ b/docs/4.2/Extensions/Bool.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/CGFloat.html b/docs/4.2/Extensions/CGFloat.html index fc0509f1e..9141cc1b2 100644 --- a/docs/4.2/Extensions/CGFloat.html +++ b/docs/4.2/Extensions/CGFloat.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1038,12 +1038,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/Extensions/ClosedRange.html b/docs/4.2/Extensions/ClosedRange.html index e170536ff..3875dcc22 100644 --- a/docs/4.2/Extensions/ClosedRange.html +++ b/docs/4.2/Extensions/ClosedRange.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1032,7 +1032,7 @@

An SQL expression that checks the inclusion of an expression in a range.

// email BETWEEN 'A' AND 'B'
-("A"..."B").contains(Column("email"))
+("A"..."B").contains(Column("email"))
 
@@ -1045,7 +1045,7 @@ @@ -1065,7 +1065,7 @@

An SQL expression that checks the inclusion of an expression in a range.

// email BETWEEN 'A' AND 'B' COLLATE NOCASE
-("A"..."B").contains(Column("email").collating(.nocase))
+("A"..."B").contains(Column("email").collating(.nocase))
 
@@ -1078,7 +1078,7 @@ @@ -1088,7 +1088,7 @@ diff --git a/docs/4.2/Extensions/Collection.html b/docs/4.2/Extensions/Collection.html index 82c2dafd0..85e75db2f 100644 --- a/docs/4.2/Extensions/Collection.html +++ b/docs/4.2/Extensions/Collection.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1050,7 +1050,7 @@ inserting the given separator between each element.

@@ -1060,7 +1060,7 @@ inserting the given separator between each element.

diff --git a/docs/4.2/Extensions/Column.html b/docs/4.2/Extensions/Column.html index c170181ce..b16bfea83 100644 --- a/docs/4.2/Extensions/Column.html +++ b/docs/4.2/Extensions/Column.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1035,7 +1035,7 @@ diff --git a/docs/4.2/Extensions/CountableClosedRange.html b/docs/4.2/Extensions/CountableClosedRange.html index 79affd05a..d4e809d37 100644 --- a/docs/4.2/Extensions/CountableClosedRange.html +++ b/docs/4.2/Extensions/CountableClosedRange.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1032,7 +1032,7 @@

An SQL expression that checks the inclusion of an expression in a range.

// id BETWEEN 1 AND 10
-(1...10).contains(Column("id"))
+(1...10).contains(Column("id"))
 
@@ -1045,7 +1045,7 @@ @@ -1055,7 +1055,7 @@ diff --git a/docs/4.2/Extensions/CountableRange.html b/docs/4.2/Extensions/CountableRange.html index e13c4329d..532c74cdd 100644 --- a/docs/4.2/Extensions/CountableRange.html +++ b/docs/4.2/Extensions/CountableRange.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1032,7 +1032,7 @@

An SQL expression that checks the inclusion of an expression in a range.

// id BETWEEN 1 AND 9
-(1..<10).contains(Column("id"))
+(1..<10).contains(Column("id"))
 
@@ -1045,7 +1045,7 @@ @@ -1055,7 +1055,7 @@ diff --git a/docs/4.2/Extensions/Data.html b/docs/4.2/Extensions/Data.html index 5fb0a72f9..33383c0e0 100644 --- a/docs/4.2/Extensions/Data.html +++ b/docs/4.2/Extensions/Data.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1068,12 +1068,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1104,7 +1104,7 @@ a Blob.

@@ -1114,7 +1114,7 @@ a Blob.

diff --git a/docs/4.2/Extensions/Database.html b/docs/4.2/Extensions/Database.html index b315b3193..e759de241 100644 --- a/docs/4.2/Extensions/Database.html +++ b/docs/4.2/Extensions/Database.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1055,7 +1055,7 @@

Add a custom FTS5 tokenizer.

-
class MyTokenizer : FTS5CustomTokenizer { ... }
+
class MyTokenizer : FTS5CustomTokenizer { ... }
 db.add(tokenizer: MyTokenizer.self)
 
@@ -1131,10 +1131,10 @@ invalid syntax.

database queue, or after the database has been closed.

Use this method when you implement a custom wrapper tokenizer:

-
final class MyTokenizer : FTS5WrapperTokenizer {
+
final class MyTokenizer : FTS5WrapperTokenizer {
     var wrappedTokenizer: FTS5Tokenizer
 
-    init(db: Database, arguments: [String]) throws {
+    init(db: Database, arguments: [String]) throws {
         wrappedTokenizer = try db.makeTokenizer(.unicode61())
     }
 }
@@ -1149,7 +1149,7 @@ database queue, or after the database has been closed.

diff --git a/docs/4.2/Extensions/DatabasePool.html b/docs/4.2/Extensions/DatabasePool.html index bc071f8d5..a2e64350a 100644 --- a/docs/4.2/Extensions/DatabasePool.html +++ b/docs/4.2/Extensions/DatabasePool.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1042,7 +1042,7 @@ diff --git a/docs/4.2/Extensions/DatabaseQueue.html b/docs/4.2/Extensions/DatabaseQueue.html index a25134b22..727d8b373 100644 --- a/docs/4.2/Extensions/DatabaseQueue.html +++ b/docs/4.2/Extensions/DatabaseQueue.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1062,7 +1062,7 @@

Add a custom FTS5 tokenizer.

-
class MyTokenizer : FTS5CustomTokenizer { ... }
+
class MyTokenizer : FTS5CustomTokenizer { ... }
 dbQueue.add(tokenizer: MyTokenizer.self)
 
@@ -1075,7 +1075,7 @@ diff --git a/docs/4.2/Extensions/Date.html b/docs/4.2/Extensions/Date.html index b4364a687..9a70ba120 100644 --- a/docs/4.2/Extensions/Date.html +++ b/docs/4.2/Extensions/Date.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1040,12 +1040,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1084,7 +1084,7 @@ are set to zero if missing.

@@ -1114,7 +1114,7 @@ are set to zero if missing.

@@ -1180,7 +1180,7 @@ are set to zero if missing.

@@ -1190,7 +1190,7 @@ are set to zero if missing.

diff --git a/docs/4.2/Extensions/Double.html b/docs/4.2/Extensions/Double.html index 07132064e..abbb5e277 100644 --- a/docs/4.2/Extensions/Double.html +++ b/docs/4.2/Extensions/Double.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/Float.html b/docs/4.2/Extensions/Float.html index 31adf63d0..31b79ec9d 100644 --- a/docs/4.2/Extensions/Float.html +++ b/docs/4.2/Extensions/Float.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/Int.html b/docs/4.2/Extensions/Int.html index 99f823be0..285670456 100644 --- a/docs/4.2/Extensions/Int.html +++ b/docs/4.2/Extensions/Int.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/Int16.html b/docs/4.2/Extensions/Int16.html index ea97eb695..9617ce283 100644 --- a/docs/4.2/Extensions/Int16.html +++ b/docs/4.2/Extensions/Int16.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/Int32.html b/docs/4.2/Extensions/Int32.html index fd7a7d6f3..c42cce797 100644 --- a/docs/4.2/Extensions/Int32.html +++ b/docs/4.2/Extensions/Int32.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/Int64.html b/docs/4.2/Extensions/Int64.html index 00e6a3b8a..4a68dd3fd 100644 --- a/docs/4.2/Extensions/Int64.html +++ b/docs/4.2/Extensions/Int64.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/Int8.html b/docs/4.2/Extensions/Int8.html index b8891bc57..b0aafc2a5 100644 --- a/docs/4.2/Extensions/Int8.html +++ b/docs/4.2/Extensions/Int8.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/JoinableRequest.html b/docs/4.2/Extensions/JoinableRequest.html index 344e37776..23118fb59 100644 --- a/docs/4.2/Extensions/JoinableRequest.html +++ b/docs/4.2/Extensions/JoinableRequest.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1042,7 +1042,7 @@ @@ -1074,7 +1074,7 @@ require that the associated database table contains a matching row.

@@ -1106,7 +1106,7 @@ that the associated database table contains a matching row.

@@ -1138,7 +1138,7 @@ require that the associated database table contains a matching row.

@@ -1170,7 +1170,7 @@ that the associated database table contains a matching row.

@@ -1180,7 +1180,7 @@ that the associated database table contains a matching row.

diff --git a/docs/4.2/Extensions/NSData.html b/docs/4.2/Extensions/NSData.html index 9523510c8..d490d5d3f 100644 --- a/docs/4.2/Extensions/NSData.html +++ b/docs/4.2/Extensions/NSData.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1038,12 +1038,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1069,12 +1069,12 @@ a Blob.

Declaration

Swift

-
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
+
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
@@ -1084,7 +1084,7 @@ a Blob.

diff --git a/docs/4.2/Extensions/NSDate.html b/docs/4.2/Extensions/NSDate.html index 83cd83b16..684bff0d6 100644 --- a/docs/4.2/Extensions/NSDate.html +++ b/docs/4.2/Extensions/NSDate.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1040,12 +1040,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1079,12 +1079,12 @@ are set to zero if missing.

Declaration

Swift

-
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
+
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
@@ -1094,7 +1094,7 @@ are set to zero if missing.

diff --git a/docs/4.2/Extensions/NSNull.html b/docs/4.2/Extensions/NSNull.html index 7bc755dec..3de238c5e 100644 --- a/docs/4.2/Extensions/NSNull.html +++ b/docs/4.2/Extensions/NSNull.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1038,12 +1038,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1068,12 +1068,12 @@

Declaration

Swift

-
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
+
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
@@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/Extensions/NSNumber.html b/docs/4.2/Extensions/NSNumber.html index ae2fe289a..7c9c6a846 100644 --- a/docs/4.2/Extensions/NSNumber.html +++ b/docs/4.2/Extensions/NSNumber.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1038,12 +1038,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1068,12 +1068,12 @@

Declaration

Swift

-
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
+
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
@@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/Extensions/NSString.html b/docs/4.2/Extensions/NSString.html index 86db0fb82..6a0fb66e4 100644 --- a/docs/4.2/Extensions/NSString.html +++ b/docs/4.2/Extensions/NSString.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1038,12 +1038,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1068,12 +1068,12 @@

Declaration

Swift

-
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
+
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
@@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/Extensions/NSURL.html b/docs/4.2/Extensions/NSURL.html index 30ae0d41b..b4e4cf300 100644 --- a/docs/4.2/Extensions/NSURL.html +++ b/docs/4.2/Extensions/NSURL.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1039,12 +1039,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1069,12 +1069,12 @@

Declaration

Swift

-
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
+
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
@@ -1084,7 +1084,7 @@ diff --git a/docs/4.2/Extensions/NSUUID.html b/docs/4.2/Extensions/NSUUID.html index d83f576b0..96d68b709 100644 --- a/docs/4.2/Extensions/NSUUID.html +++ b/docs/4.2/Extensions/NSUUID.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1037,12 +1037,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1066,12 +1066,12 @@

Declaration

Swift

-
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
+
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
@@ -1081,7 +1081,7 @@ diff --git a/docs/4.2/Extensions/Optional.html b/docs/4.2/Extensions/Optional.html index a76f8e827..8d8ef8446 100644 --- a/docs/4.2/Extensions/Optional.html +++ b/docs/4.2/Extensions/Optional.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1128,7 +1128,7 @@ elements are undefined.

A cursor over fetched optional values.

@@ -1217,7 +1217,7 @@ elements are undefined.

An array of optional values.

@@ -1271,7 +1271,7 @@ elements are undefined.

public static func fetchCursor(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> NullableDatabaseValueCursor<Wrapped>
@@ -1337,7 +1337,7 @@ elements are undefined.

A cursor over fetched optional values.

@@ -1372,7 +1372,7 @@ elements are undefined.

public static func fetchAll(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> [Wrapped?]
@@ -1438,7 +1438,7 @@ elements are undefined.

An array of optional values.

@@ -1468,7 +1468,7 @@ elements are undefined.

Returns a cursor over optional values fetched from a fetch request.

-
let request = Player.select(Column("name"))
+
let request = Player.select(Column("name"))
 let names = try Optional<String>.fetchCursor(db, request) // Cursor of String?
 while let name = try names.next() { // String?
     ...
@@ -1531,7 +1531,7 @@ elements are undefined.

A cursor over fetched optional values.

@@ -1550,7 +1550,7 @@ elements are undefined.

Returns an array of optional values fetched from a fetch request.

-
let request = Player.select(Column("name"))
+
let request = Player.select(Column("name"))
 let names = try Optional<String>.fetchAll(db, request) // [String?]
 
@@ -1604,7 +1604,7 @@ elements are undefined.

An array of optional values.

@@ -1712,7 +1712,7 @@ elements are undefined.

A cursor over fetched optional values.

@@ -1801,7 +1801,7 @@ elements are undefined.

An array of optional values.

@@ -1855,7 +1855,7 @@ elements are undefined.

public static func fetchCursor(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> FastNullableDatabaseValueCursor<Wrapped>
@@ -1921,7 +1921,7 @@ elements are undefined.

A cursor over fetched optional values.

@@ -1956,7 +1956,7 @@ elements are undefined.

public static func fetchAll(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> [Wrapped?]
@@ -2022,7 +2022,7 @@ elements are undefined.

An array of optional values.

@@ -2052,7 +2052,7 @@ elements are undefined.

Returns a cursor over optional values fetched from a fetch request.

-
let request = Player.select(Column("name"))
+
let request = Player.select(Column("name"))
 let names = try Optional<String>.fetchCursor(db, request) // Cursor of String?
 while let name = try names.next() { // String?
     ...
@@ -2115,7 +2115,7 @@ elements are undefined.

A cursor over fetched optional values.

@@ -2134,7 +2134,7 @@ elements are undefined.

Returns an array of optional values fetched from a fetch request.

-
let request = Player.select(Column("name"))
+
let request = Player.select(Column("name"))
 let names = try Optional<String>.fetchAll(db, request) // [String?]
 
@@ -2188,7 +2188,7 @@ elements are undefined.

An array of optional values.

@@ -2198,7 +2198,7 @@ elements are undefined.

diff --git a/docs/4.2/Extensions/Range.html b/docs/4.2/Extensions/Range.html index fa334c600..a1328862e 100644 --- a/docs/4.2/Extensions/Range.html +++ b/docs/4.2/Extensions/Range.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1032,7 +1032,7 @@

An SQL expression that checks the inclusion of an expression in a range.

// email >= 'A' AND email < 'B'
-("A"..<"B").contains(Column("email"))
+("A"..<"B").contains(Column("email"))
 
@@ -1045,7 +1045,7 @@ @@ -1065,7 +1065,7 @@

An SQL expression that checks the inclusion of an expression in a range.

// email >= 'A' COLLATE NOCASE AND email < 'B' COLLATE NOCASE
-("A"..<"B").contains(Column("email").collating(.nocase))
+("A"..<"B").contains(Column("email").collating(.nocase))
 
@@ -1078,7 +1078,7 @@ @@ -1088,7 +1088,7 @@ diff --git a/docs/4.2/Extensions/SQLLiteral.html b/docs/4.2/Extensions/SQLLiteral.html index 663f940f1..a11568346 100644 --- a/docs/4.2/Extensions/SQLLiteral.html +++ b/docs/4.2/Extensions/SQLLiteral.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1035,7 +1035,7 @@ diff --git a/docs/4.2/Extensions/SQLRequest.html b/docs/4.2/Extensions/SQLRequest.html index 5cac74ce1..f71c64089 100644 --- a/docs/4.2/Extensions/SQLRequest.html +++ b/docs/4.2/Extensions/SQLRequest.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1035,7 +1035,7 @@ diff --git a/docs/4.2/Extensions/Sequence.html b/docs/4.2/Extensions/Sequence.html index b9030eb9c..18559ffc4 100644 --- a/docs/4.2/Extensions/Sequence.html +++ b/docs/4.2/Extensions/Sequence.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ over self.

@@ -1087,7 +1087,7 @@ inserting the given separator between each element.

@@ -1112,7 +1112,7 @@ inserting the given separator between each element.

An SQL expression that checks the inclusion of an expression in a sequence.

// id IN (1,2,3)
-[1, 2, 3].contains(Column("id"))
+[1, 2, 3].contains(Column("id"))
 
@@ -1125,7 +1125,7 @@ a sequence.

@@ -1146,7 +1146,7 @@ a sequence.

An SQL expression that checks the inclusion of an expression in a sequence.

// name IN ('A', 'B') COLLATE NOCASE
-["A", "B"].contains(Column("name").collating(.nocase))
+["A", "B"].contains(Column("name").collating(.nocase))
 
@@ -1159,7 +1159,7 @@ a sequence.

@@ -1190,9 +1190,9 @@ logical operator.

// AND (score >= 1000) // AND (name IS NOT NULL)) let conditions = [ - Column("registered"), - Column("score") >= 1000, - Column("name") != nil] + Column("registered"), + Column("score") >= 1000, + Column("name") != nil] Player.filter(conditions.joined(operator: .and))
@@ -1215,7 +1215,7 @@ and joined(operator: .or) returns false:

@@ -1225,7 +1225,7 @@ and joined(operator: .or) returns false:

diff --git a/docs/4.2/Extensions/Set.html b/docs/4.2/Extensions/Set.html index b4b200a8f..77e1fbeb0 100644 --- a/docs/4.2/Extensions/Set.html +++ b/docs/4.2/Extensions/Set.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1032,7 +1032,7 @@

Creates a set containing the elements of a cursor.

let cursor = try String.fetchCursor(db, sql: "SELECT 'foo' UNION ALL SELECT 'foo'")
-let strings = try Set(cursor) // ["foo"]
+let strings = try Set(cursor) // ["foo"]
 
@@ -1045,7 +1045,7 @@ @@ -1055,7 +1055,7 @@ diff --git a/docs/4.2/Extensions/String.html b/docs/4.2/Extensions/String.html index 5455a218f..9d04e3b2b 100644 --- a/docs/4.2/Extensions/String.html +++ b/docs/4.2/Extensions/String.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1168,12 +1168,12 @@ SQL query.

Swift

@inlinable
-public var quotedDatabaseIdentifier: String { get }
+public var quotedDatabaseIdentifier: String { get }
@@ -1183,7 +1183,7 @@ SQL query.

diff --git a/docs/4.2/Extensions/TableRecord.html b/docs/4.2/Extensions/TableRecord.html index afc34cd3f..2d940dae3 100644 --- a/docs/4.2/Extensions/TableRecord.html +++ b/docs/4.2/Extensions/TableRecord.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1048,7 +1048,7 @@ database row.

diff --git a/docs/4.2/Extensions/TableRequest.html b/docs/4.2/Extensions/TableRequest.html index f60dde200..03d314059 100644 --- a/docs/4.2/Extensions/TableRequest.html +++ b/docs/4.2/Extensions/TableRequest.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1054,7 +1054,7 @@ for individual requests with the TableRecord.select method.

diff --git a/docs/4.2/Extensions/UInt.html b/docs/4.2/Extensions/UInt.html index b63c1f6d0..ad7441a75 100644 --- a/docs/4.2/Extensions/UInt.html +++ b/docs/4.2/Extensions/UInt.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/UInt16.html b/docs/4.2/Extensions/UInt16.html index 7fb687324..2121ef004 100644 --- a/docs/4.2/Extensions/UInt16.html +++ b/docs/4.2/Extensions/UInt16.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/UInt32.html b/docs/4.2/Extensions/UInt32.html index 1d9e51f50..31bbe7256 100644 --- a/docs/4.2/Extensions/UInt32.html +++ b/docs/4.2/Extensions/UInt32.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/UInt64.html b/docs/4.2/Extensions/UInt64.html index 98ef03f24..e2d6205a8 100644 --- a/docs/4.2/Extensions/UInt64.html +++ b/docs/4.2/Extensions/UInt64.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/UInt8.html b/docs/4.2/Extensions/UInt8.html index cef5e170b..0d3b04373 100644 --- a/docs/4.2/Extensions/UInt8.html +++ b/docs/4.2/Extensions/UInt8.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/Extensions/UUID.html b/docs/4.2/Extensions/UUID.html index 8104d2a10..d1c66048c 100644 --- a/docs/4.2/Extensions/UUID.html +++ b/docs/4.2/Extensions/UUID.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1038,12 +1038,12 @@

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1072,7 +1072,7 @@ @@ -1106,7 +1106,7 @@ @@ -1116,7 +1116,7 @@ diff --git a/docs/4.2/Functions.html b/docs/4.2/Functions.html index ed5744ddd..e0cf47f82 100644 --- a/docs/4.2/Functions.html +++ b/docs/4.2/Functions.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1032,7 +1032,7 @@ number of columns.

let sql = "SELECT 1, 2,3,4, 5,6, 7,8"
 //               <.><. . .><. .><. .>
 let adapters = splittingRowAdapters([1, 3, 2])
-let adapter = ScopeAdapter([
+let adapter = ScopeAdapter([
     "a": adapters[0],
     "b": adapters[1],
     "c": adapters[2],
@@ -1054,7 +1054,7 @@ number of columns.

@@ -1099,7 +1099,7 @@ number of columns.

@@ -1136,7 +1136,7 @@ number of columns.

@@ -1173,7 +1173,7 @@ number of columns.

@@ -1221,7 +1221,7 @@ number of columns.

@@ -1258,7 +1258,7 @@ number of columns.

@@ -1295,7 +1295,7 @@ number of columns.

@@ -1329,7 +1329,7 @@ number of columns.

@@ -1363,7 +1363,7 @@ number of columns.

@@ -1400,7 +1400,7 @@ number of columns.

@@ -1437,7 +1437,7 @@ number of columns.

@@ -1474,7 +1474,7 @@ number of columns.

@@ -1508,7 +1508,7 @@ number of columns.

@@ -1542,7 +1542,7 @@ number of columns.

@@ -1579,7 +1579,7 @@ number of columns.

@@ -1616,7 +1616,7 @@ number of columns.

@@ -1653,7 +1653,7 @@ number of columns.

@@ -1690,7 +1690,7 @@ number of columns.

@@ -1727,7 +1727,7 @@ number of columns.

@@ -1764,7 +1764,7 @@ number of columns.

@@ -1812,7 +1812,7 @@ number of columns.

@@ -1849,7 +1849,7 @@ number of columns.

@@ -1886,7 +1886,7 @@ number of columns.

@@ -1923,7 +1923,7 @@ number of columns.

@@ -1960,7 +1960,7 @@ number of columns.

@@ -1997,7 +1997,7 @@ number of columns.

@@ -2034,7 +2034,7 @@ number of columns.

@@ -2071,7 +2071,7 @@ number of columns.

@@ -2108,7 +2108,7 @@ number of columns.

@@ -2145,7 +2145,7 @@ number of columns.

@@ -2182,7 +2182,7 @@ number of columns.

@@ -2219,7 +2219,7 @@ number of columns.

@@ -2264,7 +2264,7 @@ number of columns.

@@ -2301,7 +2301,7 @@ number of columns.

@@ -2338,7 +2338,7 @@ number of columns.

@@ -2375,7 +2375,7 @@ number of columns.

@@ -2412,7 +2412,7 @@ number of columns.

@@ -2449,7 +2449,7 @@ number of columns.

@@ -2486,7 +2486,7 @@ number of columns.

@@ -2523,7 +2523,7 @@ number of columns.

@@ -2560,7 +2560,7 @@ number of columns.

@@ -2597,7 +2597,7 @@ number of columns.

@@ -2634,7 +2634,7 @@ number of columns.

@@ -2671,7 +2671,7 @@ number of columns.

@@ -2708,7 +2708,7 @@ number of columns.

@@ -2738,7 +2738,7 @@ number of columns.

Returns an aggregate that evaluates the IFNULL SQL function.

-
Team.annotated(with: Team.players.min(Column("score")) ?? 0)
+
Team.annotated(with: Team.players.min(Column("score")) ?? 0)
 
@@ -2754,7 +2754,7 @@ number of columns.

@@ -2785,7 +2785,7 @@ number of columns.

Returns an expression that evaluates the ABS SQL function.

// ABS(amount)
-abs(Column("amount"))
+abs(Column("amount"))
 
@@ -2798,7 +2798,7 @@ number of columns.

@@ -2829,7 +2829,7 @@ number of columns.

Returns an expression that evaluates the AVG SQL function.

// AVG(length)
-average(Column("length"))
+average(Column("length"))
 
@@ -2842,7 +2842,7 @@ number of columns.

@@ -2873,7 +2873,7 @@ number of columns.

Returns an expression that evaluates the COUNT SQL function.

// COUNT(email)
-count(Column("email"))
+count(Column("email"))
 
@@ -2886,7 +2886,7 @@ number of columns.

@@ -2917,7 +2917,7 @@ number of columns.

Returns an expression that evaluates the COUNT(DISTINCT) SQL function.

// COUNT(DISTINCT email)
-count(distinct: Column("email"))
+count(distinct: Column("email"))
 
@@ -2930,7 +2930,7 @@ number of columns.

@@ -2961,7 +2961,7 @@ number of columns.

Returns an expression that evaluates the IFNULL SQL function.

// IFNULL(name, 'Anonymous')
-Column("name") ?? "Anonymous"
+Column("name") ?? "Anonymous"
 
@@ -2974,7 +2974,7 @@ number of columns.

@@ -3005,7 +3005,7 @@ number of columns.

Returns an expression that evaluates the LENGTH SQL function.

// LENGTH(name)
-length(Column("name"))
+length(Column("name"))
 
@@ -3018,7 +3018,7 @@ number of columns.

@@ -3049,7 +3049,7 @@ number of columns.

Returns an expression that evaluates the MAX SQL function.

// MAX(score)
-max(Column("score"))
+max(Column("score"))
 
@@ -3062,7 +3062,7 @@ number of columns.

@@ -3093,7 +3093,7 @@ number of columns.

Returns an expression that evaluates the MIN SQL function.

// MIN(score)
-min(Column("score"))
+min(Column("score"))
 
@@ -3106,7 +3106,7 @@ number of columns.

@@ -3137,7 +3137,7 @@ number of columns.

Returns an expression that evaluates the SUM SQL function.

// SUM(amount)
-sum(Column("amount"))
+sum(Column("amount"))
 
@@ -3150,7 +3150,7 @@ number of columns.

@@ -3181,12 +3181,12 @@ number of columns.

An SQL expression that compares two expressions with the = SQL operator.

// name = 'Arthur'
-Column("name") == "Arthur"
+Column("name") == "Arthur"
 

When the right operand is nil, IS NULL is used instead.

// name IS NULL
-Column("name") == nil
+Column("name") == nil
 
@@ -3199,7 +3199,7 @@ number of columns.

@@ -3219,12 +3219,12 @@ number of columns.

An SQL expression that compares two expressions with the = SQL operator.

// name = 'Arthur' COLLATE NOCASE
-Column("name").collating(.nocase) == "Arthur"
+Column("name").collating(.nocase) == "Arthur"
 

When the right operand is nil, IS NULL is used instead.

// name IS NULL
-Column("name").collating(.nocase) == nil
+Column("name").collating(.nocase) == nil
 
@@ -3237,7 +3237,7 @@ number of columns.

@@ -3259,10 +3259,10 @@ number of columns.

The comparison is done with the built-in boolean evaluation of SQLite:

// validated
-Column("validated") == true
+Column("validated") == true
 
 // NOT validated
-Column("validated") == false
+Column("validated") == false
 
@@ -3275,7 +3275,7 @@ number of columns.

@@ -3295,12 +3295,12 @@ number of columns.

An SQL expression that compares two expressions with the = SQL operator.

// 'Arthur' = name
-"Arthur" == Column("name")
+"Arthur" == Column("name")
 

When the left operand is nil, IS NULL is used instead.

// name IS NULL
-nil == Column("name")
+nil == Column("name")
 
@@ -3313,7 +3313,7 @@ number of columns.

@@ -3333,12 +3333,12 @@ number of columns.

An SQL expression that compares two expressions with the = SQL operator.

// 'Arthur' = name COLLATE NOCASE
-"Arthur" == Column("name").collating(.nocase)
+"Arthur" == Column("name").collating(.nocase)
 

When the left operand is nil, IS NULL is used instead.

// name IS NULL
-nil == Column("name").collating(.nocase)
+nil == Column("name").collating(.nocase)
 
@@ -3351,7 +3351,7 @@ number of columns.

@@ -3373,10 +3373,10 @@ number of columns.

The comparison is done with the built-in boolean evaluation of SQLite:

// validated
-true == Column("validated")
+true == Column("validated")
 
 // NOT validated
-false == Column("validated")
+false == Column("validated")
 
@@ -3389,7 +3389,7 @@ number of columns.

@@ -3409,7 +3409,7 @@ number of columns.

An SQL expression that compares two expressions with the = SQL operator.

// email = login
-Column("email") == Column("login")
+Column("email") == Column("login")
 
@@ -3422,7 +3422,7 @@ number of columns.

@@ -3442,12 +3442,12 @@ number of columns.

An SQL expression that compares two expressions with the <> SQL operator.

// name <> 'Arthur'
-Column("name") != "Arthur"
+Column("name") != "Arthur"
 

When the right operand is nil, IS NOT NULL is used instead.

// name IS NOT NULL
-Column("name") != nil
+Column("name") != nil
 
@@ -3460,7 +3460,7 @@ number of columns.

@@ -3480,12 +3480,12 @@ number of columns.

An SQL expression that compares two expressions with the <> SQL operator.

// name <> 'Arthur' COLLATE NOCASE
-Column("name").collating(.nocase) != "Arthur"
+Column("name").collating(.nocase) != "Arthur"
 

When the right operand is nil, IS NOT NULL is used instead.

// name IS NOT NULL
-Column("name").collating(.nocase) != nil
+Column("name").collating(.nocase) != nil
 
@@ -3498,7 +3498,7 @@ number of columns.

@@ -3520,10 +3520,10 @@ number of columns.

The comparison is done with the built-in boolean evaluation of SQLite:

// NOT validated
-Column("validated") != true
+Column("validated") != true
 
 // validated
-Column("validated") != false
+Column("validated") != false
 
@@ -3536,7 +3536,7 @@ number of columns.

@@ -3556,12 +3556,12 @@ number of columns.

An SQL expression that compares two expressions with the <> SQL operator.

// 'Arthur' <> name
-"Arthur" != Column("name")
+"Arthur" != Column("name")
 

When the left operand is nil, IS NOT NULL is used instead.

// name IS NOT NULL
-nil != Column("name")
+nil != Column("name")
 
@@ -3574,7 +3574,7 @@ number of columns.

@@ -3594,12 +3594,12 @@ number of columns.

An SQL expression that compares two expressions with the <> SQL operator.

// 'Arthur' <> name COLLATE NOCASE
-"Arthur" != Column("name").collating(.nocase)
+"Arthur" != Column("name").collating(.nocase)
 

When the left operand is nil, IS NOT NULL is used instead.

// name IS NOT NULL
-nil != Column("name").collating(.nocase)
+nil != Column("name").collating(.nocase)
 
@@ -3612,7 +3612,7 @@ number of columns.

@@ -3634,10 +3634,10 @@ number of columns.

The comparison is done with the built-in boolean evaluation of SQLite:

// NOT validated
-true != Column("validated")
+true != Column("validated")
 
 // validated
-false != Column("validated")
+false != Column("validated")
 
@@ -3650,7 +3650,7 @@ number of columns.

@@ -3670,7 +3670,7 @@ number of columns.

An SQL expression that compares two expressions with the <> SQL operator.

// email <> login
-Column("email") != Column("login")
+Column("email") != Column("login")
 
@@ -3683,7 +3683,7 @@ number of columns.

@@ -3703,7 +3703,7 @@ number of columns.

An SQL expression that compares two expressions with the IS SQL operator.

// name IS 'Arthur'
-Column("name") === "Arthur"
+Column("name") === "Arthur"
 
@@ -3716,7 +3716,7 @@ number of columns.

@@ -3736,7 +3736,7 @@ number of columns.

An SQL expression that compares two expressions with the IS SQL operator.

// name IS 'Arthur' COLLATE NOCASE
-Column("name").collating(.nocase) === "Arthur"
+Column("name").collating(.nocase) === "Arthur"
 
@@ -3749,7 +3749,7 @@ number of columns.

@@ -3769,7 +3769,7 @@ number of columns.

An SQL expression that compares two expressions with the IS SQL operator.

// name IS 'Arthur'
-"Arthur" === Column("name")
+"Arthur" === Column("name")
 
@@ -3782,7 +3782,7 @@ number of columns.

@@ -3802,7 +3802,7 @@ number of columns.

An SQL expression that compares two expressions with the IS SQL operator.

// name IS 'Arthur' COLLATE NOCASE
-"Arthur" === Column("name").collating(.nocase)
+"Arthur" === Column("name").collating(.nocase)
 
@@ -3815,7 +3815,7 @@ number of columns.

@@ -3835,7 +3835,7 @@ number of columns.

An SQL expression that compares two expressions with the IS SQL operator.

// email IS login
-Column("email") === Column("login")
+Column("email") === Column("login")
 
@@ -3848,7 +3848,7 @@ number of columns.

@@ -3868,7 +3868,7 @@ number of columns.

An SQL expression that compares two expressions with the IS NOT SQL operator.

// name IS NOT 'Arthur'
-Column("name") !== "Arthur"
+Column("name") !== "Arthur"
 
@@ -3881,7 +3881,7 @@ number of columns.

@@ -3901,7 +3901,7 @@ number of columns.

An SQL expression that compares two expressions with the IS NOT SQL operator.

// name IS NOT 'Arthur' COLLATE NOCASE
-Column("name").collating(.nocase) !== "Arthur"
+Column("name").collating(.nocase) !== "Arthur"
 
@@ -3914,7 +3914,7 @@ number of columns.

@@ -3934,7 +3934,7 @@ number of columns.

An SQL expression that compares two expressions with the IS NOT SQL operator.

// name IS NOT 'Arthur'
-"Arthur" !== Column("name")
+"Arthur" !== Column("name")
 
@@ -3947,7 +3947,7 @@ number of columns.

@@ -3967,7 +3967,7 @@ number of columns.

An SQL expression that compares two expressions with the IS NOT SQL operator.

// name IS NOT 'Arthur' COLLATE NOCASE
-"Arthur" !== Column("name").collating(.nocase)
+"Arthur" !== Column("name").collating(.nocase)
 
@@ -3980,7 +3980,7 @@ number of columns.

@@ -4000,7 +4000,7 @@ number of columns.

An SQL expression that compares two expressions with the IS NOT SQL operator.

// email IS NOT login
-Column("email") !== Column("login")
+Column("email") !== Column("login")
 
@@ -4013,7 +4013,7 @@ number of columns.

@@ -4044,7 +4044,7 @@ number of columns.

An SQL expression that compares two expressions with the < SQL operator.

// score < 18
-Column("score") < 18
+Column("score") < 18
 
@@ -4057,7 +4057,7 @@ number of columns.

@@ -4077,7 +4077,7 @@ number of columns.

An SQL expression that compares two expressions with the < SQL operator.

// name < 'Arthur' COLLATE NOCASE
-Column("name").collating(.nocase) < "Arthur"
+Column("name").collating(.nocase) < "Arthur"
 
@@ -4090,7 +4090,7 @@ number of columns.

@@ -4110,7 +4110,7 @@ number of columns.

An SQL expression that compares two expressions with the < SQL operator.

// 18 < score
-18 < Column("score")
+18 < Column("score")
 
@@ -4123,7 +4123,7 @@ number of columns.

@@ -4143,7 +4143,7 @@ number of columns.

An SQL expression that compares two expressions with the < SQL operator.

// 'Arthur' < name COLLATE NOCASE
-"Arthur" < Column("name").collating(.nocase)
+"Arthur" < Column("name").collating(.nocase)
 
@@ -4156,7 +4156,7 @@ number of columns.

@@ -4176,7 +4176,7 @@ number of columns.

An SQL expression that compares two expressions with the < SQL operator.

// width < height
-Column("width") < Column("height")
+Column("width") < Column("height")
 
@@ -4189,7 +4189,7 @@ number of columns.

@@ -4209,7 +4209,7 @@ number of columns.

An SQL expression that compares two expressions with the <= SQL operator.

// score <= 18
-Column("score") <= 18
+Column("score") <= 18
 
@@ -4222,7 +4222,7 @@ number of columns.

@@ -4242,7 +4242,7 @@ number of columns.

An SQL expression that compares two expressions with the <= SQL operator.

// name <= 'Arthur' COLLATE NOCASE
-Column("name").collating(.nocase) <= "Arthur"
+Column("name").collating(.nocase) <= "Arthur"
 
@@ -4255,7 +4255,7 @@ number of columns.

@@ -4275,7 +4275,7 @@ number of columns.

An SQL expression that compares two expressions with the <= SQL operator.

// 18 <= score
-18 <= Column("score")
+18 <= Column("score")
 
@@ -4288,7 +4288,7 @@ number of columns.

@@ -4308,7 +4308,7 @@ number of columns.

An SQL expression that compares two expressions with the <= SQL operator.

// 'Arthur' <= name COLLATE NOCASE
-"Arthur" <= Column("name").collating(.nocase)
+"Arthur" <= Column("name").collating(.nocase)
 
@@ -4321,7 +4321,7 @@ number of columns.

@@ -4341,7 +4341,7 @@ number of columns.

An SQL expression that compares two expressions with the <= SQL operator.

// width <= height
-Column("width") <= Column("height")
+Column("width") <= Column("height")
 
@@ -4354,7 +4354,7 @@ number of columns.

@@ -4374,7 +4374,7 @@ number of columns.

An SQL expression that compares two expressions with the > SQL operator.

// score > 18
-Column("score") > 18
+Column("score") > 18
 
@@ -4387,7 +4387,7 @@ number of columns.

@@ -4407,7 +4407,7 @@ number of columns.

An SQL expression that compares two expressions with the > SQL operator.

// name > 'Arthur' COLLATE NOCASE
-Column("name").collating(.nocase) > "Arthur"
+Column("name").collating(.nocase) > "Arthur"
 
@@ -4420,7 +4420,7 @@ number of columns.

@@ -4440,7 +4440,7 @@ number of columns.

An SQL expression that compares two expressions with the > SQL operator.

// 18 > score
-18 > Column("score")
+18 > Column("score")
 
@@ -4453,7 +4453,7 @@ number of columns.

@@ -4473,7 +4473,7 @@ number of columns.

An SQL expression that compares two expressions with the > SQL operator.

// 'Arthur' > name COLLATE NOCASE
-"Arthur" > Column("name").collating(.nocase)
+"Arthur" > Column("name").collating(.nocase)
 
@@ -4486,7 +4486,7 @@ number of columns.

@@ -4506,7 +4506,7 @@ number of columns.

An SQL expression that compares two expressions with the > SQL operator.

// width > height
-Column("width") > Column("height")
+Column("width") > Column("height")
 
@@ -4519,7 +4519,7 @@ number of columns.

@@ -4539,7 +4539,7 @@ number of columns.

An SQL expression that compares two expressions with the >= SQL operator.

// score >= 18
-Column("score") >= 18
+Column("score") >= 18
 
@@ -4552,7 +4552,7 @@ number of columns.

@@ -4572,7 +4572,7 @@ number of columns.

An SQL expression that compares two expressions with the >= SQL operator.

// name >= 'Arthur' COLLATE NOCASE
-Column("name").collating(.nocase) >= "Arthur"
+Column("name").collating(.nocase) >= "Arthur"
 
@@ -4585,7 +4585,7 @@ number of columns.

@@ -4605,7 +4605,7 @@ number of columns.

An SQL expression that compares two expressions with the >= SQL operator.

// 18 >= score
-18 >= Column("score")
+18 >= Column("score")
 
@@ -4618,7 +4618,7 @@ number of columns.

@@ -4638,7 +4638,7 @@ number of columns.

An SQL expression that compares two expressions with the >= SQL operator.

// 'Arthur' >= name COLLATE NOCASE
-"Arthur" >= Column("name").collating(.nocase)
+"Arthur" >= Column("name").collating(.nocase)
 
@@ -4651,7 +4651,7 @@ number of columns.

@@ -4671,7 +4671,7 @@ number of columns.

An SQL expression that compares two expressions with the >= SQL operator.

// width >= height
-Column("width") >= Column("height")
+Column("width") >= Column("height")
 
@@ -4684,7 +4684,7 @@ number of columns.

@@ -4715,7 +4715,7 @@ number of columns.

An SQL arithmetic multiplication.

// width * 2
-Column("width") * 2
+Column("width") * 2
 
@@ -4728,7 +4728,7 @@ number of columns.

@@ -4748,7 +4748,7 @@ number of columns.

An SQL arithmetic multiplication.

// 2 * width
-2 * Column("width")
+2 * Column("width")
 
@@ -4761,7 +4761,7 @@ number of columns.

@@ -4781,7 +4781,7 @@ number of columns.

An SQL arithmetic multiplication.

// width * height
-Column("width") * Column("height")
+Column("width") * Column("height")
 
@@ -4794,7 +4794,7 @@ number of columns.

@@ -4814,7 +4814,7 @@ number of columns.

An SQL arithmetic division.

// width / 2
-Column("width") / 2
+Column("width") / 2
 
@@ -4827,7 +4827,7 @@ number of columns.

@@ -4847,7 +4847,7 @@ number of columns.

An SQL arithmetic division.

// 2 / width
-2 / Column("width")
+2 / Column("width")
 
@@ -4860,7 +4860,7 @@ number of columns.

@@ -4880,7 +4880,7 @@ number of columns.

An SQL arithmetic division.

// width / height
-Column("width") / Column("height")
+Column("width") / Column("height")
 
@@ -4893,7 +4893,7 @@ number of columns.

@@ -4913,7 +4913,7 @@ number of columns.

An SQL arithmetic addition.

// width + 2
-Column("width") + 2
+Column("width") + 2
 
@@ -4926,7 +4926,7 @@ number of columns.

@@ -4946,7 +4946,7 @@ number of columns.

An SQL arithmetic addition.

// 2 + width
-2 + Column("width")
+2 + Column("width")
 
@@ -4959,7 +4959,7 @@ number of columns.

@@ -4979,7 +4979,7 @@ number of columns.

An SQL arithmetic addition.

// width + height
-Column("width") + Column("height")
+Column("width") + Column("height")
 
@@ -4992,7 +4992,7 @@ number of columns.

@@ -5012,7 +5012,7 @@ number of columns.

A negated SQL arithmetic expression.

// -width
--Column("width")
+-Column("width")
 
@@ -5025,7 +5025,7 @@ number of columns.

@@ -5045,7 +5045,7 @@ number of columns.

An SQL arithmetic substraction.

// width - 2
-Column("width") - 2
+Column("width") - 2
 
@@ -5058,7 +5058,7 @@ number of columns.

@@ -5078,7 +5078,7 @@ number of columns.

An SQL arithmetic substraction.

// 2 - width
-2 - Column("width")
+2 - Column("width")
 
@@ -5091,7 +5091,7 @@ number of columns.

@@ -5111,7 +5111,7 @@ number of columns.

An SQL arithmetic substraction.

// width - height
-Column("width") - Column("height")
+Column("width") - Column("height")
 
@@ -5124,7 +5124,7 @@ number of columns.

@@ -5155,7 +5155,7 @@ number of columns.

A logical SQL expression with the AND SQL operator.

// favorite AND 0
-Column("favorite") && false
+Column("favorite") && false
 
@@ -5168,7 +5168,7 @@ number of columns.

@@ -5188,7 +5188,7 @@ number of columns.

A logical SQL expression with the AND SQL operator.

// 0 AND favorite
-false && Column("favorite")
+false && Column("favorite")
 
@@ -5201,7 +5201,7 @@ number of columns.

@@ -5221,7 +5221,7 @@ number of columns.

A logical SQL expression with the AND SQL operator.

// email IS NOT NULL AND favorite
-Column("email") != nil && Column("favorite")
+Column("email") != nil && Column("favorite")
 
@@ -5234,7 +5234,7 @@ number of columns.

@@ -5254,7 +5254,7 @@ number of columns.

A logical SQL expression with the OR SQL operator.

// favorite OR 1
-Column("favorite") || true
+Column("favorite") || true
 
@@ -5267,7 +5267,7 @@ number of columns.

@@ -5287,7 +5287,7 @@ number of columns.

A logical SQL expression with the OR SQL operator.

// 0 OR favorite
-true || Column("favorite")
+true || Column("favorite")
 
@@ -5300,7 +5300,7 @@ number of columns.

@@ -5320,7 +5320,7 @@ number of columns.

A logical SQL expression with the OR SQL operator.

// email IS NULL OR hidden
-Column("email") == nil || Column("hidden")
+Column("email") == nil || Column("hidden")
 
@@ -5333,7 +5333,7 @@ number of columns.

@@ -5353,12 +5353,12 @@ number of columns.

A negated logical SQL expression with the NOT SQL operator.

// NOT hidden
-!Column("hidden")
+!Column("hidden")
 

Some expressions may be negated with specific SQL operators:

// id NOT BETWEEN 1 AND 10
-!((1...10).contains(Column("id")))
+!((1...10).contains(Column("id")))
 
@@ -5371,7 +5371,7 @@ number of columns.

@@ -5415,7 +5415,7 @@ number of columns.

@@ -5425,7 +5425,7 @@ number of columns.

diff --git a/docs/4.2/Protocols.html b/docs/4.2/Protocols.html index 57fe1c411..8a15eeacf 100644 --- a/docs/4.2/Protocols.html +++ b/docs/4.2/Protocols.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1071,7 +1071,7 @@ to those defined by Swift’s Sequence protocol: contains, @@ -1096,7 +1096,7 @@ to those defined by Swift’s Sequence protocol: contains, The protocol for custom SQLite aggregates.

For example:

-
struct MySum : DatabaseAggregate {
+
struct MySum : DatabaseAggregate {
     var sum: Int = 0
 
     mutating func step(_ dbValues: [DatabaseValue]) {
@@ -1105,15 +1105,15 @@ to those defined by Swift’s Sequence protocol: contains, }
     }
 
-    func finalize() -> DatabaseValueConvertible? {
+    func finalize() -> DatabaseValueConvertible? {
         return sum
     }
 }
 
-let dbQueue = DatabaseQueue()
-let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self)
+let dbQueue = DatabaseQueue()
+let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self)
 dbQueue.add(function: fn)
-try dbQueue.write { db in
+try dbQueue.write { db in
     try db.execute(sql: "CREATE TABLE test(i)")
     try db.execute(sql: "INSERT INTO test(i) VALUES (1)")
     try db.execute(sql: "INSERT INTO test(i) VALUES (2)")
@@ -1132,7 +1132,7 @@ to those defined by Swift’s Sequence protocol: contains, 
                       
                       
                     
                   
@@ -1181,7 +1181,7 @@ connections, protect yourself with transactions, and be ready to setup a
                         
                       
                       
                     
                   
@@ -1223,7 +1223,7 @@ connections, protect yourself with transactions, and be ready to setup a
                         
                       
                       
                     
                   
@@ -1280,7 +1280,7 @@ arrays, or single values:

@@ -1311,7 +1311,7 @@ arrays, or single values:

The protocol for all requests that fetch database rows, and tell how those rows should be interpreted.

-
struct Player: FetchableRecord { ... }
+
struct Player: FetchableRecord { ... }
 let request: ... // Some FetchRequest that fetches Player
 try request.fetchCursor(db) // Cursor of Player
 try request.fetchAll(db)    // [Player]
@@ -1329,7 +1329,7 @@ rows should be interpreted.

@@ -1378,7 +1378,7 @@ connections, protect yourself with transactions, and be ready to setup a @@ -1413,7 +1413,7 @@ together.

To use a row adapter, provide it to any method that fetches:

-
let adapter = SuffixRowAdapter(fromIndex: 2)
+
let adapter = SuffixRowAdapter(fromIndex: 2)
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
 
 // [baz:3]
@@ -1431,7 +1431,7 @@ together.

@@ -1466,7 +1466,7 @@ optimization whenever direct access to SQLite is possible:

let int: Int = row[0] // there } let ints = Int.fetchAll(db, sql: "SELECT ...") // there -struct Player { +struct Player { init(row: Row) { name = row["name"] // there score = row["score"] // there @@ -1488,7 +1488,7 @@ Float, Double, String, and Bool.

@@ -1533,7 +1533,7 @@ or rollbacked on a database.

@@ -1612,11 +1612,11 @@ low-level FTS5Tokenizer.tokenize(context:flags:pText:nText:tokenCallback:).

Here is the implementation for a trivial tokenizer that wraps the built-in ascii tokenizer without any custom processing:

-
class TrivialAsciiTokenizer : FTS5WrapperTokenizer {
+
class TrivialAsciiTokenizer : FTS5WrapperTokenizer {
     static let name = "trivial"
     let wrappedTokenizer: FTS5Tokenizer
 
-    init(db: Database, arguments: [String]) throws {
+    init(db: Database, arguments: [String]) throws {
         wrappedTokenizer = try db.makeTokenizer(.ascii())
     }
 
@@ -1625,7 +1625,7 @@ built-in ascii tokenizer without any custom processing:

flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) - throws + throws { try tokenCallback(token, flags) } @@ -1676,7 +1676,7 @@ built-in methods that allow to fetch instances identified by key:

@@ -1701,18 +1701,18 @@ built-in methods that allow to fetch instances identified by key:

Adopt the ColumnExpression protocol when you define a column type.

You can, for example, define a String-based column enum:

-
enum Columns: String, ColumnExpression {
+
enum Columns: String, ColumnExpression {
     case id, name, score
 }
 let arthur = try Player.filter(Columns.name == "Arthur").fetchOne(db)
 

You can also define a genuine column type:

-
struct MyColumn: ColumnExpression {
+
struct MyColumn: ColumnExpression {
     var name: String
     var sqlType: String
 }
-let nameColumn = MyColumn(name: "name", sqlType: "VARCHAR")
+let nameColumn = MyColumn(name: "name", sqlType: "VARCHAR")
 let arthur = try Player.filter(nameColumn == "Arthur").fetchOne(db)
 
@@ -1729,7 +1729,7 @@ built-in methods that allow to fetch instances identified by key:

@@ -1767,7 +1767,7 @@ record types.

@@ -1811,7 +1811,7 @@ record types.

@@ -1855,7 +1855,7 @@ record types.

@@ -1899,7 +1899,7 @@ FTS4 and FTS5.

@@ -1934,7 +1934,7 @@ FTS4 and FTS5.

@@ -1958,7 +1958,7 @@ FTS4 and FTS5.

Types that adopt FetchableRecord can be initialized from a database Row.

let row = try Row.fetchOne(db, sql: "SELECT ...")!
-let player = Player(row)
+let player = Player(row)
 

The protocol comes with built-in methods that allow to fetch cursors, @@ -1986,7 +1986,7 @@ arrays, or single records:

@@ -2021,7 +2021,7 @@ arrays, or single records:

@@ -2068,7 +2068,7 @@ mutating methods.

@@ -2105,7 +2105,7 @@ mutating methods.

@@ -2115,7 +2115,7 @@ mutating methods.

diff --git a/docs/4.2/Protocols/Association.html b/docs/4.2/Protocols/Association.html index ff95e6bbf..5578dae60 100644 --- a/docs/4.2/Protocols/Association.html +++ b/docs/4.2/Protocols/Association.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1037,7 +1037,7 @@ record types.

The record type at the origin of the association.

In the belongsTo association below, it is Book:

-
struct Book: TableRecord {
+
struct Book: TableRecord {
     // BelongsToAssociation<Book, Author>
     static let author = belongsTo(Author.self)
 }
@@ -1053,7 +1053,7 @@ record types.

@@ -1078,7 +1078,7 @@ record types.

This new key impacts how rows fetched from the resulting association should be consumed:

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
@@ -1096,11 +1096,11 @@ should be consumed:

This new key helps Decodable records decode rows fetched from the resulting association:

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
-struct PlayerInfo: FetchableRecord, Decodable {
+struct PlayerInfo: FetchableRecord, Decodable {
     let player: Player
     let team: Team
 
@@ -1125,7 +1125,7 @@ resulting association:

@@ -1151,14 +1151,14 @@ resulting association:

Creates an association which selects selection.

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
 // SELECT player.*, team.color
 // FROM player
 // JOIN team ON team.id = player.teamId
-let association = Player.team.select([Column("color")])
+let association = Player.team.select([Column("color")])
 var request = Player.including(required: association)
 
@@ -1167,8 +1167,8 @@ resulting association:

// FROM player // JOIN team ON team.id = player.teamId let association = Player.team - .select([Column("id")]) - .select([Column("color")]) + .select([Column("id")]) + .select([Column("color")]) var request = Player.including(required: association)
@@ -1182,7 +1182,7 @@ resulting association:

@@ -1204,7 +1204,7 @@ resulting association:

Creates an association which appends selection.

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
@@ -1212,8 +1212,8 @@ resulting association:

// FROM player // JOIN team ON team.id = player.teamId let association = Player.team - .select([Column("color")]) - .annotated(with: [Column("name")]) + .select([Column("color")]) + .annotated(with: [Column("name")]) var request = Player.including(required: association)
@@ -1227,7 +1227,7 @@ resulting association:

@@ -1250,14 +1250,14 @@ resulting association:

Creates an association with the provided predicate promise added to the eventual set of already applied predicates.

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
 // SELECT player.*, team.*
 // FROM player
 // JOIN team ON team.id = player.teamId AND 1
-let association = Player.team.filter { db in true }
+let association = Player.team.filter { db in true }
 var request = Player.including(required: association)
 
@@ -1271,7 +1271,7 @@ the eventual set of already applied predicates.

@@ -1293,7 +1293,7 @@ the eventual set of already applied predicates.

Creates an association with the provided orderings promise.

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
@@ -1301,7 +1301,7 @@ the eventual set of already applied predicates.

// FROM player // JOIN team ON team.id = player.teamId // ORDER BY team.name -let association = Player.team.order { _ in [Column("name")] } +let association = Player.team.order { _ in [Column("name")] } var request = Player.including(required: association)
@@ -1311,9 +1311,9 @@ the eventual set of already applied predicates.

// JOIN team ON team.id = player.teamId // ORDER BY team.name let association = Player.team - .order{ _ in [Column("color")] } + .order{ _ in [Column("color")] } .reversed() - .order{ _ in [Column("name")] } + .order{ _ in [Column("name")] } var request = Player.including(required: association)
@@ -1327,7 +1327,7 @@ the eventual set of already applied predicates.

@@ -1349,7 +1349,7 @@ the eventual set of already applied predicates.

Creates an association that reverses applied orderings.

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
@@ -1357,7 +1357,7 @@ the eventual set of already applied predicates.

// FROM player // JOIN team ON team.id = player.teamId // ORDER BY team.name DESC -let association = Player.team.order(Column("name")).reversed() +let association = Player.team.order(Column("name")).reversed() var request = Player.including(required: association)
@@ -1379,7 +1379,7 @@ the eventual set of already applied predicates.

@@ -1401,14 +1401,14 @@ the eventual set of already applied predicates.

Creates an association without any ordering.

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
 // SELECT player.*, team.*
 // FROM player
 // JOIN team ON team.id = player.teamId
-let association = Player.team.order(Column("name")).unordered()
+let association = Player.team.order(Column("name")).unordered()
 var request = Player.including(required: association)
 
@@ -1422,7 +1422,7 @@ the eventual set of already applied predicates.

@@ -1448,17 +1448,17 @@ a specific database table.

In the example below, the team.color = ‘red’ condition in the where clause could be not achieved without table aliases.

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
 // SELECT player.*, team.*
 // JOIN team ON ...
 // WHERE team.color = 'red'
-let teamAlias = TableAlias()
+let teamAlias = TableAlias()
 let request = Player
     .including(required: Player.team.aliased(teamAlias))
-    .filter(teamAlias[Column("color")] == "red")
+    .filter(teamAlias[Column("color")] == "red")
 

When you give a name to a table alias, you can reliably inject sql @@ -1466,7 +1466,7 @@ snippets in your requests:

// SELECT player.*, custom.*
 // JOIN team custom ON ...
 // WHERE custom.color = 'red'
-let teamAlias = TableAlias(name: "custom")
+let teamAlias = TableAlias(name: "custom")
 let request = Player
     .including(required: Player.team.aliased(teamAlias))
     .filter(sql: "custom.color = ?", arguments: ["red"])
@@ -1482,7 +1482,7 @@ snippets in your requests:

@@ -1492,7 +1492,7 @@ snippets in your requests:

diff --git a/docs/4.2/Protocols/AssociationToMany.html b/docs/4.2/Protocols/AssociationToMany.html index 19c1a7c9f..bf8e541c9 100644 --- a/docs/4.2/Protocols/AssociationToMany.html +++ b/docs/4.2/Protocols/AssociationToMany.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1054,7 +1054,7 @@ @@ -1092,7 +1092,7 @@ the association. For example:

For example:

-
struct TeamInfo: FetchableRecord, Decodable {
+
struct TeamInfo: FetchableRecord, Decodable {
     var team: Team
     var playerCount: Int
 }
@@ -1112,7 +1112,7 @@ the association. For example:

@@ -1137,7 +1137,7 @@ the association. For example:

It has a default name, which is hasNo[Key], where key is the key of the association. For example:

-
struct TeamInfo: FetchableRecord, Decodable {
+
struct TeamInfo: FetchableRecord, Decodable {
     var team: Team
     var hasNoPlayer: Bool
 }
@@ -1159,7 +1159,7 @@ the association. For example:

@@ -1188,14 +1188,14 @@ name which is average[Key][Column], where key is the key of the association. For example:

For example:

-
struct TeamInfo: FetchableRecord, Decodable {
+
struct TeamInfo: FetchableRecord, Decodable {
     var team: Team
     var averagePlayerScore: Double
 }
-let request = Team.annotated(with: Team.players.average(Column("score")))
+let request = Team.annotated(with: Team.players.average(Column("score")))
 let infos: [TeamInfo] = try TeamInfo.fetchAll(db, request)
 
-let teams: [Team] = try Team.having(Team.players.average(Column("score")) > 100).fetchAll(db)
+let teams: [Team] = try Team.having(Team.players.average(Column("score")) > 100).fetchAll(db)
 
@@ -1208,7 +1208,7 @@ association. For example:

@@ -1237,14 +1237,14 @@ name which is maximum[Key][Column], where key is the key of the association. For example:

For example:

-
struct TeamInfo: FetchableRecord, Decodable {
+
struct TeamInfo: FetchableRecord, Decodable {
     var team: Team
     var maxPlayerScore: Double
 }
-let request = Team.annotated(with: Team.players.max(Column("score")))
+let request = Team.annotated(with: Team.players.max(Column("score")))
 let infos: [TeamInfo] = try TeamInfo.fetchAll(db, request)
 
-let teams: [Team] = try Team.having(Team.players.max(Column("score")) < 100).fetchAll(db)
+let teams: [Team] = try Team.having(Team.players.max(Column("score")) < 100).fetchAll(db)
 
@@ -1257,7 +1257,7 @@ association. For example:

@@ -1286,14 +1286,14 @@ name which is minimum[Key][Column], where key is the key of the association. For example:

For example:

-
struct TeamInfo: FetchableRecord, Decodable {
+
struct TeamInfo: FetchableRecord, Decodable {
     var team: Team
     var minPlayerScore: Double
 }
-let request = Team.annotated(with: Team.players.min(Column("score")))
+let request = Team.annotated(with: Team.players.min(Column("score")))
 let infos: [TeamInfo] = try TeamInfo.fetchAll(db, request)
 
-let teams: [Team] = try Team.having(Team.players.min(Column("score")) > 100).fetchAll(db)
+let teams: [Team] = try Team.having(Team.players.min(Column("score")) > 100).fetchAll(db)
 
@@ -1306,7 +1306,7 @@ association. For example:

@@ -1335,14 +1335,14 @@ name which is [key][Column]Sum, where key is the key of the association. For example:

For example:

-
struct TeamInfo: FetchableRecord, Decodable {
+
struct TeamInfo: FetchableRecord, Decodable {
     var team: Team
     var playerScoreSum: Double
 }
-let request = Team.annotated(with: Team.players.sum(Column("score")))
+let request = Team.annotated(with: Team.players.sum(Column("score")))
 let infos: [TeamInfo] = try TeamInfo.fetchAll(db, request)
 
-let teams: [Team] = try Team.having(Team.players.sum(Column("score")) > 100).fetchAll(db)
+let teams: [Team] = try Team.having(Team.players.sum(Column("score")) > 100).fetchAll(db)
 
@@ -1355,7 +1355,7 @@ association. For example:

@@ -1365,7 +1365,7 @@ association. For example:

diff --git a/docs/4.2/Protocols/AssociationToOne.html b/docs/4.2/Protocols/AssociationToOne.html index 486e5fe49..17808f4d0 100644 --- a/docs/4.2/Protocols/AssociationToOne.html +++ b/docs/4.2/Protocols/AssociationToOne.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1054,7 +1054,7 @@ @@ -1064,7 +1064,7 @@ diff --git a/docs/4.2/Protocols/ColumnExpression.html b/docs/4.2/Protocols/ColumnExpression.html index e0e222ee7..c738d51dd 100644 --- a/docs/4.2/Protocols/ColumnExpression.html +++ b/docs/4.2/Protocols/ColumnExpression.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1015,18 +1015,18 @@

Adopt the ColumnExpression protocol when you define a column type.

You can, for example, define a String-based column enum:

-
enum Columns: String, ColumnExpression {
+
enum Columns: String, ColumnExpression {
     case id, name, score
 }
 let arthur = try Player.filter(Columns.name == "Arthur").fetchOne(db)
 

You can also define a genuine column type:

-
struct MyColumn: ColumnExpression {
+
struct MyColumn: ColumnExpression {
     var name: String
     var sqlType: String
 }
-let nameColumn = MyColumn(name: "name", sqlType: "VARCHAR")
+let nameColumn = MyColumn(name: "name", sqlType: "VARCHAR")
 let arthur = try Player.filter(nameColumn == "Arthur").fetchOne(db)
 
@@ -1065,12 +1065,12 @@

Declaration

Swift

-
var name: String { get }
+
var name: String { get }
@@ -1097,7 +1097,7 @@

A matching SQL expression with the MATCH SQL operator.

// content MATCH '...'
-Column("content").match(pattern)
+Column("content").match(pattern)
 

If the search pattern is nil, SQLite will evaluate the expression @@ -1113,7 +1113,7 @@ to false.

@@ -1123,7 +1123,7 @@ to false.

diff --git a/docs/4.2/Protocols/Cursor.html b/docs/4.2/Protocols/Cursor.html index f967a5161..dbb1224da 100644 --- a/docs/4.2/Protocols/Cursor.html +++ b/docs/4.2/Protocols/Cursor.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1069,7 +1069,7 @@ to those defined by Swift’s Sequence protocol: contains, @@ -1100,7 +1100,7 @@ exists. Once nil has been returned, all subsequent calls return nil.

@@ -1145,7 +1145,7 @@ an element.

@@ -1205,7 +1205,7 @@ passed element represents a match.

predicate; otherwise, false.

@@ -1230,7 +1230,7 @@ predicate; otherwise, false.

integer starting at zero, and x represents an element of the cursor.

let cursor = try String.fetchCursor(db, sql: "SELECT 'foo' UNION ALL SELECT 'bar'")
 let c = cursor.enumerated()
-while let (n, x) = c.next() {
+while let (n, x) = c.next() {
     print("\(n): \(x)")
 }
 // Prints: "0: foo"
@@ -1247,7 +1247,7 @@ integer starting at zero, and x represents an element of the cursor.

@@ -1280,7 +1280,7 @@ integer starting at zero, and x represents an element of the cursor.

@@ -1314,7 +1314,7 @@ predicate or nil if no such element is found.

@@ -1349,7 +1349,7 @@ transform over this cursor.

@@ -1405,7 +1405,7 @@ called again.

@@ -1431,7 +1431,7 @@ elements.

If the number of elements to drop exceeds the number of elements in the cursor, the result is an empty cursor.

-
let numbers = AnyCursor([1, 2, 3, 4, 5])
+
let numbers = AnyCursor([1, 2, 3, 4, 5])
 try print(numbers.dropFirst(2))
 // Prints "[3, 4, 5]"
 try print(numbers.dropFirst(10))
@@ -1473,7 +1473,7 @@ the cursor. n must be greater than or equal to zero.

elements.

@@ -1497,7 +1497,7 @@ elements.

Returns a cursor containing all but the first element of the cursor.

The following example drops the first element from a cursor of integers.

-
let numbers = AnyCursor([1, 2, 3, 4, 5])
+
let numbers = AnyCursor([1, 2, 3, 4, 5])
 try print(numbers.dropFirst())
 // Prints "[2, 3, 4, 5]"
 
@@ -1518,7 +1518,7 @@ elements.

A cursor starting after the first element of the cursor.

@@ -1544,7 +1544,7 @@ elements.

The cursor must be finite. If the number of elements to drop exceeds the number of elements in the cursor, the result is an empty array.

-
let numbers = AnyCursor([1, 2, 3, 4, 5])
+
let numbers = AnyCursor([1, 2, 3, 4, 5])
 try print(numbers.dropLast(2))
 // Prints "[1, 2, 3]"
 try print(numbers.dropLast(10))
@@ -1585,7 +1585,7 @@ cursor. n must be greater than or equal to zero.

An array leaving off the specified number of elements.

@@ -1609,7 +1609,7 @@ cursor. n must be greater than or equal to zero.

Returns an array containing all but the last element of the cursor.

The following example drops the last element from a cursor of integers.

-
let numbers = AnyCursor([1, 2, 3, 4, 5])
+
let numbers = AnyCursor([1, 2, 3, 4, 5])
 try print(numbers.dropLast())
 // Prints "[1, 2, 3, 4]"
 
@@ -1630,7 +1630,7 @@ cursor. n must be greater than or equal to zero.

An array leaving off the last element of the cursor.

@@ -1666,7 +1666,7 @@ over self.

@@ -1702,7 +1702,7 @@ over self.

@@ -1735,7 +1735,7 @@ over self.

@@ -1769,7 +1769,7 @@ this cursor’s elements.

@@ -1829,7 +1829,7 @@ argument; otherwise, false.

areInIncreasingOrder. If the cursor has no elements, returns nil.

@@ -1889,7 +1889,7 @@ argument; otherwise, false.

areInIncreasingOrder. If the cursor has no elements, returns nil.

@@ -1915,7 +1915,7 @@ initial elements of the cursor.

If the maximum length exceeds the number of elements in the cursor, the result contains all the elements in the cursor.

-
let numbers = AnyCursor([1, 2, 3, 4, 5])
+
let numbers = AnyCursor([1, 2, 3, 4, 5])
 try print(numbers.prefix(2))
 // Prints "[1, 2]"
 try print(numbers.prefix(10))
@@ -1957,7 +1957,7 @@ value of maxLength must be greater than or equal to zero.

with at most maxLength elements.

@@ -2013,7 +2013,7 @@ called again.

@@ -2050,7 +2050,7 @@ element of this cursor and an accumulating value.

@@ -2087,7 +2087,7 @@ element of this cursor and an accumulating value.

@@ -2114,7 +2114,7 @@ final elements of the cursor.

The cursor must be finite. If the maximum length exceeds the number of elements in the cursor, the result contains all the elements in the cursor.

-
let numbers = AnyCursor([1, 2, 3, 4, 5])
+
let numbers = AnyCursor([1, 2, 3, 4, 5])
 try print(numbers.suffix(2))
 // Prints "[4, 5]"
 try print(numbers.suffix(10))
@@ -2151,7 +2151,7 @@ value of maxLength must be greater than or equal to zero.

@@ -2196,7 +2196,7 @@ given element.

@@ -2267,7 +2267,7 @@ argument; otherwise, false.

nil.

@@ -2327,7 +2327,7 @@ argument; otherwise, false.

nil.

@@ -2371,7 +2371,7 @@ argument; otherwise, false.

@@ -2415,7 +2415,7 @@ argument; otherwise, false.

@@ -2459,7 +2459,7 @@ argument; otherwise, false.

@@ -2469,7 +2469,7 @@ argument; otherwise, false.

diff --git a/docs/4.2/Protocols/DatabaseAggregate.html b/docs/4.2/Protocols/DatabaseAggregate.html index 23e890d6d..62782b73d 100644 --- a/docs/4.2/Protocols/DatabaseAggregate.html +++ b/docs/4.2/Protocols/DatabaseAggregate.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1015,7 +1015,7 @@

The protocol for custom SQLite aggregates.

For example:

-
struct MySum : DatabaseAggregate {
+
struct MySum : DatabaseAggregate {
     var sum: Int = 0
 
     mutating func step(_ dbValues: [DatabaseValue]) {
@@ -1024,15 +1024,15 @@
         }
     }
 
-    func finalize() -> DatabaseValueConvertible? {
+    func finalize() -> DatabaseValueConvertible? {
         return sum
     }
 }
 
-let dbQueue = DatabaseQueue()
-let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self)
+let dbQueue = DatabaseQueue()
+let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self)
 dbQueue.add(function: fn)
-try dbQueue.write { db in
+try dbQueue.write { db in
     try db.execute(sql: "CREATE TABLE test(i)")
     try db.execute(sql: "INSERT INTO test(i) VALUES (1)")
     try db.execute(sql: "INSERT INTO test(i) VALUES (2)")
@@ -1069,7 +1069,7 @@
                         
                       
                       
                     
                   
@@ -1110,7 +1110,7 @@ aggregate function.

@@ -1140,7 +1140,7 @@ aggregate function.

@@ -1150,7 +1150,7 @@ aggregate function.

diff --git a/docs/4.2/Protocols/DatabaseReader.html b/docs/4.2/Protocols/DatabaseReader.html index 984616ead..588a8fe0f 100644 --- a/docs/4.2/Protocols/DatabaseReader.html +++ b/docs/4.2/Protocols/DatabaseReader.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1052,12 +1052,12 @@ connections, protect yourself with transactions, and be ready to setup a

Declaration

Swift

-
var configuration: Configuration { get }
+
var configuration: Configuration { get }
@@ -1091,14 +1091,14 @@ connection, and returns its result.

Guarantee 1: the block argument is isolated. Eventual concurrent database updates are not visible inside the block:

-
try reader.read { db in
+
try reader.read { db in
     // Those two values are guaranteed to be equal, even if the
     // `player` table is modified between the two requests:
     let count1 = try Player.fetchCount(db)
     let count2 = try Player.fetchCount(db)
 }
 
-try reader.read { db in
+try reader.read { db in
     // Now this value may be different:
     let count = try Player.fetchCount(db)
 }
@@ -1143,7 +1143,7 @@ happen while establishing the read access to the database.
                         
                       
                       
                     
                   
@@ -1166,14 +1166,14 @@ database connection.

Guarantee 1: the block argument is isolated. Eventual concurrent database updates are not visible inside the block:

-
try reader.asyncRead { result in
+
try reader.asyncRead { result in
     do (
         let db = try result.get()
         // Those two values are guaranteed to be equal, even if the
         // `player` table is modified between the two requests:
         let count1 = try Player.fetchCount(db)
         let count2 = try Player.fetchCount(db)
-    } catch {
+    } catch {
         // handle error
     }
 }
@@ -1212,7 +1212,7 @@ whose resultCode is SQLITE_READONLY.

@@ -1237,7 +1237,7 @@ connection, and returns its result.

The block argument is not isolated: eventual concurrent database updates are visible inside the block:

-
try reader.unsafeRead { db in
+
try reader.unsafeRead { db in
     // Those two values may be different because some other thread
     // may have inserted or deleted a player between the two requests:
     let count1 = try Player.fetchCount(db)
@@ -1246,7 +1246,7 @@ are visible inside the block:

Cursor iterations are isolated, though:

-
try reader.unsafeRead { db in
+
try reader.unsafeRead { db in
     // No concurrent update can mess with this iteration:
     let rows = try Row.fetchCursor(db, sql: "SELECT ...")
     while let row = try rows.next() { ... }
@@ -1291,7 +1291,7 @@ happen while establishing the read access to the database.
                         
                       
                       
                     
                   
@@ -1316,7 +1316,7 @@ returns its result.

The block argument is not isolated: eventual concurrent database updates are visible inside the block:

-
try reader.unsafeReentrantRead { db in
+
try reader.unsafeReentrantRead { db in
     // Those two values may be different because some other thread
     // may have inserted or deleted a player between the two requests:
     let count1 = try Player.fetchCount(db)
@@ -1325,7 +1325,7 @@ are visible inside the block:

Cursor iterations are isolated, though:

-
try reader.unsafeReentrantRead { db in
+
try reader.unsafeReentrantRead { db in
     // No concurrent update can mess with this iteration:
     let rows = try Row.fetchCursor(db, sql: "SELECT ...")
     while let row = try rows.next() { ... }
@@ -1373,7 +1373,7 @@ dangerous concurrency practices.

@@ -1403,14 +1403,14 @@ dangerous concurrency practices.

Add or redefine an SQL function.

-
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
-    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
+
let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
+    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
         return nil
     }
     return int + 1
 }
 reader.add(function: fn)
-try reader.read { db in
+try reader.read { db in
     try Int.fetchOne(db, sql: "SELECT succ(1)")! // 2
 }
 
@@ -1425,7 +1425,7 @@ dangerous concurrency practices.

@@ -1455,7 +1455,7 @@ dangerous concurrency practices.

@@ -1485,7 +1485,7 @@ dangerous concurrency practices.

Add or redefine a collation.

-
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
+
let collation = DatabaseCollation("localized_standard") { (string1, string2) in
     return (string1 as NSString).localizedStandardCompare(string2)
 }
 reader.add(collation: collation)
@@ -1502,7 +1502,7 @@ dangerous concurrency practices.

@@ -1532,7 +1532,7 @@ dangerous concurrency practices.

@@ -1624,7 +1624,7 @@ during observation

a TransactionObserver

@@ -1654,7 +1654,7 @@ during observation

@@ -1705,7 +1705,7 @@ but they won’t trigger any error.

@@ -1715,7 +1715,7 @@ but they won’t trigger any error.

diff --git a/docs/4.2/Protocols/DatabaseRegionConvertible.html b/docs/4.2/Protocols/DatabaseRegionConvertible.html index 3d01431bd..515e751a3 100644 --- a/docs/4.2/Protocols/DatabaseRegionConvertible.html +++ b/docs/4.2/Protocols/DatabaseRegionConvertible.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1062,7 +1062,7 @@ @@ -1072,7 +1072,7 @@ diff --git a/docs/4.2/Protocols/DatabaseValueConvertible.html b/docs/4.2/Protocols/DatabaseValueConvertible.html index ce8caf5d3..99da08718 100644 --- a/docs/4.2/Protocols/DatabaseValueConvertible.html +++ b/docs/4.2/Protocols/DatabaseValueConvertible.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1061,12 +1061,12 @@ arrays, or single values:

Declaration

Swift

-
var databaseValue: DatabaseValue { get }
+
var databaseValue: DatabaseValue { get }
@@ -1099,12 +1099,12 @@ arrays, or single values:

Declaration

Swift

-
static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
+
static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
@@ -1215,7 +1215,7 @@ elements are undefined.

A cursor over fetched values.

@@ -1307,7 +1307,7 @@ elements are undefined.

An array.

@@ -1402,7 +1402,7 @@ extracted from the first row.

An optional value.

@@ -1459,7 +1459,7 @@ elements are undefined.

public static func fetchCursor(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> DatabaseValueCursor<Self>
@@ -1525,7 +1525,7 @@ elements are undefined.

A cursor over fetched values.

@@ -1563,7 +1563,7 @@ elements are undefined.

public static func fetchAll(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> [Self]
@@ -1629,7 +1629,7 @@ elements are undefined.

An array.

@@ -1670,7 +1670,7 @@ extracted from the first row.

public static func fetchOne(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> Self?
@@ -1736,7 +1736,7 @@ extracted from the first row.

An optional value.

@@ -1769,7 +1769,7 @@ extracted from the first row.

Returns a cursor over values fetched from a fetch request.

-
let request = Player.select(Column("name"))
+
let request = Player.select(Column("name"))
 let names = try String.fetchCursor(db, request) // Cursor of String
 while let name = try name.next() { // String
     ...
@@ -1831,7 +1831,7 @@ elements are undefined.

A cursor over fetched values.

@@ -1853,7 +1853,7 @@ elements are undefined.

Returns an array of values fetched from a fetch request.

-
let request = Player.select(Column("name"))
+
let request = Player.select(Column("name"))
 let names = try String.fetchAll(db, request) // [String]
 
@@ -1907,7 +1907,7 @@ elements are undefined.

An array.

@@ -1932,7 +1932,7 @@ elements are undefined.

The result is nil if the query returns no row, or if no value can be extracted from the first row.

-
let request = Player.filter(key: 1).select(Column("name"))
+
let request = Player.filter(key: 1).select(Column("name"))
 let name = try String.fetchOne(db, request) // String?
 
@@ -1986,7 +1986,7 @@ extracted from the first row.

An optional value.

@@ -2097,7 +2097,7 @@ elements are undefined.

A cursor over fetched values.

@@ -2189,7 +2189,7 @@ elements are undefined.

An array of values.

@@ -2281,7 +2281,7 @@ elements are undefined.

An optional value.

@@ -2338,7 +2338,7 @@ elements are undefined.

public static func fetchCursor(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> FastDatabaseValueCursor<Self>
@@ -2404,7 +2404,7 @@ elements are undefined.

A cursor over fetched values.

@@ -2442,7 +2442,7 @@ elements are undefined.

public static func fetchAll(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> [Self]
@@ -2508,7 +2508,7 @@ elements are undefined.

An array of values.

@@ -2546,7 +2546,7 @@ elements are undefined.

public static func fetchOne(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> Self?
@@ -2612,7 +2612,7 @@ elements are undefined.

An optional value.

@@ -2645,7 +2645,7 @@ elements are undefined.

Returns a cursor over values fetched from a fetch request.

-
let request = Player.select(Column("name"))
+
let request = Player.select(Column("name"))
 let names = try String.fetchCursor(db, request) // Cursor of String
 while let name = try names.next() { // String
     ...
@@ -2708,7 +2708,7 @@ elements are undefined.

A cursor over fetched values.

@@ -2730,7 +2730,7 @@ elements are undefined.

Returns an array of values fetched from a fetch request.

-
let request = Player.select(Column("name"))
+
let request = Player.select(Column("name"))
 let names = try String.fetchAll(db, request) // [String]
 
@@ -2784,7 +2784,7 @@ elements are undefined.

An array of values.

@@ -2806,7 +2806,7 @@ elements are undefined.

Returns a single value fetched from a fetch request.

-
let request = Player.filter(key: 1).select(Column("name"))
+
let request = Player.filter(key: 1).select(Column("name"))
 let name = try String.fetchOne(db, request) // String?
 
@@ -2860,7 +2860,7 @@ elements are undefined.

An optional value.

@@ -2870,7 +2870,7 @@ elements are undefined.

diff --git a/docs/4.2/Protocols/DatabaseWriter.html b/docs/4.2/Protocols/DatabaseWriter.html index f6a465690..34361415c 100644 --- a/docs/4.2/Protocols/DatabaseWriter.html +++ b/docs/4.2/Protocols/DatabaseWriter.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1127,7 +1127,7 @@ wrapping transaction. @@ -1190,7 +1190,7 @@ in a transaction.

@@ -1303,7 +1303,7 @@ transaction error.

@@ -1337,7 +1337,7 @@ in a transaction.

@@ -1377,7 +1377,7 @@ dangerous concurrency practices.

@@ -1420,17 +1420,17 @@ returned future, on any dispatch queue.

In the example below, the number of players is fetched concurrently with the player insertion. Yet the future is guaranteed to return zero:

-
try writer.writeWithoutTransaction { db in
+
try writer.writeWithoutTransaction { db in
     // Delete all players
     try Player.deleteAll()
 
     // Count players concurrently
-    let future = writer.concurrentRead { db in
+    let future = writer.concurrentRead { db in
         return try Player.fetchCount()
     }
 
     // Insert a player
-    try Player(...).insert(db)
+    try Player(...).insert(db)
 
     // Guaranteed to be zero
     let count = try future.wait()
@@ -1447,7 +1447,7 @@ the player insertion. Yet the future is guaranteed to return zero:

@@ -1529,7 +1529,7 @@ is deallocated).

@@ -1579,7 +1579,7 @@ execution of this method. @@ -1626,7 +1626,7 @@ disk space.

@@ -1636,7 +1636,7 @@ disk space.

diff --git a/docs/4.2/Protocols/EncodableRecord.html b/docs/4.2/Protocols/EncodableRecord.html index e58a311a1..4fddf5564 100644 --- a/docs/4.2/Protocols/EncodableRecord.html +++ b/docs/4.2/Protocols/EncodableRecord.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1040,7 +1040,7 @@ the columns of the database table (see databaseTableName()).

Primary key columns, if any, must be included.

-
struct Player: EncodableRecord {
+
struct Player: EncodableRecord {
     var id: Int64?
     var name: String?
 
@@ -1069,7 +1069,7 @@ is considered undefined behavior.

@@ -1107,26 +1107,26 @@ into database rows.

For example:

// A key that holds a encoder's name
-let encoderName = CodingUserInfoKey(rawValue: "encoderName")!
+let encoderName = CodingUserInfoKey(rawValue: "encoderName")!
 
-struct Player: PersistableRecord, Encodable {
+struct Player: PersistableRecord, Encodable {
     // Customize the encoder name when encoding a database row
     static let databaseEncodingUserInfo: [CodingUserInfoKey: Any] = [encoderName: "Database"]
 
-    func encode(to encoder: Encoder) throws {
+    func encode(to encoder: Encoder) throws {
         // Print the encoder name
         print(encoder.userInfo[encoderName])
         ...
     }
 }
 
-let player = Player(...)
+let player = Player(...)
 
 // prints "Database"
 try player.insert(db)
 
 // prints "JSON"
-let encoder = JSONEncoder()
+let encoder = JSONEncoder()
 encoder.userInfo = [encoderName: "JSON"]
 let data = try encoder.encode(player)
 
@@ -1145,7 +1145,7 @@ into database rows.

@@ -1181,17 +1181,17 @@ following properties:

You can override those defaults:

-
struct Achievement: Encodable {
+
struct Achievement: Encodable {
     var name: String
     var date: Date
 }
 
-struct Player: Encodable, PersistableRecord {
+struct Player: Encodable, PersistableRecord {
     // stored in a JSON column
     var achievements: [Achievement]
 
-    static func databaseJSONEncoder(for column: String) -> JSONEncoder {
-        let encoder = JSONEncoder()
+    static func databaseJSONEncoder(for column: String) -> JSONEncoder {
+        let encoder = JSONEncoder()
         encoder.dateEncodingStrategy = .iso8601
         return encoder
     }
@@ -1212,7 +1212,7 @@ following properties:

@@ -1239,7 +1239,7 @@ protocol, this property controls the encoding of date properties.

Default value is .deferredToDate

For example:

-
struct Player: PersistableRecord, Encodable {
+
struct Player: PersistableRecord, Encodable {
     static let databaseDateEncodingStrategy: DatabaseDateEncodingStrategy = .timeIntervalSince1970
 
     var name: String
@@ -1256,12 +1256,12 @@ protocol, this property controls the encoding of date properties.

Declaration

Swift

-
static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
+
static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
@@ -1288,7 +1288,7 @@ protocol, this property controls the encoding of UUID properties.

Default value is .deferredToUUID

For example:

-
struct Player: PersistableProtocol, Encodable {
+
struct Player: PersistableProtocol, Encodable {
     static let databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy = .string
 
     // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
@@ -1305,12 +1305,12 @@ protocol, this property controls the encoding of UUID properties.

Declaration

Swift

-
static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
+
static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
@@ -1347,7 +1347,7 @@ protocol, this property controls the encoding of UUID properties.

@@ -1392,7 +1392,7 @@ have the same database representation.

@@ -1432,7 +1432,7 @@ defined by the receiver record are considered.

@@ -1442,7 +1442,7 @@ defined by the receiver record are considered.

diff --git a/docs/4.2/Protocols/FTS5CustomTokenizer.html b/docs/4.2/Protocols/FTS5CustomTokenizer.html index e37485238..a2a7aaeb4 100644 --- a/docs/4.2/Protocols/FTS5CustomTokenizer.html +++ b/docs/4.2/Protocols/FTS5CustomTokenizer.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1080,9 +1080,9 @@ be ["arg1", "arg2"].

Creates an FTS5 tokenizer descriptor.

-
class MyTokenizer : FTS5CustomTokenizer { ... }
+
class MyTokenizer : FTS5CustomTokenizer { ... }
 
-db.create(virtualTable: "book", using: FTS5()) { t in
+db.create(virtualTable: "book", using: FTS5()) { t in
     let tokenizer = MyTokenizer.tokenizerDescriptor(arguments: ["unicode61", "remove_diacritics", "0"])
     t.tokenizer = tokenizer
 }
@@ -1097,7 +1097,7 @@ be ["arg1", "arg2"].

diff --git a/docs/4.2/Protocols/FTS5Tokenizer.html b/docs/4.2/Protocols/FTS5Tokenizer.html index 06e30ca67..d56d15f84 100644 --- a/docs/4.2/Protocols/FTS5Tokenizer.html +++ b/docs/4.2/Protocols/FTS5Tokenizer.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1039,7 +1039,7 @@ notifies found tokens to the tokenCallback function.

diff --git a/docs/4.2/Protocols/FTS5WrapperTokenizer.html b/docs/4.2/Protocols/FTS5WrapperTokenizer.html index af7bf2da3..388f1e9bf 100644 --- a/docs/4.2/Protocols/FTS5WrapperTokenizer.html +++ b/docs/4.2/Protocols/FTS5WrapperTokenizer.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1015,11 +1015,11 @@ low-level FTS5Tokenizer.tokenize(context:flags:pText:nText:tokenCallback:).

Here is the implementation for a trivial tokenizer that wraps the built-in ascii tokenizer without any custom processing:

-
class TrivialAsciiTokenizer : FTS5WrapperTokenizer {
+
class TrivialAsciiTokenizer : FTS5WrapperTokenizer {
     static let name = "trivial"
     let wrappedTokenizer: FTS5Tokenizer
 
-    init(db: Database, arguments: [String]) throws {
+    init(db: Database, arguments: [String]) throws {
         wrappedTokenizer = try db.makeTokenizer(.ascii())
     }
 
@@ -1028,7 +1028,7 @@ built-in ascii tokenizer without any custom processing:

flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) - throws + throws { try tokenCallback(token, flags) } @@ -1080,7 +1080,7 @@ tokens to the tokenCallback function.

flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) - throws + throws { // pass through: try tokenCallback(token, flags) @@ -1133,7 +1133,7 @@ tokenizer produces synonyms (see diff --git a/docs/4.2/Protocols/FetchRequest.html b/docs/4.2/Protocols/FetchRequest.html index e823d7894..966de27b1 100644 --- a/docs/4.2/Protocols/FetchRequest.html +++ b/docs/4.2/Protocols/FetchRequest.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1014,7 +1014,7 @@

The protocol for all requests that fetch database rows, and tell how those rows should be interpreted.

-
struct Player: FetchableRecord { ... }
+
struct Player: FetchableRecord { ... }
 let request: ... // Some FetchRequest that fetches Player
 try request.fetchCursor(db) // Cursor of Player
 try request.fetchAll(db)    // [Player]
@@ -1050,7 +1050,7 @@ rows should be interpreted.

@@ -1121,7 +1121,7 @@ prepared statement.

A prepared statement and an eventual row adapter.

@@ -1188,7 +1188,7 @@ prepared statement.

A prepared request.

@@ -1255,7 +1255,7 @@ statement returned by the prepare method: SELECT COUNT(*) FRO @@ -1338,7 +1338,7 @@ elements are undefined.

A cursor over fetched values.

@@ -1402,7 +1402,7 @@ elements are undefined.

An array of values.

@@ -1469,7 +1469,7 @@ extracted from the first row.

An optional value.

@@ -1552,7 +1552,7 @@ elements are undefined.

A cursor over fetched values.

@@ -1616,7 +1616,7 @@ elements are undefined.

An array of values.

@@ -1660,7 +1660,7 @@ elements are undefined.

@@ -1715,7 +1715,7 @@ returned by the prepare method.

@@ -1807,7 +1807,7 @@ elements are undefined.

A cursor over fetched rows.

@@ -1871,7 +1871,7 @@ elements are undefined.

An array of fetched rows.

@@ -1935,7 +1935,7 @@ elements are undefined.

An optional row.

@@ -2018,7 +2018,7 @@ elements are undefined.

A cursor over fetched values.

@@ -2082,7 +2082,7 @@ elements are undefined.

An array of values.

@@ -2149,7 +2149,7 @@ extracted from the first row.

An optional value.

@@ -2232,7 +2232,7 @@ elements are undefined.

A cursor over fetched values.

@@ -2296,7 +2296,7 @@ elements are undefined.

An array of values.

@@ -2379,7 +2379,7 @@ elements are undefined.

A cursor over fetched records.

@@ -2443,7 +2443,7 @@ elements are undefined.

An array of records.

@@ -2507,7 +2507,7 @@ elements are undefined.

An optional record.

@@ -2577,7 +2577,7 @@ main queue.

a ValueObservation.

@@ -2614,7 +2614,7 @@ fresh values whenever the request is modified by a database transaction.

For example:

-
let request = Player.select(Column("name"), as: String.self)
+
let request = Player.select(Column("name"), as: String.self)
 let observation = request.observationForAll()
 
 let observer = try observation.start(in: dbQueue) { names: [String] in
@@ -2647,7 +2647,7 @@ main queue.
                         

a ValueObservation.

@@ -2672,7 +2672,7 @@ main queue. fresh value whenever the request is modified by a database transaction.

For example:

-
let request = Player.select(max(Column("score")), as: Int.self)
+
let request = Player.select(max(Column("score")), as: Int.self)
 let observation = request.observationForFirst()
 
 let observer = try observation.start(in: dbQueue) { maxScore: Int? in
@@ -2724,7 +2724,7 @@ main queue.
                         

a ValueObservation.

@@ -2761,7 +2761,7 @@ fresh values whenever the request is modified by a database transaction.

For example:

-
let request = Player.select(Column("name"), as: Optional<String>.self)
+
let request = Player.select(Column("name"), as: Optional<String>.self)
 let observation = request.observationForAll()
 
 let observer = try observation.start(in: dbQueue) { names: [String?] in
@@ -2794,7 +2794,7 @@ main queue.
                         

a ValueObservation.

@@ -2820,7 +2820,7 @@ fresh values whenever the request is modified by a database transaction.

For example:

-
let request = Player.select(Column("name"), as: Optional<String>.self)
+
let request = Player.select(Column("name"), as: Optional<String>.self)
 let observation = request.observationForAll()
 
 let observer = try observation.start(in: dbQueue) { names: [String?] in
@@ -2853,7 +2853,7 @@ main queue.
                         

a ValueObservation.

@@ -2923,7 +2923,7 @@ main queue.

a ValueObservation.

@@ -2981,7 +2981,7 @@ main queue.

a ValueObservation.

@@ -3050,7 +3050,7 @@ main queue.

a ValueObservation.

@@ -3108,7 +3108,7 @@ main queue.

a ValueObservation.

@@ -3118,7 +3118,7 @@ main queue. diff --git a/docs/4.2/Protocols/FetchableRecord.html b/docs/4.2/Protocols/FetchableRecord.html index e3da72bfa..2fad4a1c8 100644 --- a/docs/4.2/Protocols/FetchableRecord.html +++ b/docs/4.2/Protocols/FetchableRecord.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1014,7 +1014,7 @@

Types that adopt FetchableRecord can be initialized from a database Row.

let row = try Row.fetchOne(db, sql: "SELECT ...")!
-let player = Player(row)
+let player = Player(row)
 

The protocol comes with built-in methods that allow to fetch cursors, @@ -1078,7 +1078,7 @@ make sure to store a copy: self.row = row.copy().

@@ -1116,14 +1116,14 @@ from database rows.

For example:

// A key that holds a decoder's name
-let decoderName = CodingUserInfoKey(rawValue: "decoderName")!
+let decoderName = CodingUserInfoKey(rawValue: "decoderName")!
 
 // A FetchableRecord + Decodable record
-struct Player: FetchableRecord, Decodable {
+struct Player: FetchableRecord, Decodable {
     // Customize the decoder name when decoding a database row
     static let databaseDecodingUserInfo: [CodingUserInfoKey: Any] = [decoderName: "Database"]
 
-    init(from decoder: Decoder) throws {
+    init(from decoder: Decoder) throws {
         // Print the decoder name
         print(decoder.userInfo[decoderName])
         ...
@@ -1134,7 +1134,7 @@ from database rows.

let player = try Player.fetchOne(db, ...) // prints "JSON" -let decoder = JSONDecoder() +let decoder = JSONDecoder() decoder.userInfo = [decoderName: "JSON"] let player = try decoder.decode(Player.self, from: ...)
@@ -1153,7 +1153,7 @@ from database rows.

@@ -1188,17 +1188,17 @@ following properties:

You can override those defaults:

-
struct Achievement: Decodable {
+
struct Achievement: Decodable {
     var name: String
     var date: Date
 }
 
-struct Player: Decodable, FetchableRecord {
+struct Player: Decodable, FetchableRecord {
     // stored in a JSON column
     var achievements: [Achievement]
 
-    static func databaseJSONDecoder(for column: String) -> JSONDecoder {
-        let decoder = JSONDecoder()
+    static func databaseJSONDecoder(for column: String) -> JSONDecoder {
+        let decoder = JSONDecoder()
         decoder.dateDecodingStrategy = .iso8601
         return decoder
     }
@@ -1226,7 +1226,7 @@ following properties:

@@ -1253,7 +1253,7 @@ protocol, this property controls the decoding of date properties.

Default value is .deferredToDate

For example:

-
struct Player: FetchableRecord, Decodable {
+
struct Player: FetchableRecord, Decodable {
     static let databaseDateDecodingStrategy: DatabaseDateDecodingStrategy = .timeIntervalSince1970
 
     var name: String
@@ -1270,12 +1270,12 @@ protocol, this property controls the decoding of date properties.

Declaration

Swift

-
static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
+
static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
@@ -1364,7 +1364,7 @@ for individual requests with the TableRecord.select method.

A cursor over fetched records.

@@ -1428,7 +1428,7 @@ for individual requests with the TableRecord.select method.

@@ -1492,7 +1492,7 @@ for individual requests with the TableRecord.select method.

@@ -1585,7 +1585,7 @@ for individual requests with the TableRecord.select method.

A cursor over fetched records.

@@ -1664,7 +1664,7 @@ for individual requests with the TableRecord.select method.

An array of records.

@@ -1741,7 +1741,7 @@ for individual requests with the TableRecord.select method.

An optional record.

@@ -1837,7 +1837,7 @@ for individual requests with the TableRecord.select method.

A cursor over fetched records.

@@ -1918,7 +1918,7 @@ for individual requests with the TableRecord.select method.

An array of records.

@@ -1994,7 +1994,7 @@ any key with a unique index on it).

An optional record.

@@ -2105,7 +2105,7 @@ elements are undefined.

A cursor over fetched records.

@@ -2197,7 +2197,7 @@ elements are undefined.

An array of records.

@@ -2289,7 +2289,7 @@ elements are undefined.

An optional record.

@@ -2346,7 +2346,7 @@ elements are undefined.

public static func fetchCursor(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> RecordCursor<Self>
@@ -2412,7 +2412,7 @@ elements are undefined.

A cursor over fetched records.

@@ -2450,7 +2450,7 @@ elements are undefined.

public static func fetchAll(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> [Self]
@@ -2516,7 +2516,7 @@ elements are undefined.

An array of records.

@@ -2554,7 +2554,7 @@ elements are undefined.

public static func fetchOne(
     _ db: Database,
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil)
     throws -> Self?
@@ -2620,7 +2620,7 @@ elements are undefined.

An optional record.

@@ -2715,7 +2715,7 @@ elements are undefined.

A cursor over fetched records.

@@ -2791,7 +2791,7 @@ elements are undefined.

An array of records.

@@ -2867,7 +2867,7 @@ elements are undefined.

An optional record.

@@ -2877,7 +2877,7 @@ elements are undefined.

diff --git a/docs/4.2/Protocols/MutablePersistableRecord.html b/docs/4.2/Protocols/MutablePersistableRecord.html index 297058b0f..d09b647dc 100644 --- a/docs/4.2/Protocols/MutablePersistableRecord.html +++ b/docs/4.2/Protocols/MutablePersistableRecord.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1060,12 +1060,12 @@ updates, which has GRDB generate regular INSERT and UPDATE queries.

Declaration

Swift

-
static var persistenceConflictPolicy: PersistenceConflictPolicy { get }
+
static var persistenceConflictPolicy: PersistenceConflictPolicy { get }
@@ -1093,7 +1093,7 @@ dispatch queue, with the inserted RowID and the eventual INTEGER PRIMARY KEY column name.

This method is optional: the default implementation does nothing.

-
struct Player : MutablePersistableRecord {
+
struct Player : MutablePersistableRecord {
     var id: Int64?
     var name: String?
 
@@ -1151,7 +1151,7 @@ INTEGER PRIMARY KEY column name.

@@ -1238,7 +1238,7 @@ that they invoke the performInsert() method.

@@ -1345,7 +1345,7 @@ match any row in the database. @@ -1425,7 +1425,7 @@ the database.

@@ -1499,7 +1499,7 @@ that they invoke the performDelete() method.

Whether a database row was deleted.

@@ -1574,7 +1574,7 @@ the database.

Whether the primary key matches a row in the database.

@@ -1644,7 +1644,7 @@ match any row in the database. @@ -1739,7 +1739,7 @@ match any row in the database and record could not be updated.

Whether the record had changes.

@@ -1830,7 +1830,7 @@ match any row in the database and record could not be updated.

Whether the record had changes.

@@ -1881,7 +1881,7 @@ implementation of performInsert().

@@ -1959,7 +1959,7 @@ match any row in the database. @@ -2001,7 +2001,7 @@ implementation of performSave().

@@ -2041,7 +2041,7 @@ implementation of performDelete().

@@ -2081,7 +2081,7 @@ implementation of performExists().

@@ -2183,7 +2183,7 @@ match any row in the database and record could not be updated.

Whether the record had changes.

@@ -2256,7 +2256,7 @@ match any row in the database and record could not be updated.

The number of deleted rows

@@ -2351,7 +2351,7 @@ deleted rows.

The number of deleted rows

@@ -2435,7 +2435,7 @@ database row was deleted.

Whether a database row was deleted.

@@ -2518,7 +2518,7 @@ any key with a unique index on it); returns the number of deleted rows.

The number of deleted rows

@@ -2590,7 +2590,7 @@ with a unique index on it); returns whether a database row was deleted.

Whether a database row was deleted.

@@ -2600,7 +2600,7 @@ with a unique index on it); returns whether a database row was deleted.

diff --git a/docs/4.2/Protocols/PersistableRecord.html b/docs/4.2/Protocols/PersistableRecord.html index 10e3f1467..6f3e4e231 100644 --- a/docs/4.2/Protocols/PersistableRecord.html +++ b/docs/4.2/Protocols/PersistableRecord.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1098,7 +1098,7 @@ MutablePersistableRecord protocol instead.

@@ -1174,7 +1174,7 @@ that they invoke the performInsert() method.

@@ -1254,7 +1254,7 @@ the database.

@@ -1305,7 +1305,7 @@ implementation of performInsert().

@@ -1347,7 +1347,7 @@ implementation of performSave().

@@ -1357,7 +1357,7 @@ implementation of performSave().

diff --git a/docs/4.2/Protocols/RowAdapter.html b/docs/4.2/Protocols/RowAdapter.html index 6ab9ec28b..4b381b8df 100644 --- a/docs/4.2/Protocols/RowAdapter.html +++ b/docs/4.2/Protocols/RowAdapter.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1025,7 +1025,7 @@ together.

To use a row adapter, provide it to any method that fetches:

-
let adapter = SuffixRowAdapter(fromIndex: 2)
+
let adapter = SuffixRowAdapter(fromIndex: 2)
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
 
 // [baz:3]
@@ -1061,14 +1061,14 @@ LayoutedColumnMapping.

// An adapter that turns any row to a row that contains a single
 // column named "foo" whose value is the leftmost value of the
 // base row.
-struct FirstColumnAdapter : RowAdapter {
-    func layoutedAdapter(from layout: RowLayout) throws -> LayoutedRowAdapter {
-        return LayoutedColumnMapping(layoutColumns: [(0, "foo")])
+struct FirstColumnAdapter : RowAdapter {
+    func layoutedAdapter(from layout: RowLayout) throws -> LayoutedRowAdapter {
+        return LayoutedColumnMapping(layoutColumns: [(0, "foo")])
     }
 }
 
 // [foo:1]
-try Row.fetchOne(db, sql: "SELECT 1, 2, 3", adapter: FirstColumnAdapter())
+try Row.fetchOne(db, sql: "SELECT 1, 2, 3", adapter: FirstColumnAdapter())
 
@@ -1081,7 +1081,7 @@ LayoutedColumnMapping.

@@ -1141,7 +1141,7 @@ row adapters.

@@ -1151,7 +1151,7 @@ row adapters.

diff --git a/docs/4.2/Protocols/StatementColumnConvertible.html b/docs/4.2/Protocols/StatementColumnConvertible.html index 3f7d149c1..d12591196 100644 --- a/docs/4.2/Protocols/StatementColumnConvertible.html +++ b/docs/4.2/Protocols/StatementColumnConvertible.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1025,7 +1025,7 @@ optimization whenever direct access to SQLite is possible:

let int: Int = row[0] // there } let ints = Int.fetchAll(db, sql: "SELECT ...") // there -struct Player { +struct Player { init(row: Row) { name = row["name"] // there score = row["score"] // there @@ -1056,7 +1056,7 @@ Float, Double, String, and Bool.

Initializes a value from a raw SQLite statement pointer.

For example, here is the how Int64 adopts StatementColumnConvertible:

-
extension Int64: StatementColumnConvertible {
+
extension Int64: StatementColumnConvertible {
     init(sqliteStatement: SQLiteStatement, index: Int32) {
         self = sqlite3_column_int64(sqliteStatement, index)
     }
@@ -1109,7 +1109,7 @@ any extra check.

@@ -1119,7 +1119,7 @@ any extra check.

diff --git a/docs/4.2/Protocols/TableRecord.html b/docs/4.2/Protocols/TableRecord.html index 84fb6da23..dfa85d289 100644 --- a/docs/4.2/Protocols/TableRecord.html +++ b/docs/4.2/Protocols/TableRecord.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1044,7 +1044,7 @@ built-in methods that allow to fetch instances identified by key:

The name of the database table used to build requests.

-
struct Player : TableRecord {
+
struct Player : TableRecord {
     static var databaseTableName = "player"
 }
 
@@ -1070,12 +1070,12 @@ built-in methods that allow to fetch instances identified by key:

Declaration

Swift

-
static var databaseTableName: String { get }
+
static var databaseTableName: String { get }
@@ -1105,9 +1105,9 @@ built-in methods that allow to fetch instances identified by key:

You can provide a custom implementation and provide an explicit list of columns:

-
struct RestrictedPlayer : TableRecord {
+
struct RestrictedPlayer : TableRecord {
     static var databaseTableName = "player"
-    static var databaseSelection = [Column("id"), Column("name")]
+    static var databaseSelection = [Column("id"), Column("name")]
 }
 
 // SELECT id, name FROM player
@@ -1115,9 +1115,9 @@ of columns:

You can also add extra columns such as the rowid column:

-
struct ExtendedPlayer : TableRecord {
+
struct ExtendedPlayer : TableRecord {
     static var databaseTableName = "player"
-    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
+    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
 }
 
 // SELECT *, rowid FROM player
@@ -1139,7 +1139,7 @@ of columns:

@@ -1193,7 +1193,7 @@ for individual requests with the TableRecord.select method.

@@ -1220,8 +1220,8 @@ for individual requests with the TableRecord.select method.

Creates a Belongs To association between Self and the destination type.

-
struct Author: TableRecord { ... }
-struct Book: TableRecord {
+
struct Author: TableRecord { ... }
+struct Book: TableRecord {
     static let author = belongsTo(Author.self)
 }
 
@@ -1234,22 +1234,22 @@ and the destination type:

To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

-
struct BookInfo: FetchableRecord, Decodable {
+
struct BookInfo: FetchableRecord, Decodable {
     var book: Book
     var author: Author?
 }
 
-let bookInfos = try dbQueue.read { db in
+let bookInfos = try dbQueue.read { db in
     return try BookInfo.fetchAll(db, request)
 }
-for bookInfo in bookInfos {
+for bookInfo in bookInfos {
     print("\(bookInfo.book.title) by \(bookInfo.author.name)")
 }
 

It is recommended that you define, alongside the static association, a property with the same name:

-
struct Book: TableRecord, EncodableRecord {
+
struct Book: TableRecord, EncodableRecord {
     static let author = belongsTo(Author.self)
     var author: QueryInterfaceRequest<Author> {
         return request(for: Book.author)
@@ -1259,7 +1259,7 @@ property with the same name:

This property will let you navigate from the source type to the destination type:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let book: Book = ...
     let author = try book.author.fetchOne(db) // Author?
 }
@@ -1327,7 +1327,7 @@ foreign keys to the destination table.

@@ -1350,8 +1350,8 @@ foreign keys to the destination table.

Creates a Has many association between Self and the destination type.

-
struct Book: TableRecord { ... }
-struct Author: TableRecord {
+
struct Book: TableRecord { ... }
+struct Author: TableRecord {
     static let books = hasMany(Book.self)
 }
 
@@ -1364,22 +1364,22 @@ and the destination type:

To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

-
struct Authorship: FetchableRecord, Decodable {
+
struct Authorship: FetchableRecord, Decodable {
     var author: Author
     var book: Book
 }
 
-let authorships = try dbQueue.read { db in
+let authorships = try dbQueue.read { db in
     return try Authorship.fetchAll(db, request)
 }
-for authorship in authorships {
+for authorship in authorships {
     print("\(authorship.author.name) wrote \(authorship.book.title)")
 }
 

It is recommended that you define, alongside the static association, a property with the same name:

-
struct Author: TableRecord, EncodableRecord {
+
struct Author: TableRecord, EncodableRecord {
     static let books = hasMany(Book.self)
     var books: QueryInterfaceRequest<Book> {
         return request(for: Author.books)
@@ -1389,7 +1389,7 @@ property with the same name:

This property will let you navigate from the source type to the destination type:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let author: Author = ...
     let books = try author.books.fetchAll(db) // [Book]
 }
@@ -1457,7 +1457,7 @@ foreign keys from the destination table.

@@ -1480,16 +1480,16 @@ foreign keys from the destination table.

Creates a Has Many Through association between Self and the destination type.

-
struct Country: TableRecord {
+
struct Country: TableRecord {
     static let passports = hasMany(Passport.self)
     static let citizens = hasMany(Citizen.self, through: passports, using: Passport.citizen)
 }
 
-struct Passport: TableRecord {
+struct Passport: TableRecord {
     static let citizen = belongsTo(Citizen.self)
 }
 
-struct Citizen: TableRecord { }
+struct Citizen: TableRecord { }
 

The association will let you define requests that load both the source @@ -1500,22 +1500,22 @@ and the destination type:

To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

-
struct Citizenship: FetchableRecord, Decodable {
+
struct Citizenship: FetchableRecord, Decodable {
     var country: Country
     var citizen: Citizen
 }
 
-let citizenships = try dbQueue.read { db in
+let citizenships = try dbQueue.read { db in
     return try Citizenship.fetchAll(db, request)
 }
-for citizenship in citizenships {
+for citizenship in citizenships {
     print("\(citizenship.citizen.name) is a citizen of \(citizenship.country.name)")
 }
 

It is recommended that you define, alongside the static association, a property with the same name:

-
struct Country: TableRecord, EncodableRecord {
+
struct Country: TableRecord, EncodableRecord {
     static let passports = hasMany(Passport.self)
     static let citizens = hasMany(Citizen.self, through: passports, using: Passport.citizen)
     var citizens: QueryInterfaceRequest<Citizen> {
@@ -1526,7 +1526,7 @@ property with the same name:

This property will let you navigate from the source type to the destination type:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let country: Country = ...
     let citizens = try country.citizens.fetchAll(db) // [Country]
 }
@@ -1608,7 +1608,7 @@ is the same key as the target.

@@ -1631,8 +1631,8 @@ is the same key as the target.

Creates a Has one association between Self and the destination type.

-
struct Demographics: TableRecord { ... }
-struct Country: TableRecord {
+
struct Demographics: TableRecord { ... }
+struct Country: TableRecord {
     static let demographics = hasOne(Demographics.self)
 }
 
@@ -1645,22 +1645,22 @@ and the destination type:

To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

-
struct CountryInfo: FetchableRecord, Decodable {
+
struct CountryInfo: FetchableRecord, Decodable {
     var country: Country
     var demographics: Demographics?
 }
 
-let countryInfos = try dbQueue.read { db in
+let countryInfos = try dbQueue.read { db in
     return try CountryInfo.fetchAll(db, request)
 }
-for countryInfo in countryInfos {
+for countryInfo in countryInfos {
     print("\(countryInfo.country.name) has \(countryInfo.demographics.population) citizens")
 }
 

It is recommended that you define, alongside the static association, a property with the same name:

-
struct Country: TableRecord, EncodableRecord {
+
struct Country: TableRecord, EncodableRecord {
     static let demographics = hasOne(Demographics.self)
     var demographics: QueryInterfaceRequest<Demographics> {
         return request(for: Country.demographics)
@@ -1670,7 +1670,7 @@ property with the same name:

This property will let you navigate from the source type to the destination type:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let country: Country = ...
     let demographics = try country.demographics.fetchOne(db) // Demographics?
 }
@@ -1738,7 +1738,7 @@ foreign keys from the destination table.

@@ -1761,16 +1761,16 @@ foreign keys from the destination table.

Creates a Has One Through association between Self and the destination type.

-
struct Book: TableRecord {
+
struct Book: TableRecord {
     static let library = belongsTo(Library.self)
     static let returnAddress = hasOne(Address.self, through: library, using: library.address)
 }
 
-struct Library: TableRecord {
+struct Library: TableRecord {
     static let address = hasOne(Address.self)
 }
 
-struct Address: TableRecord { ... }
+struct Address: TableRecord { ... }
 

The association will let you define requests that load both the source @@ -1781,22 +1781,22 @@ and the destination type:

To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

-
struct Todo: FetchableRecord, Decodable {
+
struct Todo: FetchableRecord, Decodable {
     var book: Book
     var address: Address
 }
 
-let todos = try dbQueue.read { db in
+let todos = try dbQueue.read { db in
     return try Todo.fetchAll(db, request)
 }
-for todo in todos {
+for todo in todos {
     print("Please return \(todo.book) to \(todo.address)")
 }
 

It is recommended that you define, alongside the static association, a property with the same name:

-
struct Book: TableRecord, EncodableRecord {
+
struct Book: TableRecord, EncodableRecord {
     static let library = belongsTo(Library.self)
     static let returnAddress = hasOne(Address.self, through: library, using: library.address)
     var returnAddress: QueryInterfaceRequest<Address> {
@@ -1807,7 +1807,7 @@ property with the same name:

This property will let you navigate from the source type to the destination type:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let book: Book = ...
     let address = try book.returnAddress.fetchOne(db) // Address?
 }
@@ -1889,7 +1889,7 @@ is the same key as the target.

@@ -1917,7 +1917,7 @@ is the same key as the target.

Creates a request that fetches the associated record(s).

For example:

-
struct Team: TableRecord, EncodableRecord {
+
struct Team: TableRecord, EncodableRecord {
     static let players = hasMany(Player.self)
     var players: QueryInterfaceRequest<Player> {
         return request(for: Team.players)
@@ -1940,7 +1940,7 @@ is the same key as the target.

@@ -1986,7 +1986,7 @@ is the same key as the target.

@@ -2023,7 +2023,7 @@ require that the associated database table contains a matching row.

@@ -2060,7 +2060,7 @@ that the associated database table contains a matching row.

@@ -2097,7 +2097,7 @@ require that the associated database table contains a matching row.

@@ -2134,7 +2134,7 @@ that the associated database table contains a matching row.

@@ -2182,7 +2182,7 @@ that the associated database table contains a matching row.

@@ -2219,7 +2219,7 @@ that the associated database table contains a matching row.

@@ -2262,7 +2262,7 @@ for individual requests with the TableRecord.select method.

@@ -2313,7 +2313,7 @@ for individual requests with the TableRecord.select method.

@@ -2346,7 +2346,7 @@ for individual requests with the TableRecord.select method.

@@ -2369,7 +2369,7 @@ for individual requests with the TableRecord.select method.

Creates a request which selects selection.

// SELECT id, email FROM player
-let request = Player.select(Column("id"), Column("email"))
+let request = Player.select(Column("id"), Column("email"))
 
@@ -2382,7 +2382,7 @@ for individual requests with the TableRecord.select method.

@@ -2405,7 +2405,7 @@ for individual requests with the TableRecord.select method.

Creates a request which selects selection.

// SELECT id, email FROM player
-let request = Player.select([Column("id"), Column("email")])
+let request = Player.select([Column("id"), Column("email")])
 
@@ -2418,7 +2418,7 @@ for individual requests with the TableRecord.select method.

@@ -2451,13 +2451,13 @@ for individual requests with the TableRecord.select method.

Swift

public static func select(
     sql: String,
-    arguments: StatementArguments = StatementArguments())
+    arguments: StatementArguments = StatementArguments())
     -> QueryInterfaceRequest<Self>
@@ -2480,7 +2480,7 @@ for individual requests with the TableRecord.select method.

Creates a request which selects an SQL literal.

// SELECT id, email FROM player
-let request = Player.select(literal: SQLLiteral(sql: "id, email"))
+let request = Player.select(literal: SQLLiteral(sql: "id, email"))
 
@@ -2493,7 +2493,7 @@ for individual requests with the TableRecord.select method.

@@ -2516,9 +2516,9 @@ for individual requests with the TableRecord.select method.

Creates a request which selects selection, and fetches values of type type.

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     // SELECT max(score) FROM player
-    let request = Player.select([max(Column("score"))], as: Int.self)
+    let request = Player.select([max(Column("score"))], as: Int.self)
     let maxScore: Int? = try request.fetchOne(db)
 }
 
@@ -2536,7 +2536,7 @@ type type.

@@ -2559,9 +2559,9 @@ type type.

Creates a request which selects selection, and fetches values of type type.

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     // SELECT max(score) FROM player
-    let request = Player.select(max(Column("score")), as: Int.self)
+    let request = Player.select(max(Column("score")), as: Int.self)
     let maxScore: Int? = try request.fetchOne(db)
 }
 
@@ -2579,7 +2579,7 @@ type type.

@@ -2602,7 +2602,7 @@ type type.

Creates a request which selects sql, and fetches values of type type.

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     // SELECT max(score) FROM player
     let request = Player.select(sql: "max(score)", as: Int.self)
     let maxScore: Int? = try request.fetchOne(db)
@@ -2616,14 +2616,14 @@ type type.

Swift

public static func select<RowDecoder>(
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     as type: RowDecoder.Type)
     -> QueryInterfaceRequest<RowDecoder>
@@ -2646,9 +2646,9 @@ type type.

Creates a request which selects an SQL literal, and fetches values of type type.

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     // SELECT max(score) FROM player
-    let request = Player.select(literal: SQLLiteral(sql: "max(score)"), as: Int.self)
+    let request = Player.select(literal: SQLLiteral(sql: "max(score)"), as: Int.self)
     let maxScore: Int? = try request.fetchOne(db)
 }
 
@@ -2666,7 +2666,7 @@ type type.

@@ -2690,8 +2690,8 @@ type type.

Creates a request which appends selection.

// SELECT id, email, name FROM player
 le request = Player
-    .select([Column("id"), Column("email")])
-    .annotated(with: [Column("name")])
+    .select([Column("id"), Column("email")])
+    .annotated(with: [Column("name")])
 
@@ -2704,7 +2704,7 @@ type type.

@@ -2728,8 +2728,8 @@ type type.

Creates a request which appends selection.

// SELECT id, email, name FROM player
 le request = Player
-    .select([Column("id"), Column("email")])
-    .annotated(with: Column("name"))
+    .select([Column("id"), Column("email")])
+    .annotated(with: Column("name"))
 
@@ -2742,7 +2742,7 @@ type type.

@@ -2765,7 +2765,7 @@ type type.

Creates a request with the provided predicate.

// SELECT * FROM player WHERE email = 'arthur@example.com'
-let request = Player.filter(Column("email") == "arthur@example.com")
+let request = Player.filter(Column("email") == "arthur@example.com")
 

The selection defaults to all columns. This default can be changed for @@ -2782,7 +2782,7 @@ for individual requests with the TableRecord.select method.

@@ -2824,7 +2824,7 @@ for individual requests with the TableRecord.select method.

@@ -2866,7 +2866,7 @@ for individual requests with the TableRecord.select method.

@@ -2909,7 +2909,7 @@ for individual requests with the TableRecord.select method.

@@ -2952,7 +2952,7 @@ for individual requests with the TableRecord.select method.

@@ -2989,13 +2989,13 @@ for individual requests with the TableRecord.select method.

Swift

public static func filter(
     sql: String,
-    arguments: StatementArguments = StatementArguments())
+    arguments: StatementArguments = StatementArguments())
     -> QueryInterfaceRequest<Self>
@@ -3018,7 +3018,7 @@ for individual requests with the TableRecord.select method.

Creates a request with the provided predicate.

// SELECT * FROM player WHERE email = 'arthur@example.com'
-let request = Player.filter(literal: SQLLiteral(sql: "email = ?", arguments: ["arthur@example.com"]))
+let request = Player.filter(literal: SQLLiteral(sql: "email = ?", arguments: ["arthur@example.com"]))
 

With Swift 5, you can safely embed raw values in your SQL queries, @@ -3040,7 +3040,7 @@ for individual requests with the TableRecord.select method.

@@ -3064,7 +3064,7 @@ for individual requests with the TableRecord.select method.

Creates a request sorted according to the provided orderings.

// SELECT * FROM player ORDER BY name
-let request = Player.order(Column("name"))
+let request = Player.order(Column("name"))
 

The selection defaults to all columns. This default can be changed for @@ -3081,7 +3081,7 @@ for individual requests with the TableRecord.select method.

@@ -3105,7 +3105,7 @@ for individual requests with the TableRecord.select method.

Creates a request sorted according to the provided orderings.

// SELECT * FROM player ORDER BY name
-let request = Player.order([Column("name")])
+let request = Player.order([Column("name")])
 

The selection defaults to all columns. This default can be changed for @@ -3122,7 +3122,7 @@ for individual requests with the TableRecord.select method.

@@ -3165,7 +3165,7 @@ for individual requests with the TableRecord.select method.

@@ -3202,13 +3202,13 @@ for individual requests with the TableRecord.select method.

Swift

public static func order(
     sql: String,
-    arguments: StatementArguments = StatementArguments())
+    arguments: StatementArguments = StatementArguments())
     -> QueryInterfaceRequest<Self>
@@ -3231,7 +3231,7 @@ for individual requests with the TableRecord.select method.

Creates a request sorted according to an SQL literal.

// SELECT * FROM player ORDER BY name
-let request = Player.order(literal: SQLLiteral(sql: "name"))
+let request = Player.order(literal: SQLLiteral(sql: "name"))
 

With Swift 5, you can safely embed raw values in your SQL queries, @@ -3254,7 +3254,7 @@ for individual requests with the TableRecord.select method.

@@ -3295,7 +3295,7 @@ for individual requests with the TableRecord.select method.

@@ -3321,16 +3321,16 @@ a specific database table.

In the example below, the team.avgScore < player.score condition in the ON clause could be not achieved without table aliases.

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
 // SELECT player.*, team.*
 // JOIN team ON ... AND team.avgScore < player.score
-let playerAlias = TableAlias()
+let playerAlias = TableAlias()
 let request = Player
     .aliased(playerAlias)
-    .including(required: Player.team.filter(Column("avgScore") < playerAlias[Column("score")])
+    .including(required: Player.team.filter(Column("avgScore") < playerAlias[Column("score")])
 
@@ -3343,7 +3343,7 @@ the ON clause could be not achieved without table aliases.

@@ -3406,7 +3406,7 @@ the ON clause could be not achieved without table aliases.

@@ -3441,7 +3441,7 @@ the ON clause could be not achieved without table aliases.

The selection as an SQL String.

For example:

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let databaseTableName = "player"
 }
 
@@ -3462,7 +3462,7 @@ the ON clause could be not achieved without table aliases.

@@ -3486,11 +3486,11 @@ the ON clause could be not achieved without table aliases.

Returns the number of selected columns.

For example:

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let databaseTableName = "player"
 }
 
-try dbQueue.write { db in
+try dbQueue.write { db in
     try db.create(table: "player") { t in
         t.autoIncrementedPrimaryKey("id")
         t.column("name", .text)
@@ -3512,7 +3512,7 @@ the ON clause could be not achieved without table aliases.

@@ -3581,7 +3581,7 @@ main queue.

a ValueObservation.

@@ -3650,7 +3650,7 @@ main queue.

a ValueObservation.

@@ -3708,7 +3708,7 @@ main queue.

a ValueObservation.

@@ -3718,7 +3718,7 @@ main queue. diff --git a/docs/4.2/Protocols/TransactionObserver.html b/docs/4.2/Protocols/TransactionObserver.html index feae9f48f..b551296ec 100644 --- a/docs/4.2/Protocols/TransactionObserver.html +++ b/docs/4.2/Protocols/TransactionObserver.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1047,7 +1047,7 @@ databaseDidChange(with:) method.

@@ -1095,7 +1095,7 @@ stopObservingDatabaseChangesUntilNextTransaction() method.

@@ -1146,7 +1146,7 @@ has an opportunity to rollback pending changes by throwing an error.

@@ -1178,7 +1178,7 @@ has an opportunity to rollback pending changes by throwing an error.

@@ -1210,7 +1210,7 @@ has an opportunity to rollback pending changes by throwing an error.

@@ -1307,10 +1307,10 @@ and may provide most/all of what you need. method won’t be called until the next transaction.

For example:

-
class PlayerObserver: TransactionObserver {
+
class PlayerObserver: TransactionObserver {
     var playerTableWasModified = false
 
-    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
+    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
         return eventKind.tableName == "player"
     }
 
@@ -1338,7 +1338,7 @@ method won’t be called until the next transaction.

@@ -1348,7 +1348,7 @@ method won’t be called until the next transaction.

diff --git a/docs/4.2/Protocols/ValueReducer.html b/docs/4.2/Protocols/ValueReducer.html index d1c00bea9..87e30cc73 100644 --- a/docs/4.2/Protocols/ValueReducer.html +++ b/docs/4.2/Protocols/ValueReducer.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1138,7 +1138,7 @@ when observer should not be notified.

@@ -1178,7 +1178,7 @@ transformation which each element emitted by this reducer.

@@ -1218,7 +1218,7 @@ transformation which each element emitted by this reducer.

@@ -1258,7 +1258,7 @@ transformation which each element emitted by this reducer.

@@ -1293,7 +1293,7 @@ transformation which each element emitted by this reducer.

@@ -1303,7 +1303,7 @@ transformation which each element emitted by this reducer.

diff --git a/docs/4.2/Protocols/VirtualTableModule.html b/docs/4.2/Protocols/VirtualTableModule.html index 03bbe642c..0ac819b1f 100644 --- a/docs/4.2/Protocols/VirtualTableModule.html +++ b/docs/4.2/Protocols/VirtualTableModule.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1057,7 +1057,7 @@ FTS4 and FTS5.

@@ -1082,12 +1082,12 @@ FTS4 and FTS5.

Declaration

Swift

-
var moduleName: String { get }
+
var moduleName: String { get }
@@ -1122,7 +1122,7 @@ FTS4 and FTS5.

@@ -1152,7 +1152,7 @@ FTS4 and FTS5.

@@ -1183,7 +1183,7 @@ been created.

@@ -1193,7 +1193,7 @@ been created.

diff --git a/docs/4.2/Structs.html b/docs/4.2/Structs.html index 77c622052..63583b266 100644 --- a/docs/4.2/Structs.html +++ b/docs/4.2/Structs.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1038,7 +1038,7 @@ @@ -1089,7 +1089,7 @@ @@ -1122,7 +1122,7 @@ @@ -1191,7 +1191,7 @@ @@ -1223,7 +1223,7 @@ @@ -1258,7 +1258,7 @@ @@ -1289,7 +1289,7 @@ @@ -1352,7 +1352,7 @@ cover a full table, or the combination of columns and rows:

@@ -1394,7 +1394,7 @@ cover a full table, or the combination of columns and rows:

@@ -1421,7 +1421,7 @@ requests, and notifies each database transaction whenever the database changes.

For example:

-
let observation = DatabaseRegionObservation(tracking: Player.all)
+
let observation = DatabaseRegionObservation(tracking: Player.all)
 let observer = try observation.start(in: dbQueue) { db: Database in
     print("Players have changed.")
 }
@@ -1438,7 +1438,7 @@ database changes.

@@ -1482,7 +1482,7 @@ database changes.

@@ -1524,7 +1524,7 @@ database changes.

@@ -1566,7 +1566,7 @@ database changes.

@@ -1611,7 +1611,7 @@ hiding its specifics.

@@ -1652,7 +1652,7 @@ hiding its specifics.

@@ -1687,7 +1687,7 @@ hiding its specifics.

@@ -1706,7 +1706,7 @@ hiding its specifics.

ColumnMapping is a row adapter that maps column names.

-
let adapter = ColumnMapping(["foo": "bar"])
+
let adapter = ColumnMapping(["foo": "bar"])
 let sql = "SELECT 'foo' AS foo, 'bar' AS bar, 'baz' AS baz"
 
 // [foo:"bar"]
@@ -1724,7 +1724,7 @@ hiding its specifics.

@@ -1743,7 +1743,7 @@ hiding its specifics.

SuffixRowAdapter is a row adapter that hides the first columns in a row.

-
let adapter = SuffixRowAdapter(fromIndex: 2)
+
let adapter = SuffixRowAdapter(fromIndex: 2)
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
 
 // [baz:3]
@@ -1761,7 +1761,7 @@ hiding its specifics.

@@ -1780,7 +1780,7 @@ hiding its specifics.

RangeRowAdapter is a row adapter that only exposes a range of columns.

-
let adapter = RangeRowAdapter(1..<3)
+
let adapter = RangeRowAdapter(1..<3)
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz, 4 as qux"
 
 // [bar:2 baz:3]
@@ -1798,7 +1798,7 @@ hiding its specifics.

@@ -1818,11 +1818,11 @@ hiding its specifics.

ScopeAdapter is a row adapter that lets you define scopes on rows.

// Two adapters
-let fooAdapter = ColumnMapping(["value": "foo"])
-let barAdapter = ColumnMapping(["value": "bar"])
+let fooAdapter = ColumnMapping(["value": "foo"])
+let barAdapter = ColumnMapping(["value": "bar"])
 
 // Define scopes
-let adapter = ScopeAdapter([
+let adapter = ScopeAdapter([
     "foo": fooAdapter,
     "bar": barAdapter])
 
@@ -1850,7 +1850,7 @@ hiding its specifics.

@@ -1876,7 +1876,7 @@ hiding its specifics.

Interpolation.

For example:

-
try dbQueue.write { db in
+
try dbQueue.write { db in
     let name: String = ...
     let id: Int64 = ...
     let query: SQLLiteral = "UPDATE player SET name = \(name) WHERE id = \(id)"
@@ -1895,7 +1895,7 @@ Interpolation.

@@ -1930,7 +1930,7 @@ Interpolation.

@@ -1977,7 +1977,7 @@ number already assigned

To fill question marks placeholders, feed StatementArguments with an array:

db.execute(
     sql: "INSERT ... (?, ?)",
-    arguments: StatementArguments(["Arthur", 41]))
+    arguments: StatementArguments(["Arthur", 41]))
 
 // Array literals are automatically converted:
 db.execute(
@@ -1989,7 +1989,7 @@ number already assigned
 

To fill named arguments, feed StatementArguments with a dictionary:

db.execute(
     sql: "INSERT ... (:name, :score)",
-    arguments: StatementArguments(["name": "Arthur", "score": 41]))
+    arguments: StatementArguments(["name": "Arthur", "score": 41]))
 
 // Dictionary literals are automatically converted:
 db.execute(
@@ -2048,7 +2048,7 @@ confusing, and it is best to avoid this practice:

@@ -2083,7 +2083,7 @@ confusing, and it is best to avoid this practice:

@@ -2125,7 +2125,7 @@ confusing, and it is best to avoid this practice:

@@ -2168,7 +2168,7 @@ confusing, and it is best to avoid this practice:

FTS3 lets you define fts3 virtual tables.

// CREATE VIRTUAL TABLE document USING fts3(content)
-try db.create(virtualTable: "document", using: FTS3()) { t in
+try db.create(virtualTable: "document", using: FTS3()) { t in
     t.column("content")
 }
 
@@ -2184,7 +2184,7 @@ confusing, and it is best to avoid this practice:

@@ -2219,7 +2219,7 @@ confusing, and it is best to avoid this practice:

@@ -2242,7 +2242,7 @@ confusing, and it is best to avoid this practice:

An FTS3 tokenizer, suitable for FTS3 and FTS4 table definitions:

-
db.create(virtualTable: "book", using: FTS4()) { t in
+
db.create(virtualTable: "book", using: FTS4()) { t in
     t.tokenizer = .simple // FTS3TokenizerDescriptor
 }
 
@@ -2260,7 +2260,7 @@ confusing, and it is best to avoid this practice:

@@ -2284,7 +2284,7 @@ confusing, and it is best to avoid this practice:

FTS4 lets you define fts4 virtual tables.

// CREATE VIRTUAL TABLE document USING fts4(content)
-try db.create(virtualTable: "document", using: FTS4()) { t in
+try db.create(virtualTable: "document", using: FTS4()) { t in
     t.column("content")
 }
 
@@ -2302,7 +2302,7 @@ confusing, and it is best to avoid this practice:

@@ -2326,7 +2326,7 @@ confusing, and it is best to avoid this practice:

FTS5 lets you define fts5 virtual tables.

// CREATE VIRTUAL TABLE document USING fts5(content)
-try db.create(virtualTable: "document", using: FTS5()) { t in
+try db.create(virtualTable: "document", using: FTS5()) { t in
     t.column("content")
 }
 
@@ -2406,7 +2406,7 @@ confusing, and it is best to avoid this practice:

An FTS5 tokenizer, suitable for FTS5 table definitions:

-
db.create(virtualTable: "book", using: FTS5()) { t in
+
db.create(virtualTable: "book", using: FTS5()) { t in
     t.tokenizer = .unicode61() // FTS5TokenizerDescriptor
 }
 
@@ -2469,7 +2469,7 @@ applied in order, once and only once.

When a user upgrades your application, only non-applied migration are run.

Usage:

-
var migrator = DatabaseMigrator()
+
var migrator = DatabaseMigrator()
 
 // 1st migration
 migrator.registerMigration("createLibrary") { db in
@@ -2516,7 +2516,7 @@ applied in order, once and only once.

@@ -2542,7 +2542,7 @@ applied in order, once and only once.

population of associated records.

For example:

-
struct Author: TableRecord {
+
struct Author: TableRecord {
     static let books = hasMany(Book.self)
 }
 
@@ -2572,7 +2572,7 @@ of aggregates:

@@ -2600,8 +2600,8 @@ type to another record type, such as each instance of the declaring record

For example, if your application includes authors and books, and each book is assigned its author, you’d declare the association this way:

-
struct Author: TableRecord { ... }
-struct Book: TableRecord {
+
struct Author: TableRecord { ... }
+struct Book: TableRecord {
     static let author = belongsTo(Author.self)
     ...
 }
@@ -2650,8 +2650,8 @@ speaking, all primary keys are supported.

If the database schema does not define foreign keys between tables, you can still use BelongsTo associations. But your help is needed to define the missing foreign key:

-
struct Book: FetchableRecord, TableRecord {
-    static let author = belongsTo(Author.self, using: ForeignKey(...))
+
struct Book: FetchableRecord, TableRecord {
+    static let author = belongsTo(Author.self, using: ForeignKey(...))
 }
 
@@ -2667,7 +2667,7 @@ missing foreign key:

@@ -2695,8 +2695,8 @@ instances of the other record.

For example, if your application includes authors and books, and each author is assigned zero or more books, you’d declare the association this way:

-
struct Book: TableRecord { ... }
-struct Author: TableRecord {
+
struct Book: TableRecord { ... }
+struct Author: TableRecord {
     static let books = hasMany(Book.self)
     ...
 }
@@ -2745,8 +2745,8 @@ speaking, all primary keys are supported.

If the database schema does not define foreign keys between tables, you can still use HasMany associations. But your help is needed to define the missing foreign key:

-
struct Author: TableRecord {
-    static let books = hasMany(Book.self, using: ForeignKey(...))
+
struct Author: TableRecord {
+    static let books = hasMany(Book.self, using: ForeignKey(...))
 }
 
@@ -2762,7 +2762,7 @@ missing foreign key:

@@ -2791,18 +2791,18 @@ record by proceeding through a third record.

For example, consider the practice of passport delivery. One coutry has many citizens through its passports:

-
struct Country: TableRecord {
+
struct Country: TableRecord {
     static let passports = hasMany(Passport.self)
     static let citizens = hasMany(Citizen.self, through: passports, using: Passport.citizen)
     ...
 }
 
-struct Passport: TableRecord {
+struct Passport: TableRecord {
     static let citizen = belongsTo(Citizen.self)
     ...
 }
 
-struct Citizen: TableRecord { ... }
+struct Citizen: TableRecord { ... }
 

The HasManyThrough association is also useful for setting up @@ -2810,16 +2810,16 @@ record by proceeding through a third record.

has many sections, and a section has many paragraphs, you may sometimes want to get a simple collection of all paragraphs in the document. You could set that up this way:

-
struct Document: TableRecord {
+
struct Document: TableRecord {
     static let sections = hasMany(Section.self)
     static let paragraphs = hasMany(Paragraph.self, through: sections, using: Section.paragraphs)
 }
 
-struct Section: TableRecord {
+struct Section: TableRecord {
     static let paragraphs = hasMany(Paragraph.self)
 }
 
-struct Paragraph: TableRecord {
+struct Paragraph: TableRecord {
 }
 
@@ -2838,7 +2838,7 @@ HasManyThrough, etc).

@@ -2867,8 +2867,8 @@ instances of the other record.

For example, if your application has one database table for countries, and another for their demographic profiles, you’d declare the association this way:

-
struct Demographics: TableRecord { ... }
-struct Country: TableRecord {
+
struct Demographics: TableRecord { ... }
+struct Country: TableRecord {
     static let demographics = hasOne(Demographics.self)
     ...
 }
@@ -2918,8 +2918,8 @@ speaking, all primary keys are supported.

If the database schema does not follow this convention, and does not define foreign keys between tables, you can still use HasOne associations. But your help is needed to define the missing foreign key:

-
struct Country: FetchableRecord, TableRecord {
-    static let demographics = hasOne(Demographics.self, using: ForeignKey(...))
+
struct Country: FetchableRecord, TableRecord {
+    static let demographics = hasOne(Demographics.self, using: ForeignKey(...))
 }
 
@@ -2935,7 +2935,7 @@ your help is needed to define the missing foreign key:

@@ -2962,18 +2962,18 @@ another record. This association indicates that the declaring record can be matched with one instance of another record by proceeding through a third record. For example, if each book belongs to a library, and each library has one address, then one knows where the book should be returned to:

-
struct Book: TableRecord {
+
struct Book: TableRecord {
     static let library = belongsTo(Library.self)
     static let returnAddress = hasOne(Address.self, through: library, using: library.address)
     ...
 }
 
-struct Library: TableRecord {
+struct Library: TableRecord {
     static let address = hasOne(Address.self)
     ...
 }
 
-struct Address: TableRecord { ... }
+struct Address: TableRecord { ... }
 

As in the example above, HasOneThrough association is always built from @@ -2991,7 +2991,7 @@ HasOneThrough).

@@ -3016,10 +3016,10 @@ HasOneThrough).

QueryInterfaceRequest is a request that generates SQL for you.

For example:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let request = Player
-        .filter(Column("score") > 1000)
-        .order(Column("name"))
+        .filter(Column("score") > 1000)
+        .order(Column("name"))
     let players = try request.fetchAll(db) // [Player]
 }
 
@@ -3037,7 +3037,7 @@ HasOneThrough).

@@ -3077,7 +3077,7 @@ Instead, adopt the ColumnExpression protocol.

@@ -3109,12 +3109,12 @@ Instead, adopt the ColumnExpression protocol.

Experimental

SQLExpressionLiteral is an expression built from a raw SQL snippet.

-
SQLExpressionLiteral(sql: "1 + 2")
+
SQLExpressionLiteral(sql: "1 + 2")
 

The SQL literal may contain ? and colon-prefixed arguments:

-
SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
-SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
+
SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
+SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
 
See more @@ -3128,7 +3128,7 @@ Instead, adopt the ColumnExpression protocol.

@@ -3172,7 +3172,7 @@ Instead, adopt the ColumnExpression protocol.

@@ -3207,9 +3207,9 @@ Instead, adopt the ColumnExpression protocol.

TableRecord.databaseSelection.

For example:

-
struct Player : TableRecord {
+
struct Player : TableRecord {
     static var databaseTableName = "player"
-    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
+    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
 }
 
 // SELECT *, rowid FROM player
@@ -3227,7 +3227,7 @@ TableRecord.databaseSelection.

@@ -3269,10 +3269,10 @@ foreign key from book to person, or Could not infer foreign key from book to person.

Your help is needed. You have to instruct GRDB which foreign key to use:

-
struct Book: TableRecord {
+
struct Book: TableRecord {
     // Define foreign keys
-    static let authorForeignKey = ForeignKey(["authorId"]))
-    static let translatorForeignKey = ForeignKey(["translatorId"]))
+    static let authorForeignKey = ForeignKey(["authorId"]))
+    static let translatorForeignKey = ForeignKey(["translatorId"]))
 
     // Use foreign keys to define associations:
     static let author = belongsTo(Person.self, using: authorForeignKey)
@@ -3283,27 +3283,27 @@ to person.

Foreign keys are always defined from the table that contains the columns at the origin of the foreign key. Person’s symmetric HasMany associations reuse Book’s foreign keys:

-
struct Person: TableRecord {
+
struct Person: TableRecord {
     static let writtenBooks = hasMany(Book.self, using: Book.authorForeignKey)
     static let translatedBooks = hasMany(Book.self, using: Book.translatorForeignKey)
 }
 

Foreign keys can also be defined from query interface columns:

-
struct Book: TableRecord {
-    enum Columns: String, ColumnExpression {
+
struct Book: TableRecord {
+    enum Columns: String, ColumnExpression {
         case id, title, authorId, translatorId
     }
 
-    static let authorForeignKey = ForeignKey([Columns.authorId]))
-    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
+    static let authorForeignKey = ForeignKey([Columns.authorId]))
+    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
 }
 

When the destination table of a foreign key does not define any primary key, you need to provide the full definition of a foreign key:

-
struct Book: TableRecord {
-    static let authorForeignKey = ForeignKey(["authorId"], to: ["id"]))
+
struct Book: TableRecord {
+    static let authorForeignKey = ForeignKey(["authorId"], to: ["id"]))
     static let author = belongsTo(Person.self, using: authorForeignKey)
 }
 
@@ -3319,7 +3319,7 @@ you need to provide the full definition of a foreign key:

@@ -3350,7 +3350,7 @@ you need to provide the full definition of a foreign key:

Use persistence containers in the encode(to:) method of your encodable records:

-
struct Player: EncodableRecord {
+
struct Player: EncodableRecord {
     var id: Int64?
     var name: String?
 
@@ -3372,7 +3372,7 @@ encodable records:

@@ -3414,7 +3414,7 @@ encodable records:

@@ -3454,7 +3454,7 @@ conflicts when records are inserted or updated.

@@ -3491,7 +3491,7 @@ conflicts when records are inserted or updated.

@@ -3541,7 +3541,7 @@ notifies fresh values whenever the database changes.

@@ -3581,7 +3581,7 @@ hiding its specifics.

@@ -3591,7 +3591,7 @@ hiding its specifics.

diff --git a/docs/4.2/Structs/AdaptedFetchRequest.html b/docs/4.2/Structs/AdaptedFetchRequest.html index 9c7ea36af..947fb6295 100644 --- a/docs/4.2/Structs/AdaptedFetchRequest.html +++ b/docs/4.2/Structs/AdaptedFetchRequest.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1042,7 +1042,7 @@ @@ -1052,7 +1052,7 @@ diff --git a/docs/4.2/Structs/AllColumns.html b/docs/4.2/Structs/AllColumns.html index 33177e67d..5c0a4abff 100644 --- a/docs/4.2/Structs/AllColumns.html +++ b/docs/4.2/Structs/AllColumns.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1018,9 +1018,9 @@ TableRecord.databaseSelection.

For example:

-
struct Player : TableRecord {
+
struct Player : TableRecord {
     static var databaseTableName = "player"
-    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
+    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
 }
 
 // SELECT *, rowid FROM player
@@ -1056,7 +1056,7 @@ TableRecord.databaseSelection.

@@ -1066,7 +1066,7 @@ TableRecord.databaseSelection.

diff --git a/docs/4.2/Structs/AnyDatabaseRegionConvertible.html b/docs/4.2/Structs/AnyDatabaseRegionConvertible.html index 4d8090e36..1833dfdad 100644 --- a/docs/4.2/Structs/AnyDatabaseRegionConvertible.html +++ b/docs/4.2/Structs/AnyDatabaseRegionConvertible.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/Structs/AnyFetchRequest.html b/docs/4.2/Structs/AnyFetchRequest.html index bb8f3f8e8..770623944 100644 --- a/docs/4.2/Structs/AnyFetchRequest.html +++ b/docs/4.2/Structs/AnyFetchRequest.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ hiding its specifics.

@@ -1075,7 +1075,7 @@ hiding its specifics.

@@ -1107,7 +1107,7 @@ operations the argument closure.

@@ -1117,7 +1117,7 @@ operations the argument closure.

diff --git a/docs/4.2/Structs/AnyValueReducer.html b/docs/4.2/Structs/AnyValueReducer.html index c30f04641..9320c8501 100644 --- a/docs/4.2/Structs/AnyValueReducer.html +++ b/docs/4.2/Structs/AnyValueReducer.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1042,7 +1042,7 @@ forward operations the argument closures.

For example, this reducer counts the number of a times the player table is modified:

var count = 0
-let reducer = AnyValueReducer(
+let reducer = AnyValueReducer(
     fetch: { _ in },
     value: { _ -> Int? in
         count += 1
@@ -1065,7 +1065,7 @@ is modified:

@@ -1095,7 +1095,7 @@ is modified:

@@ -1105,7 +1105,7 @@ is modified:

diff --git a/docs/4.2/Structs/AssociationAggregate.html b/docs/4.2/Structs/AssociationAggregate.html index 598ac60bd..b93ebfc84 100644 --- a/docs/4.2/Structs/AssociationAggregate.html +++ b/docs/4.2/Structs/AssociationAggregate.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,7 +1016,7 @@ population of associated records.

For example:

-
struct Author: TableRecord {
+
struct Author: TableRecord {
     static let books = hasMany(Book.self)
 }
 
@@ -1073,7 +1073,7 @@ of aggregates:

@@ -1111,7 +1111,7 @@ of aggregates:

@@ -1133,7 +1133,7 @@ of aggregates:

coding key.

For example:

-
struct AuthorInfo: Decodable, FetchableRecord {
+
struct AuthorInfo: Decodable, FetchableRecord {
     var author: Author
     var numberOfBooks: Int
 
@@ -1156,7 +1156,7 @@ coding key.

@@ -1178,7 +1178,7 @@ coding key.

coding key.

For example:

-
struct AuthorInfo: Decodable, FetchableRecord {
+
struct AuthorInfo: Decodable, FetchableRecord {
     var author: Author
     var numberOfBooks: Int
 
@@ -1200,7 +1200,7 @@ coding key.

@@ -1210,7 +1210,7 @@ coding key.

diff --git a/docs/4.2/Structs/Column.html b/docs/4.2/Structs/Column.html index ceebf385a..d671991d8 100644 --- a/docs/4.2/Structs/Column.html +++ b/docs/4.2/Structs/Column.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1048,7 +1048,7 @@ Instead, adopt the ColumnExpression protocol.

@@ -1078,7 +1078,7 @@ Instead, adopt the ColumnExpression protocol.

@@ -1108,7 +1108,7 @@ Instead, adopt the ColumnExpression protocol.

@@ -1138,7 +1138,7 @@ Instead, adopt the ColumnExpression protocol.

@@ -1148,7 +1148,7 @@ Instead, adopt the ColumnExpression protocol.

diff --git a/docs/4.2/Structs/ColumnInfo.html b/docs/4.2/Structs/ColumnInfo.html index 246d11a3e..51c5a84de 100644 --- a/docs/4.2/Structs/ColumnInfo.html +++ b/docs/4.2/Structs/ColumnInfo.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1059,7 +1059,7 @@ @@ -1089,7 +1089,7 @@ @@ -1119,7 +1119,7 @@ @@ -1171,7 +1171,7 @@ non-constant expression such as CURRENT_TIMESTAMP.

@@ -1214,7 +1214,7 @@ the primary key for columns that are part of the primary key.

@@ -1224,7 +1224,7 @@ the primary key for columns that are part of the primary key.

diff --git a/docs/4.2/Structs/ColumnMapping.html b/docs/4.2/Structs/ColumnMapping.html index 35e9380c7..5513d79f5 100644 --- a/docs/4.2/Structs/ColumnMapping.html +++ b/docs/4.2/Structs/ColumnMapping.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1013,7 +1013,7 @@

ColumnMapping is a row adapter that maps column names.

-
let adapter = ColumnMapping(["foo": "bar"])
+
let adapter = ColumnMapping(["foo": "bar"])
 let sql = "SELECT 'foo' AS foo, 'bar' AS bar, 'baz' AS baz"
 
 // [foo:"bar"]
@@ -1050,7 +1050,7 @@ column names in a base row.

@@ -1060,7 +1060,7 @@ column names in a base row.

diff --git a/docs/4.2/Structs/Configuration.html b/docs/4.2/Structs/Configuration.html index 1b6796d95..690bf67ce 100644 --- a/docs/4.2/Structs/Configuration.html +++ b/docs/4.2/Structs/Configuration.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1052,7 +1052,7 @@ @@ -1084,7 +1084,7 @@ @@ -1105,11 +1105,11 @@

The database label.

You can query this label at runtime:

-
var configuration = Configuration()
+
var configuration = Configuration()
 configuration.label = "MyDatabase"
-let dbQueue = try DatabaseQueue(path: ..., configuration: configuration)
+let dbQueue = try DatabaseQueue(path: ..., configuration: configuration)
 
-try dbQueue.read { db in
+try dbQueue.read { db in
     print(db.configuration.label) // Prints "MyDatabase"
 }
 
@@ -1162,7 +1162,7 @@ DatabaseSnapshot. N grows with the number of snapshots. @@ -1194,7 +1194,7 @@ DatabaseSnapshot. N grows with the number of snapshots. @@ -1252,7 +1252,7 @@ before that connection has been made available to any read/write API’s.

For example:

-
var config = Configuration()
+
var config = Configuration()
 config.prepareDatabase = { db in
     try db.execute(sql: "PRAGMA kdf_iter = 10000")
 }
@@ -1268,7 +1268,7 @@ API’s.

@@ -1311,7 +1311,7 @@ API’s.

@@ -1333,25 +1333,25 @@ API’s.

end of a database access block.

For example:

-
let dbQueue = DatabaseQueue()
+
let dbQueue = DatabaseQueue()
 
 // fatal error: A transaction has been left opened at the end of a database access
-try dbQueue.inDatabase { db in
+try dbQueue.inDatabase { db in
     try db.beginTransaction()
 }
 

If true, one can leave opened transaction at the end of database access blocks:

-
var config = Configuration()
+
var config = Configuration()
 config.allowsUnsafeTransactions = true
-let dbQueue = DatabaseQueue(configuration: config)
+let dbQueue = DatabaseQueue(configuration: config)
 
-try dbQueue.inDatabase { db in
+try dbQueue.inDatabase { db in
     try db.beginTransaction()
 }
 
-try dbQueue.inDatabase { db in
+try dbQueue.inDatabase { db in
     try db.commit()
 }
 
@@ -1371,7 +1371,7 @@ never allow leaving a transaction opened at the end of a read access.

@@ -1414,7 +1414,7 @@ never allow leaving a transaction opened at the end of a read access.

@@ -1447,7 +1447,7 @@ pools only).

@@ -1481,7 +1481,7 @@ pools only).

@@ -1513,7 +1513,7 @@ pools only).

@@ -1554,7 +1554,7 @@ pools only).

@@ -1564,7 +1564,7 @@ pools only).

diff --git a/docs/4.2/Structs/DatabaseDateComponents.html b/docs/4.2/Structs/DatabaseDateComponents.html index 5c680f6e5..73d8b7a0d 100644 --- a/docs/4.2/Structs/DatabaseDateComponents.html +++ b/docs/4.2/Structs/DatabaseDateComponents.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1044,7 +1044,7 @@ @@ -1085,7 +1085,7 @@ @@ -1115,7 +1115,7 @@ @@ -1177,7 +1177,7 @@ the database.

@@ -1249,7 +1249,7 @@ the database.

@@ -1285,12 +1285,12 @@ the database.

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1321,7 +1321,7 @@ valid date.

@@ -1331,7 +1331,7 @@ valid date.

diff --git a/docs/4.2/Structs/DatabaseDateComponents/Format.html b/docs/4.2/Structs/DatabaseDateComponents/Format.html index 381815ca6..c8b213f30 100644 --- a/docs/4.2/Structs/DatabaseDateComponents/Format.html +++ b/docs/4.2/Structs/DatabaseDateComponents/Format.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1075,7 +1075,7 @@ @@ -1107,7 +1107,7 @@ @@ -1139,7 +1139,7 @@ @@ -1169,7 +1169,7 @@ @@ -1199,7 +1199,7 @@ @@ -1229,7 +1229,7 @@ @@ -1239,7 +1239,7 @@ diff --git a/docs/4.2/Structs/DatabaseError.html b/docs/4.2/Structs/DatabaseError.html index 2b12c3a1d..c2af07130 100644 --- a/docs/4.2/Structs/DatabaseError.html +++ b/docs/4.2/Structs/DatabaseError.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1033,9 +1033,9 @@

The SQLite error code (see https://www.sqlite.org/rescode.html#primary_result_code_list).

-
do {
+
do {
     ...
-} catch let error as DatabaseError where error.resultCode == .SQL_CONSTRAINT {
+} catch let error as DatabaseError where error.resultCode == .SQL_CONSTRAINT {
     // A constraint error
 }
 
@@ -1051,12 +1051,12 @@ significant 8 bits of any SQLite result code. See

Declaration

Swift

-
public var resultCode: ResultCode { get }
+
public var resultCode: ResultCode { get }
@@ -1076,9 +1076,9 @@ significant 8 bits of any SQLite result code. See

The SQLite extended error code (see https://www.sqlite.org/rescode.html#extended_result_code_list).

-
do {
+
do {
     ...
-} catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY {
+} catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY {
     // A foreign key constraint error
 }
 
@@ -1095,7 +1095,7 @@ significant 8 bits of any SQLite result code. See
@@ -1125,7 +1125,7 @@ significant 8 bits of any SQLite result code. See @@ -1155,7 +1155,7 @@ significant 8 bits of any SQLite result code. See @@ -1189,7 +1189,7 @@ significant 8 bits of any SQLite result code. See @@ -1199,7 +1199,7 @@ significant 8 bits of any SQLite result code. See diff --git a/docs/4.2/Structs/DatabaseEvent.html b/docs/4.2/Structs/DatabaseEvent.html index 80f8c48cb..ffeba5c29 100644 --- a/docs/4.2/Structs/DatabaseEvent.html +++ b/docs/4.2/Structs/DatabaseEvent.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1044,7 +1044,7 @@ @@ -1074,7 +1074,7 @@ @@ -1099,12 +1099,12 @@

Declaration

Swift

-
public var databaseName: String { get }
+
public var databaseName: String { get }
@@ -1129,12 +1129,12 @@

Declaration

Swift

-
public var tableName: String { get }
+
public var tableName: String { get }
@@ -1164,7 +1164,7 @@ @@ -1183,7 +1183,7 @@

Returns an event that can be stored:

-
class MyObserver: TransactionObserver {
+
class MyObserver: TransactionObserver {
     var events: [DatabaseEvent]
     func databaseDidChange(with event: DatabaseEvent) {
         events.append(event.copy())
@@ -1201,7 +1201,7 @@
                         
@@ -1211,7 +1211,7 @@ diff --git a/docs/4.2/Structs/DatabaseEvent/Kind.html b/docs/4.2/Structs/DatabaseEvent/Kind.html index 2bfeee528..afa9259b1 100644 --- a/docs/4.2/Structs/DatabaseEvent/Kind.html +++ b/docs/4.2/Structs/DatabaseEvent/Kind.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1103,7 +1103,7 @@ @@ -1113,7 +1113,7 @@ diff --git a/docs/4.2/Structs/DatabaseMigrator.html b/docs/4.2/Structs/DatabaseMigrator.html index f09243cae..df8f3aeda 100644 --- a/docs/4.2/Structs/DatabaseMigrator.html +++ b/docs/4.2/Structs/DatabaseMigrator.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1020,7 +1020,7 @@ applied in order, once and only once.

When a user upgrades your application, only non-applied migration are run.

Usage:

-
var migrator = DatabaseMigrator()
+
var migrator = DatabaseMigrator()
 
 // 1st migration
 migrator.registerMigration("createLibrary") { db in
@@ -1089,7 +1089,7 @@ migrations, and the schema changes often.

In this case, it is recommended that you make sure this flag does not ship in the distributed application, in order to avoid undesired data loss:

-
var migrator = DatabaseMigrator()
+
var migrator = DatabaseMigrator()
 #if DEBUG
 // Speed up development by nuking the database when migrations change
 migrator.eraseDatabaseOnSchemaChange = true
@@ -1109,7 +1109,7 @@ for some downloaded data.

@@ -1139,7 +1139,7 @@ for some downloaded data.

@@ -1213,7 +1213,7 @@ for some downloaded data.

@@ -1245,7 +1245,7 @@ for some downloaded data.

@@ -1302,7 +1302,7 @@ migrations should apply.

@@ -1360,7 +1360,7 @@ migrations should apply.

@@ -1390,7 +1390,7 @@ migrations should apply.

@@ -1400,7 +1400,7 @@ migrations should apply.

diff --git a/docs/4.2/Structs/DatabasePreUpdateEvent.html b/docs/4.2/Structs/DatabasePreUpdateEvent.html index 794183a81..df88fb706 100644 --- a/docs/4.2/Structs/DatabasePreUpdateEvent.html +++ b/docs/4.2/Structs/DatabasePreUpdateEvent.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1276,7 +1276,7 @@ righmost column.

Returns an event that can be stored:

-
class MyObserver: TransactionObserver {
+
class MyObserver: TransactionObserver {
     var events: [DatabasePreUpdateEvent]
     func databaseWillChange(with event: DatabasePreUpdateEvent) {
         events.append(event.copy())
@@ -1293,7 +1293,7 @@ righmost column.

diff --git a/docs/4.2/Structs/DatabasePreUpdateEvent/Kind.html b/docs/4.2/Structs/DatabasePreUpdateEvent/Kind.html index 3fca60692..7bbfadd3f 100644 --- a/docs/4.2/Structs/DatabasePreUpdateEvent/Kind.html +++ b/docs/4.2/Structs/DatabasePreUpdateEvent/Kind.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1074,7 +1074,7 @@ diff --git a/docs/4.2/Structs/DatabaseRegion.html b/docs/4.2/Structs/DatabaseRegion.html index 85122e671..7dee69a0a 100644 --- a/docs/4.2/Structs/DatabaseRegion.html +++ b/docs/4.2/Structs/DatabaseRegion.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1066,12 +1066,12 @@ cover a full table, or the combination of columns and rows:

Declaration

Swift

-
public var isEmpty: Bool { get }
+
public var isEmpty: Bool { get }
@@ -1102,7 +1102,7 @@ from all tables.

@@ -1132,7 +1132,7 @@ from all tables.

@@ -1181,7 +1181,7 @@ from all tables.

@@ -1211,7 +1211,7 @@ from all tables.

@@ -1241,7 +1241,7 @@ from all tables.

@@ -1283,7 +1283,7 @@ database were modified by an event of this kind.

@@ -1320,7 +1320,7 @@ region.isModified(byEventsOfKind:) @@ -1330,7 +1330,7 @@ region.isModified(byEventsOfKind:) diff --git a/docs/4.2/Structs/DatabaseRegionObservation.html b/docs/4.2/Structs/DatabaseRegionObservation.html index f3a968092..a2bb24d86 100644 --- a/docs/4.2/Structs/DatabaseRegionObservation.html +++ b/docs/4.2/Structs/DatabaseRegionObservation.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1017,7 +1017,7 @@ requests, and notifies each database transaction whenever the database changes.

For example:

-
let observation = DatabaseRegionObservation(tracking: Player.all)
+
let observation = DatabaseRegionObservation(tracking: Player.all)
 let observer = try observation.start(in: dbQueue) { db: Database in
     print("Players have changed.")
 }
@@ -1055,7 +1055,7 @@ is deallocated.

@@ -1083,7 +1083,7 @@ database transaction.

For example, this sample code counts the number of a times the player table is modified:

-
let observation = DatabaseRegionObservation(tracking: Player.all())
+
let observation = DatabaseRegionObservation(tracking: Player.all())
 
 var count = 0
 let observer = observation.start(in: dbQueue) { _ in
@@ -1124,7 +1124,7 @@ deallocated. See the 
-                        Show on GitHub
+                        Show on GitHub
                       
                     
                   
@@ -1148,7 +1148,7 @@ database transaction.

For example, this sample code counts the number of a times the player table is modified:

-
let observation = DatabaseRegionObservation(tracking: [Player.all()])
+
let observation = DatabaseRegionObservation(tracking: [Player.all()])
 
 var count = 0
 let observer = observation.start(in: dbQueue) { _ in
@@ -1189,7 +1189,7 @@ deallocated. See the 
-                        Show on GitHub
+                        Show on GitHub
                       
                     
                   
@@ -1263,7 +1263,7 @@ with write access each time the observed region has been modified.

a TransactionObserver

@@ -1273,7 +1273,7 @@ with write access each time the observed region has been modified.

diff --git a/docs/4.2/Structs/DatabaseValue.html b/docs/4.2/Structs/DatabaseValue.html index 51ecb5ac6..569214a5a 100644 --- a/docs/4.2/Structs/DatabaseValue.html +++ b/docs/4.2/Structs/DatabaseValue.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1106,7 +1106,7 @@ @@ -1138,7 +1138,7 @@ @@ -1174,12 +1174,12 @@

Declaration

Swift

-
public var isNull: Bool { get }
+
public var isNull: Bool { get }
@@ -1234,7 +1234,7 @@ storages instead:

@@ -1270,12 +1270,12 @@ storages instead:

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1305,7 +1305,7 @@ storages instead:

@@ -1315,7 +1315,7 @@ storages instead:

diff --git a/docs/4.2/Structs/DatabaseValue/Storage.html b/docs/4.2/Structs/DatabaseValue/Storage.html index 595b8cb56..b0d773d83 100644 --- a/docs/4.2/Structs/DatabaseValue/Storage.html +++ b/docs/4.2/Structs/DatabaseValue/Storage.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1103,7 +1103,7 @@ @@ -1133,7 +1133,7 @@ @@ -1163,7 +1163,7 @@ @@ -1188,12 +1188,12 @@

Declaration

Swift

-
public var value: DatabaseValueConvertible? { get }
+
public var value: DatabaseValueConvertible? { get }
@@ -1227,7 +1227,7 @@ are never equal.

@@ -1237,7 +1237,7 @@ are never equal.

diff --git a/docs/4.2/Structs/EmptyRowAdapter.html b/docs/4.2/Structs/EmptyRowAdapter.html index 0e5714a5e..48eac066c 100644 --- a/docs/4.2/Structs/EmptyRowAdapter.html +++ b/docs/4.2/Structs/EmptyRowAdapter.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1053,7 +1053,7 @@ diff --git a/docs/4.2/Structs/FTS3.html b/docs/4.2/Structs/FTS3.html index b95599147..49be8c270 100644 --- a/docs/4.2/Structs/FTS3.html +++ b/docs/4.2/Structs/FTS3.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1014,7 +1014,7 @@

FTS3 lets you define fts3 virtual tables.

// CREATE VIRTUAL TABLE document USING fts3(content)
-try db.create(virtualTable: "document", using: FTS3()) { t in
+try db.create(virtualTable: "document", using: FTS3()) { t in
     t.column("content")
 }
 
@@ -1052,7 +1052,7 @@ tokenizer argument.

@@ -1073,7 +1073,7 @@ tokenizer argument.

Creates a FTS3 module suitable for the Database create(virtualTable:using:) method.

// CREATE VIRTUAL TABLE document USING fts3(content)
-try db.create(virtualTable: "document", using: FTS3()) { t in
+try db.create(virtualTable: "document", using: FTS3()) { t in
     t.column("content")
 }
 
@@ -1088,7 +1088,7 @@ tokenizer argument.

@@ -1129,7 +1129,7 @@ tokenizer argument.

@@ -1161,7 +1161,7 @@ tokenizer argument.

@@ -1193,7 +1193,7 @@ tokenizer argument.

@@ -1225,7 +1225,7 @@ tokenizer argument.

@@ -1235,7 +1235,7 @@ tokenizer argument.

diff --git a/docs/4.2/Structs/FTS3/Diacritics.html b/docs/4.2/Structs/FTS3/Diacritics.html index 84a6340b2..971df88d7 100644 --- a/docs/4.2/Structs/FTS3/Diacritics.html +++ b/docs/4.2/Structs/FTS3/Diacritics.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1047,7 +1047,7 @@ option matches the raw remove_diacritics=0 tokenizer argument.

@@ -1078,7 +1078,7 @@ option matches the raw remove_diacritics=1 tokenizer argument.

@@ -1109,7 +1109,7 @@ available from SQLite 3.27.0

diff --git a/docs/4.2/Structs/FTS3Pattern.html b/docs/4.2/Structs/FTS3Pattern.html index c4ddc26c3..5111e179a 100644 --- a/docs/4.2/Structs/FTS3Pattern.html +++ b/docs/4.2/Structs/FTS3Pattern.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1065,8 +1065,8 @@ invalid syntax.

The pattern syntax is documented at https://www.sqlite.org/fts3.html#full_text_index_queries

-
try FTS3Pattern(rawPattern: "and") // OK
-try FTS3Pattern(rawPattern: "AND") // malformed MATCH expression: [AND]
+
try FTS3Pattern(rawPattern: "and") // OK
+try FTS3Pattern(rawPattern: "AND") // malformed MATCH expression: [AND]
 
@@ -1079,7 +1079,7 @@ invalid syntax.

@@ -1099,8 +1099,8 @@ invalid syntax.

Creates a pattern that matches any token found in the input string; returns nil if no pattern could be built.

-
FTS3Pattern(matchingAnyTokenIn: "")        // nil
-FTS3Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
+
FTS3Pattern(matchingAnyTokenIn: "")        // nil
+FTS3Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
 
@@ -1122,8 +1122,8 @@ returns nil if no pattern could be built.

Creates a pattern that matches all tokens found in the input string; returns nil if no pattern could be built.

-
FTS3Pattern(matchingAllTokensIn: "")        // nil
-FTS3Pattern(matchingAllTokensIn: "foo bar") // foo bar
+
FTS3Pattern(matchingAllTokensIn: "")        // nil
+FTS3Pattern(matchingAllTokensIn: "foo bar") // foo bar
 
@@ -1145,8 +1145,8 @@ returns nil if no pattern could be built.

Creates a pattern that matches a contiguous string; returns nil if no pattern could be built.

-
FTS3Pattern(matchingPhrase: "")        // nil
-FTS3Pattern(matchingPhrase: "foo bar") // "foo bar"
+
FTS3Pattern(matchingPhrase: "")        // nil
+FTS3Pattern(matchingPhrase: "foo bar") // "foo bar"
 
@@ -1168,8 +1168,8 @@ pattern could be built.

Creates a pattern that matches any token found in the input string; returns nil if no pattern could be built.

-
FTS3Pattern(matchingAnyTokenIn: "")        // nil
-FTS3Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
+
FTS3Pattern(matchingAnyTokenIn: "")        // nil
+FTS3Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
 
@@ -1202,7 +1202,7 @@ returns nil if no pattern could be built.

@@ -1222,8 +1222,8 @@ returns nil if no pattern could be built.

Creates a pattern that matches all tokens found in the input string; returns nil if no pattern could be built.

-
FTS3Pattern(matchingAllTokensIn: "")        // nil
-FTS3Pattern(matchingAllTokensIn: "foo bar") // foo bar
+
FTS3Pattern(matchingAllTokensIn: "")        // nil
+FTS3Pattern(matchingAllTokensIn: "foo bar") // foo bar
 
@@ -1256,7 +1256,7 @@ returns nil if no pattern could be built.

@@ -1276,8 +1276,8 @@ returns nil if no pattern could be built.

Creates a pattern that matches a contiguous string; returns nil if no pattern could be built.

-
FTS3Pattern(matchingPhrase: "")        // nil
-FTS3Pattern(matchingPhrase: "foo bar") // "foo bar"
+
FTS3Pattern(matchingPhrase: "")        // nil
+FTS3Pattern(matchingPhrase: "foo bar") // "foo bar"
 
@@ -1310,7 +1310,7 @@ pattern could be built.

@@ -1339,12 +1339,12 @@ pattern could be built.

Declaration

Swift

-
public var databaseValue: DatabaseValue { get }
+
public var databaseValue: DatabaseValue { get }
@@ -1375,7 +1375,7 @@ a suitable value.

@@ -1385,7 +1385,7 @@ a suitable value.

diff --git a/docs/4.2/Structs/FTS3TokenizerDescriptor.html b/docs/4.2/Structs/FTS3TokenizerDescriptor.html index 1f6bdee7e..6d0fa27a9 100644 --- a/docs/4.2/Structs/FTS3TokenizerDescriptor.html +++ b/docs/4.2/Structs/FTS3TokenizerDescriptor.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1013,7 +1013,7 @@

An FTS3 tokenizer, suitable for FTS3 and FTS4 table definitions:

-
db.create(virtualTable: "book", using: FTS4()) { t in
+
db.create(virtualTable: "book", using: FTS4()) { t in
     t.tokenizer = .simple // FTS3TokenizerDescriptor
 }
 
@@ -1038,7 +1038,7 @@

The simple tokenizer.

-
db.create(virtualTable: "book", using: FTS4()) { t in
+
db.create(virtualTable: "book", using: FTS4()) { t in
     t.tokenizer = .simple
 }
 
@@ -1055,7 +1055,7 @@
@@ -1074,7 +1074,7 @@

The porter tokenizer.

-
db.create(virtualTable: "book", using: FTS4()) { t in
+
db.create(virtualTable: "book", using: FTS4()) { t in
     t.tokenizer = .porter
 }
 
@@ -1091,7 +1091,7 @@
@@ -1110,7 +1110,7 @@

The unicode61 tokenizer.

-
db.create(virtualTable: "book", using: FTS4()) { t in
+
db.create(virtualTable: "book", using: FTS4()) { t in
     t.tokenizer = .unicode61()
 }
 
@@ -1135,7 +1135,7 @@

The unicode61 tokenizer.

-
db.create(virtualTable: "book", using: FTS4()) { t in
+
db.create(virtualTable: "book", using: FTS4()) { t in
     t.tokenizer = .unicode61()
 }
 
@@ -1203,7 +1203,7 @@ these characters as token characters.

@@ -1213,7 +1213,7 @@ these characters as token characters.

diff --git a/docs/4.2/Structs/FTS4.html b/docs/4.2/Structs/FTS4.html index b08bf4ed8..8949b233b 100644 --- a/docs/4.2/Structs/FTS4.html +++ b/docs/4.2/Structs/FTS4.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1014,7 +1014,7 @@

FTS4 lets you define fts4 virtual tables.

// CREATE VIRTUAL TABLE document USING fts4(content)
-try db.create(virtualTable: "document", using: FTS4()) { t in
+try db.create(virtualTable: "document", using: FTS4()) { t in
     t.column("content")
 }
 
@@ -1041,7 +1041,7 @@

Creates a FTS4 module suitable for the Database create(virtualTable:using:) method.

// CREATE VIRTUAL TABLE document USING fts4(content)
-try db.create(virtualTable: "document", using: FTS4()) { t in
+try db.create(virtualTable: "document", using: FTS4()) { t in
     t.column("content")
 }
 
@@ -1058,7 +1058,7 @@ @@ -1099,7 +1099,7 @@ @@ -1131,7 +1131,7 @@ @@ -1163,7 +1163,7 @@ @@ -1195,7 +1195,7 @@ @@ -1205,7 +1205,7 @@ diff --git a/docs/4.2/Structs/FTS5.html b/docs/4.2/Structs/FTS5.html index fd6efb3fb..c86b43462 100644 --- a/docs/4.2/Structs/FTS5.html +++ b/docs/4.2/Structs/FTS5.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1008,7 +1008,7 @@

FTS5

FTS5 lets you define fts5 virtual tables.

// CREATE VIRTUAL TABLE document USING fts5(content)
-try db.create(virtualTable: "document", using: FTS5()) { t in
+try db.create(virtualTable: "document", using: FTS5()) { t in
     t.column("content")
 }
 
@@ -1058,7 +1058,7 @@ tokenizer argument.

Creates a FTS5 module suitable for the Database create(virtualTable:using:) method.

// CREATE VIRTUAL TABLE document USING fts5(content)
-try db.create(virtualTable: "document", using: FTS5()) { t in
+try db.create(virtualTable: "document", using: FTS5()) { t in
     t.column("content")
 }
 
@@ -1163,7 +1163,7 @@ tokenizer argument.

diff --git a/docs/4.2/Structs/FTS5/Diacritics.html b/docs/4.2/Structs/FTS5/Diacritics.html index cae98c5a0..9ad5344d2 100644 --- a/docs/4.2/Structs/FTS5/Diacritics.html +++ b/docs/4.2/Structs/FTS5/Diacritics.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1081,7 +1081,7 @@ available from SQLite 3.27.0

diff --git a/docs/4.2/Structs/FTS5Pattern.html b/docs/4.2/Structs/FTS5Pattern.html index b04859c47..3683221af 100644 --- a/docs/4.2/Structs/FTS5Pattern.html +++ b/docs/4.2/Structs/FTS5Pattern.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1046,8 +1046,8 @@

Creates a pattern that matches any token found in the input string; returns nil if no pattern could be built.

-
FTS5Pattern(matchingAnyTokenIn: "")        // nil
-FTS5Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
+
FTS5Pattern(matchingAnyTokenIn: "")        // nil
+FTS5Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
 
@@ -1069,8 +1069,8 @@ returns nil if no pattern could be built.

Creates a pattern that matches all tokens found in the input string; returns nil if no pattern could be built.

-
FTS5Pattern(matchingAllTokensIn: "")        // nil
-FTS5Pattern(matchingAllTokensIn: "foo bar") // foo bar
+
FTS5Pattern(matchingAllTokensIn: "")        // nil
+FTS5Pattern(matchingAllTokensIn: "foo bar") // foo bar
 
@@ -1092,8 +1092,8 @@ returns nil if no pattern could be built.

Creates a pattern that matches a contiguous string; returns nil if no pattern could be built.

-
FTS5Pattern(matchingPhrase: "")        // nil
-FTS5Pattern(matchingPhrase: "foo bar") // "foo bar"
+
FTS5Pattern(matchingPhrase: "")        // nil
+FTS5Pattern(matchingPhrase: "foo bar") // "foo bar"
 
@@ -1115,8 +1115,8 @@ pattern could be built.

Creates a pattern that matches a contiguous string prefix; returns nil if no pattern could be built.

-
FTS5Pattern(matchingPrefixPhrase: "")        // nil
-FTS5Pattern(matchingPrefixPhrase: "foo bar") // ^"foo bar"
+
FTS5Pattern(matchingPrefixPhrase: "")        // nil
+FTS5Pattern(matchingPrefixPhrase: "foo bar") // ^"foo bar"
 
@@ -1171,7 +1171,7 @@ contains a suitable value.

diff --git a/docs/4.2/Structs/FTS5TokenFlags.html b/docs/4.2/Structs/FTS5TokenFlags.html index 041377360..eb2d22e40 100644 --- a/docs/4.2/Structs/FTS5TokenFlags.html +++ b/docs/4.2/Structs/FTS5TokenFlags.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1074,7 +1074,7 @@ diff --git a/docs/4.2/Structs/FTS5Tokenization.html b/docs/4.2/Structs/FTS5Tokenization.html index b09bf588a..a9ac6071c 100644 --- a/docs/4.2/Structs/FTS5Tokenization.html +++ b/docs/4.2/Structs/FTS5Tokenization.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1131,7 +1131,7 @@ diff --git a/docs/4.2/Structs/FTS5TokenizerDescriptor.html b/docs/4.2/Structs/FTS5TokenizerDescriptor.html index b839fd3fd..fa1552a32 100644 --- a/docs/4.2/Structs/FTS5TokenizerDescriptor.html +++ b/docs/4.2/Structs/FTS5TokenizerDescriptor.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1007,7 +1007,7 @@

FTS5TokenizerDescriptor

An FTS5 tokenizer, suitable for FTS5 table definitions:

-
db.create(virtualTable: "book", using: FTS5()) { t in
+
db.create(virtualTable: "book", using: FTS5()) { t in
     t.tokenizer = .unicode61() // FTS5TokenizerDescriptor
 }
 
@@ -1057,8 +1057,8 @@

Creates an FTS5 tokenizer descriptor.

-
db.create(virtualTable: "book", using: FTS5()) { t in
-    let tokenizer = FTS5TokenizerDescriptor(components: ["porter", "unicode61", "remove_diacritics", "0"])
+
db.create(virtualTable: "book", using: FTS5()) { t in
+    let tokenizer = FTS5TokenizerDescriptor(components: ["porter", "unicode61", "remove_diacritics", "0"])
     t.tokenizer = tokenizer
 }
 
@@ -1086,7 +1086,7 @@

The ascii tokenizer

-
db.create(virtualTable: "book", using: FTS5()) { t in
+
db.create(virtualTable: "book", using: FTS5()) { t in
     t.tokenizer = .ascii()
 }
 
@@ -1130,7 +1130,7 @@

An unicode61 tokenizer

-
db.create(virtualTable: "book", using: FTS5()) { t in
+
db.create(virtualTable: "book", using: FTS5()) { t in
     t.tokenizer = .unicode61()
 }
 
@@ -1146,7 +1146,7 @@
diff --git a/docs/4.2/Structs/FetchedRecordsSectionInfo.html b/docs/4.2/Structs/FetchedRecordsSectionInfo.html index 5fb86e48e..1d0865851 100644 --- a/docs/4.2/Structs/FetchedRecordsSectionInfo.html +++ b/docs/4.2/Structs/FetchedRecordsSectionInfo.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1038,12 +1038,12 @@

Declaration

Swift

-
public var numberOfRecords: Int { get }
+
public var numberOfRecords: Int { get }
@@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/Structs/ForeignKey.html b/docs/4.2/Structs/ForeignKey.html index 5d4b05a7e..65bab6de4 100644 --- a/docs/4.2/Structs/ForeignKey.html +++ b/docs/4.2/Structs/ForeignKey.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1032,10 +1032,10 @@ foreign key from book to person, or Could not infer foreign key from book to person.

Your help is needed. You have to instruct GRDB which foreign key to use:

-
struct Book: TableRecord {
+
struct Book: TableRecord {
     // Define foreign keys
-    static let authorForeignKey = ForeignKey(["authorId"]))
-    static let translatorForeignKey = ForeignKey(["translatorId"]))
+    static let authorForeignKey = ForeignKey(["authorId"]))
+    static let translatorForeignKey = ForeignKey(["translatorId"]))
 
     // Use foreign keys to define associations:
     static let author = belongsTo(Person.self, using: authorForeignKey)
@@ -1046,27 +1046,27 @@ to person.

Foreign keys are always defined from the table that contains the columns at the origin of the foreign key. Person’s symmetric HasMany associations reuse Book’s foreign keys:

-
struct Person: TableRecord {
+
struct Person: TableRecord {
     static let writtenBooks = hasMany(Book.self, using: Book.authorForeignKey)
     static let translatedBooks = hasMany(Book.self, using: Book.translatorForeignKey)
 }
 

Foreign keys can also be defined from query interface columns:

-
struct Book: TableRecord {
-    enum Columns: String, ColumnExpression {
+
struct Book: TableRecord {
+    enum Columns: String, ColumnExpression {
         case id, title, authorId, translatorId
     }
 
-    static let authorForeignKey = ForeignKey([Columns.authorId]))
-    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
+    static let authorForeignKey = ForeignKey([Columns.authorId]))
+    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
 }
 

When the destination table of a foreign key does not define any primary key, you need to provide the full definition of a foreign key:

-
struct Book: TableRecord {
-    static let authorForeignKey = ForeignKey(["authorId"], to: ["id"]))
+
struct Book: TableRecord {
+    static let authorForeignKey = ForeignKey(["authorId"], to: ["id"]))
     static let author = belongsTo(Person.self, using: authorForeignKey)
 }
 
@@ -1089,10 +1089,10 @@ you need to provide the full definition of a foreign key:

Creates a ForeignKey intended to define a record association.

-
struct Book: TableRecord {
+
struct Book: TableRecord {
     // Define foreign keys
-    static let authorForeignKey = ForeignKey(["authorId"]))
-    static let translatorForeignKey = ForeignKey(["translatorId"]))
+    static let authorForeignKey = ForeignKey(["authorId"]))
+    static let translatorForeignKey = ForeignKey(["translatorId"]))
 
     // Use foreign keys to define associations:
     static let author = belongsTo(Person.self, using: authorForeignKey)
@@ -1143,7 +1143,7 @@ primary key.

@@ -1162,15 +1162,15 @@ primary key.

Creates a ForeignKey intended to define a record association.

-
struct Book: TableRecord {
+
struct Book: TableRecord {
     // Define columns
-    enum Columns: String, ColumnExpression {
+    enum Columns: String, ColumnExpression {
         case id, title, authorId, translatorId
     }
 
     // Define foreign keys
-    static let authorForeignKey = ForeignKey([Columns.authorId]))
-    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
+    static let authorForeignKey = ForeignKey([Columns.authorId]))
+    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
 
     // Use foreign keys to define associations:
     static let author = belongsTo(Person.self, using: authorForeignKey)
@@ -1221,7 +1221,7 @@ primary key.

@@ -1231,7 +1231,7 @@ primary key.

diff --git a/docs/4.2/Structs/ForeignKeyInfo.html b/docs/4.2/Structs/ForeignKeyInfo.html index 42ef28994..854e6e9a0 100644 --- a/docs/4.2/Structs/ForeignKeyInfo.html +++ b/docs/4.2/Structs/ForeignKeyInfo.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1044,7 +1044,7 @@ @@ -1074,7 +1074,7 @@ @@ -1104,7 +1104,7 @@ @@ -1134,7 +1134,7 @@ @@ -1144,7 +1144,7 @@ diff --git a/docs/4.2/Structs/IndexInfo.html b/docs/4.2/Structs/IndexInfo.html index 0f2695d83..bd7c80aac 100644 --- a/docs/4.2/Structs/IndexInfo.html +++ b/docs/4.2/Structs/IndexInfo.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1115,7 +1115,7 @@ diff --git a/docs/4.2/Structs/Inflections.html b/docs/4.2/Structs/Inflections.html index 35e657c15..9adea2f59 100644 --- a/docs/4.2/Structs/Inflections.html +++ b/docs/4.2/Structs/Inflections.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1052,7 +1052,7 @@ @@ -1082,7 +1082,7 @@

Appends a pluralization rule.

-
var inflections = Inflections()
+
var inflections = Inflections()
 inflections.plural("$", "s")
 inflections.pluralize("player") // "players"
 
@@ -1144,7 +1144,7 @@
@@ -1163,7 +1163,7 @@

Appends a singularization rule.

-
var inflections = Inflections()
+
var inflections = Inflections()
 inflections.singular("s$", "")
 inflections.singularize("players") // "player"
 
@@ -1225,7 +1225,7 @@
@@ -1244,7 +1244,7 @@

Appends uncountable words.

-
var inflections = Inflections()
+
var inflections = Inflections()
 inflections.plural("$", "s")
 inflections.uncountableWords(["foo"])
 inflections.pluralize("foo") // "foo"
@@ -1261,7 +1261,7 @@
                         
@@ -1280,7 +1280,7 @@

Appends an irregular singular/plural pair.

-
var inflections = Inflections()
+
var inflections = Inflections()
 inflections.plural("$", "s")
 inflections.irregularSuffix("man", "men")
 inflections.pluralize("man")      // "men"
@@ -1328,7 +1328,7 @@
                         
                       
@@ -1371,7 +1371,7 @@ @@ -1401,7 +1401,7 @@ @@ -1430,12 +1430,12 @@

Declaration

Swift

-
public static var `default`: Inflections
+
public static var `default`: Inflections
@@ -1445,7 +1445,7 @@ diff --git a/docs/4.2/Structs/PersistenceConflictPolicy.html b/docs/4.2/Structs/PersistenceConflictPolicy.html index 71221e774..3ba5046cf 100644 --- a/docs/4.2/Structs/PersistenceConflictPolicy.html +++ b/docs/4.2/Structs/PersistenceConflictPolicy.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1048,7 +1048,7 @@ conflicts when records are inserted or updated.

@@ -1078,7 +1078,7 @@ conflicts when records are inserted or updated.

@@ -1108,7 +1108,7 @@ conflicts when records are inserted or updated.

@@ -1118,7 +1118,7 @@ conflicts when records are inserted or updated.

diff --git a/docs/4.2/Structs/PersistenceContainer.html b/docs/4.2/Structs/PersistenceContainer.html index 750a09eed..566828501 100644 --- a/docs/4.2/Structs/PersistenceContainer.html +++ b/docs/4.2/Structs/PersistenceContainer.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1014,7 +1014,7 @@

Use persistence containers in the encode(to:) method of your encodable records:

-
struct Player: EncodableRecord {
+
struct Player: EncodableRecord {
     var id: Int64?
     var name: String?
 
@@ -1054,12 +1054,12 @@ is considered undefined behavior.

Swift

@inlinable
-public subscript(column: String) -> DatabaseValueConvertible? { get set }
+public subscript(column: String) -> DatabaseValueConvertible? { get set }
@@ -1089,12 +1089,12 @@ is considered undefined behavior.

Swift

@inlinable
-public subscript<Column>(column: Column) -> DatabaseValueConvertible? where Column : ColumnExpression { get set }
+public subscript<Column>(column: Column) -> DatabaseValueConvertible? where Column : ColumnExpression { get set }
@@ -1104,7 +1104,7 @@ is considered undefined behavior.

diff --git a/docs/4.2/Structs/PreparedRequest.html b/docs/4.2/Structs/PreparedRequest.html index 8783dbd54..5459336e2 100644 --- a/docs/4.2/Structs/PreparedRequest.html +++ b/docs/4.2/Structs/PreparedRequest.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1138,7 +1138,7 @@ select statement.

@@ -1148,7 +1148,7 @@ select statement.

diff --git a/docs/4.2/Structs/PrimaryKeyInfo.html b/docs/4.2/Structs/PrimaryKeyInfo.html index 362a667d1..5a01ccc9b 100644 --- a/docs/4.2/Structs/PrimaryKeyInfo.html +++ b/docs/4.2/Structs/PrimaryKeyInfo.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1081,7 +1081,7 @@ @@ -1106,12 +1106,12 @@

Declaration

Swift

-
public var rowIDColumn: String? { get }
+
public var rowIDColumn: String? { get }
@@ -1136,12 +1136,12 @@

Declaration

Swift

-
public var isRowID: Bool { get }
+
public var isRowID: Bool { get }
@@ -1151,7 +1151,7 @@ diff --git a/docs/4.2/Structs/QueryInterfaceRequest.html b/docs/4.2/Structs/QueryInterfaceRequest.html index 099ee1786..b76f5ea2a 100644 --- a/docs/4.2/Structs/QueryInterfaceRequest.html +++ b/docs/4.2/Structs/QueryInterfaceRequest.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1015,10 +1015,10 @@

QueryInterfaceRequest is a request that generates SQL for you.

For example:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     let request = Player
-        .filter(Column("score") > 1000)
-        .order(Column("name"))
+        .filter(Column("score") > 1000)
+        .order(Column("name"))
     let players = try request.fetchAll(db) // [Player]
 }
 
@@ -1066,7 +1066,7 @@ @@ -1101,7 +1101,7 @@ @@ -1138,7 +1138,7 @@ the eventual set of already applied predicates.

@@ -1171,7 +1171,7 @@ the eventual set of already applied predicates.

@@ -1203,14 +1203,14 @@ the eventual set of already applied predicates.

Creates a request which selects selection.

// SELECT id, email FROM player
 var request = Player.all()
-request = request.select([Column("id"), Column("email")])
+request = request.select([Column("id"), Column("email")])
 

Any previous selection is replaced:

// SELECT email FROM player
 request
-    .select([Column("id")])
-    .select([Column("email")])
+    .select([Column("id")])
+    .select([Column("email")])
 
@@ -1223,7 +1223,7 @@ the eventual set of already applied predicates.

@@ -1243,9 +1243,9 @@ the eventual set of already applied predicates.

Creates a request which selects selection, and fetches values of type type.

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     // SELECT max(score) FROM player
-    let request = Player.all().select([max(Column("score"))], as: Int.self)
+    let request = Player.all().select([max(Column("score"))], as: Int.self)
     let maxScore: Int? = try request.fetchOne(db)
 }
 
@@ -1261,7 +1261,7 @@ type type.

@@ -1281,9 +1281,9 @@ type type.

Creates a request which selects selection, and fetches values of type type.

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     // SELECT max(score) FROM player
-    let request = Player.all().select(max(Column("score")), as: Int.self)
+    let request = Player.all().select(max(Column("score")), as: Int.self)
     let maxScore: Int? = try request.fetchOne(db)
 }
 
@@ -1299,7 +1299,7 @@ type type.

@@ -1319,7 +1319,7 @@ type type.

Creates a request which selects sql, and fetches values of type type.

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     // SELECT max(score) FROM player
     let request = Player.all().select(sql: "max(score)", as: Int.self)
     let maxScore: Int? = try request.fetchOne(db)
@@ -1333,14 +1333,14 @@ type type.

Swift

public func select<RowDecoder>(
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     as type: RowDecoder.Type)
     -> QueryInterfaceRequest<RowDecoder>
@@ -1360,12 +1360,12 @@ type type.

Creates a request which selects an SQL literal, and fetches values of type type.

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     // SELECT IFNULL(name, 'Anonymous') FROM player WHERE id = 42
     let request = Player.
         .filter(primaryKey: 42)
         .select(
-            SQLLiteral(
+            SQLLiteral(
                 sql: "IFNULL(name, ?)",
                 arguments: ["Anonymous"]),
             as: String.self)
@@ -1375,7 +1375,7 @@ type type.

With Swift 5, you can safely embed raw values in your SQL queries, without any risk of syntax errors or SQL injection:

-
try dbQueue.read { db in
+
try dbQueue.read { db in
     // SELECT IFNULL(name, 'Anonymous') FROM player WHERE id = 42
     let request = Player.
         .filter(primaryKey: 42)
@@ -1399,7 +1399,7 @@ without any risk of syntax errors or SQL injection:

@@ -1421,8 +1421,8 @@ without any risk of syntax errors or SQL injection:

// SELECT id, email, name FROM player
 var request = Player.all()
 request = request
-    .select([Column("id"), Column("email")])
-    .annotated(with: [Column("name")])
+    .select([Column("id"), Column("email")])
+    .annotated(with: [Column("name")])
 
@@ -1435,7 +1435,7 @@ without any risk of syntax errors or SQL injection:

@@ -1468,7 +1468,7 @@ without any risk of syntax errors or SQL injection:

eventual set of already applied predicates.

// SELECT * FROM player WHERE 1
 var request = Player.all()
-request = request.filter { db in true }
+request = request.filter { db in true }
 
@@ -1481,7 +1481,7 @@ eventual set of already applied predicates.

@@ -1513,15 +1513,15 @@ eventual set of already applied predicates.

Creates a request with the provided orderings promise.

// SELECT * FROM player ORDER BY name
 var request = Player.all()
-request = request.order { _ in [Column("name")] }
+request = request.order { _ in [Column("name")] }
 

Any previous ordering is replaced:

// SELECT * FROM player ORDER BY name
 request
-    .order{ _ in [Column("email")] }
+    .order{ _ in [Column("email")] }
     .reversed()
-    .order{ _ in [Column("name")] }
+    .order{ _ in [Column("name")] }
 
@@ -1534,7 +1534,7 @@ eventual set of already applied predicates.

@@ -1554,7 +1554,7 @@ eventual set of already applied predicates.

Creates a request that reverses applied orderings.

// SELECT * FROM player ORDER BY name DESC
-var request = Player.all().order(Column("name"))
+var request = Player.all().order(Column("name"))
 request = request.reversed()
 
@@ -1574,7 +1574,7 @@ eventual set of already applied predicates.

@@ -1594,7 +1594,7 @@ eventual set of already applied predicates.

Creates a request without any ordering.

// SELECT * FROM player
-var request = Player.all().order(Column("name"))
+var request = Player.all().order(Column("name"))
 request = request.unordered()
 
@@ -1608,7 +1608,7 @@ eventual set of already applied predicates.

@@ -1649,7 +1649,7 @@ eventual set of already applied predicates.

@@ -1680,7 +1680,7 @@ eventual set of already applied predicates.

@@ -1715,7 +1715,7 @@ eventual set of already applied predicates.

request = request.distinct() // SELECT DISTINCT name FROM player -var request = Player.select(Column("name")) +var request = Player.select(Column("name")) request = request.distinct()
@@ -1729,7 +1729,7 @@ eventual set of already applied predicates.

@@ -1765,7 +1765,7 @@ eventual set of already applied predicates.

@@ -1788,17 +1788,17 @@ a specific database table.

In the example below, the team.avgScore < player.score condition in the ON clause could be not achieved without table aliases.

-
struct Player: TableRecord {
+
struct Player: TableRecord {
     static let team = belongsTo(Team.self)
 }
 
 // SELECT player.*, team.*
 // JOIN team ON ... AND team.avgScore < player.score
-let playerAlias = TableAlias()
+let playerAlias = TableAlias()
 let request = Player
     .all()
     .aliased(playerAlias)
-    .including(required: Player.team.filter(Column("avgScore") < playerAlias[Column("score")])
+    .including(required: Player.team.filter(Column("avgScore") < playerAlias[Column("score")])
 
@@ -1811,7 +1811,7 @@ the ON clause could be not achieved without table aliases.

@@ -1873,7 +1873,7 @@ value, record).

A typed request bound to type Target.

@@ -1943,7 +1943,7 @@ value, record).

The number of deleted rows

@@ -1953,7 +1953,7 @@ value, record).

diff --git a/docs/4.2/Structs/RangeRowAdapter.html b/docs/4.2/Structs/RangeRowAdapter.html index 68fbadbac..6cc77587a 100644 --- a/docs/4.2/Structs/RangeRowAdapter.html +++ b/docs/4.2/Structs/RangeRowAdapter.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1013,7 +1013,7 @@

RangeRowAdapter is a row adapter that only exposes a range of columns.

-
let adapter = RangeRowAdapter(1..<3)
+
let adapter = RangeRowAdapter(1..<3)
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz, 4 as qux"
 
 // [bar:2 baz:3]
@@ -1049,7 +1049,7 @@
                         
                       
                       
                     
                   
@@ -1079,7 +1079,7 @@
                         
                       
                       
                     
                   
@@ -1089,7 +1089,7 @@
           
         
         
       
diff --git a/docs/4.2/Structs/ResultCode.html b/docs/4.2/Structs/ResultCode.html
index 991bf4303..a8d757ee9 100644
--- a/docs/4.2/Structs/ResultCode.html
+++ b/docs/4.2/Structs/ResultCode.html
@@ -14,7 +14,7 @@
     
     
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1042,7 +1042,7 @@ @@ -1071,7 +1071,7 @@ @@ -1100,12 +1100,12 @@ See https://www.sqlite.org/rescode

Declaration

Swift

-
public var primaryResultCode: ResultCode { get }
+
public var primaryResultCode: ResultCode { get }
@@ -1127,7 +1127,7 @@ See https://www.sqlite.org/rescode

Primary result codes match themselves and their extended result codes, while extended result codes match only themselves:

-
switch error.extendedResultCode {
+
switch error.extendedResultCode {
 case .SQLITE_CONSTRAINT_FOREIGNKEY: // foreign key constraint error
 case .SQLITE_CONSTRAINT:            // any other constraint error
 default:                            // any other database error
@@ -1144,7 +1144,7 @@ while extended result codes match only themselves:

@@ -1174,7 +1174,7 @@ while extended result codes match only themselves:

@@ -1204,7 +1204,7 @@ while extended result codes match only themselves:

@@ -1234,7 +1234,7 @@ while extended result codes match only themselves:

@@ -1264,7 +1264,7 @@ while extended result codes match only themselves:

@@ -1294,7 +1294,7 @@ while extended result codes match only themselves:

@@ -1324,7 +1324,7 @@ while extended result codes match only themselves:

@@ -1354,7 +1354,7 @@ while extended result codes match only themselves:

@@ -1384,7 +1384,7 @@ while extended result codes match only themselves:

@@ -1414,7 +1414,7 @@ while extended result codes match only themselves:

@@ -1444,7 +1444,7 @@ while extended result codes match only themselves:

@@ -1474,7 +1474,7 @@ while extended result codes match only themselves:

@@ -1504,7 +1504,7 @@ while extended result codes match only themselves:

@@ -1534,7 +1534,7 @@ while extended result codes match only themselves:

@@ -1564,7 +1564,7 @@ while extended result codes match only themselves:

@@ -1594,7 +1594,7 @@ while extended result codes match only themselves:

@@ -1624,7 +1624,7 @@ while extended result codes match only themselves:

@@ -1654,7 +1654,7 @@ while extended result codes match only themselves:

@@ -1684,7 +1684,7 @@ while extended result codes match only themselves:

@@ -1714,7 +1714,7 @@ while extended result codes match only themselves:

@@ -1744,7 +1744,7 @@ while extended result codes match only themselves:

@@ -1774,7 +1774,7 @@ while extended result codes match only themselves:

@@ -1804,7 +1804,7 @@ while extended result codes match only themselves:

@@ -1834,7 +1834,7 @@ while extended result codes match only themselves:

@@ -1864,7 +1864,7 @@ while extended result codes match only themselves:

@@ -1894,7 +1894,7 @@ while extended result codes match only themselves:

@@ -1924,7 +1924,7 @@ while extended result codes match only themselves:

@@ -1954,7 +1954,7 @@ while extended result codes match only themselves:

@@ -1984,7 +1984,7 @@ while extended result codes match only themselves:

@@ -2014,7 +2014,7 @@ while extended result codes match only themselves:

@@ -2044,7 +2044,7 @@ while extended result codes match only themselves:

@@ -2074,7 +2074,7 @@ while extended result codes match only themselves:

@@ -2104,7 +2104,7 @@ while extended result codes match only themselves:

@@ -2134,7 +2134,7 @@ while extended result codes match only themselves:

@@ -2164,7 +2164,7 @@ while extended result codes match only themselves:

@@ -2194,7 +2194,7 @@ while extended result codes match only themselves:

@@ -2224,7 +2224,7 @@ while extended result codes match only themselves:

@@ -2254,7 +2254,7 @@ while extended result codes match only themselves:

@@ -2284,7 +2284,7 @@ while extended result codes match only themselves:

@@ -2314,7 +2314,7 @@ while extended result codes match only themselves:

@@ -2344,7 +2344,7 @@ while extended result codes match only themselves:

@@ -2374,7 +2374,7 @@ while extended result codes match only themselves:

@@ -2404,7 +2404,7 @@ while extended result codes match only themselves:

@@ -2434,7 +2434,7 @@ while extended result codes match only themselves:

@@ -2464,7 +2464,7 @@ while extended result codes match only themselves:

@@ -2494,7 +2494,7 @@ while extended result codes match only themselves:

@@ -2524,7 +2524,7 @@ while extended result codes match only themselves:

@@ -2554,7 +2554,7 @@ while extended result codes match only themselves:

@@ -2584,7 +2584,7 @@ while extended result codes match only themselves:

@@ -2614,7 +2614,7 @@ while extended result codes match only themselves:

@@ -2644,7 +2644,7 @@ while extended result codes match only themselves:

@@ -2674,7 +2674,7 @@ while extended result codes match only themselves:

@@ -2704,7 +2704,7 @@ while extended result codes match only themselves:

@@ -2734,7 +2734,7 @@ while extended result codes match only themselves:

@@ -2764,7 +2764,7 @@ while extended result codes match only themselves:

@@ -2794,7 +2794,7 @@ while extended result codes match only themselves:

@@ -2824,7 +2824,7 @@ while extended result codes match only themselves:

@@ -2854,7 +2854,7 @@ while extended result codes match only themselves:

@@ -2884,7 +2884,7 @@ while extended result codes match only themselves:

@@ -2914,7 +2914,7 @@ while extended result codes match only themselves:

@@ -2944,7 +2944,7 @@ while extended result codes match only themselves:

@@ -2974,7 +2974,7 @@ while extended result codes match only themselves:

@@ -3004,7 +3004,7 @@ while extended result codes match only themselves:

@@ -3034,7 +3034,7 @@ while extended result codes match only themselves:

@@ -3064,7 +3064,7 @@ while extended result codes match only themselves:

@@ -3094,7 +3094,7 @@ while extended result codes match only themselves:

@@ -3124,7 +3124,7 @@ while extended result codes match only themselves:

@@ -3154,7 +3154,7 @@ while extended result codes match only themselves:

@@ -3184,7 +3184,7 @@ while extended result codes match only themselves:

@@ -3214,7 +3214,7 @@ while extended result codes match only themselves:

@@ -3244,7 +3244,7 @@ while extended result codes match only themselves:

@@ -3274,7 +3274,7 @@ while extended result codes match only themselves:

@@ -3304,7 +3304,7 @@ while extended result codes match only themselves:

@@ -3334,7 +3334,7 @@ while extended result codes match only themselves:

@@ -3364,7 +3364,7 @@ while extended result codes match only themselves:

@@ -3394,7 +3394,7 @@ while extended result codes match only themselves:

@@ -3424,7 +3424,7 @@ while extended result codes match only themselves:

@@ -3454,7 +3454,7 @@ while extended result codes match only themselves:

@@ -3484,7 +3484,7 @@ while extended result codes match only themselves:

@@ -3514,7 +3514,7 @@ while extended result codes match only themselves:

@@ -3544,7 +3544,7 @@ while extended result codes match only themselves:

@@ -3574,7 +3574,7 @@ while extended result codes match only themselves:

@@ -3604,7 +3604,7 @@ while extended result codes match only themselves:

@@ -3634,7 +3634,7 @@ while extended result codes match only themselves:

@@ -3664,7 +3664,7 @@ while extended result codes match only themselves:

@@ -3694,7 +3694,7 @@ while extended result codes match only themselves:

@@ -3724,7 +3724,7 @@ while extended result codes match only themselves:

@@ -3754,7 +3754,7 @@ while extended result codes match only themselves:

@@ -3764,7 +3764,7 @@ while extended result codes match only themselves:

diff --git a/docs/4.2/Structs/SQLExpressionLiteral.html b/docs/4.2/Structs/SQLExpressionLiteral.html index 11df4eaa9..4c5d1e065 100644 --- a/docs/4.2/Structs/SQLExpressionLiteral.html +++ b/docs/4.2/Structs/SQLExpressionLiteral.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1015,12 +1015,12 @@

Experimental

SQLExpressionLiteral is an expression built from a raw SQL snippet.

-
SQLExpressionLiteral(sql: "1 + 2")
+
SQLExpressionLiteral(sql: "1 + 2")
 

The SQL literal may contain ? and colon-prefixed arguments:

-
SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
-SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
+
SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
+SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
 
@@ -1047,12 +1047,12 @@

Declaration

Swift

-
public var sql: String { get }
+
public var sql: String { get }
@@ -1077,12 +1077,12 @@

Declaration

Swift

-
public var arguments: StatementArguments { get }
+
public var arguments: StatementArguments { get }
@@ -1103,9 +1103,9 @@

Experimental

Creates an SQL literal expression.

-
SQLExpressionLiteral(sql: "1 + 2")
-SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
-SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
+
SQLExpressionLiteral(sql: "1 + 2")
+SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
+SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
 
@@ -1113,12 +1113,12 @@

Declaration

Swift

-
public init(sql: String, arguments: StatementArguments = StatementArguments())
+
public init(sql: String, arguments: StatementArguments = StatementArguments())
@@ -1139,14 +1139,14 @@

Experimental

Creates an SQL literal expression.

-
SQLExpressionLiteral(literal: SQLLiteral(sql: "1 + 2")
-SQLExpressionLiteral(literal: SQLLiteral(sql: "? + ?", arguments: [1, 2]))
-SQLExpressionLiteral(literal: SQLLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2]))
+
SQLExpressionLiteral(literal: SQLLiteral(sql: "1 + 2")
+SQLExpressionLiteral(literal: SQLLiteral(sql: "? + ?", arguments: [1, 2]))
+SQLExpressionLiteral(literal: SQLLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2]))
 

With Swift 5, you can safely embed raw values in your SQL queries, without any risk of syntax errors or SQL injection:

-
SQLExpressionLiteral(literal: "\(1) + \(2)")
+
SQLExpressionLiteral(literal: "\(1) + \(2)")
 
@@ -1159,7 +1159,7 @@ without any risk of syntax errors or SQL injection:

@@ -1169,7 +1169,7 @@ without any risk of syntax errors or SQL injection:

diff --git a/docs/4.2/Structs/SQLFunctionName.html b/docs/4.2/Structs/SQLFunctionName.html index c488716f4..25a4ee970 100644 --- a/docs/4.2/Structs/SQLFunctionName.html +++ b/docs/4.2/Structs/SQLFunctionName.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1052,7 +1052,7 @@ @@ -1093,7 +1093,7 @@ @@ -1134,7 +1134,7 @@ @@ -1175,7 +1175,7 @@ @@ -1216,7 +1216,7 @@ @@ -1257,7 +1257,7 @@ @@ -1298,7 +1298,7 @@ @@ -1308,7 +1308,7 @@ diff --git a/docs/4.2/Structs/SQLLiteral.html b/docs/4.2/Structs/SQLLiteral.html index 4413e0819..fce419a51 100644 --- a/docs/4.2/Structs/SQLLiteral.html +++ b/docs/4.2/Structs/SQLLiteral.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1016,7 +1016,7 @@ Interpolation.

For example:

-
try dbQueue.write { db in
+
try dbQueue.write { db in
     let name: String = ...
     let id: Int64 = ...
     let query: SQLLiteral = "UPDATE player SET name = \(name) WHERE id = \(id)"
@@ -1053,7 +1053,7 @@ Interpolation.

@@ -1083,7 +1083,7 @@ Interpolation.

@@ -1104,7 +1104,7 @@ Interpolation.

Creates an SQLLiteral from a plain SQL string, and eventual arguments.

For example:

-
let query = SQLLiteral(
+
let query = SQLLiteral(
     sql: "UPDATE player SET name = ? WHERE id = ?",
     arguments: [name, id])
 
@@ -1114,12 +1114,12 @@ Interpolation.

Declaration

Swift

-
public init(sql: String, arguments: StatementArguments = StatementArguments())
+
public init(sql: String, arguments: StatementArguments = StatementArguments())
@@ -1149,7 +1149,7 @@ Interpolation.

@@ -1188,7 +1188,7 @@ Interpolation.

@@ -1222,7 +1222,7 @@ Interpolation.

@@ -1256,7 +1256,7 @@ Interpolation.

@@ -1285,12 +1285,12 @@ Interpolation.

Declaration

Swift

-
public mutating func append(sql: String, arguments: StatementArguments = StatementArguments())
+
public mutating func append(sql: String, arguments: StatementArguments = StatementArguments())
@@ -1300,7 +1300,7 @@ Interpolation.

diff --git a/docs/4.2/Structs/SQLRequest.html b/docs/4.2/Structs/SQLRequest.html index fb18cb66d..74e6b5953 100644 --- a/docs/4.2/Structs/SQLRequest.html +++ b/docs/4.2/Structs/SQLRequest.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1042,7 +1042,7 @@ @@ -1071,12 +1071,12 @@

Declaration

Swift

-
public var sql: String { get }
+
public var sql: String { get }
@@ -1105,12 +1105,12 @@

Declaration

Swift

-
public var arguments: StatementArguments { get }
+
public var arguments: StatementArguments { get }
@@ -1140,7 +1140,7 @@ @@ -1175,7 +1175,7 @@ optional row adapter.

Swift

public init(
     sql: String,
-    arguments: StatementArguments = StatementArguments(),
+    arguments: StatementArguments = StatementArguments(),
     adapter: RowAdapter? = nil,
     cached: Bool = false)
@@ -1242,7 +1242,7 @@ prepared statement.

A SQLRequest

@@ -1261,10 +1261,10 @@ prepared statement.

Creates a request from an SQLLiteral, and optional row adapter.

-
let request = SQLRequest<String>(literal: SQLLiteral(sql: """
+
let request = SQLRequest<String>(literal: SQLLiteral(sql: """
     SELECT name FROM player
     """))
-let request = SQLRequest<Player>(literal: SQLLiteral(sql: """
+let request = SQLRequest<Player>(literal: SQLLiteral(sql: """
     SELECT * FROM player WHERE name = ?
     """, arguments: ["O'Brien"]))
 
@@ -1334,7 +1334,7 @@ prepared statement.

A SQLRequest

@@ -1417,7 +1417,7 @@ prepared statement.

An SQLRequest

@@ -1427,7 +1427,7 @@ prepared statement.

diff --git a/docs/4.2/Structs/ScopeAdapter.html b/docs/4.2/Structs/ScopeAdapter.html index 79ab18b65..fc7cad2a9 100644 --- a/docs/4.2/Structs/ScopeAdapter.html +++ b/docs/4.2/Structs/ScopeAdapter.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1014,11 +1014,11 @@

ScopeAdapter is a row adapter that lets you define scopes on rows.

// Two adapters
-let fooAdapter = ColumnMapping(["value": "foo"])
-let barAdapter = ColumnMapping(["value": "bar"])
+let fooAdapter = ColumnMapping(["value": "foo"])
+let barAdapter = ColumnMapping(["value": "bar"])
 
 // Define scopes
-let adapter = ScopeAdapter([
+let adapter = ScopeAdapter([
     "foo": fooAdapter,
     "bar": barAdapter])
 
@@ -1055,7 +1055,7 @@
                         

Creates an adapter that preserves row contents and add scoped rows.

For example:

-
let adapter = ScopeAdapter(["suffix": SuffixRowAdapter(fromIndex: 1)])
+
let adapter = ScopeAdapter(["suffix": SuffixRowAdapter(fromIndex: 1)])
 let row = try Row.fetchOne(db, sql: "SELECT 1, 2, 3", adapter: adapter)!
 row                  // [1, 2, 3]
 row.scopes["suffix"] // [2, 3]
@@ -1091,7 +1091,7 @@ row adapters.

@@ -1112,8 +1112,8 @@ row adapters.

Creates an adapter based on the base adapter, and add scoped rows.

For example:

-
let baseAdapter = RangeRowAdapter(0..<1)
-let adapter = ScopeAdapter(base: baseAdapter, scopes: ["suffix": SuffixRowAdapter(fromIndex: 1)])
+
let baseAdapter = RangeRowAdapter(0..<1)
+let adapter = ScopeAdapter(base: baseAdapter, scopes: ["suffix": SuffixRowAdapter(fromIndex: 1)])
 let row = try Row.fetchOne(db, sql: "SELECT 1, 2, 3", adapter: adapter)!
 row                   // [1]
 row.scopes["initial"] // [2, 3]
@@ -1167,7 +1167,7 @@ row adapters.

@@ -1177,7 +1177,7 @@ row adapters.

diff --git a/docs/4.2/Structs/StatementArguments.html b/docs/4.2/Structs/StatementArguments.html index bf1f559e7..dacf3f0e3 100644 --- a/docs/4.2/Structs/StatementArguments.html +++ b/docs/4.2/Structs/StatementArguments.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1031,7 +1031,7 @@ number already assigned

To fill question marks placeholders, feed StatementArguments with an array:

db.execute(
     sql: "INSERT ... (?, ?)",
-    arguments: StatementArguments(["Arthur", 41]))
+    arguments: StatementArguments(["Arthur", 41]))
 
 // Array literals are automatically converted:
 db.execute(
@@ -1043,7 +1043,7 @@ number already assigned
 

To fill named arguments, feed StatementArguments with a dictionary:

db.execute(
     sql: "INSERT ... (:name, :score)",
-    arguments: StatementArguments(["name": "Arthur", "score": 41]))
+    arguments: StatementArguments(["name": "Arthur", "score": 41]))
 
 // Dictionary literals are automatically converted:
 db.execute(
@@ -1114,12 +1114,12 @@ confusing, and it is best to avoid this practice:

Declaration

Swift

-
public var isEmpty: Bool { get }
+
public var isEmpty: Bool { get }
@@ -1160,7 +1160,7 @@ confusing, and it is best to avoid this practice:

@@ -1191,7 +1191,7 @@ confusing, and it is best to avoid this practice:

Creates statement arguments from a sequence of optional values.

let values: [DatabaseValueConvertible?] = ["foo", 1, nil]
-db.execute(sql: "INSERT ... (?,?,?)", arguments: StatementArguments(values))
+db.execute(sql: "INSERT ... (?,?,?)", arguments: StatementArguments(values))
 
@@ -1227,7 +1227,7 @@ confusing, and it is best to avoid this practice:

A StatementArguments.

@@ -1247,7 +1247,7 @@ confusing, and it is best to avoid this practice:

Creates statement arguments from a sequence of optional values.

let values: [String] = ["foo", "bar"]
-db.execute(sql: "INSERT ... (?,?)", arguments: StatementArguments(values))
+db.execute(sql: "INSERT ... (?,?)", arguments: StatementArguments(values))
 
@@ -1283,7 +1283,7 @@ confusing, and it is best to avoid this practice:

A StatementArguments.

@@ -1337,7 +1337,7 @@ array elements adopt DatabaseValueConvertible.

A StatementArguments.

@@ -1369,7 +1369,7 @@ array elements adopt DatabaseValueConvertible.

Creates statement arguments from a sequence of (key, value) dictionary, such as a dictionary.

let values: [String: DatabaseValueConvertible?] = ["firstName": nil, "lastName": "Miller"]
-db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
+db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
 
@@ -1405,7 +1405,7 @@ such as a dictionary.

A StatementArguments.

@@ -1426,7 +1426,7 @@ such as a dictionary.

Creates statement arguments from a sequence of (key, value) pairs, such as a dictionary.

let values: [String: DatabaseValueConvertible?] = ["firstName": nil, "lastName": "Miller"]
-db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
+db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
 
@@ -1463,7 +1463,7 @@ as a dictionary.

A StatementArguments.

@@ -1519,7 +1519,7 @@ adopt DatabaseValueConvertible.

A StatementArguments.

@@ -1591,7 +1591,7 @@ the StatementArguments type for more information about mixed arguments):

@@ -1650,7 +1650,7 @@ append(contentsOf:) method.

@@ -1707,7 +1707,7 @@ side wins:

@@ -1769,7 +1769,7 @@ append(contentsOf:) method.

@@ -1815,7 +1815,7 @@ append(contentsOf:) method.

@@ -1861,7 +1861,7 @@ append(contentsOf:) method.

@@ -1871,7 +1871,7 @@ append(contentsOf:) method.

diff --git a/docs/4.2/Structs/SuffixRowAdapter.html b/docs/4.2/Structs/SuffixRowAdapter.html index 20a7c0616..03dca9b17 100644 --- a/docs/4.2/Structs/SuffixRowAdapter.html +++ b/docs/4.2/Structs/SuffixRowAdapter.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1013,7 +1013,7 @@

SuffixRowAdapter is a row adapter that hides the first columns in a row.

-
let adapter = SuffixRowAdapter(fromIndex: 2)
+
let adapter = SuffixRowAdapter(fromIndex: 2)
 let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
 
 // [baz:3]
@@ -1052,7 +1052,7 @@ provided index.

@@ -1062,7 +1062,7 @@ provided index.

diff --git a/docs/4.2/Structs/ValueObservation.html b/docs/4.2/Structs/ValueObservation.html index 1804fffe3..a7acac3a4 100644 --- a/docs/4.2/Structs/ValueObservation.html +++ b/docs/4.2/Structs/ValueObservation.html @@ -14,7 +14,7 @@
-

GRDB 4.2.0 Docs (90% documented)

+

GRDB 4.2.1 Docs (90% documented)

View on GitHub

Install in Dash

@@ -1056,7 +1056,7 @@ observation is less efficient than a read-only observation.

@@ -1102,8 +1102,8 @@ value is also notified on the main queue, but asynchronously:

When the database changes, fresh values are asynchronously notified:

// Eventually prints "fresh players" on the main queue
-try dbQueue.write { db in
-    try Player(...).insert(db)
+try dbQueue.write { db in
+    try Player(...).insert(db)
 }
 
  • .onQueue(_:startImmediately:): all values are asychronously notified @@ -1140,7 +1140,7 @@ unspecified queues.

  • @@ -1227,7 +1227,7 @@ main queue.

    a ValueObservation.

    @@ -1261,7 +1261,7 @@ fresh values whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(Column("name"), as: String.self)
    +
    let request = Player.select(Column("name"), as: String.self)
     let observation = ValueObservation.trackingAll(request)
     
     let observer = try observation.start(in: dbQueue) { names: [String] in
    @@ -1316,7 +1316,7 @@ main queue.
                             

    a ValueObservation.

    @@ -1338,7 +1338,7 @@ main queue. fresh value whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(max(Column("score")), as: Int.self)
    +
    let request = Player.select(max(Column("score")), as: Int.self)
     let observation = ValueObservation.trackingOne(request)
     
     let observer = try observation.start(in: dbQueue) { maxScore: Int? in
    @@ -1393,7 +1393,7 @@ main queue.
                             

    a ValueObservation.

    @@ -1416,7 +1416,7 @@ fresh values whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(Column("name"), as: Optional<String>.self)
    +
    let request = Player.select(Column("name"), as: Optional<String>.self)
     let observation = ValueObservation.trackingAll(request)
     
     let observer = try observation.start(in: dbQueue) { names: [String?] in
    @@ -1472,7 +1472,7 @@ main queue.
                             

    a ValueObservation.

    @@ -1561,7 +1561,7 @@ main queue.

    a ValueObservation.

    @@ -1638,7 +1638,7 @@ main queue.

    a ValueObservation.

    @@ -1674,7 +1674,7 @@ main queue. @@ -1762,7 +1762,7 @@ main queue.

    a ValueObservation.

    @@ -1839,7 +1839,7 @@ main queue.

    a ValueObservation.

    @@ -1918,7 +1918,7 @@ a database queue or database pool), and returns a transaction observer.

    a TransactionObserver

    @@ -2000,7 +2000,7 @@ happen during observation

    a TransactionObserver

    @@ -2038,10 +2038,10 @@ regions is modified by a database transaction.

    For example, this observation counts the number of a times the player table is modified:

    var count = 0
    -let reducer = AnyValueReducer(
    +let reducer = AnyValueReducer(
         fetch: { _ in /* don't fetch anything */ },
         value: { _ -> Int? in
    -        defer { count += 1 }
    +        defer { count += 1 }
             return count })
     let observation = ValueObservation.tracking(Player.all(), reducer: { db in reducer })
     let observer = observation.start(in: dbQueue) { count: Int in
    @@ -2106,7 +2106,7 @@ the ValueReducer protocol are supported.

    @@ -2133,10 +2133,10 @@ regions is modified by a database transaction.

    For example, this observation counts the number of a times the player table is modified:

    var count = 0
    -let reducer = AnyValueReducer(
    +let reducer = AnyValueReducer(
         fetch: { _ in /* don't fetch anything */ },
         value: { _ -> Int? in
    -        defer { count += 1 }
    +        defer { count += 1 }
             return count })
     let observation = ValueObservation.tracking([Player.all()], reducer: { db in reducer })
     let observer = observation.start(in: dbQueue) { count: Int in
    @@ -2201,7 +2201,7 @@ the ValueReducer protocol are supported.

    @@ -2234,7 +2234,7 @@ the ValueReducer protocol are supported.

    fetch closure whenever a database transaction changes them.

    For example:

    -
    let observation = ValueObservation.tracking { db in
    +
    let observation = ValueObservation.tracking { db in
         try Player.fetchAll(db)
     }
     
    @@ -2285,7 +2285,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2372,7 +2372,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2459,7 +2459,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2505,7 +2505,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2551,7 +2551,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2599,7 +2599,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2647,7 +2647,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2697,7 +2697,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2747,7 +2747,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2799,7 +2799,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2851,7 +2851,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2905,7 +2905,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2961,7 +2961,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -3019,7 +3019,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -3056,7 +3056,7 @@ value observation.

    @@ -3093,7 +3093,7 @@ value observation.

    @@ -3129,7 +3129,7 @@ value observation.

    @@ -3160,7 +3160,7 @@ value observation.

    @@ -3170,7 +3170,7 @@ value observation.

    diff --git a/docs/4.2/Typealiases.html b/docs/4.2/Typealiases.html index bd6b76405..dc70fba23 100644 --- a/docs/4.2/Typealiases.html +++ b/docs/4.2/Typealiases.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1037,7 +1037,7 @@ @@ -1071,7 +1071,7 @@ @@ -1105,7 +1105,7 @@ @@ -1165,7 +1165,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes.html index 3d79dc9ad..2f854be18 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1049,7 +1049,7 @@ cursor.

    @@ -1075,11 +1075,11 @@ cursor.

    You don’t create a database directly. Instead, you use a DatabaseQueue, or a DatabasePool:

    -
    let dbQueue = DatabaseQueue(...)
    +
    let dbQueue = DatabaseQueue(...)
     
     // The Database is the `db` in the closure:
    -try dbQueue.write { db in
    -    try Player(...).insert(db)
    +try dbQueue.write { db in
    +    try Player(...).insert(db)
     }
     
    @@ -1094,7 +1094,7 @@ a DatabasePool:

    @@ -1129,7 +1129,7 @@ a DatabasePool:

    @@ -1164,7 +1164,7 @@ a DatabasePool:

    @@ -1199,7 +1199,7 @@ a DatabasePool:

    @@ -1234,7 +1234,7 @@ a DatabasePool:

    @@ -1272,7 +1272,7 @@ underlying database reader.

    @@ -1312,7 +1312,7 @@ moment it was created.

    @@ -1343,7 +1343,7 @@ moment it was created.

    A cursor of database values extracted from a single column. For example:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let urls: DatabaseValueCursor<URL> = try URL.fetchCursor(db, sql: "SELECT url FROM link")
         while let url = urls.next() { // URL
             print(url)
    @@ -1361,7 +1361,7 @@ For example:

    @@ -1381,7 +1381,7 @@ For example:

    A cursor of optional database values extracted from a single column. For example:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let urls: NullableDatabaseValueCursor<URL> = try Optional<URL>.fetchCursor(db, sql: "SELECT url FROM link")
         while let url = urls.next() { // URL?
             print(url)
    @@ -1399,7 +1399,7 @@ For example:

    @@ -1423,11 +1423,11 @@ For example:

    A future database value, returned by the DatabaseWriter.concurrentRead(_:) method.

    -
    let futureCount: Future<Int> = try writer.writeWithoutTransaction { db in
    -    try Player(...).insert()
    +
    let futureCount: Future<Int> = try writer.writeWithoutTransaction { db in
    +    try Player(...).insert()
     
         // Count players concurrently
    -    return writer.concurrentRead { db in
    +    return writer.concurrentRead { db in
             return try Player.fetchCount()
         }
     }
    @@ -1446,7 +1446,7 @@ method.

    @@ -1480,7 +1480,7 @@ underlying database writer.

    @@ -1517,7 +1517,7 @@ underlying database writer.

    @@ -1547,7 +1547,7 @@ underlying database writer.

    A cursor of database rows. For example:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let rows: RowCursor = try Row.fetchCursor(db, sql: "SELECT * FROM player")
     }
     
    @@ -1563,7 +1563,7 @@ underlying database writer.

    @@ -1601,7 +1601,7 @@ and SelectStatement that fetches rows.

    @@ -1633,7 +1633,7 @@ and SelectStatement that fetches rows.

    A subclass of Statement that fetches database rows.

    You create SelectStatement with the Database.makeSelectStatement() method:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let statement = try db.makeSelectStatement(sql: "SELECT COUNT(*) FROM player WHERE score > ?")
         let moreThanTwentyCount = try Int.fetchOne(statement, arguments: [20])!
         let moreThanThirtyCount = try Int.fetchOne(statement, arguments: [30])!
    @@ -1651,7 +1651,7 @@ and SelectStatement that fetches rows.

    @@ -1683,7 +1683,7 @@ and SelectStatement that fetches rows.

    A subclass of Statement that executes SQL queries.

    You create UpdateStatement with the Database.makeUpdateStatement() method:

    -
    try dbQueue.inTransaction { db in
    +
    try dbQueue.inTransaction { db in
         let statement = try db.makeUpdateStatement(sql: "INSERT INTO player (name) VALUES (?)")
         try statement.execute(arguments: ["Arthur"])
         try statement.execute(arguments: ["Barbara"])
    @@ -1702,7 +1702,7 @@ and SelectStatement that fetches rows.

    @@ -1726,7 +1726,7 @@ and SelectStatement that fetches rows.

    A cursor of database values extracted from a single column. For example:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let names: ColumnCursor<String> = try String.fetchCursor(db, sql: "SELECT name FROM player")
         while let name = names.next() { // String
             print(name)
    @@ -1744,7 +1744,7 @@ For example:

    @@ -1764,7 +1764,7 @@ For example:

    A cursor of optional database values extracted from a single column. For example:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let emails: FastNullableDatabaseValueCursor<String> =
             try Optional<String>.fetchCursor(db, sql: "SELECT email FROM player")
         while let email = emails.next() { // String?
    @@ -1784,7 +1784,7 @@ For example:

    @@ -1810,7 +1810,7 @@ For example:

    You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

    -
    try db.create(virtualTable: "document", using: FTS3()) { t in // t is FTS3TableDefinition
    +
    try db.create(virtualTable: "document", using: FTS3()) { t in // t is FTS3TableDefinition
         t.column("content")
     }
     
    @@ -1826,7 +1826,7 @@ For example:

    @@ -1852,7 +1852,7 @@ For example:

    You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

    -
    try db.create(virtualTable: "document", using: FTS4()) { t in // t is FTS4TableDefinition
    +
    try db.create(virtualTable: "document", using: FTS4()) { t in // t is FTS4TableDefinition
         t.column("content")
     }
     
    @@ -1870,7 +1870,7 @@ For example:

    @@ -1892,7 +1892,7 @@ For example:

    virtual table.

    You get instances of this class when you create an FTS4 table:

    -
    try db.create(virtualTable: "document", using: FTS4()) { t in
    +
    try db.create(virtualTable: "document", using: FTS4()) { t in
         t.column("content")      // FTS4ColumnDefinition
     }
     
    @@ -1910,7 +1910,7 @@ virtual table.

    @@ -1936,7 +1936,7 @@ virtual table.

    You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

    -
    try db.create(virtualTable: "document", using: FTS5()) { t in // t is FTS5TableDefinition
    +
    try db.create(virtualTable: "document", using: FTS5()) { t in // t is FTS5TableDefinition
         t.column("content")
     }
     
    @@ -1965,7 +1965,7 @@ virtual table.

    virtual table.

    You get instances of this class when you create an FTS5 table:

    -
    try db.create(virtualTable: "document", using: FTS5()) { t in
    +
    try db.create(virtualTable: "document", using: FTS5()) { t in
         t.column("content")      // FTS5ColumnDefinition
     }
     
    @@ -2016,7 +2016,7 @@ virtual table.

    @@ -2060,7 +2060,7 @@ virtual table.

    @@ -2100,7 +2100,7 @@ virtual table.

    @@ -2144,7 +2144,7 @@ virtual table.

    @@ -2174,8 +2174,8 @@ virtual table.

    A cursor of records. For example:

    -
    struct Player : FetchableRecord { ... }
    -try dbQueue.read { db in
    +
    struct Player : FetchableRecord { ... }
    +try dbQueue.read { db in
         let players: RecordCursor<Player> = try Player.fetchCursor(db, sql: "SELECT * FROM player")
     }
     
    @@ -2190,7 +2190,7 @@ virtual table.

    @@ -2229,7 +2229,7 @@ more information.

    @@ -2272,7 +2272,7 @@ designed to be subclassed.

    @@ -2282,7 +2282,7 @@ designed to be subclassed.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyCursor.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyCursor.html index 6db7a456d..29bb16aa7 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyCursor.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyCursor.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1048,7 +1048,7 @@ the base cursor’s element type

    @@ -1079,7 +1079,7 @@ on the base iterator’s element type

    @@ -1110,7 +1110,7 @@ on the base sequence’s element type

    @@ -1140,7 +1140,7 @@ on the base sequence’s element type

    @@ -1150,7 +1150,7 @@ on the base sequence’s element type

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyDatabaseReader.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyDatabaseReader.html index 38a17751d..f5be6b10d 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyDatabaseReader.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyDatabaseReader.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1046,7 +1046,7 @@ underlying database reader.

    @@ -1056,7 +1056,7 @@ underlying database reader.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyDatabaseWriter.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyDatabaseWriter.html index c023adfb4..cab1b4f94 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyDatabaseWriter.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/AnyDatabaseWriter.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1046,7 +1046,7 @@ underlying database writer.

    @@ -1056,7 +1056,7 @@ underlying database writer.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/ColumnDefinition.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/ColumnDefinition.html index 7497aee6d..7936bcda0 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/ColumnDefinition.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/ColumnDefinition.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1103,7 +1103,7 @@

    Self so that you can further refine the column definition.

    @@ -1164,7 +1164,7 @@

    Self so that you can further refine the column definition.

    @@ -1225,7 +1225,7 @@

    Self so that you can further refine the column definition.

    @@ -1266,7 +1266,7 @@

    Self so that you can further refine the column definition.

    @@ -1286,7 +1286,7 @@

    Adds a CHECK constraint on the column.

    try db.create(table: "player") { t in
    -    t.column("name", .text).check { length($0) > 0 }
    +    t.column("name", .text).check { length($0) > 0 }
     }
     
    @@ -1327,7 +1327,7 @@ represents the defined column, and returns the expression to check.

    Self so that you can further refine the column definition.

    @@ -1387,7 +1387,7 @@ represents the defined column, and returns the expression to check.

    Self so that you can further refine the column definition.

    @@ -1447,7 +1447,7 @@ represents the defined column, and returns the expression to check.

    Self so that you can further refine the column definition.

    @@ -1507,7 +1507,7 @@ represents the defined column, and returns the expression to check.

    Self so that you can further refine the column definition.

    @@ -1566,7 +1566,7 @@ represents the defined column, and returns the expression to check.

    Self so that you can further refine the column definition.

    @@ -1625,7 +1625,7 @@ represents the defined column, and returns the expression to check.

    Self so that you can further refine the column definition.

    @@ -1671,7 +1671,7 @@ represents the defined column, and returns the expression to check.

    Self so that you can further refine the column definition.

    @@ -1681,7 +1681,7 @@ represents the defined column, and returns the expression to check.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database.html index 312d25d97..7ea4b6d2c 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,11 +1016,11 @@

    You don’t create a database directly. Instead, you use a DatabaseQueue, or a DatabasePool:

    -
    let dbQueue = DatabaseQueue(...)
    +
    let dbQueue = DatabaseQueue(...)
     
     // The Database is the `db` in the closure:
    -try dbQueue.write { db in
    -    try Player(...).insert(db)
    +try dbQueue.write { db in
    +    try Player(...).insert(db)
     }
     
    @@ -1060,7 +1060,7 @@ a DatabasePool:

    @@ -1108,12 +1108,12 @@ for debugging.

    Declaration

    Swift

    -
    public static var logError: Database.LogErrorFunction? { get set }
    +
    public static var logError: Database.LogErrorFunction? { get set }
    @@ -1143,7 +1143,7 @@ for debugging.

    @@ -1184,12 +1184,12 @@ returns zero.

    Declaration

    Swift

    -
    public var lastInsertedRowID: Int64 { get }
    +
    public var lastInsertedRowID: Int64 { get }
    @@ -1217,12 +1217,12 @@ successful INSERT, UPDATE or DELETE statement.

    Declaration

    Swift

    -
    public var changesCount: Int { get }
    +
    public var changesCount: Int { get }
    @@ -1251,12 +1251,12 @@ opened.

    Declaration

    Swift

    -
    public var totalChangesCount: Int { get }
    +
    public var totalChangesCount: Int { get }
    @@ -1281,12 +1281,12 @@ opened.

    Declaration

    Swift

    -
    public var isInsideTransaction: Bool { get }
    +
    public var isInsideTransaction: Bool { get }
    @@ -1330,7 +1330,7 @@ modified by another connection.

    @@ -1360,7 +1360,7 @@ modified by another connection.

    @@ -1394,7 +1394,7 @@ modified by another connection.

    @@ -1426,7 +1426,7 @@ modified by another connection.

    @@ -1456,7 +1456,7 @@ modified by another connection.

    @@ -1486,7 +1486,7 @@ modified by another connection.

    @@ -1525,7 +1525,7 @@ table has no explicit primary key, the result is the hidden @@ -1562,7 +1562,7 @@ table(_:hasUniqueKey:) instead.

    @@ -1597,7 +1597,7 @@ if the columns are the primary key, or if there is a unique index on them.

    @@ -1627,7 +1627,7 @@ if the columns are the primary key, or if there is a unique index on them.

    @@ -1666,7 +1666,7 @@ if the columns are the primary key, or if there is a unique index on them.

    @@ -1739,7 +1739,7 @@ if the columns are the primary key, or if there is a unique index on them.

    A SelectStatement.

    @@ -1804,7 +1804,7 @@ contain values for its eventual arguments.

    An UpdateStatement.

    @@ -1866,7 +1866,7 @@ contain values for its eventual arguments.

    An UpdateStatement.

    @@ -1931,7 +1931,7 @@ contain values for its eventual arguments.

    An UpdateStatement.

    @@ -1973,7 +1973,7 @@ contain values for its eventual arguments.

    Declaration

    Swift

    -
    public func execute(sql: String, arguments: StatementArguments = StatementArguments()) throws
    +
    public func execute(sql: String, arguments: StatementArguments = StatementArguments()) throws
    @@ -2009,7 +2009,7 @@ contain values for its eventual arguments.

    @@ -2028,11 +2028,11 @@ contain values for its eventual arguments.

    Executes one or several SQL statements, separated by semi-colons.

    -
    try db.execute(literal: SQLLiteral(
    +
    try db.execute(literal: SQLLiteral(
         sql: "INSERT INTO player (name) VALUES (:name)",
         arguments: ["name": "Arthur"]))
     
    -try db.execute(literal: SQLLiteral(sql: """
    +try db.execute(literal: SQLLiteral(sql: """
         INSERT INTO player (name) VALUES (?);
         INSERT INTO player (name) VALUES (?);
         INSERT INTO player (name) VALUES (?);
    @@ -2084,7 +2084,7 @@ without any risk of syntax errors or SQL injection:

    @@ -2114,8 +2114,8 @@ without any risk of syntax errors or SQL injection:

    Add or redefine an SQL function.

    -
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    -    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
    +
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    +    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
             return nil
         }
         return int + 1
    @@ -2134,7 +2134,7 @@ without any risk of syntax errors or SQL injection:

    @@ -2164,7 +2164,7 @@ without any risk of syntax errors or SQL injection:

    @@ -2194,7 +2194,7 @@ without any risk of syntax errors or SQL injection:

    Add or redefine a collation.

    -
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
    +
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
         return (string1 as NSString).localizedStandardCompare(string2)
     }
     db.add(collation: collation)
    @@ -2211,7 +2211,7 @@ without any risk of syntax errors or SQL injection:

    @@ -2241,7 +2241,7 @@ without any risk of syntax errors or SQL injection:

    @@ -2271,8 +2271,8 @@ without any risk of syntax errors or SQL injection:

    Executes a block inside a database transaction.

    -
    try dbQueue.inDatabase do {
    -    try db.inTransaction {
    +
    try dbQueue.inDatabase do {
    +    try db.inTransaction {
             try db.execute(sql: "INSERT ...")
             return .commit
         }
    @@ -2334,7 +2334,7 @@ for more information.

    @@ -2353,8 +2353,8 @@ for more information.

    Executes a block inside a savepoint.

    -
    try dbQueue.inDatabase do {
    -    try db.inSavepoint {
    +
    try dbQueue.inDatabase do {
    +    try db.inSavepoint {
             try db.execute(sql: "INSERT ...")
             return .commit
         }
    @@ -2401,7 +2401,7 @@ either .commit or .rollback.

    @@ -2458,7 +2458,7 @@ for more information.

    @@ -2488,7 +2488,7 @@ for more information.

    @@ -2518,7 +2518,7 @@ for more information.

    @@ -2552,7 +2552,7 @@ for more information.

    @@ -2586,8 +2586,8 @@ remains locked for more than the specified duration.

    To set the busy mode of a database, use Configuration:

    // Wait 1 second before failing with SQLITE_BUSY
    -let configuration = Configuration(busyMode: .timeout(1))
    -let dbQueue = DatabaseQueue(path: "...", configuration: configuration)
    +let configuration = Configuration(busyMode: .timeout(1))
    +let dbQueue = DatabaseQueue(path: "...", configuration: configuration)
     

    Relevant SQLite documentation:

    @@ -2610,7 +2610,7 @@ remains locked for more than the specified duration.

    @@ -2641,7 +2641,7 @@ remains locked for more than the specified duration.

    @@ -2674,7 +2674,7 @@ remains locked for more than the specified duration.

    @@ -2712,7 +2712,7 @@ remains locked for more than the specified duration.

    @@ -2745,7 +2745,7 @@ remains locked for more than the specified duration.

    @@ -2778,7 +2778,7 @@ remains locked for more than the specified duration.

    @@ -2808,7 +2808,7 @@ remains locked for more than the specified duration.

    @@ -2839,7 +2839,7 @@ remains locked for more than the specified duration.

    @@ -2870,7 +2870,7 @@ remains locked for more than the specified duration.

    @@ -2947,7 +2947,7 @@ is deallocated).

    @@ -2977,7 +2977,7 @@ is deallocated).

    @@ -2997,8 +2997,8 @@ is deallocated).

    Registers a closure to be executed after the next or current transaction completion.

    -
    try dbQueue.write { db in
    -    db.afterNextTransactionCommit { _ in
    +
    try dbQueue.write { db in
    +    db.afterNextTransactionCommit { _ in
             print("success")
         }
         ...
    @@ -3020,7 +3020,7 @@ dispatch queue, serialized will all database updates.

    @@ -3053,7 +3053,7 @@ dispatch queue, serialized will all database updates.

    @@ -3087,7 +3087,7 @@ dispatch queue, serialized will all database updates.

    @@ -3255,7 +3255,7 @@ already exists.

    @@ -3362,7 +3362,7 @@ already exists.

    @@ -3399,7 +3399,7 @@ already exists.

    @@ -3471,7 +3471,7 @@ already exists.

    @@ -3508,7 +3508,7 @@ already exists.

    @@ -3650,7 +3650,7 @@ query.

    @@ -3669,7 +3669,7 @@ query.

    Creates a partial index.

    -
    try db.create(index: "playerByEmail", on: "player", columns: ["email"], condition: Column("email") != nil)
    +
    try db.create(index: "playerByEmail", on: "player", columns: ["email"], condition: Column("email") != nil)
     

    See https://www.sqlite.org/lang_createindex.html, and @@ -3772,7 +3772,7 @@ query.

    @@ -3809,7 +3809,7 @@ query.

    @@ -3849,7 +3849,7 @@ has changed.

    @@ -3889,7 +3889,7 @@ has changed.

    @@ -3984,7 +3984,7 @@ already exists.

    @@ -4014,7 +4014,7 @@ argument: refer to this module’s documentation.

    Use this method to create full-text tables using the FTS3, FTS4, or FTS5 modules:

    -
    try db.create(virtualTable: "book", using: FTS4()) { t in
    +
    try db.create(virtualTable: "book", using: FTS4()) { t in
         t.column("title")
         t.column("author")
         t.column("body")
    @@ -4100,7 +4100,7 @@ already exists.

    @@ -4110,7 +4110,7 @@ already exists.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/BusyMode.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/BusyMode.html index d2312f2b2..b2b31a0e8 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/BusyMode.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/BusyMode.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1028,8 +1028,8 @@ remains locked for more than the specified duration.

    To set the busy mode of a database, use Configuration:

    // Wait 1 second before failing with SQLITE_BUSY
    -let configuration = Configuration(busyMode: .timeout(1))
    -let dbQueue = DatabaseQueue(path: "...", configuration: configuration)
    +let configuration = Configuration(busyMode: .timeout(1))
    +let dbQueue = DatabaseQueue(path: "...", configuration: configuration)
     

    Relevant SQLite documentation:

    @@ -1071,7 +1071,7 @@ tries to access the locked database.

    @@ -1102,7 +1102,7 @@ locked for more than the specified duration (in seconds).

    @@ -1133,7 +1133,7 @@ See https://www.sqlite. @@ -1143,7 +1143,7 @@ See https://www.sqlite. diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/CheckpointMode.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/CheckpointMode.html index 85ee48afb..f13518009 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/CheckpointMode.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/CheckpointMode.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1103,7 +1103,7 @@ @@ -1133,7 +1133,7 @@ @@ -1143,7 +1143,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/CollationName.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/CollationName.html index ddb8a890c..0aebb2141 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/CollationName.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/CollationName.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ColumnType.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ColumnType.html index 8f724d0b8..02dd0adab 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ColumnType.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ColumnType.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1050,7 +1050,7 @@ @@ -1080,7 +1080,7 @@ @@ -1110,7 +1110,7 @@ @@ -1140,7 +1140,7 @@ @@ -1170,7 +1170,7 @@ @@ -1200,7 +1200,7 @@ @@ -1230,7 +1230,7 @@ @@ -1260,7 +1260,7 @@ @@ -1290,7 +1290,7 @@ @@ -1300,7 +1300,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ConflictResolution.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ConflictResolution.html index 18d2614e8..b164be0be 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ConflictResolution.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ConflictResolution.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1135,7 +1135,7 @@ @@ -1165,7 +1165,7 @@ @@ -1175,7 +1175,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ForeignKeyAction.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ForeignKeyAction.html index e1a84421d..350a110cd 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ForeignKeyAction.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/ForeignKeyAction.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionCompletion.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionCompletion.html index 17ac6c9d6..516ea72d5 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionCompletion.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionCompletion.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionKind.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionKind.html index 42730d741..bee5922e3 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionKind.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionKind.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1103,7 +1103,7 @@ @@ -1113,7 +1113,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionObservationExtent.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionObservationExtent.html index 3d3d158e9..d36a62db0 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionObservationExtent.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Database/TransactionObservationExtent.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1115,7 +1115,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseCollation.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseCollation.html index c661c4960..20de7e417 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseCollation.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseCollation.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1062,7 +1062,7 @@

    Creates a collation.

    -
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
    +
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
         return (string1 as NSString).localizedStandardCompare(string2)
     }
     db.add(collation: collation)
    @@ -1110,7 +1110,7 @@
                             
                           
    @@ -1164,7 +1164,7 @@ connections.

    @@ -1207,7 +1207,7 @@ connections.

    @@ -1250,7 +1250,7 @@ connections.

    @@ -1293,7 +1293,7 @@ connections.

    @@ -1336,7 +1336,7 @@ connections.

    @@ -1346,7 +1346,7 @@ connections.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseFunction.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseFunction.html index 69f7f66e1..ce79b41c5 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseFunction.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseFunction.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1038,12 +1038,12 @@

    Declaration

    Swift

    -
    public var name: String { get }
    +
    public var name: String { get }
    @@ -1062,8 +1062,8 @@

    Returns an SQL function.

    -
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    -    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
    +
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    +    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
             return nil
         }
         return int + 1
    @@ -1149,7 +1149,7 @@ not nil.

    @@ -1168,7 +1168,7 @@ not nil.

    Returns an SQL aggregate function.

    -
    struct MySum : DatabaseAggregate {
    +
    struct MySum : DatabaseAggregate {
         var sum: Int = 0
     
         mutating func step(_ dbValues: [DatabaseValue]) {
    @@ -1177,15 +1177,15 @@ not nil.

    } } - func finalize() -> DatabaseValueConvertible? { + func finalize() -> DatabaseValueConvertible? { return sum } } -let dbQueue = DatabaseQueue() -let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self) +let dbQueue = DatabaseQueue() +let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self) dbQueue.add(function: fn) -try dbQueue.write { db in +try dbQueue.write { db in try db.execute(sql: "CREATE TABLE test(i)") try db.execute(sql: "INSERT INTO test(i) VALUES (1)") try db.execute(sql: "INSERT INTO test(i) VALUES (2)") @@ -1270,7 +1270,7 @@ not nil.

    @@ -1307,7 +1307,7 @@ String property.

    This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s capitalized:

    -
    let nameColumn = Column("name")
    +
    let nameColumn = Column("name")
     let request = Player.select(nameColumn.capitalized)
     let names = try String.fetchAll(dbQueue, request)   // [String]
     
    @@ -1322,7 +1322,7 @@ capitalized:

    @@ -1348,7 +1348,7 @@ String property.

    This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s lowercased:

    -
    let nameColumn = Column("name")
    +
    let nameColumn = Column("name")
     let request = Player.select(nameColumn.lowercased())
     let names = try String.fetchAll(dbQueue, request)   // [String]
     
    @@ -1363,7 +1363,7 @@ lowercased:

    @@ -1389,7 +1389,7 @@ String property.

    This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s uppercased:

    -
    let nameColumn = Column("name")
    +
    let nameColumn = Column("name")
     let request = Player.select(nameColumn.uppercased())
     let names = try String.fetchAll(dbQueue, request)   // [String]
     
    @@ -1404,7 +1404,7 @@ uppercased:

    @@ -1441,7 +1441,7 @@ localizedCapitalized String property.

    This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s localizedCapitalized:

    -
    let nameColumn = Column("name")
    +
    let nameColumn = Column("name")
     let request = Player.select(nameColumn.localizedCapitalized)
     let names = try String.fetchAll(dbQueue, request)   // [String]
     
    @@ -1457,7 +1457,7 @@ localizedCapitalized:

    @@ -1483,7 +1483,7 @@ localizedLowercased String property.

    This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s localizedLowercased:

    -
    let nameColumn = Column("name")
    +
    let nameColumn = Column("name")
     let request = Player.select(nameColumn.localizedLowercased)
     let names = try String.fetchAll(dbQueue, request)   // [String]
     
    @@ -1499,7 +1499,7 @@ localizedLowercased:

    @@ -1525,7 +1525,7 @@ localizedUppercased String property.

    This function is automatically added by GRDB to your database connections. It is the function used by the query interface’s localizedUppercased:

    -
    let nameColumn = Column("name")
    +
    let nameColumn = Column("name")
     let request = Player.select(nameColumn.localizedUppercased)
     let names = try String.fetchAll(dbQueue, request)   // [String]
     
    @@ -1541,7 +1541,7 @@ localizedUppercased:

    @@ -1584,7 +1584,7 @@ localizedUppercased:

    @@ -1594,7 +1594,7 @@ localizedUppercased:

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseFuture.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseFuture.html index 22b1bc434..c9a0ec1c8 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseFuture.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseFuture.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1014,11 +1014,11 @@

    A future database value, returned by the DatabaseWriter.concurrentRead(_:) method.

    -
    let futureCount: Future<Int> = try writer.writeWithoutTransaction { db in
    -    try Player(...).insert()
    +
    let futureCount: Future<Int> = try writer.writeWithoutTransaction { db in
    +    try Player(...).insert()
     
         // Count players concurrently
    -    return writer.concurrentRead { db in
    +    return writer.concurrentRead { db in
             return try Player.fetchCount()
         }
     }
    @@ -1062,7 +1062,7 @@ method.

    @@ -1072,7 +1072,7 @@ method.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabasePool.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabasePool.html index f1fa32e99..395e88be4 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabasePool.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabasePool.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,12 +1045,12 @@

    Declaration

    Swift

    -
    public var path: String { get }
    +
    public var path: String { get }
    @@ -1074,12 +1074,12 @@

    Declaration

    Swift

    -
    public var configuration: Configuration { get }
    +
    public var configuration: Configuration { get }
    @@ -1109,7 +1109,7 @@

    Opens the SQLite database at path path.

    -
    let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
    +
    let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
     

    Database connections get closed when the database pool gets deallocated.

    @@ -1124,7 +1124,7 @@

    Declaration

    Swift

    -
    public init(path: String, configuration: Configuration = Configuration()) throws
    +
    public init(path: String, configuration: Configuration = Configuration()) throws
    @@ -1160,7 +1160,7 @@ @@ -1224,7 +1224,7 @@ more information.

    @@ -1269,7 +1269,7 @@ more information.

    @@ -1307,7 +1307,7 @@ enters background. @@ -1338,21 +1338,21 @@ enters background.

    Synchronously executes a read-only block in a protected dispatch queue, and returns its result. The block is wrapped in a deferred transaction.

    -
    let players = try dbPool.read { db in
    +
    let players = try dbPool.read { db in
         try Player.fetchAll(...)
     }
     

    The block is completely isolated. Eventual concurrent database updates are not visible inside the block:

    -
    try dbPool.read { db in
    +
    try dbPool.read { db in
         // Those two values are guaranteed to be equal, even if the
         // `wine` table is modified between the two requests:
         let count1 = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
         let count2 = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
     }
     
    -try dbPool.read { db in
    +try dbPool.read { db in
         // Now this value may be different:
         let count = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
     }
    @@ -1395,7 +1395,7 @@ happen while establishing the read access to the database.
                             
                           
    @@ -1414,11 +1414,11 @@ happen while establishing the read access to the database.

    Asynchronously executes a read-only block in a protected dispatch queue.

    -
    let players = try dbQueue.asyncRead { result in
    -    do {
    +
    let players = try dbQueue.asyncRead { result in
    +    do {
             let db = try result.get()
             let count = try Player.fetchCount(db)
    -    } catch {
    +    } catch {
             // Handle error
         }
     }
    @@ -1457,7 +1457,7 @@ DatabaseError of resultCode SQLITE_READONLY.

    @@ -1480,7 +1480,7 @@ and returns its result.

    The block argument is not isolated: eventual concurrent database updates are visible inside the block:

    -
    try dbPool.unsafeRead { db in
    +
    try dbPool.unsafeRead { db in
         // Those two values may be different because some other thread
         // may have inserted or deleted a wine between the two requests:
         let count1 = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
    @@ -1489,7 +1489,7 @@ are visible inside the block:

    Cursor iteration is safe, though:

    -
    try dbPool.unsafeRead { db in
    +
    try dbPool.unsafeRead { db in
         // No concurrent update can mess with this iteration:
         let rows = try Row.fetchCursor(db, sql: "SELECT ...")
         while let row = try rows.next() { ... }
    @@ -1533,7 +1533,7 @@ happen while establishing the read access to the database.
                             
                           
                           
                         
                       
    @@ -1556,7 +1556,7 @@ and returns its result.

    The block argument is not isolated: eventual concurrent database updates are visible inside the block:

    -
    try dbPool.unsafeReentrantRead { db in
    +
    try dbPool.unsafeReentrantRead { db in
         // Those two values may be different because some other thread
         // may have inserted or deleted a wine between the two requests:
         let count1 = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM wine")!
    @@ -1565,7 +1565,7 @@ are visible inside the block:

    Cursor iteration is safe, though:

    -
    try dbPool.unsafeReentrantRead { db in
    +
    try dbPool.unsafeReentrantRead { db in
         // No concurrent update can mess with this iteration:
         let rows = try Row.fetchCursor(db, sql: "SELECT ...")
         while let row = try rows.next() { ... }
    @@ -1610,7 +1610,7 @@ happen while establishing the read access to the database.
                             
                           
                           
                         
                       
    @@ -1639,7 +1639,7 @@ happen while establishing the read access to the database.
                             
                           
                           
                         
                       
    @@ -1671,23 +1671,23 @@ are established.

    In the example below, the number of players is fetched concurrently with the player insertion. Yet the future is guaranteed to return zero:

    -
    try writer.asyncWriteWithoutTransaction { db in
    +
    try writer.asyncWriteWithoutTransaction { db in
         // Delete all players
         try Player.deleteAll()
     
         // Count players concurrently
    -    writer.asyncConcurrentRead { result in
    -        do {
    +    writer.asyncConcurrentRead { result in
    +        do {
                 let db = try result.get()
                 // Guaranteed to be zero
                 let count = try Player.fetchCount(db)
    -        } catch {
    +        } catch {
                 // Handle error
             }
         }
     
         // Insert a player
    -    try Player(...).insert(db)
    +    try Player(...).insert(db)
     }
     
    @@ -1720,7 +1720,7 @@ the player insertion. Yet the future is guaranteed to return zero:

    @@ -1794,7 +1794,7 @@ in a transaction.

    @@ -1826,7 +1826,7 @@ has completed.

    of the database until the transaction has completed.

    This method is not reentrant.

    -
    try dbPool.writeInTransaction { db in
    +
    try dbPool.writeInTransaction { db in
         db.execute(...)
         return .commit
     }
    @@ -1885,7 +1885,7 @@ for more information.

    @@ -1925,7 +1925,7 @@ dangerous concurrency practices.

    @@ -1959,7 +1959,7 @@ in a transaction.

    @@ -1989,14 +1989,14 @@ in a transaction.

    Add or redefine an SQL function.

    -
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    -    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
    +
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    +    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
             return nil
         }
         return int + 1
     }
     dbPool.add(function: fn)
    -try dbPool.read { db in
    +try dbPool.read { db in
         try Int.fetchOne(db, sql: "SELECT succ(1)") // 2
     }
     
    @@ -2011,7 +2011,7 @@ in a transaction.

    @@ -2041,7 +2041,7 @@ in a transaction.

    @@ -2071,11 +2071,11 @@ in a transaction.

    Add or redefine a collation.

    -
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
    +
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
         return (string1 as NSString).localizedStandardCompare(string2)
     }
     dbPool.add(collation: collation)
    -try dbPool.write { db in
    +try dbPool.write { db in
         try db.execute(sql: "CREATE TABLE file (name TEXT COLLATE LOCALIZED_STANDARD")
     }
     
    @@ -2090,7 +2090,7 @@ in a transaction.

    @@ -2120,7 +2120,7 @@ in a transaction.

    @@ -2150,7 +2150,7 @@ in a transaction.

    Add a custom FTS5 tokenizer.

    -
    class MyTokenizer : FTS5CustomTokenizer { ... }
    +
    class MyTokenizer : FTS5CustomTokenizer { ... }
     dbPool.add(tokenizer: MyTokenizer.self)
     
    @@ -2189,19 +2189,19 @@ moment it was created.

    When you want to control the latest committed changes seen by a snapshot, create it from the pool’s writer protected dispatch queue:

    -
    let snapshot1 = try dbPool.write { db -> DatabaseSnapshot in
    +
    let snapshot1 = try dbPool.write { db -> DatabaseSnapshot in
         try Player.deleteAll()
         return try dbPool.makeSnapshot()
     }
     // <- Other threads may modify the database here
     let snapshot2 = try dbPool.makeSnapshot()
     
    -try snapshot1.read { db in
    +try snapshot1.read { db in
         // Guaranteed to be zero
         try Player.fetchCount(db)
     }
     
    -try snapshot2.read { db in
    +try snapshot2.read { db in
         // Could be anything
         try Player.fetchCount(db)
     }
    @@ -2210,8 +2210,8 @@ snapshot, create it from the pool’s writer protected dispatch queue:

    It is forbidden to create a snapshot from the writer protected dispatch queue when a transaction is opened, though, because it is likely a programmer error:

    -
    try dbPool.write { db in
    -    try db.inTransaction {
    +
    try dbPool.write { db in
    +    try db.inTransaction {
             try Player.deleteAll()
             // fatal error: makeSnapshot() must not be called from inside a transaction
             let snapshot = try dbPool.makeSnapshot()
    @@ -2222,11 +2222,11 @@ programmer error:

    To avoid this fatal error, create the snapshot before or after the transaction:

    -
    try dbPool.writeWithoutTransaction { db in
    +
    try dbPool.writeWithoutTransaction { db in
         // OK
         let snapshot = try dbPool.makeSnapshot()
     
    -    try db.inTransaction {
    +    try db.inTransaction {
             try Player.deleteAll()
             return .commit
         }
    @@ -2251,7 +2251,7 @@ number of reader connections in the pool.

    @@ -2261,7 +2261,7 @@ number of reader connections in the pool.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseQueue.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseQueue.html index 26df3251d..5aafd886a 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseQueue.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseQueue.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,12 +1045,12 @@

    Declaration

    Swift

    -
    public var configuration: Configuration { get }
    +
    public var configuration: Configuration { get }
    @@ -1075,12 +1075,12 @@

    Declaration

    Swift

    -
    public var path: String { get }
    +
    public var path: String { get }
    @@ -1110,7 +1110,7 @@

    Opens the SQLite database at path path.

    -
    let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
    +
    let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
     

    Database connections get closed when the database queue gets deallocated.

    @@ -1125,7 +1125,7 @@

    Declaration

    Swift

    -
    public init(path: String, configuration: Configuration = Configuration()) throws
    +
    public init(path: String, configuration: Configuration = Configuration()) throws
    @@ -1161,7 +1161,7 @@ @@ -1180,7 +1180,7 @@

    Opens an in-memory SQLite database.

    -
    let dbQueue = DatabaseQueue()
    +
    let dbQueue = DatabaseQueue()
     

    Database memory is released when the database queue gets deallocated.

    @@ -1190,7 +1190,7 @@

    Declaration

    Swift

    -
    public init(configuration: Configuration = Configuration())
    +
    public init(configuration: Configuration = Configuration())
    @@ -1214,7 +1214,7 @@ @@ -1259,7 +1259,7 @@ @@ -1297,7 +1297,7 @@ enters background. @@ -1328,7 +1328,7 @@ enters background.

    Synchronously executes a read-only block in a protected dispatch queue, and returns its result.

    -
    let players = try dbQueue.read { db in
    +
    let players = try dbQueue.read { db in
         try Player.fetchAll(db)
     }
     
    @@ -1373,7 +1373,7 @@ DatabaseError of resultCode SQLITE_READONLY.

    @@ -1392,11 +1392,11 @@ DatabaseError of resultCode SQLITE_READONLY.

    Asynchronously executes a read-only block in a protected dispatch queue.

    -
    let players = try dbQueue.asyncRead { result in
    -    do {
    +
    let players = try dbQueue.asyncRead { result in
    +    do {
             let db = try result.get()
             let count = try Player.fetchCount(db)
    -    } catch {
    +    } catch {
             // Handle error
         }
     }
    @@ -1435,7 +1435,7 @@ DatabaseError of resultCode SQLITE_READONLY.

    @@ -1464,7 +1464,7 @@ DatabaseError of resultCode SQLITE_READONLY.

    @@ -1504,7 +1504,7 @@ also rollbacked, but no error is thrown.

    transaction has completed.

    This method is not reentrant.

    -
    try dbQueue.writeInTransaction { db in
    +
    try dbQueue.writeInTransaction { db in
         db.execute(...)
         return .commit
     }
    @@ -1563,7 +1563,7 @@ for more information.

    @@ -1623,7 +1623,7 @@ are completed.

    @@ -1644,8 +1644,8 @@ are completed.

    Synchronously executes database updates in a protected dispatch queue, outside of any transaction, and returns the result.

    // INSERT INTO player ...
    -let players = try dbQueue.inDatabase { db in
    -    try Player(...).insert(db)
    +let players = try dbQueue.inDatabase { db in
    +    try Player(...).insert(db)
     }
     
    @@ -1685,7 +1685,7 @@ outside of any transaction, and returns the result.

    @@ -1706,8 +1706,8 @@ outside of any transaction, and returns the result.

    Synchronously executes database updates in a protected dispatch queue, and returns the result.

    // INSERT INTO player ...
    -try dbQueue.unsafeReentrantWrite { db in
    -    try Player(...).insert(db)
    +try dbQueue.unsafeReentrantWrite { db in
    +    try Player(...).insert(db)
     }
     
    @@ -1724,7 +1724,7 @@ concurrency practices.

    @@ -1755,7 +1755,7 @@ outside of any transaction.

    @@ -1785,14 +1785,14 @@ outside of any transaction.

    Add or redefine an SQL function.

    -
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    -    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
    +
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    +    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
             return nil
         }
         return int + 1
     }
     dbQueue.add(function: fn)
    -try dbQueue.read { db in
    +try dbQueue.read { db in
         try Int.fetchOne(db, sql: "SELECT succ(1)") // 2
     }
     
    @@ -1807,7 +1807,7 @@ outside of any transaction.

    @@ -1837,7 +1837,7 @@ outside of any transaction.

    @@ -1867,11 +1867,11 @@ outside of any transaction.

    Add or redefine a collation.

    -
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
    +
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
         return (string1 as NSString).localizedStandardCompare(string2)
     }
     dbQueue.add(collation: collation)
    -try dbQueue.write { db in
    +try dbQueue.write { db in
         try db.execute(sql: "CREATE TABLE file (name TEXT COLLATE LOCALIZED_STANDARD")
     }
     
    @@ -1886,7 +1886,7 @@ outside of any transaction.

    @@ -1916,7 +1916,7 @@ outside of any transaction.

    @@ -1926,7 +1926,7 @@ outside of any transaction.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseSnapshot.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseSnapshot.html index 3808e6639..bbb7d30cd 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseSnapshot.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/DatabaseSnapshot.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,12 +1043,12 @@ moment it was created.

    Declaration

    Swift

    -
    public var configuration: Configuration { get }
    +
    public var configuration: Configuration { get }
    @@ -1079,7 +1079,7 @@ moment it was created.

    Synchronously executes a read-only block that takes a database connection, and returns its result.

    -
    let players = try snapshot.read { db in
    +
    let players = try snapshot.read { db in
         try Player.fetchAll(...)
     }
     
    @@ -1118,7 +1118,7 @@ connection, and returns its result.

    @@ -1137,11 +1137,11 @@ connection, and returns its result.

    Asynchronously executes a read-only block in a protected dispatch queue.

    -
    let players = try snapshot.asyncRead { result in
    -    do {
    +
    let players = try snapshot.asyncRead { result in
    +    do {
             let db = try result.get()
             let count = try Player.fetchCount(db)
    -    } catch {
    +    } catch {
             // Handle error
         }
     }
    @@ -1176,7 +1176,7 @@ connection, and returns its result.

    @@ -1216,7 +1216,7 @@ connection, and returns its result.

    @@ -1245,7 +1245,7 @@ connection, and returns its result.

    @@ -1285,7 +1285,7 @@ connection, and returns its result.

    @@ -1314,7 +1314,7 @@ connection, and returns its result.

    @@ -1358,7 +1358,7 @@ connection, and returns its result.

    @@ -1387,7 +1387,7 @@ connection, and returns its result.

    @@ -1397,7 +1397,7 @@ connection, and returns its result.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS3TableDefinition.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS3TableDefinition.html index 2b5f66093..ef7be7f40 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS3TableDefinition.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS3TableDefinition.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,7 +1016,7 @@

    You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

    -
    try db.create(virtualTable: "document", using: FTS3()) { t in // t is FTS3TableDefinition
    +
    try db.create(virtualTable: "document", using: FTS3()) { t in // t is FTS3TableDefinition
         t.column("content")
     }
     
    @@ -1039,7 +1039,7 @@

    The virtual table tokenizer

    -
    try db.create(virtualTable: "document", using: FTS3()) { t in
    +
    try db.create(virtualTable: "document", using: FTS3()) { t in
         t.tokenizer = .porter
     }
     
    @@ -1056,7 +1056,7 @@
    @@ -1075,7 +1075,7 @@

    Appends a table column.

    -
    try db.create(virtualTable: "document", using: FTS3()) { t in
    +
    try db.create(virtualTable: "document", using: FTS3()) { t in
         t.column("content")
     }
     
    @@ -1109,7 +1109,7 @@
    @@ -1119,7 +1119,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS4ColumnDefinition.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS4ColumnDefinition.html index 5771c0896..67a7b1892 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS4ColumnDefinition.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS4ColumnDefinition.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,7 +1016,7 @@ virtual table.

    You get instances of this class when you create an FTS4 table:

    -
    try db.create(virtualTable: "document", using: FTS4()) { t in
    +
    try db.create(virtualTable: "document", using: FTS4()) { t in
         t.column("content")      // FTS4ColumnDefinition
     }
     
    @@ -1041,7 +1041,7 @@ virtual table.

    Excludes the column from the full-text index.

    -
    try db.create(virtualTable: "document", using: FTS4()) { t in
    +
    try db.create(virtualTable: "document", using: FTS4()) { t in
         t.column("a")
         t.column("b").notIndexed()
     }
    @@ -1065,7 +1065,7 @@ virtual table.

    Self so that you can further refine the column definition.

    @@ -1084,7 +1084,7 @@ virtual table.

    Uses the column as the Int32 language id hidden column.

    -
    try db.create(virtualTable: "document", using: FTS4()) { t in
    +
    try db.create(virtualTable: "document", using: FTS4()) { t in
         t.column("a")
         t.column("lid").asLanguageId()
     }
    @@ -1107,7 +1107,7 @@ virtual table.

    Self so that you can further refine the column definition.

    @@ -1117,7 +1117,7 @@ virtual table.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS4TableDefinition.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS4TableDefinition.html index c1898baf9..a5d1f0fb4 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS4TableDefinition.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS4TableDefinition.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,7 +1016,7 @@

    You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

    -
    try db.create(virtualTable: "document", using: FTS4()) { t in // t is FTS4TableDefinition
    +
    try db.create(virtualTable: "document", using: FTS4()) { t in // t is FTS4TableDefinition
         t.column("content")
     }
     
    @@ -1041,7 +1041,7 @@

    The virtual table tokenizer

    -
    try db.create(virtualTable: "document", using: FTS4()) { t in
    +
    try db.create(virtualTable: "document", using: FTS4()) { t in
         t.tokenizer = .porter
     }
     
    @@ -1058,7 +1058,7 @@
    @@ -1092,12 +1092,12 @@ established with the

    Swift

    -
    public var content: String? { get set }
    +
    public var content: String? { get set }
    @@ -1129,7 +1129,7 @@ established with the - Show on GitHub + Show on GitHub @@ -1161,7 +1161,7 @@ established with the - Show on GitHub + Show on GitHub @@ -1193,7 +1193,7 @@ established with the - Show on GitHub + Show on GitHub @@ -1213,7 +1213,7 @@ established with the

    Support for the FTS5 prefix option

    // CREATE VIRTUAL TABLE document USING FTS4(content, prefix='2 4');
    -db.create(virtualTable: "document", using:FTS4()) { t in
    +db.create(virtualTable: "document", using:FTS4()) { t in
         t.prefixes = [2, 4]
         t.column("content")
     }
    @@ -1231,7 +1231,7 @@ established with the 
    -                        Show on GitHub
    +                        Show on GitHub
                           
                         
                       
    @@ -1250,7 +1250,7 @@ established with the 
                           
                         
                       
    @@ -1322,7 +1322,7 @@ full-text table is kept up to date with the external table.

    @@ -1332,7 +1332,7 @@ full-text table is kept up to date with the external table.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS5ColumnDefinition.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS5ColumnDefinition.html index 3a70a3c40..400408065 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS5ColumnDefinition.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS5ColumnDefinition.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1010,7 +1010,7 @@ virtual table.

    You get instances of this class when you create an FTS5 table:

    -
    try db.create(virtualTable: "document", using: FTS5()) { t in
    +
    try db.create(virtualTable: "document", using: FTS5()) { t in
         t.column("content")      // FTS5ColumnDefinition
     }
     
    @@ -1035,7 +1035,7 @@ virtual table.

    Excludes the column from the full-text index.

    -
    try db.create(virtualTable: "document", using: FTS5()) { t in
    +
    try db.create(virtualTable: "document", using: FTS5()) { t in
         t.column("a")
         t.column("b").notIndexed()
     }
    @@ -1052,7 +1052,7 @@ virtual table.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS5TableDefinition.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS5TableDefinition.html index 6e51ea535..923a003d1 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS5TableDefinition.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FTS5TableDefinition.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1010,7 +1010,7 @@

    You don’t create instances of this class. Instead, you use the Database create(virtualTable:using:) method:

    -
    try db.create(virtualTable: "document", using: FTS5()) { t in // t is FTS5TableDefinition
    +
    try db.create(virtualTable: "document", using: FTS5()) { t in // t is FTS5TableDefinition
         t.column("content")
     }
     
    @@ -1035,7 +1035,7 @@

    The virtual table tokenizer

    -
    try db.create(virtualTable: "document", using: FTS5()) { t in
    +
    try db.create(virtualTable: "document", using: FTS5()) { t in
         t.tokenizer = .porter()
     }
     
    @@ -1179,7 +1179,7 @@ established with the

    Appends a table column.

    -
    try db.create(virtualTable: "document", using: FTS5()) { t in
    +
    try db.create(virtualTable: "document", using: FTS5()) { t in
         t.column("content")
     }
     
    @@ -1219,7 +1219,7 @@ full-text table is kept up to date with the external table.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FetchedRecordsController.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FetchedRecordsController.html index 74cad8960..c0ff8c2dc 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FetchedRecordsController.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/FetchedRecordsController.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1059,7 +1059,7 @@ its eventual arguments.

    public convenience init(
         _ databaseWriter: DatabaseWriter,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil,
         queue: DispatchQueue = .main,
         isSameRecord: ((Record, Record) -> Bool)? = nil) throws
    @@ -1153,7 +1153,7 @@ same identity. For example, they have the same id.

    @@ -1173,8 +1173,8 @@ same identity. For example, they have the same id.

    Creates a fetched records controller initialized from a fetch request from the Query Interface.

    -
    let request = Wine.order(Column("name"))
    -let controller = FetchedRecordsController(
    +
    let request = Wine.order(Column("name"))
    +let controller = FetchedRecordsController(
         dbQueue,
         request: request,
         isSameRecord: { (wine1, wine2) in wine1.id == wine2.id })
    @@ -1257,7 +1257,7 @@ same identity. For example, they have the same id.

    @@ -1293,7 +1293,7 @@ main queue unless stated otherwise in the controller’s initializer).

    @@ -1337,7 +1337,7 @@ to changes.

    @@ -1369,7 +1369,7 @@ to changes.

    @@ -1405,7 +1405,7 @@ main queue unless stated otherwise in the controller’s initializer).

    @@ -1436,14 +1436,14 @@ main queue unless stated otherwise in the controller’s initializer).

    Swift

    public func setRequest(
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws
    @@ -1523,7 +1523,7 @@ removed, moved, or updated.

    @@ -1621,7 +1621,7 @@ removed, moved, or updated.

    @@ -1662,7 +1662,7 @@ main queue unless stated otherwise in the controller’s initializer).

    @@ -1699,7 +1699,7 @@ after the didChange callback has completed.

    @@ -1749,7 +1749,7 @@ main queue unless stated otherwise in the controller’s initializer).

    @@ -1805,7 +1805,7 @@ has an id primary key, this initializer is equivalent to:

    public convenience init(
         _ databaseWriter: DatabaseWriter,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil,
         queue: DispatchQueue = .main) throws
    @@ -1883,7 +1883,7 @@ used from this queue.

    @@ -1903,8 +1903,8 @@ used from this queue.

    Creates a fetched records controller initialized from a fetch request from the Query Interface.

    -
    let request = Wine.order(Column("name"))
    -let controller = FetchedRecordsController(
    +
    let request = Wine.order(Column("name"))
    +let controller = FetchedRecordsController(
         dbQueue,
         request: request)
     
    @@ -1980,7 +1980,7 @@ used from this queue.

    @@ -2043,7 +2043,7 @@ records, a fatal error is raised.

    @@ -2090,7 +2090,7 @@ records. In this case, there is a single empty section.

    @@ -2136,7 +2136,7 @@ records. In this case, there is a single empty section.

    if record could not be found.

    @@ -2146,7 +2146,7 @@ if record could not be found.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Record.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Record.html index 436807b51..c5e613d09 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Record.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Record.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1051,7 +1051,7 @@ designed to be subclassed.

    @@ -1081,7 +1081,7 @@ designed to be subclassed.

    @@ -1114,8 +1114,8 @@ designed to be subclassed.

    This table name is required by the insert, update, save, delete, and exists methods.

    -
    class Player : Record {
    -    override class var databaseTableName: String {
    +
    class Player : Record {
    +    override class var databaseTableName: String {
             return "player"
         }
     }
    @@ -1128,7 +1128,7 @@ and exists methods.

    Declaration

    Swift

    -
    open class var databaseTableName: String { get }
    +
    open class var databaseTableName: String { get }
    @@ -1137,7 +1137,7 @@ and exists methods.

    The name of a database table.

    @@ -1173,12 +1173,12 @@ even if a row was actually inserted without any conflict.

    Declaration

    Swift

    -
    open class var persistenceConflictPolicy: PersistenceConflictPolicy { get }
    +
    open class var persistenceConflictPolicy: PersistenceConflictPolicy { get }
    @@ -1205,9 +1205,9 @@ even if a row was actually inserted without any conflict.

    You can override this property and provide an explicit list of columns:

    -
    class RestrictedPlayer : Record {
    +
    class RestrictedPlayer : Record {
         override static var databaseSelection: [SQLSelectable] {
    -        return [Column("id"), Column("name")]
    +        return [Column("id"), Column("name")]
         }
     }
     
    @@ -1216,9 +1216,9 @@ of columns:

    You can also add extra columns such as the rowid column:

    -
    class ExtendedPlayer : Player {
    +
    class ExtendedPlayer : Player {
         override static var databaseSelection: [SQLSelectable] {
    -        return [AllColumns(), Column.rowID]
    +        return [AllColumns(), Column.rowID]
         }
     }
     
    @@ -1236,7 +1236,7 @@ of columns:

    @@ -1260,7 +1260,7 @@ of columns:

    the columns of the database table (see Record.databaseTableName()).

    Primary key columns, if any, must be included.

    -
    class Player : Record {
    +
    class Player : Record {
         var id: Int64?
         var name: String?
     
    @@ -1284,7 +1284,7 @@ the container.

    @@ -1309,7 +1309,7 @@ dispatch queue, with the inserted RowID and the eventual INTEGER PRIMARY KEY column name.

    The implementation of the base Record class does nothing.

    -
    class Player : Record {
    +
    class Player : Record {
         var id: Int64?
         var name: String?
     
    @@ -1360,7 +1360,7 @@ INTEGER PRIMARY KEY column name.

    @@ -1409,7 +1409,7 @@ INTEGER PRIMARY KEY column name.

    A copy of self.

    @@ -1460,12 +1460,12 @@ of the record.

    Declaration

    Swift

    -
    public var hasDatabaseChanges: Bool { get set }
    +
    public var hasDatabaseChanges: Bool { get set }
    @@ -1503,7 +1503,7 @@ are nil.

    @@ -1577,7 +1577,7 @@ before the insertion.

    @@ -1650,7 +1650,7 @@ match any row in the database and record could not be updated. @@ -1729,7 +1729,7 @@ match any row in the database and record could not be updated.

    Whether the record had changes.

    @@ -1798,7 +1798,7 @@ thrown by update(). @@ -1859,7 +1859,7 @@ thrown by update().

    Whether a database row was deleted.

    @@ -1869,7 +1869,7 @@ thrown by update(). diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row.html index 4da6b1ae2..8f7d49bbe 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1087,7 +1087,7 @@ @@ -1128,7 +1128,7 @@ @@ -1158,7 +1158,7 @@ @@ -1191,7 +1191,7 @@ adopt DatabaseValueConvertible.

    @@ -1225,7 +1225,7 @@ want to keep a specific one: row.copy().

    @@ -1269,7 +1269,7 @@ of column-value pairs in self.

    @@ -1301,7 +1301,7 @@ of column-value pairs in self.

    @@ -1347,12 +1347,12 @@ contains a non-null value.

    Declaration

    Swift

    -
    public var containsNonNullValue: Bool { get }
    +
    public var containsNonNullValue: Bool { get }
    @@ -1389,7 +1389,7 @@ values.

    @@ -1418,12 +1418,12 @@ righmost column.

    Declaration

    Swift

    -
    public subscript(index: Int) -> DatabaseValueConvertible? { get }
    +
    public subscript(index: Int) -> DatabaseValueConvertible? { get }
    @@ -1456,12 +1456,12 @@ fail, a fatal error is raised.

    Swift

    @inlinable
    -public subscript<Value>(index: Int) -> Value? where Value : DatabaseValueConvertible { get }
    +public subscript<Value>(index: Int) -> Value? where Value : DatabaseValueConvertible { get }
    @@ -1498,12 +1498,12 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions

    Swift

    @inlinable
    -public subscript<Value>(index: Int) -> Value? where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
    +public subscript<Value>(index: Int) -> Value? where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
    @@ -1535,12 +1535,12 @@ SQLite value can not be converted to Value.

    Swift

    @inlinable
    -public subscript<Value>(index: Int) -> Value where Value : DatabaseValueConvertible { get }
    +public subscript<Value>(index: Int) -> Value where Value : DatabaseValueConvertible { get }
    @@ -1576,12 +1576,12 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions

    Swift

    @inlinable
    -public subscript<Value>(index: Int) -> Value where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
    +public subscript<Value>(index: Int) -> Value where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
    @@ -1612,12 +1612,12 @@ the same name, the leftmost column is considered.

    Declaration

    Swift

    -
    public subscript(columnName: String) -> DatabaseValueConvertible? { get }
    +
    public subscript(columnName: String) -> DatabaseValueConvertible? { get }
    @@ -1650,12 +1650,12 @@ nil. Otherwise the SQLite value is converted to the requested type

    Swift

    @inlinable
    -public subscript<Value>(columnName: String) -> Value? where Value : DatabaseValueConvertible { get }
    +public subscript<Value>(columnName: String) -> Value? where Value : DatabaseValueConvertible { get }
    @@ -1692,12 +1692,12 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions

    Swift

    @inlinable
    -public subscript<Value>(columnName: String) -> Value? where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
    +public subscript<Value>(columnName: String) -> Value? where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
    @@ -1731,12 +1731,12 @@ SQLite value can not be converted to Value.

    Swift

    @inlinable
    -public subscript<Value>(columnName: String) -> Value where Value : DatabaseValueConvertible { get }
    +public subscript<Value>(columnName: String) -> Value where Value : DatabaseValueConvertible { get }
    @@ -1774,12 +1774,12 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions

    Swift

    @inlinable
    -public subscript<Value>(columnName: String) -> Value where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
    +public subscript<Value>(columnName: String) -> Value where Value : DatabaseValueConvertible, Value : StatementColumnConvertible { get }
    @@ -1811,12 +1811,12 @@ the same name, the leftmost column is considered.

    Swift

    @inlinable
    -public subscript<Column>(column: Column) -> DatabaseValueConvertible? where Column : ColumnExpression { get }
    +public subscript<Column>(column: Column) -> DatabaseValueConvertible? where Column : ColumnExpression { get }
    @@ -1849,12 +1849,12 @@ nil. Otherwise the SQLite value is converted to the requested type

    Swift

    @inlinable
    -public subscript<Value, Column>(column: Column) -> Value? where Value : DatabaseValueConvertible, Column : ColumnExpression { get }
    +public subscript<Value, Column>(column: Column) -> Value? where Value : DatabaseValueConvertible, Column : ColumnExpression { get }
    @@ -1900,7 +1900,7 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions @@ -1934,12 +1934,12 @@ SQLite value can not be converted to Value.

    Swift

    @inlinable
    -public subscript<Value, Column>(column: Column) -> Value where Value : DatabaseValueConvertible, Column : ColumnExpression { get }
    +public subscript<Value, Column>(column: Column) -> Value where Value : DatabaseValueConvertible, Column : ColumnExpression { get }
    @@ -1986,7 +1986,7 @@ StatementColumnConvertible. It may trigger SQLite built-in conversions @@ -2025,7 +2025,7 @@ than the row’s lifetime.

    @@ -2065,7 +2065,7 @@ than the row’s lifetime.

    @@ -2105,7 +2105,7 @@ than the row’s lifetime.

    @@ -2149,7 +2149,7 @@ of column-value pairs in self.

    @@ -2184,7 +2184,7 @@ of column-value pairs in self.

    let request = Book.including(required: Book.author)
     let row = try Row.fetchOne(db, request)!
     
    -print(Book(row: row).title)
    +print(Book(row: row).title)
     // Prints "Moby-Dick"
     
     let author: Author = row["author"]
    @@ -2196,7 +2196,7 @@ of column-value pairs in self.

    let request = Book.including(required: Book.author.including(required: Author.country))
     let row = try Row.fetchOne(db, request)!
     
    -print(Book(row: row).title)
    +print(Book(row: row).title)
     // Prints "Moby-Dick"
     
     let country: Country = row["country"]
    @@ -2215,12 +2215,12 @@ for more information.

    Declaration

    Swift

    -
    public subscript<Record>(scope: String) -> Record where Record : FetchableRecord { get }
    +
    public subscript<Record>(scope: String) -> Record where Record : FetchableRecord { get }
    @@ -2244,7 +2244,7 @@ for more information.

    let request = Book.including(optional: Book.author)
     let row = try Row.fetchOne(db, request)!
     
    -print(Book(row: row).title)
    +print(Book(row: row).title)
     // Prints "Moby-Dick"
     
     let author: Author? = row["author"]
    @@ -2256,7 +2256,7 @@ for more information.

    let request = Book.including(optional: Book.author.including(optional: Author.country))
     let row = try Row.fetchOne(db, request)!
     
    -print(Book(row: row).title)
    +print(Book(row: row).title)
     // Prints "Moby-Dick"
     
     let country: Country? = row["country"]
    @@ -2275,12 +2275,12 @@ for more information.

    Declaration

    Swift

    -
    public subscript<Record>(scope: String) -> Record? where Record : FetchableRecord { get }
    +
    public subscript<Record>(scope: String) -> Record? where Record : FetchableRecord { get }
    @@ -2304,7 +2304,7 @@ for more information.

    let request = Author.including(all: Author.books)
     let row = try Row.fetchOne(db, request)!
     
    -print(Author(row: row).name)
    +print(Author(row: row).name)
     // Prints "Herman Melville"
     
     let books: [Book] = row["books"]
    @@ -2326,7 +2326,7 @@ for more information.

    @@ -2350,7 +2350,7 @@ for more information.

    let request = Author.including(all: Author.books)
     let row = try Row.fetchOne(db, request)!
     
    -print(Author(row: row).name)
    +print(Author(row: row).name)
     // Prints "Herman Melville"
     
     let books: Set<Book> = row["books"]
    @@ -2363,12 +2363,12 @@ for more information.

    Declaration

    Swift

    -
    public subscript<Record>(key: String) -> Set<Record> where Record : FetchableRecord, Record : Hashable { get }
    +
    public subscript<Record>(key: String) -> Set<Record> where Record : FetchableRecord, Record : Hashable { get }
    @@ -2401,10 +2401,10 @@ for more information.

    For example:

    // Define a tree of nested scopes
    -let adapter = ScopeAdapter([
    -    "foo": RangeRowAdapter(0..<1),
    -    "bar": RangeRowAdapter(1..<2).addingScopes([
    -        "baz" : RangeRowAdapter(2..<3)])])
    +let adapter = ScopeAdapter([
    +    "foo": RangeRowAdapter(0..<1),
    +    "bar": RangeRowAdapter(1..<2).addingScopes([
    +        "baz" : RangeRowAdapter(2..<3)])])
     
     // Fetch
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
    @@ -2423,12 +2423,12 @@ for more information.

    Declaration

    Swift

    -
    public var scopes: ScopesView { get }
    +
    public var scopes: ScopesView { get }
    @@ -2450,10 +2450,10 @@ for more information.

    For example:

    // Define a tree of nested scopes
    -let adapter = ScopeAdapter([
    -    "foo": RangeRowAdapter(0..<1),
    -    "bar": RangeRowAdapter(1..<2).addingScopes([
    -        "baz" : RangeRowAdapter(2..<3)])])
    +let adapter = ScopeAdapter([
    +    "foo": RangeRowAdapter(0..<1),
    +    "bar": RangeRowAdapter(1..<2).addingScopes([
    +        "baz" : RangeRowAdapter(2..<3)])])
     
     // Fetch
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
    @@ -2471,12 +2471,12 @@ for more information.

    Declaration

    Swift

    -
    public var scopesTree: ScopesTreeView { get }
    +
    public var scopesTree: ScopesTreeView { get }
    @@ -2500,9 +2500,9 @@ for more information.

    adapted rows, such as rows fetched from joined requests.

    let row = ...
     // Failure because row equality tests for row scopes:
    -XCTAssertEqual(row, ["id": 1, "name": "foo"])
    +XCTAssertEqual(row, ["id": 1, "name": "foo"])
     // Success:
    -XCTAssertEqual(row.unscoped, ["id": 1, "name": "foo"])
    +XCTAssertEqual(row.unscoped, ["id": 1, "name": "foo"])
     
    @@ -2510,12 +2510,12 @@ adapted rows, such as rows fetched from joined requests.

    Declaration

    Swift

    -
    public var unscoped: Row { get }
    +
    public var unscoped: Row { get }
    @@ -2543,12 +2543,12 @@ adapted rows, such as rows fetched from joined requests.

    Declaration

    Swift

    -
    public var unadapted: Row { get }
    +
    public var unadapted: Row { get }
    @@ -2677,7 +2677,7 @@ elements are undefined.

    A cursor over fetched rows.

    @@ -2766,7 +2766,7 @@ elements are undefined.

    An array of rows.

    @@ -2855,7 +2855,7 @@ elements are undefined.

    An optional row.

    @@ -2918,7 +2918,7 @@ elements are undefined.

    public static func fetchCursor(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> RowCursor
    @@ -2984,7 +2984,7 @@ elements are undefined.

    A cursor over fetched rows.

    @@ -3004,7 +3004,7 @@ elements are undefined.

    Returns an array of rows fetched from an SQL query.

    let rows = try Row.fetchAll(db, sql: "SELECT id, name FROM player") // [Row]
    -for row in rows {
    +for row in rows {
         let id: Int64 = row[0]
         let name: String = row[1]
     }
    @@ -3023,7 +3023,7 @@ elements are undefined.

    public static func fetchAll(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> [Row]
    @@ -3089,7 +3089,7 @@ elements are undefined.

    An array of rows.

    @@ -3109,7 +3109,7 @@ elements are undefined.

    Returns a single row fetched from an SQL query.

    let row = try Row.fetchOne(db, sql: "SELECT id, name FROM player") // Row?
    -if let row = row {
    +if let row = row {
         let id: Int64 = row[0]
         let name: String = row[1]
     }
    @@ -3128,7 +3128,7 @@ elements are undefined.

    public static func fetchOne(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> Row?
    @@ -3194,7 +3194,7 @@ elements are undefined.

    An optional row.

    @@ -3295,7 +3295,7 @@ elements are undefined.

    A cursor over fetched rows.

    @@ -3368,7 +3368,7 @@ elements are undefined.

    An array of rows.

    @@ -3441,7 +3441,7 @@ elements are undefined.

    An optional row.

    @@ -3487,7 +3487,7 @@ duplicated columns names are allowed.

    @@ -3528,7 +3528,7 @@ duplicated columns names are allowed.

    @@ -3563,10 +3563,10 @@ dictionary.

    For example:

    // Define a tree of nested scopes
    -let adapter = ScopeAdapter([
    -    "foo": RangeRowAdapter(0..<1),
    -    "bar": RangeRowAdapter(1..<2).addingScopes([
    -        "baz" : RangeRowAdapter(2..<3)])])
    +let adapter = ScopeAdapter([
    +    "foo": RangeRowAdapter(0..<1),
    +    "bar": RangeRowAdapter(1..<2).addingScopes([
    +        "baz" : RangeRowAdapter(2..<3)])])
     
     // Fetch
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
    @@ -3591,7 +3591,7 @@ dictionary.

    @@ -3624,10 +3624,10 @@ dictionary.

    For example:

    // Define a tree of nested scopes
    -let adapter = ScopeAdapter([
    -    "foo": RangeRowAdapter(0..<1),
    -    "bar": RangeRowAdapter(1..<2).addingScopes([
    -        "baz" : RangeRowAdapter(2..<3)])])
    +let adapter = ScopeAdapter([
    +    "foo": RangeRowAdapter(0..<1),
    +    "bar": RangeRowAdapter(1..<2).addingScopes([
    +        "baz" : RangeRowAdapter(2..<3)])])
     
     // Fetch
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
    @@ -3651,7 +3651,7 @@ dictionary.

    @@ -3705,7 +3705,7 @@ dictionary.

    @@ -3715,7 +3715,7 @@ dictionary.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/PrefetchedRowsView.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/PrefetchedRowsView.html index 36e62325f..f8c02ee42 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/PrefetchedRowsView.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/PrefetchedRowsView.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1050,12 +1050,12 @@

    Declaration

    Swift

    -
    public var isEmpty: Bool { get }
    +
    public var isEmpty: Bool { get }
    @@ -1093,7 +1093,7 @@ @@ -1140,7 +1140,7 @@ available, too.

    @@ -1150,7 +1150,7 @@ available, too.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/ScopesTreeView.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/ScopesTreeView.html index e4604faec..151c43863 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/ScopesTreeView.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/ScopesTreeView.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,10 +1016,10 @@

    For example:

    // Define a tree of nested scopes
    -let adapter = ScopeAdapter([
    -    "foo": RangeRowAdapter(0..<1),
    -    "bar": RangeRowAdapter(1..<2).addingScopes([
    -        "baz" : RangeRowAdapter(2..<3)])])
    +let adapter = ScopeAdapter([
    +    "foo": RangeRowAdapter(0..<1),
    +    "bar": RangeRowAdapter(1..<2).addingScopes([
    +        "baz" : RangeRowAdapter(2..<3)])])
     
     // Fetch
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
    @@ -1061,7 +1061,7 @@
                             
                           
                           
                         
                       
    @@ -1112,12 +1112,12 @@
                             

    Declaration

    Swift

    -
    public subscript(name: String) -> Row? { get }
    +
    public subscript(name: String) -> Row? { get }
    @@ -1127,7 +1127,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/ScopesView.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/ScopesView.html index 5f642de51..746209d11 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/ScopesView.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Row/ScopesView.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1018,10 +1018,10 @@ dictionary.

    For example:

    // Define a tree of nested scopes
    -let adapter = ScopeAdapter([
    -    "foo": RangeRowAdapter(0..<1),
    -    "bar": RangeRowAdapter(1..<2).addingScopes([
    -        "baz" : RangeRowAdapter(2..<3)])])
    +let adapter = ScopeAdapter([
    +    "foo": RangeRowAdapter(0..<1),
    +    "bar": RangeRowAdapter(1..<2).addingScopes([
    +        "baz" : RangeRowAdapter(2..<3)])])
     
     // Fetch
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
    @@ -1063,7 +1063,7 @@ dictionary.

    @@ -1088,12 +1088,12 @@ dictionary.

    Declaration

    Swift

    -
    public var names: Dictionary<String, LayoutedRowAdapter>.Keys { get }
    +
    public var names: Dictionary<String, LayoutedRowAdapter>.Keys { get }
    @@ -1119,12 +1119,12 @@ scope is not defined.

    Declaration

    Swift

    -
    public subscript(name: String) -> Row? { get }
    +
    public subscript(name: String) -> Row? { get }
    @@ -1134,7 +1134,7 @@ scope is not defined.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/RowCursor.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/RowCursor.html index 66a593328..80ecebae5 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/RowCursor.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/RowCursor.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1013,7 +1013,7 @@

    A cursor of database rows. For example:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let rows: RowCursor = try Row.fetchCursor(db, sql: "SELECT * FROM player")
     }
     
    @@ -1047,7 +1047,7 @@ @@ -1057,7 +1057,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/SelectStatement.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/SelectStatement.html index dc3906cf6..d5fa7a819 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/SelectStatement.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/SelectStatement.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1015,7 +1015,7 @@

    A subclass of Statement that fetches database rows.

    You create SelectStatement with the Database.makeSelectStatement() method:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let statement = try db.makeSelectStatement(sql: "SELECT COUNT(*) FROM player WHERE score > ?")
         let moreThanTwentyCount = try Int.fetchOne(statement, arguments: [20])!
         let moreThanThirtyCount = try Int.fetchOne(statement, arguments: [30])!
    @@ -1051,7 +1051,7 @@
                             
                           
                           
                         
                       
    @@ -1076,12 +1076,12 @@
                             

    Declaration

    Swift

    -
    public var columnCount: Int { get }
    +
    public var columnCount: Int { get }
    @@ -1111,7 +1111,7 @@ @@ -1142,7 +1142,7 @@ case-insensitive way.

    @@ -1152,7 +1152,7 @@ case-insensitive way.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Statement.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Statement.html index 2047297ac..d04e136f8 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Statement.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/Statement.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1046,7 +1046,7 @@ and SelectStatement that fetches rows.

    @@ -1071,12 +1071,12 @@ and SelectStatement that fetches rows.

    Declaration

    Swift

    -
    public var sql: String { get }
    +
    public var sql: String { get }
    @@ -1112,12 +1112,12 @@ and SelectStatement that fetches rows.

    Declaration

    Swift

    -
    public var arguments: StatementArguments { get set }
    +
    public var arguments: StatementArguments { get set }
    @@ -1148,7 +1148,7 @@ statement arguments.

    @@ -1178,7 +1178,7 @@ statement arguments.

    @@ -1188,7 +1188,7 @@ statement arguments.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableAlias.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableAlias.html index e83aa1274..22e7b2868 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableAlias.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableAlias.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1071,12 +1071,12 @@ joined queries.

    Declaration

    Swift

    -
    public subscript(selectable: SQLSelectable) -> SQLSelectable { get }
    +
    public subscript(selectable: SQLSelectable) -> SQLSelectable { get }
    @@ -1102,12 +1102,12 @@ joined queries.

    Declaration

    Swift

    -
    public subscript(expression: SQLExpression) -> SQLExpression { get }
    +
    public subscript(expression: SQLExpression) -> SQLExpression { get }
    @@ -1117,7 +1117,7 @@ joined queries.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableAlteration.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableAlteration.html index 9d6a663e4..dc918bfcd 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableAlteration.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableAlteration.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1095,7 +1095,7 @@ column definition.

    @@ -1105,7 +1105,7 @@ column definition.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableDefinition.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableDefinition.html index 224977311..4db43b1f0 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableDefinition.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/TableDefinition.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1102,7 +1102,7 @@ inserted in between.

    Self so that you can further refine the column definition.

    @@ -1175,7 +1175,7 @@ inserted in between.

    column definition.

    @@ -1246,7 +1246,7 @@ column definition.

    @@ -1316,7 +1316,7 @@ column definition.

    @@ -1443,7 +1443,7 @@ See https://www.sq @@ -1465,8 +1465,8 @@ See https://www.sq
    try db.create(table: "player") { t in
         t.column("personalPhone", .text)
         t.column("workPhone", .text)
    -    let personalPhone = Column("personalPhone")
    -    let workPhone = Column("workPhone")
    +    let personalPhone = Column("personalPhone")
    +    let workPhone = Column("workPhone")
         t.check(personalPhone != nil || workPhone != nil)
     }
     
    @@ -1502,7 +1502,7 @@ See
    https://www.sq @@ -1559,7 +1559,7 @@ See https://www.sq @@ -1569,7 +1569,7 @@ See https://www.sq diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/UpdateStatement.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/UpdateStatement.html index 08033642c..c92626fd2 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/UpdateStatement.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Classes/UpdateStatement.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1015,7 +1015,7 @@

    A subclass of Statement that executes SQL queries.

    You create UpdateStatement with the Database.makeUpdateStatement() method:

    -
    try dbQueue.inTransaction { db in
    +
    try dbQueue.inTransaction { db in
         let statement = try db.makeUpdateStatement(sql: "INSERT INTO player (name) VALUES (?)")
         try statement.execute(arguments: ["Arthur"])
         try statement.execute(arguments: ["Barbara"])
    @@ -1076,7 +1076,7 @@
                             
                           
                           
                         
                       
    @@ -1086,7 +1086,7 @@
               
             
             
           
    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums.html
    index 73655b5db..9f159cae2 100644
    --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums.html
    +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums.html
    @@ -14,7 +14,7 @@
         
         
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1046,7 +1046,7 @@ more information.

    @@ -1088,7 +1088,7 @@ more information.

    @@ -1121,7 +1121,7 @@ more information.

    adopt the standard Encodable protocol encode their date properties.

    For example:

    -
    struct Player: EncodableRecord, Encodable {
    +
    struct Player: EncodableRecord, Encodable {
         static let databaseDateEncodingStrategy: DatabaseDateEncodingStrategy = .timeIntervalSince1970
     
         var name: String
    @@ -1140,7 +1140,7 @@ adopt the standard Encodable protocol encode their date properties.

    @@ -1173,7 +1173,7 @@ adopt the standard Encodable protocol encode their date properties.

    adopt the standard Encodable protocol encode their UUID properties.

    For example:

    -
    struct Player: EncodableProtocol, Encodable {
    +
    struct Player: EncodableProtocol, Encodable {
         static let databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy = .string
     
         // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
    @@ -1192,7 +1192,7 @@ adopt the standard Encodable protocol encode their UUID properties.

    @@ -1225,7 +1225,7 @@ adopt the standard Encodable protocol encode their UUID properties.

    adopt the standard Decodable protocol decode their date properties.

    For example:

    -
    struct Player: FetchableRecord, Decodable {
    +
    struct Player: FetchableRecord, Decodable {
         static let databaseDateDecodingStrategy: DatabaseDateDecodingStrategy = .timeIntervalSince1970
     
         var name: String
    @@ -1244,7 +1244,7 @@ adopt the standard Decodable protocol decode their date properties.

    @@ -1289,7 +1289,7 @@ column names, and values the old values that have been changed.

    @@ -1324,7 +1324,7 @@ column names, and values the old values that have been changed.

    @@ -1367,7 +1367,7 @@ of fresh values to your application.

    @@ -1402,7 +1402,7 @@ of fresh values to your application.

    @@ -1412,7 +1412,7 @@ of fresh values to your application.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseDateDecodingStrategy.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseDateDecodingStrategy.html index 558a6e95f..4a639af65 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseDateDecodingStrategy.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseDateDecodingStrategy.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,7 +1016,7 @@ adopt the standard Decodable protocol decode their date properties.

    For example:

    -
    struct Player: FetchableRecord, Decodable {
    +
    struct Player: FetchableRecord, Decodable {
         static let databaseDateDecodingStrategy: DatabaseDateDecodingStrategy = .timeIntervalSince1970
     
         var name: String
    @@ -1069,7 +1069,7 @@ Missing components are assumed to be zero:

    @@ -1100,7 +1100,7 @@ midnight UTC on 1 January 2001

    @@ -1131,7 +1131,7 @@ midnight UTC on 1 January 1970

    @@ -1162,7 +1162,7 @@ midnight UTC on 1 January 1970

    @@ -1192,7 +1192,7 @@ midnight UTC on 1 January 1970

    @@ -1222,7 +1222,7 @@ midnight UTC on 1 January 1970

    @@ -1256,7 +1256,7 @@ error, and react accordingly).

    @@ -1266,7 +1266,7 @@ error, and react accordingly).

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseDateEncodingStrategy.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseDateEncodingStrategy.html index 19759f158..d65243de7 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseDateEncodingStrategy.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseDateEncodingStrategy.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,7 +1016,7 @@ adopt the standard Encodable protocol encode their date properties.

    For example:

    -
    struct Player: EncodableRecord, Encodable {
    +
    struct Player: EncodableRecord, Encodable {
         static let databaseDateEncodingStrategy: DatabaseDateEncodingStrategy = .timeIntervalSince1970
     
         var name: String
    @@ -1056,7 +1056,7 @@ UTC time zone.

    @@ -1087,7 +1087,7 @@ midnight UTC on 1 January 2001

    @@ -1118,7 +1118,7 @@ midnight UTC on 1 January 1970

    @@ -1149,7 +1149,7 @@ midnight UTC on 1 January 1970

    @@ -1180,7 +1180,7 @@ midnight UTC on 1 January 1970

    @@ -1210,7 +1210,7 @@ midnight UTC on 1 January 1970

    @@ -1240,7 +1240,7 @@ midnight UTC on 1 January 1970

    @@ -1270,7 +1270,7 @@ midnight UTC on 1 January 1970

    @@ -1280,7 +1280,7 @@ midnight UTC on 1 January 1970

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseEventKind.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseEventKind.html index 1bc6b9c54..ec105017f 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseEventKind.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseEventKind.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1044,7 +1044,7 @@ more information.

    @@ -1074,7 +1074,7 @@ more information.

    @@ -1104,7 +1104,7 @@ more information.

    @@ -1140,12 +1140,12 @@ more information.

    Declaration

    Swift

    -
    public var tableName: String { get }
    +
    public var tableName: String { get }
    @@ -1155,7 +1155,7 @@ more information.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseUUIDEncodingStrategy.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseUUIDEncodingStrategy.html index 5fcb34c52..971aafb78 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseUUIDEncodingStrategy.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/DatabaseUUIDEncodingStrategy.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,7 +1016,7 @@ adopt the standard Encodable protocol encode their UUID properties.

    For example:

    -
    struct Player: EncodableProtocol, Encodable {
    +
    struct Player: EncodableProtocol, Encodable {
         static let databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy = .string
     
         // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
    @@ -1055,7 +1055,7 @@ adopt the standard Encodable protocol encode their UUID properties.

    @@ -1085,7 +1085,7 @@ adopt the standard Encodable protocol encode their UUID properties.

    @@ -1095,7 +1095,7 @@ adopt the standard Encodable protocol encode their UUID properties.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/FetchedRecordChange.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/FetchedRecordChange.html index b063f0a75..ead3295ae 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/FetchedRecordChange.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/FetchedRecordChange.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1046,7 +1046,7 @@ column names, and values the old values that have been changed.

    @@ -1076,7 +1076,7 @@ column names, and values the old values that have been changed.

    @@ -1108,7 +1108,7 @@ have been changed.

    @@ -1140,7 +1140,7 @@ been changed.

    @@ -1175,12 +1175,12 @@ been changed.

    Declaration

    Swift

    -
    public var description: String { get }
    +
    public var description: String { get }
    @@ -1190,7 +1190,7 @@ been changed.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/PersistenceError.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/PersistenceError.html index b78a273d9..b74fe24ce 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/PersistenceError.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/PersistenceError.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1049,7 +1049,7 @@ found in the database.

    @@ -1059,7 +1059,7 @@ found in the database.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/SQLLogicalBinaryOperator.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/SQLLogicalBinaryOperator.html index ede296b87..b7cfaae3e 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/SQLLogicalBinaryOperator.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/SQLLogicalBinaryOperator.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers.html index fedb16f5f..712e6698e 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1053,7 +1053,7 @@ @@ -1098,7 +1098,7 @@ @@ -1144,7 +1144,7 @@ @@ -1191,7 +1191,7 @@ @@ -1239,7 +1239,7 @@ @@ -1288,7 +1288,7 @@ @@ -1338,7 +1338,7 @@ @@ -1348,7 +1348,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine2.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine2.html index cac37a60f..cc3c11c32 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine2.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine2.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1044,7 +1044,7 @@ @@ -1073,7 +1073,7 @@ @@ -1102,7 +1102,7 @@ @@ -1131,7 +1131,7 @@ @@ -1141,7 +1141,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine3.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine3.html index 56fd71c98..8f206f6fb 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine3.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine3.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1074,7 +1074,7 @@ @@ -1103,7 +1103,7 @@ @@ -1132,7 +1132,7 @@ @@ -1142,7 +1142,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine4.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine4.html index 8b1fc2d36..a25b3ca42 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine4.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine4.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1046,7 +1046,7 @@ @@ -1075,7 +1075,7 @@ @@ -1104,7 +1104,7 @@ @@ -1133,7 +1133,7 @@ @@ -1143,7 +1143,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine5.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine5.html index 09218c800..7ce895040 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine5.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine5.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1047,7 +1047,7 @@ @@ -1076,7 +1076,7 @@ @@ -1105,7 +1105,7 @@ @@ -1134,7 +1134,7 @@ @@ -1144,7 +1144,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine6.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine6.html index 33e47a54a..e21ff061b 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine6.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine6.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1048,7 +1048,7 @@ @@ -1077,7 +1077,7 @@ @@ -1106,7 +1106,7 @@ @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine7.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine7.html index 8287d6efb..8b8226470 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine7.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine7.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1049,7 +1049,7 @@ @@ -1078,7 +1078,7 @@ @@ -1107,7 +1107,7 @@ @@ -1136,7 +1136,7 @@ @@ -1146,7 +1146,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine8.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine8.html index b4d790f6d..0182f3dc7 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine8.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueReducers/Combine8.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1050,7 +1050,7 @@ @@ -1079,7 +1079,7 @@ @@ -1108,7 +1108,7 @@ @@ -1137,7 +1137,7 @@ @@ -1147,7 +1147,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueScheduling.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueScheduling.html index 89b296328..a1357c098 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueScheduling.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Enums/ValueScheduling.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1057,8 +1057,8 @@ is also notified on the main queue, but asynchronously:

    When the database changes, fresh values are asynchronously notified on the main queue:

    // Eventually prints "fresh players" on the main queue
    -try dbQueue.write { db in
    -    try Player(...).insert(db)
    +try dbQueue.write { db in
    +    try Player(...).insert(db)
     }
     
    @@ -1072,7 +1072,7 @@ the main queue:

    @@ -1105,7 +1105,7 @@ is true.

    @@ -1150,7 +1150,7 @@ unspecified queues.

    @@ -1160,7 +1160,7 @@ unspecified queues.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions.html index 0c500ab7c..93fbb7d90 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -2101,7 +2101,7 @@ and arrays of optional DatabaseValueConvertible:

    @@ -2184,7 +2184,7 @@ and arrays of optional DatabaseValueConvertible:

    @@ -2313,7 +2313,7 @@ and arrays of optional DatabaseValueConvertible:

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Array.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Array.html index 6e5572f09..82e781075 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Array.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Array.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1032,7 +1032,7 @@

    Creates an array containing the elements of a cursor.

    let cursor = try String.fetchCursor(db, sql: "SELECT 'foo' UNION ALL SELECT 'bar'")
    -let strings = try Array(cursor) // ["foo", "bar"]
    +let strings = try Array(cursor) // ["foo", "bar"]
     
    @@ -1046,7 +1046,7 @@ @@ -1056,7 +1056,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Bool.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Bool.html index 5972ad36a..3056f4e5d 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Bool.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Bool.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CGFloat.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CGFloat.html index fc0509f1e..9141cc1b2 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CGFloat.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CGFloat.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1038,12 +1038,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/ClosedRange.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/ClosedRange.html index e170536ff..3875dcc22 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/ClosedRange.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/ClosedRange.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1032,7 +1032,7 @@

    An SQL expression that checks the inclusion of an expression in a range.

    // email BETWEEN 'A' AND 'B'
    -("A"..."B").contains(Column("email"))
    +("A"..."B").contains(Column("email"))
     
    @@ -1045,7 +1045,7 @@ @@ -1065,7 +1065,7 @@

    An SQL expression that checks the inclusion of an expression in a range.

    // email BETWEEN 'A' AND 'B' COLLATE NOCASE
    -("A"..."B").contains(Column("email").collating(.nocase))
    +("A"..."B").contains(Column("email").collating(.nocase))
     
    @@ -1078,7 +1078,7 @@ @@ -1088,7 +1088,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Collection.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Collection.html index 82c2dafd0..85e75db2f 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Collection.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Collection.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1050,7 +1050,7 @@ inserting the given separator between each element.

    @@ -1060,7 +1060,7 @@ inserting the given separator between each element.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Column.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Column.html index c170181ce..b16bfea83 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Column.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Column.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1035,7 +1035,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CountableClosedRange.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CountableClosedRange.html index 79affd05a..d4e809d37 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CountableClosedRange.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CountableClosedRange.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1032,7 +1032,7 @@

    An SQL expression that checks the inclusion of an expression in a range.

    // id BETWEEN 1 AND 10
    -(1...10).contains(Column("id"))
    +(1...10).contains(Column("id"))
     
    @@ -1045,7 +1045,7 @@ @@ -1055,7 +1055,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CountableRange.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CountableRange.html index e13c4329d..532c74cdd 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CountableRange.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/CountableRange.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1032,7 +1032,7 @@

    An SQL expression that checks the inclusion of an expression in a range.

    // id BETWEEN 1 AND 9
    -(1..<10).contains(Column("id"))
    +(1..<10).contains(Column("id"))
     
    @@ -1045,7 +1045,7 @@ @@ -1055,7 +1055,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Data.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Data.html index 5fb0a72f9..33383c0e0 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Data.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Data.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1068,12 +1068,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1104,7 +1104,7 @@ a Blob.

    @@ -1114,7 +1114,7 @@ a Blob.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Database.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Database.html index b315b3193..e759de241 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Database.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Database.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1055,7 +1055,7 @@

    Add a custom FTS5 tokenizer.

    -
    class MyTokenizer : FTS5CustomTokenizer { ... }
    +
    class MyTokenizer : FTS5CustomTokenizer { ... }
     db.add(tokenizer: MyTokenizer.self)
     
    @@ -1131,10 +1131,10 @@ invalid syntax.

    database queue, or after the database has been closed.

    Use this method when you implement a custom wrapper tokenizer:

    -
    final class MyTokenizer : FTS5WrapperTokenizer {
    +
    final class MyTokenizer : FTS5WrapperTokenizer {
         var wrappedTokenizer: FTS5Tokenizer
     
    -    init(db: Database, arguments: [String]) throws {
    +    init(db: Database, arguments: [String]) throws {
             wrappedTokenizer = try db.makeTokenizer(.unicode61())
         }
     }
    @@ -1149,7 +1149,7 @@ database queue, or after the database has been closed.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/DatabasePool.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/DatabasePool.html index bc071f8d5..a2e64350a 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/DatabasePool.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/DatabasePool.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1042,7 +1042,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/DatabaseQueue.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/DatabaseQueue.html index a25134b22..727d8b373 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/DatabaseQueue.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/DatabaseQueue.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1062,7 +1062,7 @@

    Add a custom FTS5 tokenizer.

    -
    class MyTokenizer : FTS5CustomTokenizer { ... }
    +
    class MyTokenizer : FTS5CustomTokenizer { ... }
     dbQueue.add(tokenizer: MyTokenizer.self)
     
    @@ -1075,7 +1075,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Date.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Date.html index b4364a687..9a70ba120 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Date.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Date.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1040,12 +1040,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1084,7 +1084,7 @@ are set to zero if missing.

    @@ -1114,7 +1114,7 @@ are set to zero if missing.

    @@ -1180,7 +1180,7 @@ are set to zero if missing.

    @@ -1190,7 +1190,7 @@ are set to zero if missing.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Double.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Double.html index 07132064e..abbb5e277 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Double.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Double.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Float.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Float.html index 31adf63d0..31b79ec9d 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Float.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Float.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int.html index 99f823be0..285670456 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int16.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int16.html index ea97eb695..9617ce283 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int16.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int16.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int32.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int32.html index fd7a7d6f3..c42cce797 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int32.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int32.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int64.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int64.html index 00e6a3b8a..4a68dd3fd 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int64.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int64.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int8.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int8.html index b8891bc57..b0aafc2a5 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int8.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Int8.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/JoinableRequest.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/JoinableRequest.html index 344e37776..23118fb59 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/JoinableRequest.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/JoinableRequest.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1042,7 +1042,7 @@ @@ -1074,7 +1074,7 @@ require that the associated database table contains a matching row.

    @@ -1106,7 +1106,7 @@ that the associated database table contains a matching row.

    @@ -1138,7 +1138,7 @@ require that the associated database table contains a matching row.

    @@ -1170,7 +1170,7 @@ that the associated database table contains a matching row.

    @@ -1180,7 +1180,7 @@ that the associated database table contains a matching row.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSData.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSData.html index 9523510c8..d490d5d3f 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSData.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSData.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1038,12 +1038,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1069,12 +1069,12 @@ a Blob.

    Declaration

    Swift

    -
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    +
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    @@ -1084,7 +1084,7 @@ a Blob.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSDate.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSDate.html index 83cd83b16..684bff0d6 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSDate.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSDate.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1040,12 +1040,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1079,12 +1079,12 @@ are set to zero if missing.

    Declaration

    Swift

    -
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    +
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    @@ -1094,7 +1094,7 @@ are set to zero if missing.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSNull.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSNull.html index 7bc755dec..3de238c5e 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSNull.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSNull.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1038,12 +1038,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1068,12 +1068,12 @@

    Declaration

    Swift

    -
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    +
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSNumber.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSNumber.html index ae2fe289a..7c9c6a846 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSNumber.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSNumber.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1038,12 +1038,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1068,12 +1068,12 @@

    Declaration

    Swift

    -
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    +
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSString.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSString.html index 86db0fb82..6a0fb66e4 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSString.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSString.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1038,12 +1038,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1068,12 +1068,12 @@

    Declaration

    Swift

    -
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    +
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSURL.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSURL.html index 30ae0d41b..b4e4cf300 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSURL.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSURL.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1039,12 +1039,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1069,12 +1069,12 @@

    Declaration

    Swift

    -
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    +
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    @@ -1084,7 +1084,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSUUID.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSUUID.html index d83f576b0..96d68b709 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSUUID.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/NSUUID.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1037,12 +1037,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1066,12 +1066,12 @@

    Declaration

    Swift

    -
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    +
    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    @@ -1081,7 +1081,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Optional.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Optional.html index a76f8e827..8d8ef8446 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Optional.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Optional.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1128,7 +1128,7 @@ elements are undefined.

    A cursor over fetched optional values.

    @@ -1217,7 +1217,7 @@ elements are undefined.

    An array of optional values.

    @@ -1271,7 +1271,7 @@ elements are undefined.

    public static func fetchCursor(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> NullableDatabaseValueCursor<Wrapped>
    @@ -1337,7 +1337,7 @@ elements are undefined.

    A cursor over fetched optional values.

    @@ -1372,7 +1372,7 @@ elements are undefined.

    public static func fetchAll(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> [Wrapped?]
    @@ -1438,7 +1438,7 @@ elements are undefined.

    An array of optional values.

    @@ -1468,7 +1468,7 @@ elements are undefined.

    Returns a cursor over optional values fetched from a fetch request.

    -
    let request = Player.select(Column("name"))
    +
    let request = Player.select(Column("name"))
     let names = try Optional<String>.fetchCursor(db, request) // Cursor of String?
     while let name = try names.next() { // String?
         ...
    @@ -1531,7 +1531,7 @@ elements are undefined.

    A cursor over fetched optional values.

    @@ -1550,7 +1550,7 @@ elements are undefined.

    Returns an array of optional values fetched from a fetch request.

    -
    let request = Player.select(Column("name"))
    +
    let request = Player.select(Column("name"))
     let names = try Optional<String>.fetchAll(db, request) // [String?]
     
    @@ -1604,7 +1604,7 @@ elements are undefined.

    An array of optional values.

    @@ -1712,7 +1712,7 @@ elements are undefined.

    A cursor over fetched optional values.

    @@ -1801,7 +1801,7 @@ elements are undefined.

    An array of optional values.

    @@ -1855,7 +1855,7 @@ elements are undefined.

    public static func fetchCursor(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> FastNullableDatabaseValueCursor<Wrapped>
    @@ -1921,7 +1921,7 @@ elements are undefined.

    A cursor over fetched optional values.

    @@ -1956,7 +1956,7 @@ elements are undefined.

    public static func fetchAll(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> [Wrapped?]
    @@ -2022,7 +2022,7 @@ elements are undefined.

    An array of optional values.

    @@ -2052,7 +2052,7 @@ elements are undefined.

    Returns a cursor over optional values fetched from a fetch request.

    -
    let request = Player.select(Column("name"))
    +
    let request = Player.select(Column("name"))
     let names = try Optional<String>.fetchCursor(db, request) // Cursor of String?
     while let name = try names.next() { // String?
         ...
    @@ -2115,7 +2115,7 @@ elements are undefined.

    A cursor over fetched optional values.

    @@ -2134,7 +2134,7 @@ elements are undefined.

    Returns an array of optional values fetched from a fetch request.

    -
    let request = Player.select(Column("name"))
    +
    let request = Player.select(Column("name"))
     let names = try Optional<String>.fetchAll(db, request) // [String?]
     
    @@ -2188,7 +2188,7 @@ elements are undefined.

    An array of optional values.

    @@ -2198,7 +2198,7 @@ elements are undefined.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Range.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Range.html index fa334c600..a1328862e 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Range.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Range.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1032,7 +1032,7 @@

    An SQL expression that checks the inclusion of an expression in a range.

    // email >= 'A' AND email < 'B'
    -("A"..<"B").contains(Column("email"))
    +("A"..<"B").contains(Column("email"))
     
    @@ -1045,7 +1045,7 @@ @@ -1065,7 +1065,7 @@

    An SQL expression that checks the inclusion of an expression in a range.

    // email >= 'A' COLLATE NOCASE AND email < 'B' COLLATE NOCASE
    -("A"..<"B").contains(Column("email").collating(.nocase))
    +("A"..<"B").contains(Column("email").collating(.nocase))
     
    @@ -1078,7 +1078,7 @@ @@ -1088,7 +1088,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/SQLLiteral.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/SQLLiteral.html index 663f940f1..a11568346 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/SQLLiteral.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/SQLLiteral.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1035,7 +1035,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/SQLRequest.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/SQLRequest.html index 5cac74ce1..f71c64089 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/SQLRequest.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/SQLRequest.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1035,7 +1035,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Sequence.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Sequence.html index b9030eb9c..18559ffc4 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Sequence.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Sequence.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ over self.

    @@ -1087,7 +1087,7 @@ inserting the given separator between each element.

    @@ -1112,7 +1112,7 @@ inserting the given separator between each element.

    An SQL expression that checks the inclusion of an expression in a sequence.

    // id IN (1,2,3)
    -[1, 2, 3].contains(Column("id"))
    +[1, 2, 3].contains(Column("id"))
     
    @@ -1125,7 +1125,7 @@ a sequence.

    @@ -1146,7 +1146,7 @@ a sequence.

    An SQL expression that checks the inclusion of an expression in a sequence.

    // name IN ('A', 'B') COLLATE NOCASE
    -["A", "B"].contains(Column("name").collating(.nocase))
    +["A", "B"].contains(Column("name").collating(.nocase))
     
    @@ -1159,7 +1159,7 @@ a sequence.

    @@ -1190,9 +1190,9 @@ logical operator.

    // AND (score >= 1000) // AND (name IS NOT NULL)) let conditions = [ - Column("registered"), - Column("score") >= 1000, - Column("name") != nil] + Column("registered"), + Column("score") >= 1000, + Column("name") != nil] Player.filter(conditions.joined(operator: .and))
    @@ -1215,7 +1215,7 @@ and joined(operator: .or) returns false:

    @@ -1225,7 +1225,7 @@ and joined(operator: .or) returns false:

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Set.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Set.html index b4b200a8f..77e1fbeb0 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Set.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/Set.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1032,7 +1032,7 @@

    Creates a set containing the elements of a cursor.

    let cursor = try String.fetchCursor(db, sql: "SELECT 'foo' UNION ALL SELECT 'foo'")
    -let strings = try Set(cursor) // ["foo"]
    +let strings = try Set(cursor) // ["foo"]
     
    @@ -1045,7 +1045,7 @@ @@ -1055,7 +1055,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/String.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/String.html index 5455a218f..9d04e3b2b 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/String.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/String.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1168,12 +1168,12 @@ SQL query.

    Swift

    @inlinable
    -public var quotedDatabaseIdentifier: String { get }
    +public var quotedDatabaseIdentifier: String { get }
    @@ -1183,7 +1183,7 @@ SQL query.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/TableRecord.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/TableRecord.html index afc34cd3f..2d940dae3 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/TableRecord.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/TableRecord.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1048,7 +1048,7 @@ database row.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/TableRequest.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/TableRequest.html index f60dde200..03d314059 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/TableRequest.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/TableRequest.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1054,7 +1054,7 @@ for individual requests with the TableRecord.select method.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt.html index b63c1f6d0..ad7441a75 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt16.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt16.html index 7fb687324..2121ef004 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt16.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt16.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt32.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt32.html index 1d9e51f50..31bbe7256 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt32.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt32.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt64.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt64.html index 98ef03f24..e2d6205a8 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt64.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt64.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt8.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt8.html index cef5e170b..0d3b04373 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt8.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UInt8.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1075,7 +1075,7 @@ @@ -1100,12 +1100,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1135,7 +1135,7 @@ @@ -1145,7 +1145,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UUID.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UUID.html index 8104d2a10..d1c66048c 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UUID.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Extensions/UUID.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1038,12 +1038,12 @@

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1072,7 +1072,7 @@ @@ -1106,7 +1106,7 @@ @@ -1116,7 +1116,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Functions.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Functions.html index ed5744ddd..e0cf47f82 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Functions.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Functions.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1032,7 +1032,7 @@ number of columns.

    let sql = "SELECT 1, 2,3,4, 5,6, 7,8"
     //               <.><. . .><. .><. .>
     let adapters = splittingRowAdapters([1, 3, 2])
    -let adapter = ScopeAdapter([
    +let adapter = ScopeAdapter([
         "a": adapters[0],
         "b": adapters[1],
         "c": adapters[2],
    @@ -1054,7 +1054,7 @@ number of columns.

    @@ -1099,7 +1099,7 @@ number of columns.

    @@ -1136,7 +1136,7 @@ number of columns.

    @@ -1173,7 +1173,7 @@ number of columns.

    @@ -1221,7 +1221,7 @@ number of columns.

    @@ -1258,7 +1258,7 @@ number of columns.

    @@ -1295,7 +1295,7 @@ number of columns.

    @@ -1329,7 +1329,7 @@ number of columns.

    @@ -1363,7 +1363,7 @@ number of columns.

    @@ -1400,7 +1400,7 @@ number of columns.

    @@ -1437,7 +1437,7 @@ number of columns.

    @@ -1474,7 +1474,7 @@ number of columns.

    @@ -1508,7 +1508,7 @@ number of columns.

    @@ -1542,7 +1542,7 @@ number of columns.

    @@ -1579,7 +1579,7 @@ number of columns.

    @@ -1616,7 +1616,7 @@ number of columns.

    @@ -1653,7 +1653,7 @@ number of columns.

    @@ -1690,7 +1690,7 @@ number of columns.

    @@ -1727,7 +1727,7 @@ number of columns.

    @@ -1764,7 +1764,7 @@ number of columns.

    @@ -1812,7 +1812,7 @@ number of columns.

    @@ -1849,7 +1849,7 @@ number of columns.

    @@ -1886,7 +1886,7 @@ number of columns.

    @@ -1923,7 +1923,7 @@ number of columns.

    @@ -1960,7 +1960,7 @@ number of columns.

    @@ -1997,7 +1997,7 @@ number of columns.

    @@ -2034,7 +2034,7 @@ number of columns.

    @@ -2071,7 +2071,7 @@ number of columns.

    @@ -2108,7 +2108,7 @@ number of columns.

    @@ -2145,7 +2145,7 @@ number of columns.

    @@ -2182,7 +2182,7 @@ number of columns.

    @@ -2219,7 +2219,7 @@ number of columns.

    @@ -2264,7 +2264,7 @@ number of columns.

    @@ -2301,7 +2301,7 @@ number of columns.

    @@ -2338,7 +2338,7 @@ number of columns.

    @@ -2375,7 +2375,7 @@ number of columns.

    @@ -2412,7 +2412,7 @@ number of columns.

    @@ -2449,7 +2449,7 @@ number of columns.

    @@ -2486,7 +2486,7 @@ number of columns.

    @@ -2523,7 +2523,7 @@ number of columns.

    @@ -2560,7 +2560,7 @@ number of columns.

    @@ -2597,7 +2597,7 @@ number of columns.

    @@ -2634,7 +2634,7 @@ number of columns.

    @@ -2671,7 +2671,7 @@ number of columns.

    @@ -2708,7 +2708,7 @@ number of columns.

    @@ -2738,7 +2738,7 @@ number of columns.

    Returns an aggregate that evaluates the IFNULL SQL function.

    -
    Team.annotated(with: Team.players.min(Column("score")) ?? 0)
    +
    Team.annotated(with: Team.players.min(Column("score")) ?? 0)
     
    @@ -2754,7 +2754,7 @@ number of columns.

    @@ -2785,7 +2785,7 @@ number of columns.

    Returns an expression that evaluates the ABS SQL function.

    // ABS(amount)
    -abs(Column("amount"))
    +abs(Column("amount"))
     
    @@ -2798,7 +2798,7 @@ number of columns.

    @@ -2829,7 +2829,7 @@ number of columns.

    Returns an expression that evaluates the AVG SQL function.

    // AVG(length)
    -average(Column("length"))
    +average(Column("length"))
     
    @@ -2842,7 +2842,7 @@ number of columns.

    @@ -2873,7 +2873,7 @@ number of columns.

    Returns an expression that evaluates the COUNT SQL function.

    // COUNT(email)
    -count(Column("email"))
    +count(Column("email"))
     
    @@ -2886,7 +2886,7 @@ number of columns.

    @@ -2917,7 +2917,7 @@ number of columns.

    Returns an expression that evaluates the COUNT(DISTINCT) SQL function.

    // COUNT(DISTINCT email)
    -count(distinct: Column("email"))
    +count(distinct: Column("email"))
     
    @@ -2930,7 +2930,7 @@ number of columns.

    @@ -2961,7 +2961,7 @@ number of columns.

    Returns an expression that evaluates the IFNULL SQL function.

    // IFNULL(name, 'Anonymous')
    -Column("name") ?? "Anonymous"
    +Column("name") ?? "Anonymous"
     
    @@ -2974,7 +2974,7 @@ number of columns.

    @@ -3005,7 +3005,7 @@ number of columns.

    Returns an expression that evaluates the LENGTH SQL function.

    // LENGTH(name)
    -length(Column("name"))
    +length(Column("name"))
     
    @@ -3018,7 +3018,7 @@ number of columns.

    @@ -3049,7 +3049,7 @@ number of columns.

    Returns an expression that evaluates the MAX SQL function.

    // MAX(score)
    -max(Column("score"))
    +max(Column("score"))
     
    @@ -3062,7 +3062,7 @@ number of columns.

    @@ -3093,7 +3093,7 @@ number of columns.

    Returns an expression that evaluates the MIN SQL function.

    // MIN(score)
    -min(Column("score"))
    +min(Column("score"))
     
    @@ -3106,7 +3106,7 @@ number of columns.

    @@ -3137,7 +3137,7 @@ number of columns.

    Returns an expression that evaluates the SUM SQL function.

    // SUM(amount)
    -sum(Column("amount"))
    +sum(Column("amount"))
     
    @@ -3150,7 +3150,7 @@ number of columns.

    @@ -3181,12 +3181,12 @@ number of columns.

    An SQL expression that compares two expressions with the = SQL operator.

    // name = 'Arthur'
    -Column("name") == "Arthur"
    +Column("name") == "Arthur"
     

    When the right operand is nil, IS NULL is used instead.

    // name IS NULL
    -Column("name") == nil
    +Column("name") == nil
     
    @@ -3199,7 +3199,7 @@ number of columns.

    @@ -3219,12 +3219,12 @@ number of columns.

    An SQL expression that compares two expressions with the = SQL operator.

    // name = 'Arthur' COLLATE NOCASE
    -Column("name").collating(.nocase) == "Arthur"
    +Column("name").collating(.nocase) == "Arthur"
     

    When the right operand is nil, IS NULL is used instead.

    // name IS NULL
    -Column("name").collating(.nocase) == nil
    +Column("name").collating(.nocase) == nil
     
    @@ -3237,7 +3237,7 @@ number of columns.

    @@ -3259,10 +3259,10 @@ number of columns.

    The comparison is done with the built-in boolean evaluation of SQLite:

    // validated
    -Column("validated") == true
    +Column("validated") == true
     
     // NOT validated
    -Column("validated") == false
    +Column("validated") == false
     
    @@ -3275,7 +3275,7 @@ number of columns.

    @@ -3295,12 +3295,12 @@ number of columns.

    An SQL expression that compares two expressions with the = SQL operator.

    // 'Arthur' = name
    -"Arthur" == Column("name")
    +"Arthur" == Column("name")
     

    When the left operand is nil, IS NULL is used instead.

    // name IS NULL
    -nil == Column("name")
    +nil == Column("name")
     
    @@ -3313,7 +3313,7 @@ number of columns.

    @@ -3333,12 +3333,12 @@ number of columns.

    An SQL expression that compares two expressions with the = SQL operator.

    // 'Arthur' = name COLLATE NOCASE
    -"Arthur" == Column("name").collating(.nocase)
    +"Arthur" == Column("name").collating(.nocase)
     

    When the left operand is nil, IS NULL is used instead.

    // name IS NULL
    -nil == Column("name").collating(.nocase)
    +nil == Column("name").collating(.nocase)
     
    @@ -3351,7 +3351,7 @@ number of columns.

    @@ -3373,10 +3373,10 @@ number of columns.

    The comparison is done with the built-in boolean evaluation of SQLite:

    // validated
    -true == Column("validated")
    +true == Column("validated")
     
     // NOT validated
    -false == Column("validated")
    +false == Column("validated")
     
    @@ -3389,7 +3389,7 @@ number of columns.

    @@ -3409,7 +3409,7 @@ number of columns.

    An SQL expression that compares two expressions with the = SQL operator.

    // email = login
    -Column("email") == Column("login")
    +Column("email") == Column("login")
     
    @@ -3422,7 +3422,7 @@ number of columns.

    @@ -3442,12 +3442,12 @@ number of columns.

    An SQL expression that compares two expressions with the <> SQL operator.

    // name <> 'Arthur'
    -Column("name") != "Arthur"
    +Column("name") != "Arthur"
     

    When the right operand is nil, IS NOT NULL is used instead.

    // name IS NOT NULL
    -Column("name") != nil
    +Column("name") != nil
     
    @@ -3460,7 +3460,7 @@ number of columns.

    @@ -3480,12 +3480,12 @@ number of columns.

    An SQL expression that compares two expressions with the <> SQL operator.

    // name <> 'Arthur' COLLATE NOCASE
    -Column("name").collating(.nocase) != "Arthur"
    +Column("name").collating(.nocase) != "Arthur"
     

    When the right operand is nil, IS NOT NULL is used instead.

    // name IS NOT NULL
    -Column("name").collating(.nocase) != nil
    +Column("name").collating(.nocase) != nil
     
    @@ -3498,7 +3498,7 @@ number of columns.

    @@ -3520,10 +3520,10 @@ number of columns.

    The comparison is done with the built-in boolean evaluation of SQLite:

    // NOT validated
    -Column("validated") != true
    +Column("validated") != true
     
     // validated
    -Column("validated") != false
    +Column("validated") != false
     
    @@ -3536,7 +3536,7 @@ number of columns.

    @@ -3556,12 +3556,12 @@ number of columns.

    An SQL expression that compares two expressions with the <> SQL operator.

    // 'Arthur' <> name
    -"Arthur" != Column("name")
    +"Arthur" != Column("name")
     

    When the left operand is nil, IS NOT NULL is used instead.

    // name IS NOT NULL
    -nil != Column("name")
    +nil != Column("name")
     
    @@ -3574,7 +3574,7 @@ number of columns.

    @@ -3594,12 +3594,12 @@ number of columns.

    An SQL expression that compares two expressions with the <> SQL operator.

    // 'Arthur' <> name COLLATE NOCASE
    -"Arthur" != Column("name").collating(.nocase)
    +"Arthur" != Column("name").collating(.nocase)
     

    When the left operand is nil, IS NOT NULL is used instead.

    // name IS NOT NULL
    -nil != Column("name").collating(.nocase)
    +nil != Column("name").collating(.nocase)
     
    @@ -3612,7 +3612,7 @@ number of columns.

    @@ -3634,10 +3634,10 @@ number of columns.

    The comparison is done with the built-in boolean evaluation of SQLite:

    // NOT validated
    -true != Column("validated")
    +true != Column("validated")
     
     // validated
    -false != Column("validated")
    +false != Column("validated")
     
    @@ -3650,7 +3650,7 @@ number of columns.

    @@ -3670,7 +3670,7 @@ number of columns.

    An SQL expression that compares two expressions with the <> SQL operator.

    // email <> login
    -Column("email") != Column("login")
    +Column("email") != Column("login")
     
    @@ -3683,7 +3683,7 @@ number of columns.

    @@ -3703,7 +3703,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS SQL operator.

    // name IS 'Arthur'
    -Column("name") === "Arthur"
    +Column("name") === "Arthur"
     
    @@ -3716,7 +3716,7 @@ number of columns.

    @@ -3736,7 +3736,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS SQL operator.

    // name IS 'Arthur' COLLATE NOCASE
    -Column("name").collating(.nocase) === "Arthur"
    +Column("name").collating(.nocase) === "Arthur"
     
    @@ -3749,7 +3749,7 @@ number of columns.

    @@ -3769,7 +3769,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS SQL operator.

    // name IS 'Arthur'
    -"Arthur" === Column("name")
    +"Arthur" === Column("name")
     
    @@ -3782,7 +3782,7 @@ number of columns.

    @@ -3802,7 +3802,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS SQL operator.

    // name IS 'Arthur' COLLATE NOCASE
    -"Arthur" === Column("name").collating(.nocase)
    +"Arthur" === Column("name").collating(.nocase)
     
    @@ -3815,7 +3815,7 @@ number of columns.

    @@ -3835,7 +3835,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS SQL operator.

    // email IS login
    -Column("email") === Column("login")
    +Column("email") === Column("login")
     
    @@ -3848,7 +3848,7 @@ number of columns.

    @@ -3868,7 +3868,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS NOT SQL operator.

    // name IS NOT 'Arthur'
    -Column("name") !== "Arthur"
    +Column("name") !== "Arthur"
     
    @@ -3881,7 +3881,7 @@ number of columns.

    @@ -3901,7 +3901,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS NOT SQL operator.

    // name IS NOT 'Arthur' COLLATE NOCASE
    -Column("name").collating(.nocase) !== "Arthur"
    +Column("name").collating(.nocase) !== "Arthur"
     
    @@ -3914,7 +3914,7 @@ number of columns.

    @@ -3934,7 +3934,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS NOT SQL operator.

    // name IS NOT 'Arthur'
    -"Arthur" !== Column("name")
    +"Arthur" !== Column("name")
     
    @@ -3947,7 +3947,7 @@ number of columns.

    @@ -3967,7 +3967,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS NOT SQL operator.

    // name IS NOT 'Arthur' COLLATE NOCASE
    -"Arthur" !== Column("name").collating(.nocase)
    +"Arthur" !== Column("name").collating(.nocase)
     
    @@ -3980,7 +3980,7 @@ number of columns.

    @@ -4000,7 +4000,7 @@ number of columns.

    An SQL expression that compares two expressions with the IS NOT SQL operator.

    // email IS NOT login
    -Column("email") !== Column("login")
    +Column("email") !== Column("login")
     
    @@ -4013,7 +4013,7 @@ number of columns.

    @@ -4044,7 +4044,7 @@ number of columns.

    An SQL expression that compares two expressions with the < SQL operator.

    // score < 18
    -Column("score") < 18
    +Column("score") < 18
     
    @@ -4057,7 +4057,7 @@ number of columns.

    @@ -4077,7 +4077,7 @@ number of columns.

    An SQL expression that compares two expressions with the < SQL operator.

    // name < 'Arthur' COLLATE NOCASE
    -Column("name").collating(.nocase) < "Arthur"
    +Column("name").collating(.nocase) < "Arthur"
     
    @@ -4090,7 +4090,7 @@ number of columns.

    @@ -4110,7 +4110,7 @@ number of columns.

    An SQL expression that compares two expressions with the < SQL operator.

    // 18 < score
    -18 < Column("score")
    +18 < Column("score")
     
    @@ -4123,7 +4123,7 @@ number of columns.

    @@ -4143,7 +4143,7 @@ number of columns.

    An SQL expression that compares two expressions with the < SQL operator.

    // 'Arthur' < name COLLATE NOCASE
    -"Arthur" < Column("name").collating(.nocase)
    +"Arthur" < Column("name").collating(.nocase)
     
    @@ -4156,7 +4156,7 @@ number of columns.

    @@ -4176,7 +4176,7 @@ number of columns.

    An SQL expression that compares two expressions with the < SQL operator.

    // width < height
    -Column("width") < Column("height")
    +Column("width") < Column("height")
     
    @@ -4189,7 +4189,7 @@ number of columns.

    @@ -4209,7 +4209,7 @@ number of columns.

    An SQL expression that compares two expressions with the <= SQL operator.

    // score <= 18
    -Column("score") <= 18
    +Column("score") <= 18
     
    @@ -4222,7 +4222,7 @@ number of columns.

    @@ -4242,7 +4242,7 @@ number of columns.

    An SQL expression that compares two expressions with the <= SQL operator.

    // name <= 'Arthur' COLLATE NOCASE
    -Column("name").collating(.nocase) <= "Arthur"
    +Column("name").collating(.nocase) <= "Arthur"
     
    @@ -4255,7 +4255,7 @@ number of columns.

    @@ -4275,7 +4275,7 @@ number of columns.

    An SQL expression that compares two expressions with the <= SQL operator.

    // 18 <= score
    -18 <= Column("score")
    +18 <= Column("score")
     
    @@ -4288,7 +4288,7 @@ number of columns.

    @@ -4308,7 +4308,7 @@ number of columns.

    An SQL expression that compares two expressions with the <= SQL operator.

    // 'Arthur' <= name COLLATE NOCASE
    -"Arthur" <= Column("name").collating(.nocase)
    +"Arthur" <= Column("name").collating(.nocase)
     
    @@ -4321,7 +4321,7 @@ number of columns.

    @@ -4341,7 +4341,7 @@ number of columns.

    An SQL expression that compares two expressions with the <= SQL operator.

    // width <= height
    -Column("width") <= Column("height")
    +Column("width") <= Column("height")
     
    @@ -4354,7 +4354,7 @@ number of columns.

    @@ -4374,7 +4374,7 @@ number of columns.

    An SQL expression that compares two expressions with the > SQL operator.

    // score > 18
    -Column("score") > 18
    +Column("score") > 18
     
    @@ -4387,7 +4387,7 @@ number of columns.

    @@ -4407,7 +4407,7 @@ number of columns.

    An SQL expression that compares two expressions with the > SQL operator.

    // name > 'Arthur' COLLATE NOCASE
    -Column("name").collating(.nocase) > "Arthur"
    +Column("name").collating(.nocase) > "Arthur"
     
    @@ -4420,7 +4420,7 @@ number of columns.

    @@ -4440,7 +4440,7 @@ number of columns.

    An SQL expression that compares two expressions with the > SQL operator.

    // 18 > score
    -18 > Column("score")
    +18 > Column("score")
     
    @@ -4453,7 +4453,7 @@ number of columns.

    @@ -4473,7 +4473,7 @@ number of columns.

    An SQL expression that compares two expressions with the > SQL operator.

    // 'Arthur' > name COLLATE NOCASE
    -"Arthur" > Column("name").collating(.nocase)
    +"Arthur" > Column("name").collating(.nocase)
     
    @@ -4486,7 +4486,7 @@ number of columns.

    @@ -4506,7 +4506,7 @@ number of columns.

    An SQL expression that compares two expressions with the > SQL operator.

    // width > height
    -Column("width") > Column("height")
    +Column("width") > Column("height")
     
    @@ -4519,7 +4519,7 @@ number of columns.

    @@ -4539,7 +4539,7 @@ number of columns.

    An SQL expression that compares two expressions with the >= SQL operator.

    // score >= 18
    -Column("score") >= 18
    +Column("score") >= 18
     
    @@ -4552,7 +4552,7 @@ number of columns.

    @@ -4572,7 +4572,7 @@ number of columns.

    An SQL expression that compares two expressions with the >= SQL operator.

    // name >= 'Arthur' COLLATE NOCASE
    -Column("name").collating(.nocase) >= "Arthur"
    +Column("name").collating(.nocase) >= "Arthur"
     
    @@ -4585,7 +4585,7 @@ number of columns.

    @@ -4605,7 +4605,7 @@ number of columns.

    An SQL expression that compares two expressions with the >= SQL operator.

    // 18 >= score
    -18 >= Column("score")
    +18 >= Column("score")
     
    @@ -4618,7 +4618,7 @@ number of columns.

    @@ -4638,7 +4638,7 @@ number of columns.

    An SQL expression that compares two expressions with the >= SQL operator.

    // 'Arthur' >= name COLLATE NOCASE
    -"Arthur" >= Column("name").collating(.nocase)
    +"Arthur" >= Column("name").collating(.nocase)
     
    @@ -4651,7 +4651,7 @@ number of columns.

    @@ -4671,7 +4671,7 @@ number of columns.

    An SQL expression that compares two expressions with the >= SQL operator.

    // width >= height
    -Column("width") >= Column("height")
    +Column("width") >= Column("height")
     
    @@ -4684,7 +4684,7 @@ number of columns.

    @@ -4715,7 +4715,7 @@ number of columns.

    An SQL arithmetic multiplication.

    // width * 2
    -Column("width") * 2
    +Column("width") * 2
     
    @@ -4728,7 +4728,7 @@ number of columns.

    @@ -4748,7 +4748,7 @@ number of columns.

    An SQL arithmetic multiplication.

    // 2 * width
    -2 * Column("width")
    +2 * Column("width")
     
    @@ -4761,7 +4761,7 @@ number of columns.

    @@ -4781,7 +4781,7 @@ number of columns.

    An SQL arithmetic multiplication.

    // width * height
    -Column("width") * Column("height")
    +Column("width") * Column("height")
     
    @@ -4794,7 +4794,7 @@ number of columns.

    @@ -4814,7 +4814,7 @@ number of columns.

    An SQL arithmetic division.

    // width / 2
    -Column("width") / 2
    +Column("width") / 2
     
    @@ -4827,7 +4827,7 @@ number of columns.

    @@ -4847,7 +4847,7 @@ number of columns.

    An SQL arithmetic division.

    // 2 / width
    -2 / Column("width")
    +2 / Column("width")
     
    @@ -4860,7 +4860,7 @@ number of columns.

    @@ -4880,7 +4880,7 @@ number of columns.

    An SQL arithmetic division.

    // width / height
    -Column("width") / Column("height")
    +Column("width") / Column("height")
     
    @@ -4893,7 +4893,7 @@ number of columns.

    @@ -4913,7 +4913,7 @@ number of columns.

    An SQL arithmetic addition.

    // width + 2
    -Column("width") + 2
    +Column("width") + 2
     
    @@ -4926,7 +4926,7 @@ number of columns.

    @@ -4946,7 +4946,7 @@ number of columns.

    An SQL arithmetic addition.

    // 2 + width
    -2 + Column("width")
    +2 + Column("width")
     
    @@ -4959,7 +4959,7 @@ number of columns.

    @@ -4979,7 +4979,7 @@ number of columns.

    An SQL arithmetic addition.

    // width + height
    -Column("width") + Column("height")
    +Column("width") + Column("height")
     
    @@ -4992,7 +4992,7 @@ number of columns.

    @@ -5012,7 +5012,7 @@ number of columns.

    A negated SQL arithmetic expression.

    // -width
    --Column("width")
    +-Column("width")
     
    @@ -5025,7 +5025,7 @@ number of columns.

    @@ -5045,7 +5045,7 @@ number of columns.

    An SQL arithmetic substraction.

    // width - 2
    -Column("width") - 2
    +Column("width") - 2
     
    @@ -5058,7 +5058,7 @@ number of columns.

    @@ -5078,7 +5078,7 @@ number of columns.

    An SQL arithmetic substraction.

    // 2 - width
    -2 - Column("width")
    +2 - Column("width")
     
    @@ -5091,7 +5091,7 @@ number of columns.

    @@ -5111,7 +5111,7 @@ number of columns.

    An SQL arithmetic substraction.

    // width - height
    -Column("width") - Column("height")
    +Column("width") - Column("height")
     
    @@ -5124,7 +5124,7 @@ number of columns.

    @@ -5155,7 +5155,7 @@ number of columns.

    A logical SQL expression with the AND SQL operator.

    // favorite AND 0
    -Column("favorite") && false
    +Column("favorite") && false
     
    @@ -5168,7 +5168,7 @@ number of columns.

    @@ -5188,7 +5188,7 @@ number of columns.

    A logical SQL expression with the AND SQL operator.

    // 0 AND favorite
    -false && Column("favorite")
    +false && Column("favorite")
     
    @@ -5201,7 +5201,7 @@ number of columns.

    @@ -5221,7 +5221,7 @@ number of columns.

    A logical SQL expression with the AND SQL operator.

    // email IS NOT NULL AND favorite
    -Column("email") != nil && Column("favorite")
    +Column("email") != nil && Column("favorite")
     
    @@ -5234,7 +5234,7 @@ number of columns.

    @@ -5254,7 +5254,7 @@ number of columns.

    A logical SQL expression with the OR SQL operator.

    // favorite OR 1
    -Column("favorite") || true
    +Column("favorite") || true
     
    @@ -5267,7 +5267,7 @@ number of columns.

    @@ -5287,7 +5287,7 @@ number of columns.

    A logical SQL expression with the OR SQL operator.

    // 0 OR favorite
    -true || Column("favorite")
    +true || Column("favorite")
     
    @@ -5300,7 +5300,7 @@ number of columns.

    @@ -5320,7 +5320,7 @@ number of columns.

    A logical SQL expression with the OR SQL operator.

    // email IS NULL OR hidden
    -Column("email") == nil || Column("hidden")
    +Column("email") == nil || Column("hidden")
     
    @@ -5333,7 +5333,7 @@ number of columns.

    @@ -5353,12 +5353,12 @@ number of columns.

    A negated logical SQL expression with the NOT SQL operator.

    // NOT hidden
    -!Column("hidden")
    +!Column("hidden")
     

    Some expressions may be negated with specific SQL operators:

    // id NOT BETWEEN 1 AND 10
    -!((1...10).contains(Column("id")))
    +!((1...10).contains(Column("id")))
     
    @@ -5371,7 +5371,7 @@ number of columns.

    @@ -5415,7 +5415,7 @@ number of columns.

    @@ -5425,7 +5425,7 @@ number of columns.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols.html index 57fe1c411..8a15eeacf 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1071,7 +1071,7 @@ to those defined by Swift’s Sequence protocol: contains, @@ -1096,7 +1096,7 @@ to those defined by Swift’s Sequence protocol: contains, The protocol for custom SQLite aggregates.

    For example:

    -
    struct MySum : DatabaseAggregate {
    +
    struct MySum : DatabaseAggregate {
         var sum: Int = 0
     
         mutating func step(_ dbValues: [DatabaseValue]) {
    @@ -1105,15 +1105,15 @@ to those defined by Swift’s Sequence protocol: contains, }
         }
     
    -    func finalize() -> DatabaseValueConvertible? {
    +    func finalize() -> DatabaseValueConvertible? {
             return sum
         }
     }
     
    -let dbQueue = DatabaseQueue()
    -let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self)
    +let dbQueue = DatabaseQueue()
    +let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self)
     dbQueue.add(function: fn)
    -try dbQueue.write { db in
    +try dbQueue.write { db in
         try db.execute(sql: "CREATE TABLE test(i)")
         try db.execute(sql: "INSERT INTO test(i) VALUES (1)")
         try db.execute(sql: "INSERT INTO test(i) VALUES (2)")
    @@ -1132,7 +1132,7 @@ to those defined by Swift’s Sequence protocol: contains, 
                           
                           
                         
                       
    @@ -1181,7 +1181,7 @@ connections, protect yourself with transactions, and be ready to setup a
                             
                           
                           
                         
                       
    @@ -1223,7 +1223,7 @@ connections, protect yourself with transactions, and be ready to setup a
                             
                           
                           
                         
                       
    @@ -1280,7 +1280,7 @@ arrays, or single values:

    @@ -1311,7 +1311,7 @@ arrays, or single values:

    The protocol for all requests that fetch database rows, and tell how those rows should be interpreted.

    -
    struct Player: FetchableRecord { ... }
    +
    struct Player: FetchableRecord { ... }
     let request: ... // Some FetchRequest that fetches Player
     try request.fetchCursor(db) // Cursor of Player
     try request.fetchAll(db)    // [Player]
    @@ -1329,7 +1329,7 @@ rows should be interpreted.

    @@ -1378,7 +1378,7 @@ connections, protect yourself with transactions, and be ready to setup a @@ -1413,7 +1413,7 @@ together.

    To use a row adapter, provide it to any method that fetches:

    -
    let adapter = SuffixRowAdapter(fromIndex: 2)
    +
    let adapter = SuffixRowAdapter(fromIndex: 2)
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
     
     // [baz:3]
    @@ -1431,7 +1431,7 @@ together.

    @@ -1466,7 +1466,7 @@ optimization whenever direct access to SQLite is possible:

    let int: Int = row[0] // there } let ints = Int.fetchAll(db, sql: "SELECT ...") // there -struct Player { +struct Player { init(row: Row) { name = row["name"] // there score = row["score"] // there @@ -1488,7 +1488,7 @@ Float, Double, String, and Bool.

    @@ -1533,7 +1533,7 @@ or rollbacked on a database.

    @@ -1612,11 +1612,11 @@ low-level FTS5Tokenizer.tokenize(context:flags:pText:nText:tokenCallback:).

    Here is the implementation for a trivial tokenizer that wraps the built-in ascii tokenizer without any custom processing:

    -
    class TrivialAsciiTokenizer : FTS5WrapperTokenizer {
    +
    class TrivialAsciiTokenizer : FTS5WrapperTokenizer {
         static let name = "trivial"
         let wrappedTokenizer: FTS5Tokenizer
     
    -    init(db: Database, arguments: [String]) throws {
    +    init(db: Database, arguments: [String]) throws {
             wrappedTokenizer = try db.makeTokenizer(.ascii())
         }
     
    @@ -1625,7 +1625,7 @@ built-in ascii tokenizer without any custom processing:

    flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) - throws + throws { try tokenCallback(token, flags) } @@ -1676,7 +1676,7 @@ built-in methods that allow to fetch instances identified by key:

    @@ -1701,18 +1701,18 @@ built-in methods that allow to fetch instances identified by key:

    Adopt the ColumnExpression protocol when you define a column type.

    You can, for example, define a String-based column enum:

    -
    enum Columns: String, ColumnExpression {
    +
    enum Columns: String, ColumnExpression {
         case id, name, score
     }
     let arthur = try Player.filter(Columns.name == "Arthur").fetchOne(db)
     

    You can also define a genuine column type:

    -
    struct MyColumn: ColumnExpression {
    +
    struct MyColumn: ColumnExpression {
         var name: String
         var sqlType: String
     }
    -let nameColumn = MyColumn(name: "name", sqlType: "VARCHAR")
    +let nameColumn = MyColumn(name: "name", sqlType: "VARCHAR")
     let arthur = try Player.filter(nameColumn == "Arthur").fetchOne(db)
     
    @@ -1729,7 +1729,7 @@ built-in methods that allow to fetch instances identified by key:

    @@ -1767,7 +1767,7 @@ record types.

    @@ -1811,7 +1811,7 @@ record types.

    @@ -1855,7 +1855,7 @@ record types.

    @@ -1899,7 +1899,7 @@ FTS4 and FTS5.

    @@ -1934,7 +1934,7 @@ FTS4 and FTS5.

    @@ -1958,7 +1958,7 @@ FTS4 and FTS5.

    Types that adopt FetchableRecord can be initialized from a database Row.

    let row = try Row.fetchOne(db, sql: "SELECT ...")!
    -let player = Player(row)
    +let player = Player(row)
     

    The protocol comes with built-in methods that allow to fetch cursors, @@ -1986,7 +1986,7 @@ arrays, or single records:

    @@ -2021,7 +2021,7 @@ arrays, or single records:

    @@ -2068,7 +2068,7 @@ mutating methods.

    @@ -2105,7 +2105,7 @@ mutating methods.

    @@ -2115,7 +2115,7 @@ mutating methods.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/Association.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/Association.html index ff95e6bbf..5578dae60 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/Association.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/Association.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1037,7 +1037,7 @@ record types.

    The record type at the origin of the association.

    In the belongsTo association below, it is Book:

    -
    struct Book: TableRecord {
    +
    struct Book: TableRecord {
         // BelongsToAssociation<Book, Author>
         static let author = belongsTo(Author.self)
     }
    @@ -1053,7 +1053,7 @@ record types.

    @@ -1078,7 +1078,7 @@ record types.

    This new key impacts how rows fetched from the resulting association should be consumed:

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
    @@ -1096,11 +1096,11 @@ should be consumed:

    This new key helps Decodable records decode rows fetched from the resulting association:

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
    -struct PlayerInfo: FetchableRecord, Decodable {
    +struct PlayerInfo: FetchableRecord, Decodable {
         let player: Player
         let team: Team
     
    @@ -1125,7 +1125,7 @@ resulting association:

    @@ -1151,14 +1151,14 @@ resulting association:

    Creates an association which selects selection.

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
     // SELECT player.*, team.color
     // FROM player
     // JOIN team ON team.id = player.teamId
    -let association = Player.team.select([Column("color")])
    +let association = Player.team.select([Column("color")])
     var request = Player.including(required: association)
     
    @@ -1167,8 +1167,8 @@ resulting association:

    // FROM player // JOIN team ON team.id = player.teamId let association = Player.team - .select([Column("id")]) - .select([Column("color")]) + .select([Column("id")]) + .select([Column("color")]) var request = Player.including(required: association)
    @@ -1182,7 +1182,7 @@ resulting association:

    @@ -1204,7 +1204,7 @@ resulting association:

    Creates an association which appends selection.

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
    @@ -1212,8 +1212,8 @@ resulting association:

    // FROM player // JOIN team ON team.id = player.teamId let association = Player.team - .select([Column("color")]) - .annotated(with: [Column("name")]) + .select([Column("color")]) + .annotated(with: [Column("name")]) var request = Player.including(required: association)
    @@ -1227,7 +1227,7 @@ resulting association:

    @@ -1250,14 +1250,14 @@ resulting association:

    Creates an association with the provided predicate promise added to the eventual set of already applied predicates.

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
     // SELECT player.*, team.*
     // FROM player
     // JOIN team ON team.id = player.teamId AND 1
    -let association = Player.team.filter { db in true }
    +let association = Player.team.filter { db in true }
     var request = Player.including(required: association)
     
    @@ -1271,7 +1271,7 @@ the eventual set of already applied predicates.

    @@ -1293,7 +1293,7 @@ the eventual set of already applied predicates.

    Creates an association with the provided orderings promise.

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
    @@ -1301,7 +1301,7 @@ the eventual set of already applied predicates.

    // FROM player // JOIN team ON team.id = player.teamId // ORDER BY team.name -let association = Player.team.order { _ in [Column("name")] } +let association = Player.team.order { _ in [Column("name")] } var request = Player.including(required: association)
    @@ -1311,9 +1311,9 @@ the eventual set of already applied predicates.

    // JOIN team ON team.id = player.teamId // ORDER BY team.name let association = Player.team - .order{ _ in [Column("color")] } + .order{ _ in [Column("color")] } .reversed() - .order{ _ in [Column("name")] } + .order{ _ in [Column("name")] } var request = Player.including(required: association)
    @@ -1327,7 +1327,7 @@ the eventual set of already applied predicates.

    @@ -1349,7 +1349,7 @@ the eventual set of already applied predicates.

    Creates an association that reverses applied orderings.

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
    @@ -1357,7 +1357,7 @@ the eventual set of already applied predicates.

    // FROM player // JOIN team ON team.id = player.teamId // ORDER BY team.name DESC -let association = Player.team.order(Column("name")).reversed() +let association = Player.team.order(Column("name")).reversed() var request = Player.including(required: association)
    @@ -1379,7 +1379,7 @@ the eventual set of already applied predicates.

    @@ -1401,14 +1401,14 @@ the eventual set of already applied predicates.

    Creates an association without any ordering.

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
     // SELECT player.*, team.*
     // FROM player
     // JOIN team ON team.id = player.teamId
    -let association = Player.team.order(Column("name")).unordered()
    +let association = Player.team.order(Column("name")).unordered()
     var request = Player.including(required: association)
     
    @@ -1422,7 +1422,7 @@ the eventual set of already applied predicates.

    @@ -1448,17 +1448,17 @@ a specific database table.

    In the example below, the team.color = ‘red’ condition in the where clause could be not achieved without table aliases.

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
     // SELECT player.*, team.*
     // JOIN team ON ...
     // WHERE team.color = 'red'
    -let teamAlias = TableAlias()
    +let teamAlias = TableAlias()
     let request = Player
         .including(required: Player.team.aliased(teamAlias))
    -    .filter(teamAlias[Column("color")] == "red")
    +    .filter(teamAlias[Column("color")] == "red")
     

    When you give a name to a table alias, you can reliably inject sql @@ -1466,7 +1466,7 @@ snippets in your requests:

    // SELECT player.*, custom.*
     // JOIN team custom ON ...
     // WHERE custom.color = 'red'
    -let teamAlias = TableAlias(name: "custom")
    +let teamAlias = TableAlias(name: "custom")
     let request = Player
         .including(required: Player.team.aliased(teamAlias))
         .filter(sql: "custom.color = ?", arguments: ["red"])
    @@ -1482,7 +1482,7 @@ snippets in your requests:

    @@ -1492,7 +1492,7 @@ snippets in your requests:

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/AssociationToMany.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/AssociationToMany.html index 19c1a7c9f..bf8e541c9 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/AssociationToMany.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/AssociationToMany.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1054,7 +1054,7 @@ @@ -1092,7 +1092,7 @@ the association. For example:

    For example:

    -
    struct TeamInfo: FetchableRecord, Decodable {
    +
    struct TeamInfo: FetchableRecord, Decodable {
         var team: Team
         var playerCount: Int
     }
    @@ -1112,7 +1112,7 @@ the association. For example:

    @@ -1137,7 +1137,7 @@ the association. For example:

    It has a default name, which is hasNo[Key], where key is the key of the association. For example:

    -
    struct TeamInfo: FetchableRecord, Decodable {
    +
    struct TeamInfo: FetchableRecord, Decodable {
         var team: Team
         var hasNoPlayer: Bool
     }
    @@ -1159,7 +1159,7 @@ the association. For example:

    @@ -1188,14 +1188,14 @@ name which is average[Key][Column], where key is the key of the association. For example:

    For example:

    -
    struct TeamInfo: FetchableRecord, Decodable {
    +
    struct TeamInfo: FetchableRecord, Decodable {
         var team: Team
         var averagePlayerScore: Double
     }
    -let request = Team.annotated(with: Team.players.average(Column("score")))
    +let request = Team.annotated(with: Team.players.average(Column("score")))
     let infos: [TeamInfo] = try TeamInfo.fetchAll(db, request)
     
    -let teams: [Team] = try Team.having(Team.players.average(Column("score")) > 100).fetchAll(db)
    +let teams: [Team] = try Team.having(Team.players.average(Column("score")) > 100).fetchAll(db)
     
    @@ -1208,7 +1208,7 @@ association. For example:

    @@ -1237,14 +1237,14 @@ name which is maximum[Key][Column], where key is the key of the association. For example:

    For example:

    -
    struct TeamInfo: FetchableRecord, Decodable {
    +
    struct TeamInfo: FetchableRecord, Decodable {
         var team: Team
         var maxPlayerScore: Double
     }
    -let request = Team.annotated(with: Team.players.max(Column("score")))
    +let request = Team.annotated(with: Team.players.max(Column("score")))
     let infos: [TeamInfo] = try TeamInfo.fetchAll(db, request)
     
    -let teams: [Team] = try Team.having(Team.players.max(Column("score")) < 100).fetchAll(db)
    +let teams: [Team] = try Team.having(Team.players.max(Column("score")) < 100).fetchAll(db)
     
    @@ -1257,7 +1257,7 @@ association. For example:

    @@ -1286,14 +1286,14 @@ name which is minimum[Key][Column], where key is the key of the association. For example:

    For example:

    -
    struct TeamInfo: FetchableRecord, Decodable {
    +
    struct TeamInfo: FetchableRecord, Decodable {
         var team: Team
         var minPlayerScore: Double
     }
    -let request = Team.annotated(with: Team.players.min(Column("score")))
    +let request = Team.annotated(with: Team.players.min(Column("score")))
     let infos: [TeamInfo] = try TeamInfo.fetchAll(db, request)
     
    -let teams: [Team] = try Team.having(Team.players.min(Column("score")) > 100).fetchAll(db)
    +let teams: [Team] = try Team.having(Team.players.min(Column("score")) > 100).fetchAll(db)
     
    @@ -1306,7 +1306,7 @@ association. For example:

    @@ -1335,14 +1335,14 @@ name which is [key][Column]Sum, where key is the key of the association. For example:

    For example:

    -
    struct TeamInfo: FetchableRecord, Decodable {
    +
    struct TeamInfo: FetchableRecord, Decodable {
         var team: Team
         var playerScoreSum: Double
     }
    -let request = Team.annotated(with: Team.players.sum(Column("score")))
    +let request = Team.annotated(with: Team.players.sum(Column("score")))
     let infos: [TeamInfo] = try TeamInfo.fetchAll(db, request)
     
    -let teams: [Team] = try Team.having(Team.players.sum(Column("score")) > 100).fetchAll(db)
    +let teams: [Team] = try Team.having(Team.players.sum(Column("score")) > 100).fetchAll(db)
     
    @@ -1355,7 +1355,7 @@ association. For example:

    @@ -1365,7 +1365,7 @@ association. For example:

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/AssociationToOne.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/AssociationToOne.html index 486e5fe49..17808f4d0 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/AssociationToOne.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/AssociationToOne.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1054,7 +1054,7 @@ @@ -1064,7 +1064,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/ColumnExpression.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/ColumnExpression.html index e0e222ee7..c738d51dd 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/ColumnExpression.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/ColumnExpression.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1015,18 +1015,18 @@

    Adopt the ColumnExpression protocol when you define a column type.

    You can, for example, define a String-based column enum:

    -
    enum Columns: String, ColumnExpression {
    +
    enum Columns: String, ColumnExpression {
         case id, name, score
     }
     let arthur = try Player.filter(Columns.name == "Arthur").fetchOne(db)
     

    You can also define a genuine column type:

    -
    struct MyColumn: ColumnExpression {
    +
    struct MyColumn: ColumnExpression {
         var name: String
         var sqlType: String
     }
    -let nameColumn = MyColumn(name: "name", sqlType: "VARCHAR")
    +let nameColumn = MyColumn(name: "name", sqlType: "VARCHAR")
     let arthur = try Player.filter(nameColumn == "Arthur").fetchOne(db)
     
    @@ -1065,12 +1065,12 @@

    Declaration

    Swift

    -
    var name: String { get }
    +
    var name: String { get }
    @@ -1097,7 +1097,7 @@

    A matching SQL expression with the MATCH SQL operator.

    // content MATCH '...'
    -Column("content").match(pattern)
    +Column("content").match(pattern)
     

    If the search pattern is nil, SQLite will evaluate the expression @@ -1113,7 +1113,7 @@ to false.

    @@ -1123,7 +1123,7 @@ to false.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/Cursor.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/Cursor.html index f967a5161..dbb1224da 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/Cursor.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/Cursor.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1069,7 +1069,7 @@ to those defined by Swift’s Sequence protocol: contains, @@ -1100,7 +1100,7 @@ exists. Once nil has been returned, all subsequent calls return nil.

    @@ -1145,7 +1145,7 @@ an element.

    @@ -1205,7 +1205,7 @@ passed element represents a match.

    predicate; otherwise, false.

    @@ -1230,7 +1230,7 @@ predicate; otherwise, false.

    integer starting at zero, and x represents an element of the cursor.

    let cursor = try String.fetchCursor(db, sql: "SELECT 'foo' UNION ALL SELECT 'bar'")
     let c = cursor.enumerated()
    -while let (n, x) = c.next() {
    +while let (n, x) = c.next() {
         print("\(n): \(x)")
     }
     // Prints: "0: foo"
    @@ -1247,7 +1247,7 @@ integer starting at zero, and x represents an element of the cursor.

    @@ -1280,7 +1280,7 @@ integer starting at zero, and x represents an element of the cursor.

    @@ -1314,7 +1314,7 @@ predicate or nil if no such element is found.

    @@ -1349,7 +1349,7 @@ transform over this cursor.

    @@ -1405,7 +1405,7 @@ called again.

    @@ -1431,7 +1431,7 @@ elements.

    If the number of elements to drop exceeds the number of elements in the cursor, the result is an empty cursor.

    -
    let numbers = AnyCursor([1, 2, 3, 4, 5])
    +
    let numbers = AnyCursor([1, 2, 3, 4, 5])
     try print(numbers.dropFirst(2))
     // Prints "[3, 4, 5]"
     try print(numbers.dropFirst(10))
    @@ -1473,7 +1473,7 @@ the cursor. n must be greater than or equal to zero.

    elements.

    @@ -1497,7 +1497,7 @@ elements.

    Returns a cursor containing all but the first element of the cursor.

    The following example drops the first element from a cursor of integers.

    -
    let numbers = AnyCursor([1, 2, 3, 4, 5])
    +
    let numbers = AnyCursor([1, 2, 3, 4, 5])
     try print(numbers.dropFirst())
     // Prints "[2, 3, 4, 5]"
     
    @@ -1518,7 +1518,7 @@ elements.

    A cursor starting after the first element of the cursor.

    @@ -1544,7 +1544,7 @@ elements.

    The cursor must be finite. If the number of elements to drop exceeds the number of elements in the cursor, the result is an empty array.

    -
    let numbers = AnyCursor([1, 2, 3, 4, 5])
    +
    let numbers = AnyCursor([1, 2, 3, 4, 5])
     try print(numbers.dropLast(2))
     // Prints "[1, 2, 3]"
     try print(numbers.dropLast(10))
    @@ -1585,7 +1585,7 @@ cursor. n must be greater than or equal to zero.

    An array leaving off the specified number of elements.

    @@ -1609,7 +1609,7 @@ cursor. n must be greater than or equal to zero.

    Returns an array containing all but the last element of the cursor.

    The following example drops the last element from a cursor of integers.

    -
    let numbers = AnyCursor([1, 2, 3, 4, 5])
    +
    let numbers = AnyCursor([1, 2, 3, 4, 5])
     try print(numbers.dropLast())
     // Prints "[1, 2, 3, 4]"
     
    @@ -1630,7 +1630,7 @@ cursor. n must be greater than or equal to zero.

    An array leaving off the last element of the cursor.

    @@ -1666,7 +1666,7 @@ over self.

    @@ -1702,7 +1702,7 @@ over self.

    @@ -1735,7 +1735,7 @@ over self.

    @@ -1769,7 +1769,7 @@ this cursor’s elements.

    @@ -1829,7 +1829,7 @@ argument; otherwise, false.

    areInIncreasingOrder. If the cursor has no elements, returns nil.

    @@ -1889,7 +1889,7 @@ argument; otherwise, false.

    areInIncreasingOrder. If the cursor has no elements, returns nil.

    @@ -1915,7 +1915,7 @@ initial elements of the cursor.

    If the maximum length exceeds the number of elements in the cursor, the result contains all the elements in the cursor.

    -
    let numbers = AnyCursor([1, 2, 3, 4, 5])
    +
    let numbers = AnyCursor([1, 2, 3, 4, 5])
     try print(numbers.prefix(2))
     // Prints "[1, 2]"
     try print(numbers.prefix(10))
    @@ -1957,7 +1957,7 @@ value of maxLength must be greater than or equal to zero.

    with at most maxLength elements.

    @@ -2013,7 +2013,7 @@ called again.

    @@ -2050,7 +2050,7 @@ element of this cursor and an accumulating value.

    @@ -2087,7 +2087,7 @@ element of this cursor and an accumulating value.

    @@ -2114,7 +2114,7 @@ final elements of the cursor.

    The cursor must be finite. If the maximum length exceeds the number of elements in the cursor, the result contains all the elements in the cursor.

    -
    let numbers = AnyCursor([1, 2, 3, 4, 5])
    +
    let numbers = AnyCursor([1, 2, 3, 4, 5])
     try print(numbers.suffix(2))
     // Prints "[4, 5]"
     try print(numbers.suffix(10))
    @@ -2151,7 +2151,7 @@ value of maxLength must be greater than or equal to zero.

    @@ -2196,7 +2196,7 @@ given element.

    @@ -2267,7 +2267,7 @@ argument; otherwise, false.

    nil.

    @@ -2327,7 +2327,7 @@ argument; otherwise, false.

    nil.

    @@ -2371,7 +2371,7 @@ argument; otherwise, false.

    @@ -2415,7 +2415,7 @@ argument; otherwise, false.

    @@ -2459,7 +2459,7 @@ argument; otherwise, false.

    @@ -2469,7 +2469,7 @@ argument; otherwise, false.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseAggregate.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseAggregate.html index 23e890d6d..62782b73d 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseAggregate.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseAggregate.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1015,7 +1015,7 @@

    The protocol for custom SQLite aggregates.

    For example:

    -
    struct MySum : DatabaseAggregate {
    +
    struct MySum : DatabaseAggregate {
         var sum: Int = 0
     
         mutating func step(_ dbValues: [DatabaseValue]) {
    @@ -1024,15 +1024,15 @@
             }
         }
     
    -    func finalize() -> DatabaseValueConvertible? {
    +    func finalize() -> DatabaseValueConvertible? {
             return sum
         }
     }
     
    -let dbQueue = DatabaseQueue()
    -let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self)
    +let dbQueue = DatabaseQueue()
    +let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self)
     dbQueue.add(function: fn)
    -try dbQueue.write { db in
    +try dbQueue.write { db in
         try db.execute(sql: "CREATE TABLE test(i)")
         try db.execute(sql: "INSERT INTO test(i) VALUES (1)")
         try db.execute(sql: "INSERT INTO test(i) VALUES (2)")
    @@ -1069,7 +1069,7 @@
                             
                           
                           
                         
                       
    @@ -1110,7 +1110,7 @@ aggregate function.

    @@ -1140,7 +1140,7 @@ aggregate function.

    @@ -1150,7 +1150,7 @@ aggregate function.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseReader.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseReader.html index 984616ead..588a8fe0f 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseReader.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseReader.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1052,12 +1052,12 @@ connections, protect yourself with transactions, and be ready to setup a

    Declaration

    Swift

    -
    var configuration: Configuration { get }
    +
    var configuration: Configuration { get }
    @@ -1091,14 +1091,14 @@ connection, and returns its result.

    Guarantee 1: the block argument is isolated. Eventual concurrent database updates are not visible inside the block:

    -
    try reader.read { db in
    +
    try reader.read { db in
         // Those two values are guaranteed to be equal, even if the
         // `player` table is modified between the two requests:
         let count1 = try Player.fetchCount(db)
         let count2 = try Player.fetchCount(db)
     }
     
    -try reader.read { db in
    +try reader.read { db in
         // Now this value may be different:
         let count = try Player.fetchCount(db)
     }
    @@ -1143,7 +1143,7 @@ happen while establishing the read access to the database.
                             
                           
                           
                         
                       
    @@ -1166,14 +1166,14 @@ database connection.

    Guarantee 1: the block argument is isolated. Eventual concurrent database updates are not visible inside the block:

    -
    try reader.asyncRead { result in
    +
    try reader.asyncRead { result in
         do (
             let db = try result.get()
             // Those two values are guaranteed to be equal, even if the
             // `player` table is modified between the two requests:
             let count1 = try Player.fetchCount(db)
             let count2 = try Player.fetchCount(db)
    -    } catch {
    +    } catch {
             // handle error
         }
     }
    @@ -1212,7 +1212,7 @@ whose resultCode is SQLITE_READONLY.

    @@ -1237,7 +1237,7 @@ connection, and returns its result.

    The block argument is not isolated: eventual concurrent database updates are visible inside the block:

    -
    try reader.unsafeRead { db in
    +
    try reader.unsafeRead { db in
         // Those two values may be different because some other thread
         // may have inserted or deleted a player between the two requests:
         let count1 = try Player.fetchCount(db)
    @@ -1246,7 +1246,7 @@ are visible inside the block:

    Cursor iterations are isolated, though:

    -
    try reader.unsafeRead { db in
    +
    try reader.unsafeRead { db in
         // No concurrent update can mess with this iteration:
         let rows = try Row.fetchCursor(db, sql: "SELECT ...")
         while let row = try rows.next() { ... }
    @@ -1291,7 +1291,7 @@ happen while establishing the read access to the database.
                             
                           
                           
                         
                       
    @@ -1316,7 +1316,7 @@ returns its result.

    The block argument is not isolated: eventual concurrent database updates are visible inside the block:

    -
    try reader.unsafeReentrantRead { db in
    +
    try reader.unsafeReentrantRead { db in
         // Those two values may be different because some other thread
         // may have inserted or deleted a player between the two requests:
         let count1 = try Player.fetchCount(db)
    @@ -1325,7 +1325,7 @@ are visible inside the block:

    Cursor iterations are isolated, though:

    -
    try reader.unsafeReentrantRead { db in
    +
    try reader.unsafeReentrantRead { db in
         // No concurrent update can mess with this iteration:
         let rows = try Row.fetchCursor(db, sql: "SELECT ...")
         while let row = try rows.next() { ... }
    @@ -1373,7 +1373,7 @@ dangerous concurrency practices.

    @@ -1403,14 +1403,14 @@ dangerous concurrency practices.

    Add or redefine an SQL function.

    -
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    -    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
    +
    let fn = DatabaseFunction("succ", argumentCount: 1) { dbValues in
    +    guard let int = Int.fromDatabaseValue(dbValues[0]) else {
             return nil
         }
         return int + 1
     }
     reader.add(function: fn)
    -try reader.read { db in
    +try reader.read { db in
         try Int.fetchOne(db, sql: "SELECT succ(1)")! // 2
     }
     
    @@ -1425,7 +1425,7 @@ dangerous concurrency practices.

    @@ -1455,7 +1455,7 @@ dangerous concurrency practices.

    @@ -1485,7 +1485,7 @@ dangerous concurrency practices.

    Add or redefine a collation.

    -
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
    +
    let collation = DatabaseCollation("localized_standard") { (string1, string2) in
         return (string1 as NSString).localizedStandardCompare(string2)
     }
     reader.add(collation: collation)
    @@ -1502,7 +1502,7 @@ dangerous concurrency practices.

    @@ -1532,7 +1532,7 @@ dangerous concurrency practices.

    @@ -1624,7 +1624,7 @@ during observation

    a TransactionObserver

    @@ -1654,7 +1654,7 @@ during observation

    @@ -1705,7 +1705,7 @@ but they won’t trigger any error.

    @@ -1715,7 +1715,7 @@ but they won’t trigger any error.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseRegionConvertible.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseRegionConvertible.html index 3d01431bd..515e751a3 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseRegionConvertible.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseRegionConvertible.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1062,7 +1062,7 @@ @@ -1072,7 +1072,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseValueConvertible.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseValueConvertible.html index ce8caf5d3..99da08718 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseValueConvertible.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseValueConvertible.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1061,12 +1061,12 @@ arrays, or single values:

    Declaration

    Swift

    -
    var databaseValue: DatabaseValue { get }
    +
    var databaseValue: DatabaseValue { get }
    @@ -1099,12 +1099,12 @@ arrays, or single values:

    Declaration

    Swift

    -
    static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    +
    static func fromDatabaseValue(_ dbValue: DatabaseValue) -> `Self`?
    @@ -1215,7 +1215,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -1307,7 +1307,7 @@ elements are undefined.

    An array.

    @@ -1402,7 +1402,7 @@ extracted from the first row.

    An optional value.

    @@ -1459,7 +1459,7 @@ elements are undefined.

    public static func fetchCursor(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> DatabaseValueCursor<Self>
    @@ -1525,7 +1525,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -1563,7 +1563,7 @@ elements are undefined.

    public static func fetchAll(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> [Self]
    @@ -1629,7 +1629,7 @@ elements are undefined.

    An array.

    @@ -1670,7 +1670,7 @@ extracted from the first row.

    public static func fetchOne(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> Self?
    @@ -1736,7 +1736,7 @@ extracted from the first row.

    An optional value.

    @@ -1769,7 +1769,7 @@ extracted from the first row.

    Returns a cursor over values fetched from a fetch request.

    -
    let request = Player.select(Column("name"))
    +
    let request = Player.select(Column("name"))
     let names = try String.fetchCursor(db, request) // Cursor of String
     while let name = try name.next() { // String
         ...
    @@ -1831,7 +1831,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -1853,7 +1853,7 @@ elements are undefined.

    Returns an array of values fetched from a fetch request.

    -
    let request = Player.select(Column("name"))
    +
    let request = Player.select(Column("name"))
     let names = try String.fetchAll(db, request) // [String]
     
    @@ -1907,7 +1907,7 @@ elements are undefined.

    An array.

    @@ -1932,7 +1932,7 @@ elements are undefined.

    The result is nil if the query returns no row, or if no value can be extracted from the first row.

    -
    let request = Player.filter(key: 1).select(Column("name"))
    +
    let request = Player.filter(key: 1).select(Column("name"))
     let name = try String.fetchOne(db, request) // String?
     
    @@ -1986,7 +1986,7 @@ extracted from the first row.

    An optional value.

    @@ -2097,7 +2097,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -2189,7 +2189,7 @@ elements are undefined.

    An array of values.

    @@ -2281,7 +2281,7 @@ elements are undefined.

    An optional value.

    @@ -2338,7 +2338,7 @@ elements are undefined.

    public static func fetchCursor(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> FastDatabaseValueCursor<Self>
    @@ -2404,7 +2404,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -2442,7 +2442,7 @@ elements are undefined.

    public static func fetchAll(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> [Self]
    @@ -2508,7 +2508,7 @@ elements are undefined.

    An array of values.

    @@ -2546,7 +2546,7 @@ elements are undefined.

    public static func fetchOne(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> Self?
    @@ -2612,7 +2612,7 @@ elements are undefined.

    An optional value.

    @@ -2645,7 +2645,7 @@ elements are undefined.

    Returns a cursor over values fetched from a fetch request.

    -
    let request = Player.select(Column("name"))
    +
    let request = Player.select(Column("name"))
     let names = try String.fetchCursor(db, request) // Cursor of String
     while let name = try names.next() { // String
         ...
    @@ -2708,7 +2708,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -2730,7 +2730,7 @@ elements are undefined.

    Returns an array of values fetched from a fetch request.

    -
    let request = Player.select(Column("name"))
    +
    let request = Player.select(Column("name"))
     let names = try String.fetchAll(db, request) // [String]
     
    @@ -2784,7 +2784,7 @@ elements are undefined.

    An array of values.

    @@ -2806,7 +2806,7 @@ elements are undefined.

    Returns a single value fetched from a fetch request.

    -
    let request = Player.filter(key: 1).select(Column("name"))
    +
    let request = Player.filter(key: 1).select(Column("name"))
     let name = try String.fetchOne(db, request) // String?
     
    @@ -2860,7 +2860,7 @@ elements are undefined.

    An optional value.

    @@ -2870,7 +2870,7 @@ elements are undefined.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseWriter.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseWriter.html index f6a465690..34361415c 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseWriter.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/DatabaseWriter.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1127,7 +1127,7 @@ wrapping transaction. @@ -1190,7 +1190,7 @@ in a transaction.

    @@ -1303,7 +1303,7 @@ transaction error.

    @@ -1337,7 +1337,7 @@ in a transaction.

    @@ -1377,7 +1377,7 @@ dangerous concurrency practices.

    @@ -1420,17 +1420,17 @@ returned future, on any dispatch queue.

    In the example below, the number of players is fetched concurrently with the player insertion. Yet the future is guaranteed to return zero:

    -
    try writer.writeWithoutTransaction { db in
    +
    try writer.writeWithoutTransaction { db in
         // Delete all players
         try Player.deleteAll()
     
         // Count players concurrently
    -    let future = writer.concurrentRead { db in
    +    let future = writer.concurrentRead { db in
             return try Player.fetchCount()
         }
     
         // Insert a player
    -    try Player(...).insert(db)
    +    try Player(...).insert(db)
     
         // Guaranteed to be zero
         let count = try future.wait()
    @@ -1447,7 +1447,7 @@ the player insertion. Yet the future is guaranteed to return zero:

    @@ -1529,7 +1529,7 @@ is deallocated).

    @@ -1579,7 +1579,7 @@ execution of this method. @@ -1626,7 +1626,7 @@ disk space.

    @@ -1636,7 +1636,7 @@ disk space.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/EncodableRecord.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/EncodableRecord.html index e58a311a1..4fddf5564 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/EncodableRecord.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/EncodableRecord.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1040,7 +1040,7 @@ the columns of the database table (see databaseTableName()).

    Primary key columns, if any, must be included.

    -
    struct Player: EncodableRecord {
    +
    struct Player: EncodableRecord {
         var id: Int64?
         var name: String?
     
    @@ -1069,7 +1069,7 @@ is considered undefined behavior.

    @@ -1107,26 +1107,26 @@ into database rows.

    For example:

    // A key that holds a encoder's name
    -let encoderName = CodingUserInfoKey(rawValue: "encoderName")!
    +let encoderName = CodingUserInfoKey(rawValue: "encoderName")!
     
    -struct Player: PersistableRecord, Encodable {
    +struct Player: PersistableRecord, Encodable {
         // Customize the encoder name when encoding a database row
         static let databaseEncodingUserInfo: [CodingUserInfoKey: Any] = [encoderName: "Database"]
     
    -    func encode(to encoder: Encoder) throws {
    +    func encode(to encoder: Encoder) throws {
             // Print the encoder name
             print(encoder.userInfo[encoderName])
             ...
         }
     }
     
    -let player = Player(...)
    +let player = Player(...)
     
     // prints "Database"
     try player.insert(db)
     
     // prints "JSON"
    -let encoder = JSONEncoder()
    +let encoder = JSONEncoder()
     encoder.userInfo = [encoderName: "JSON"]
     let data = try encoder.encode(player)
     
    @@ -1145,7 +1145,7 @@ into database rows.

    @@ -1181,17 +1181,17 @@ following properties:

    You can override those defaults:

    -
    struct Achievement: Encodable {
    +
    struct Achievement: Encodable {
         var name: String
         var date: Date
     }
     
    -struct Player: Encodable, PersistableRecord {
    +struct Player: Encodable, PersistableRecord {
         // stored in a JSON column
         var achievements: [Achievement]
     
    -    static func databaseJSONEncoder(for column: String) -> JSONEncoder {
    -        let encoder = JSONEncoder()
    +    static func databaseJSONEncoder(for column: String) -> JSONEncoder {
    +        let encoder = JSONEncoder()
             encoder.dateEncodingStrategy = .iso8601
             return encoder
         }
    @@ -1212,7 +1212,7 @@ following properties:

    @@ -1239,7 +1239,7 @@ protocol, this property controls the encoding of date properties.

    Default value is .deferredToDate

    For example:

    -
    struct Player: PersistableRecord, Encodable {
    +
    struct Player: PersistableRecord, Encodable {
         static let databaseDateEncodingStrategy: DatabaseDateEncodingStrategy = .timeIntervalSince1970
     
         var name: String
    @@ -1256,12 +1256,12 @@ protocol, this property controls the encoding of date properties.

    Declaration

    Swift

    -
    static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
    +
    static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
    @@ -1288,7 +1288,7 @@ protocol, this property controls the encoding of UUID properties.

    Default value is .deferredToUUID

    For example:

    -
    struct Player: PersistableProtocol, Encodable {
    +
    struct Player: PersistableProtocol, Encodable {
         static let databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy = .string
     
         // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
    @@ -1305,12 +1305,12 @@ protocol, this property controls the encoding of UUID properties.

    Declaration

    Swift

    -
    static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
    +
    static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
    @@ -1347,7 +1347,7 @@ protocol, this property controls the encoding of UUID properties.

    @@ -1392,7 +1392,7 @@ have the same database representation.

    @@ -1432,7 +1432,7 @@ defined by the receiver record are considered.

    @@ -1442,7 +1442,7 @@ defined by the receiver record are considered.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5CustomTokenizer.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5CustomTokenizer.html index e37485238..a2a7aaeb4 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5CustomTokenizer.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5CustomTokenizer.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1080,9 +1080,9 @@ be ["arg1", "arg2"].

    Creates an FTS5 tokenizer descriptor.

    -
    class MyTokenizer : FTS5CustomTokenizer { ... }
    +
    class MyTokenizer : FTS5CustomTokenizer { ... }
     
    -db.create(virtualTable: "book", using: FTS5()) { t in
    +db.create(virtualTable: "book", using: FTS5()) { t in
         let tokenizer = MyTokenizer.tokenizerDescriptor(arguments: ["unicode61", "remove_diacritics", "0"])
         t.tokenizer = tokenizer
     }
    @@ -1097,7 +1097,7 @@ be ["arg1", "arg2"].

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5Tokenizer.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5Tokenizer.html index 06e30ca67..d56d15f84 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5Tokenizer.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5Tokenizer.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1039,7 +1039,7 @@ notifies found tokens to the tokenCallback function.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5WrapperTokenizer.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5WrapperTokenizer.html index af7bf2da3..388f1e9bf 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5WrapperTokenizer.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FTS5WrapperTokenizer.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1015,11 +1015,11 @@ low-level FTS5Tokenizer.tokenize(context:flags:pText:nText:tokenCallback:).

    Here is the implementation for a trivial tokenizer that wraps the built-in ascii tokenizer without any custom processing:

    -
    class TrivialAsciiTokenizer : FTS5WrapperTokenizer {
    +
    class TrivialAsciiTokenizer : FTS5WrapperTokenizer {
         static let name = "trivial"
         let wrappedTokenizer: FTS5Tokenizer
     
    -    init(db: Database, arguments: [String]) throws {
    +    init(db: Database, arguments: [String]) throws {
             wrappedTokenizer = try db.makeTokenizer(.ascii())
         }
     
    @@ -1028,7 +1028,7 @@ built-in ascii tokenizer without any custom processing:

    flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) - throws + throws { try tokenCallback(token, flags) } @@ -1080,7 +1080,7 @@ tokens to the tokenCallback function.

    flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) - throws + throws { // pass through: try tokenCallback(token, flags) @@ -1133,7 +1133,7 @@ tokenizer produces synonyms (see diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FetchRequest.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FetchRequest.html index e823d7894..966de27b1 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FetchRequest.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FetchRequest.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1014,7 +1014,7 @@

    The protocol for all requests that fetch database rows, and tell how those rows should be interpreted.

    -
    struct Player: FetchableRecord { ... }
    +
    struct Player: FetchableRecord { ... }
     let request: ... // Some FetchRequest that fetches Player
     try request.fetchCursor(db) // Cursor of Player
     try request.fetchAll(db)    // [Player]
    @@ -1050,7 +1050,7 @@ rows should be interpreted.

    @@ -1121,7 +1121,7 @@ prepared statement.

    A prepared statement and an eventual row adapter.

    @@ -1188,7 +1188,7 @@ prepared statement.

    A prepared request.

    @@ -1255,7 +1255,7 @@ statement returned by the prepare method: SELECT COUNT(*) FRO @@ -1338,7 +1338,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -1402,7 +1402,7 @@ elements are undefined.

    An array of values.

    @@ -1469,7 +1469,7 @@ extracted from the first row.

    An optional value.

    @@ -1552,7 +1552,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -1616,7 +1616,7 @@ elements are undefined.

    An array of values.

    @@ -1660,7 +1660,7 @@ elements are undefined.

    @@ -1715,7 +1715,7 @@ returned by the prepare method.

    @@ -1807,7 +1807,7 @@ elements are undefined.

    A cursor over fetched rows.

    @@ -1871,7 +1871,7 @@ elements are undefined.

    An array of fetched rows.

    @@ -1935,7 +1935,7 @@ elements are undefined.

    An optional row.

    @@ -2018,7 +2018,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -2082,7 +2082,7 @@ elements are undefined.

    An array of values.

    @@ -2149,7 +2149,7 @@ extracted from the first row.

    An optional value.

    @@ -2232,7 +2232,7 @@ elements are undefined.

    A cursor over fetched values.

    @@ -2296,7 +2296,7 @@ elements are undefined.

    An array of values.

    @@ -2379,7 +2379,7 @@ elements are undefined.

    A cursor over fetched records.

    @@ -2443,7 +2443,7 @@ elements are undefined.

    An array of records.

    @@ -2507,7 +2507,7 @@ elements are undefined.

    An optional record.

    @@ -2577,7 +2577,7 @@ main queue.

    a ValueObservation.

    @@ -2614,7 +2614,7 @@ fresh values whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(Column("name"), as: String.self)
    +
    let request = Player.select(Column("name"), as: String.self)
     let observation = request.observationForAll()
     
     let observer = try observation.start(in: dbQueue) { names: [String] in
    @@ -2647,7 +2647,7 @@ main queue.
                             

    a ValueObservation.

    @@ -2672,7 +2672,7 @@ main queue. fresh value whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(max(Column("score")), as: Int.self)
    +
    let request = Player.select(max(Column("score")), as: Int.self)
     let observation = request.observationForFirst()
     
     let observer = try observation.start(in: dbQueue) { maxScore: Int? in
    @@ -2724,7 +2724,7 @@ main queue.
                             

    a ValueObservation.

    @@ -2761,7 +2761,7 @@ fresh values whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(Column("name"), as: Optional<String>.self)
    +
    let request = Player.select(Column("name"), as: Optional<String>.self)
     let observation = request.observationForAll()
     
     let observer = try observation.start(in: dbQueue) { names: [String?] in
    @@ -2794,7 +2794,7 @@ main queue.
                             

    a ValueObservation.

    @@ -2820,7 +2820,7 @@ fresh values whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(Column("name"), as: Optional<String>.self)
    +
    let request = Player.select(Column("name"), as: Optional<String>.self)
     let observation = request.observationForAll()
     
     let observer = try observation.start(in: dbQueue) { names: [String?] in
    @@ -2853,7 +2853,7 @@ main queue.
                             

    a ValueObservation.

    @@ -2923,7 +2923,7 @@ main queue.

    a ValueObservation.

    @@ -2981,7 +2981,7 @@ main queue.

    a ValueObservation.

    @@ -3050,7 +3050,7 @@ main queue.

    a ValueObservation.

    @@ -3108,7 +3108,7 @@ main queue.

    a ValueObservation.

    @@ -3118,7 +3118,7 @@ main queue. diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FetchableRecord.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FetchableRecord.html index e3da72bfa..2fad4a1c8 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FetchableRecord.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/FetchableRecord.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1014,7 +1014,7 @@

    Types that adopt FetchableRecord can be initialized from a database Row.

    let row = try Row.fetchOne(db, sql: "SELECT ...")!
    -let player = Player(row)
    +let player = Player(row)
     

    The protocol comes with built-in methods that allow to fetch cursors, @@ -1078,7 +1078,7 @@ make sure to store a copy: self.row = row.copy().

    @@ -1116,14 +1116,14 @@ from database rows.

    For example:

    // A key that holds a decoder's name
    -let decoderName = CodingUserInfoKey(rawValue: "decoderName")!
    +let decoderName = CodingUserInfoKey(rawValue: "decoderName")!
     
     // A FetchableRecord + Decodable record
    -struct Player: FetchableRecord, Decodable {
    +struct Player: FetchableRecord, Decodable {
         // Customize the decoder name when decoding a database row
         static let databaseDecodingUserInfo: [CodingUserInfoKey: Any] = [decoderName: "Database"]
     
    -    init(from decoder: Decoder) throws {
    +    init(from decoder: Decoder) throws {
             // Print the decoder name
             print(decoder.userInfo[decoderName])
             ...
    @@ -1134,7 +1134,7 @@ from database rows.

    let player = try Player.fetchOne(db, ...) // prints "JSON" -let decoder = JSONDecoder() +let decoder = JSONDecoder() decoder.userInfo = [decoderName: "JSON"] let player = try decoder.decode(Player.self, from: ...)
    @@ -1153,7 +1153,7 @@ from database rows.

    @@ -1188,17 +1188,17 @@ following properties:

    You can override those defaults:

    -
    struct Achievement: Decodable {
    +
    struct Achievement: Decodable {
         var name: String
         var date: Date
     }
     
    -struct Player: Decodable, FetchableRecord {
    +struct Player: Decodable, FetchableRecord {
         // stored in a JSON column
         var achievements: [Achievement]
     
    -    static func databaseJSONDecoder(for column: String) -> JSONDecoder {
    -        let decoder = JSONDecoder()
    +    static func databaseJSONDecoder(for column: String) -> JSONDecoder {
    +        let decoder = JSONDecoder()
             decoder.dateDecodingStrategy = .iso8601
             return decoder
         }
    @@ -1226,7 +1226,7 @@ following properties:

    @@ -1253,7 +1253,7 @@ protocol, this property controls the decoding of date properties.

    Default value is .deferredToDate

    For example:

    -
    struct Player: FetchableRecord, Decodable {
    +
    struct Player: FetchableRecord, Decodable {
         static let databaseDateDecodingStrategy: DatabaseDateDecodingStrategy = .timeIntervalSince1970
     
         var name: String
    @@ -1270,12 +1270,12 @@ protocol, this property controls the decoding of date properties.

    Declaration

    Swift

    -
    static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
    +
    static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
    @@ -1364,7 +1364,7 @@ for individual requests with the TableRecord.select method.

    A cursor over fetched records.

    @@ -1428,7 +1428,7 @@ for individual requests with the TableRecord.select method.

    @@ -1492,7 +1492,7 @@ for individual requests with the TableRecord.select method.

    @@ -1585,7 +1585,7 @@ for individual requests with the TableRecord.select method.

    A cursor over fetched records.

    @@ -1664,7 +1664,7 @@ for individual requests with the TableRecord.select method.

    An array of records.

    @@ -1741,7 +1741,7 @@ for individual requests with the TableRecord.select method.

    An optional record.

    @@ -1837,7 +1837,7 @@ for individual requests with the TableRecord.select method.

    A cursor over fetched records.

    @@ -1918,7 +1918,7 @@ for individual requests with the TableRecord.select method.

    An array of records.

    @@ -1994,7 +1994,7 @@ any key with a unique index on it).

    An optional record.

    @@ -2105,7 +2105,7 @@ elements are undefined.

    A cursor over fetched records.

    @@ -2197,7 +2197,7 @@ elements are undefined.

    An array of records.

    @@ -2289,7 +2289,7 @@ elements are undefined.

    An optional record.

    @@ -2346,7 +2346,7 @@ elements are undefined.

    public static func fetchCursor(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> RecordCursor<Self>
    @@ -2412,7 +2412,7 @@ elements are undefined.

    A cursor over fetched records.

    @@ -2450,7 +2450,7 @@ elements are undefined.

    public static func fetchAll(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> [Self]
    @@ -2516,7 +2516,7 @@ elements are undefined.

    An array of records.

    @@ -2554,7 +2554,7 @@ elements are undefined.

    public static func fetchOne(
         _ db: Database,
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil)
         throws -> Self?
    @@ -2620,7 +2620,7 @@ elements are undefined.

    An optional record.

    @@ -2715,7 +2715,7 @@ elements are undefined.

    A cursor over fetched records.

    @@ -2791,7 +2791,7 @@ elements are undefined.

    An array of records.

    @@ -2867,7 +2867,7 @@ elements are undefined.

    An optional record.

    @@ -2877,7 +2877,7 @@ elements are undefined.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/MutablePersistableRecord.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/MutablePersistableRecord.html index 297058b0f..d09b647dc 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/MutablePersistableRecord.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/MutablePersistableRecord.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1060,12 +1060,12 @@ updates, which has GRDB generate regular INSERT and UPDATE queries.

    Declaration

    Swift

    -
    static var persistenceConflictPolicy: PersistenceConflictPolicy { get }
    +
    static var persistenceConflictPolicy: PersistenceConflictPolicy { get }
    @@ -1093,7 +1093,7 @@ dispatch queue, with the inserted RowID and the eventual INTEGER PRIMARY KEY column name.

    This method is optional: the default implementation does nothing.

    -
    struct Player : MutablePersistableRecord {
    +
    struct Player : MutablePersistableRecord {
         var id: Int64?
         var name: String?
     
    @@ -1151,7 +1151,7 @@ INTEGER PRIMARY KEY column name.

    @@ -1238,7 +1238,7 @@ that they invoke the performInsert() method.

    @@ -1345,7 +1345,7 @@ match any row in the database. @@ -1425,7 +1425,7 @@ the database.

    @@ -1499,7 +1499,7 @@ that they invoke the performDelete() method.

    Whether a database row was deleted.

    @@ -1574,7 +1574,7 @@ the database.

    Whether the primary key matches a row in the database.

    @@ -1644,7 +1644,7 @@ match any row in the database. @@ -1739,7 +1739,7 @@ match any row in the database and record could not be updated.

    Whether the record had changes.

    @@ -1830,7 +1830,7 @@ match any row in the database and record could not be updated.

    Whether the record had changes.

    @@ -1881,7 +1881,7 @@ implementation of performInsert().

    @@ -1959,7 +1959,7 @@ match any row in the database. @@ -2001,7 +2001,7 @@ implementation of performSave().

    @@ -2041,7 +2041,7 @@ implementation of performDelete().

    @@ -2081,7 +2081,7 @@ implementation of performExists().

    @@ -2183,7 +2183,7 @@ match any row in the database and record could not be updated.

    Whether the record had changes.

    @@ -2256,7 +2256,7 @@ match any row in the database and record could not be updated.

    The number of deleted rows

    @@ -2351,7 +2351,7 @@ deleted rows.

    The number of deleted rows

    @@ -2435,7 +2435,7 @@ database row was deleted.

    Whether a database row was deleted.

    @@ -2518,7 +2518,7 @@ any key with a unique index on it); returns the number of deleted rows.

    The number of deleted rows

    @@ -2590,7 +2590,7 @@ with a unique index on it); returns whether a database row was deleted.

    Whether a database row was deleted.

    @@ -2600,7 +2600,7 @@ with a unique index on it); returns whether a database row was deleted.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/PersistableRecord.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/PersistableRecord.html index 10e3f1467..6f3e4e231 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/PersistableRecord.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/PersistableRecord.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1098,7 +1098,7 @@ MutablePersistableRecord protocol instead.

    @@ -1174,7 +1174,7 @@ that they invoke the performInsert() method.

    @@ -1254,7 +1254,7 @@ the database.

    @@ -1305,7 +1305,7 @@ implementation of performInsert().

    @@ -1347,7 +1347,7 @@ implementation of performSave().

    @@ -1357,7 +1357,7 @@ implementation of performSave().

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/RowAdapter.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/RowAdapter.html index 6ab9ec28b..4b381b8df 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/RowAdapter.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/RowAdapter.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1025,7 +1025,7 @@ together.

    To use a row adapter, provide it to any method that fetches:

    -
    let adapter = SuffixRowAdapter(fromIndex: 2)
    +
    let adapter = SuffixRowAdapter(fromIndex: 2)
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
     
     // [baz:3]
    @@ -1061,14 +1061,14 @@ LayoutedColumnMapping.

    // An adapter that turns any row to a row that contains a single
     // column named "foo" whose value is the leftmost value of the
     // base row.
    -struct FirstColumnAdapter : RowAdapter {
    -    func layoutedAdapter(from layout: RowLayout) throws -> LayoutedRowAdapter {
    -        return LayoutedColumnMapping(layoutColumns: [(0, "foo")])
    +struct FirstColumnAdapter : RowAdapter {
    +    func layoutedAdapter(from layout: RowLayout) throws -> LayoutedRowAdapter {
    +        return LayoutedColumnMapping(layoutColumns: [(0, "foo")])
         }
     }
     
     // [foo:1]
    -try Row.fetchOne(db, sql: "SELECT 1, 2, 3", adapter: FirstColumnAdapter())
    +try Row.fetchOne(db, sql: "SELECT 1, 2, 3", adapter: FirstColumnAdapter())
     
    @@ -1081,7 +1081,7 @@ LayoutedColumnMapping.

    @@ -1141,7 +1141,7 @@ row adapters.

    @@ -1151,7 +1151,7 @@ row adapters.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/StatementColumnConvertible.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/StatementColumnConvertible.html index 3f7d149c1..d12591196 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/StatementColumnConvertible.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/StatementColumnConvertible.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1025,7 +1025,7 @@ optimization whenever direct access to SQLite is possible:

    let int: Int = row[0] // there } let ints = Int.fetchAll(db, sql: "SELECT ...") // there -struct Player { +struct Player { init(row: Row) { name = row["name"] // there score = row["score"] // there @@ -1056,7 +1056,7 @@ Float, Double, String, and Bool.

    Initializes a value from a raw SQLite statement pointer.

    For example, here is the how Int64 adopts StatementColumnConvertible:

    -
    extension Int64: StatementColumnConvertible {
    +
    extension Int64: StatementColumnConvertible {
         init(sqliteStatement: SQLiteStatement, index: Int32) {
             self = sqlite3_column_int64(sqliteStatement, index)
         }
    @@ -1109,7 +1109,7 @@ any extra check.

    @@ -1119,7 +1119,7 @@ any extra check.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/TableRecord.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/TableRecord.html index 84fb6da23..dfa85d289 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/TableRecord.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/TableRecord.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1044,7 +1044,7 @@ built-in methods that allow to fetch instances identified by key:

    The name of the database table used to build requests.

    -
    struct Player : TableRecord {
    +
    struct Player : TableRecord {
         static var databaseTableName = "player"
     }
     
    @@ -1070,12 +1070,12 @@ built-in methods that allow to fetch instances identified by key:

    Declaration

    Swift

    -
    static var databaseTableName: String { get }
    +
    static var databaseTableName: String { get }
    @@ -1105,9 +1105,9 @@ built-in methods that allow to fetch instances identified by key:

    You can provide a custom implementation and provide an explicit list of columns:

    -
    struct RestrictedPlayer : TableRecord {
    +
    struct RestrictedPlayer : TableRecord {
         static var databaseTableName = "player"
    -    static var databaseSelection = [Column("id"), Column("name")]
    +    static var databaseSelection = [Column("id"), Column("name")]
     }
     
     // SELECT id, name FROM player
    @@ -1115,9 +1115,9 @@ of columns:

    You can also add extra columns such as the rowid column:

    -
    struct ExtendedPlayer : TableRecord {
    +
    struct ExtendedPlayer : TableRecord {
         static var databaseTableName = "player"
    -    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
    +    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
     }
     
     // SELECT *, rowid FROM player
    @@ -1139,7 +1139,7 @@ of columns:

    @@ -1193,7 +1193,7 @@ for individual requests with the TableRecord.select method.

    @@ -1220,8 +1220,8 @@ for individual requests with the TableRecord.select method.

    Creates a Belongs To association between Self and the destination type.

    -
    struct Author: TableRecord { ... }
    -struct Book: TableRecord {
    +
    struct Author: TableRecord { ... }
    +struct Book: TableRecord {
         static let author = belongsTo(Author.self)
     }
     
    @@ -1234,22 +1234,22 @@ and the destination type:

    To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

    -
    struct BookInfo: FetchableRecord, Decodable {
    +
    struct BookInfo: FetchableRecord, Decodable {
         var book: Book
         var author: Author?
     }
     
    -let bookInfos = try dbQueue.read { db in
    +let bookInfos = try dbQueue.read { db in
         return try BookInfo.fetchAll(db, request)
     }
    -for bookInfo in bookInfos {
    +for bookInfo in bookInfos {
         print("\(bookInfo.book.title) by \(bookInfo.author.name)")
     }
     

    It is recommended that you define, alongside the static association, a property with the same name:

    -
    struct Book: TableRecord, EncodableRecord {
    +
    struct Book: TableRecord, EncodableRecord {
         static let author = belongsTo(Author.self)
         var author: QueryInterfaceRequest<Author> {
             return request(for: Book.author)
    @@ -1259,7 +1259,7 @@ property with the same name:

    This property will let you navigate from the source type to the destination type:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let book: Book = ...
         let author = try book.author.fetchOne(db) // Author?
     }
    @@ -1327,7 +1327,7 @@ foreign keys to the destination table.

    @@ -1350,8 +1350,8 @@ foreign keys to the destination table.

    Creates a Has many association between Self and the destination type.

    -
    struct Book: TableRecord { ... }
    -struct Author: TableRecord {
    +
    struct Book: TableRecord { ... }
    +struct Author: TableRecord {
         static let books = hasMany(Book.self)
     }
     
    @@ -1364,22 +1364,22 @@ and the destination type:

    To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

    -
    struct Authorship: FetchableRecord, Decodable {
    +
    struct Authorship: FetchableRecord, Decodable {
         var author: Author
         var book: Book
     }
     
    -let authorships = try dbQueue.read { db in
    +let authorships = try dbQueue.read { db in
         return try Authorship.fetchAll(db, request)
     }
    -for authorship in authorships {
    +for authorship in authorships {
         print("\(authorship.author.name) wrote \(authorship.book.title)")
     }
     

    It is recommended that you define, alongside the static association, a property with the same name:

    -
    struct Author: TableRecord, EncodableRecord {
    +
    struct Author: TableRecord, EncodableRecord {
         static let books = hasMany(Book.self)
         var books: QueryInterfaceRequest<Book> {
             return request(for: Author.books)
    @@ -1389,7 +1389,7 @@ property with the same name:

    This property will let you navigate from the source type to the destination type:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let author: Author = ...
         let books = try author.books.fetchAll(db) // [Book]
     }
    @@ -1457,7 +1457,7 @@ foreign keys from the destination table.

    @@ -1480,16 +1480,16 @@ foreign keys from the destination table.

    Creates a Has Many Through association between Self and the destination type.

    -
    struct Country: TableRecord {
    +
    struct Country: TableRecord {
         static let passports = hasMany(Passport.self)
         static let citizens = hasMany(Citizen.self, through: passports, using: Passport.citizen)
     }
     
    -struct Passport: TableRecord {
    +struct Passport: TableRecord {
         static let citizen = belongsTo(Citizen.self)
     }
     
    -struct Citizen: TableRecord { }
    +struct Citizen: TableRecord { }
     

    The association will let you define requests that load both the source @@ -1500,22 +1500,22 @@ and the destination type:

    To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

    -
    struct Citizenship: FetchableRecord, Decodable {
    +
    struct Citizenship: FetchableRecord, Decodable {
         var country: Country
         var citizen: Citizen
     }
     
    -let citizenships = try dbQueue.read { db in
    +let citizenships = try dbQueue.read { db in
         return try Citizenship.fetchAll(db, request)
     }
    -for citizenship in citizenships {
    +for citizenship in citizenships {
         print("\(citizenship.citizen.name) is a citizen of \(citizenship.country.name)")
     }
     

    It is recommended that you define, alongside the static association, a property with the same name:

    -
    struct Country: TableRecord, EncodableRecord {
    +
    struct Country: TableRecord, EncodableRecord {
         static let passports = hasMany(Passport.self)
         static let citizens = hasMany(Citizen.self, through: passports, using: Passport.citizen)
         var citizens: QueryInterfaceRequest<Citizen> {
    @@ -1526,7 +1526,7 @@ property with the same name:

    This property will let you navigate from the source type to the destination type:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let country: Country = ...
         let citizens = try country.citizens.fetchAll(db) // [Country]
     }
    @@ -1608,7 +1608,7 @@ is the same key as the target.

    @@ -1631,8 +1631,8 @@ is the same key as the target.

    Creates a Has one association between Self and the destination type.

    -
    struct Demographics: TableRecord { ... }
    -struct Country: TableRecord {
    +
    struct Demographics: TableRecord { ... }
    +struct Country: TableRecord {
         static let demographics = hasOne(Demographics.self)
     }
     
    @@ -1645,22 +1645,22 @@ and the destination type:

    To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

    -
    struct CountryInfo: FetchableRecord, Decodable {
    +
    struct CountryInfo: FetchableRecord, Decodable {
         var country: Country
         var demographics: Demographics?
     }
     
    -let countryInfos = try dbQueue.read { db in
    +let countryInfos = try dbQueue.read { db in
         return try CountryInfo.fetchAll(db, request)
     }
    -for countryInfo in countryInfos {
    +for countryInfo in countryInfos {
         print("\(countryInfo.country.name) has \(countryInfo.demographics.population) citizens")
     }
     

    It is recommended that you define, alongside the static association, a property with the same name:

    -
    struct Country: TableRecord, EncodableRecord {
    +
    struct Country: TableRecord, EncodableRecord {
         static let demographics = hasOne(Demographics.self)
         var demographics: QueryInterfaceRequest<Demographics> {
             return request(for: Country.demographics)
    @@ -1670,7 +1670,7 @@ property with the same name:

    This property will let you navigate from the source type to the destination type:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let country: Country = ...
         let demographics = try country.demographics.fetchOne(db) // Demographics?
     }
    @@ -1738,7 +1738,7 @@ foreign keys from the destination table.

    @@ -1761,16 +1761,16 @@ foreign keys from the destination table.

    Creates a Has One Through association between Self and the destination type.

    -
    struct Book: TableRecord {
    +
    struct Book: TableRecord {
         static let library = belongsTo(Library.self)
         static let returnAddress = hasOne(Address.self, through: library, using: library.address)
     }
     
    -struct Library: TableRecord {
    +struct Library: TableRecord {
         static let address = hasOne(Address.self)
     }
     
    -struct Address: TableRecord { ... }
    +struct Address: TableRecord { ... }
     

    The association will let you define requests that load both the source @@ -1781,22 +1781,22 @@ and the destination type:

    To consume those requests, define a type that adopts both the FetchableRecord and Decodable protocols:

    -
    struct Todo: FetchableRecord, Decodable {
    +
    struct Todo: FetchableRecord, Decodable {
         var book: Book
         var address: Address
     }
     
    -let todos = try dbQueue.read { db in
    +let todos = try dbQueue.read { db in
         return try Todo.fetchAll(db, request)
     }
    -for todo in todos {
    +for todo in todos {
         print("Please return \(todo.book) to \(todo.address)")
     }
     

    It is recommended that you define, alongside the static association, a property with the same name:

    -
    struct Book: TableRecord, EncodableRecord {
    +
    struct Book: TableRecord, EncodableRecord {
         static let library = belongsTo(Library.self)
         static let returnAddress = hasOne(Address.self, through: library, using: library.address)
         var returnAddress: QueryInterfaceRequest<Address> {
    @@ -1807,7 +1807,7 @@ property with the same name:

    This property will let you navigate from the source type to the destination type:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let book: Book = ...
         let address = try book.returnAddress.fetchOne(db) // Address?
     }
    @@ -1889,7 +1889,7 @@ is the same key as the target.

    @@ -1917,7 +1917,7 @@ is the same key as the target.

    Creates a request that fetches the associated record(s).

    For example:

    -
    struct Team: TableRecord, EncodableRecord {
    +
    struct Team: TableRecord, EncodableRecord {
         static let players = hasMany(Player.self)
         var players: QueryInterfaceRequest<Player> {
             return request(for: Team.players)
    @@ -1940,7 +1940,7 @@ is the same key as the target.

    @@ -1986,7 +1986,7 @@ is the same key as the target.

    @@ -2023,7 +2023,7 @@ require that the associated database table contains a matching row.

    @@ -2060,7 +2060,7 @@ that the associated database table contains a matching row.

    @@ -2097,7 +2097,7 @@ require that the associated database table contains a matching row.

    @@ -2134,7 +2134,7 @@ that the associated database table contains a matching row.

    @@ -2182,7 +2182,7 @@ that the associated database table contains a matching row.

    @@ -2219,7 +2219,7 @@ that the associated database table contains a matching row.

    @@ -2262,7 +2262,7 @@ for individual requests with the TableRecord.select method.

    @@ -2313,7 +2313,7 @@ for individual requests with the TableRecord.select method.

    @@ -2346,7 +2346,7 @@ for individual requests with the TableRecord.select method.

    @@ -2369,7 +2369,7 @@ for individual requests with the TableRecord.select method.

    Creates a request which selects selection.

    // SELECT id, email FROM player
    -let request = Player.select(Column("id"), Column("email"))
    +let request = Player.select(Column("id"), Column("email"))
     
    @@ -2382,7 +2382,7 @@ for individual requests with the TableRecord.select method.

    @@ -2405,7 +2405,7 @@ for individual requests with the TableRecord.select method.

    Creates a request which selects selection.

    // SELECT id, email FROM player
    -let request = Player.select([Column("id"), Column("email")])
    +let request = Player.select([Column("id"), Column("email")])
     
    @@ -2418,7 +2418,7 @@ for individual requests with the TableRecord.select method.

    @@ -2451,13 +2451,13 @@ for individual requests with the TableRecord.select method.

    Swift

    public static func select(
         sql: String,
    -    arguments: StatementArguments = StatementArguments())
    +    arguments: StatementArguments = StatementArguments())
         -> QueryInterfaceRequest<Self>
    @@ -2480,7 +2480,7 @@ for individual requests with the TableRecord.select method.

    Creates a request which selects an SQL literal.

    // SELECT id, email FROM player
    -let request = Player.select(literal: SQLLiteral(sql: "id, email"))
    +let request = Player.select(literal: SQLLiteral(sql: "id, email"))
     
    @@ -2493,7 +2493,7 @@ for individual requests with the TableRecord.select method.

    @@ -2516,9 +2516,9 @@ for individual requests with the TableRecord.select method.

    Creates a request which selects selection, and fetches values of type type.

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         // SELECT max(score) FROM player
    -    let request = Player.select([max(Column("score"))], as: Int.self)
    +    let request = Player.select([max(Column("score"))], as: Int.self)
         let maxScore: Int? = try request.fetchOne(db)
     }
     
    @@ -2536,7 +2536,7 @@ type type.

    @@ -2559,9 +2559,9 @@ type type.

    Creates a request which selects selection, and fetches values of type type.

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         // SELECT max(score) FROM player
    -    let request = Player.select(max(Column("score")), as: Int.self)
    +    let request = Player.select(max(Column("score")), as: Int.self)
         let maxScore: Int? = try request.fetchOne(db)
     }
     
    @@ -2579,7 +2579,7 @@ type type.

    @@ -2602,7 +2602,7 @@ type type.

    Creates a request which selects sql, and fetches values of type type.

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         // SELECT max(score) FROM player
         let request = Player.select(sql: "max(score)", as: Int.self)
         let maxScore: Int? = try request.fetchOne(db)
    @@ -2616,14 +2616,14 @@ type type.

    Swift

    public static func select<RowDecoder>(
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         as type: RowDecoder.Type)
         -> QueryInterfaceRequest<RowDecoder>
    @@ -2646,9 +2646,9 @@ type type.

    Creates a request which selects an SQL literal, and fetches values of type type.

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         // SELECT max(score) FROM player
    -    let request = Player.select(literal: SQLLiteral(sql: "max(score)"), as: Int.self)
    +    let request = Player.select(literal: SQLLiteral(sql: "max(score)"), as: Int.self)
         let maxScore: Int? = try request.fetchOne(db)
     }
     
    @@ -2666,7 +2666,7 @@ type type.

    @@ -2690,8 +2690,8 @@ type type.

    Creates a request which appends selection.

    // SELECT id, email, name FROM player
     le request = Player
    -    .select([Column("id"), Column("email")])
    -    .annotated(with: [Column("name")])
    +    .select([Column("id"), Column("email")])
    +    .annotated(with: [Column("name")])
     
    @@ -2704,7 +2704,7 @@ type type.

    @@ -2728,8 +2728,8 @@ type type.

    Creates a request which appends selection.

    // SELECT id, email, name FROM player
     le request = Player
    -    .select([Column("id"), Column("email")])
    -    .annotated(with: Column("name"))
    +    .select([Column("id"), Column("email")])
    +    .annotated(with: Column("name"))
     
    @@ -2742,7 +2742,7 @@ type type.

    @@ -2765,7 +2765,7 @@ type type.

    Creates a request with the provided predicate.

    // SELECT * FROM player WHERE email = 'arthur@example.com'
    -let request = Player.filter(Column("email") == "arthur@example.com")
    +let request = Player.filter(Column("email") == "arthur@example.com")
     

    The selection defaults to all columns. This default can be changed for @@ -2782,7 +2782,7 @@ for individual requests with the TableRecord.select method.

    @@ -2824,7 +2824,7 @@ for individual requests with the TableRecord.select method.

    @@ -2866,7 +2866,7 @@ for individual requests with the TableRecord.select method.

    @@ -2909,7 +2909,7 @@ for individual requests with the TableRecord.select method.

    @@ -2952,7 +2952,7 @@ for individual requests with the TableRecord.select method.

    @@ -2989,13 +2989,13 @@ for individual requests with the TableRecord.select method.

    Swift

    public static func filter(
         sql: String,
    -    arguments: StatementArguments = StatementArguments())
    +    arguments: StatementArguments = StatementArguments())
         -> QueryInterfaceRequest<Self>
    @@ -3018,7 +3018,7 @@ for individual requests with the TableRecord.select method.

    Creates a request with the provided predicate.

    // SELECT * FROM player WHERE email = 'arthur@example.com'
    -let request = Player.filter(literal: SQLLiteral(sql: "email = ?", arguments: ["arthur@example.com"]))
    +let request = Player.filter(literal: SQLLiteral(sql: "email = ?", arguments: ["arthur@example.com"]))
     

    With Swift 5, you can safely embed raw values in your SQL queries, @@ -3040,7 +3040,7 @@ for individual requests with the TableRecord.select method.

    @@ -3064,7 +3064,7 @@ for individual requests with the TableRecord.select method.

    Creates a request sorted according to the provided orderings.

    // SELECT * FROM player ORDER BY name
    -let request = Player.order(Column("name"))
    +let request = Player.order(Column("name"))
     

    The selection defaults to all columns. This default can be changed for @@ -3081,7 +3081,7 @@ for individual requests with the TableRecord.select method.

    @@ -3105,7 +3105,7 @@ for individual requests with the TableRecord.select method.

    Creates a request sorted according to the provided orderings.

    // SELECT * FROM player ORDER BY name
    -let request = Player.order([Column("name")])
    +let request = Player.order([Column("name")])
     

    The selection defaults to all columns. This default can be changed for @@ -3122,7 +3122,7 @@ for individual requests with the TableRecord.select method.

    @@ -3165,7 +3165,7 @@ for individual requests with the TableRecord.select method.

    @@ -3202,13 +3202,13 @@ for individual requests with the TableRecord.select method.

    Swift

    public static func order(
         sql: String,
    -    arguments: StatementArguments = StatementArguments())
    +    arguments: StatementArguments = StatementArguments())
         -> QueryInterfaceRequest<Self>
    @@ -3231,7 +3231,7 @@ for individual requests with the TableRecord.select method.

    Creates a request sorted according to an SQL literal.

    // SELECT * FROM player ORDER BY name
    -let request = Player.order(literal: SQLLiteral(sql: "name"))
    +let request = Player.order(literal: SQLLiteral(sql: "name"))
     

    With Swift 5, you can safely embed raw values in your SQL queries, @@ -3254,7 +3254,7 @@ for individual requests with the TableRecord.select method.

    @@ -3295,7 +3295,7 @@ for individual requests with the TableRecord.select method.

    @@ -3321,16 +3321,16 @@ a specific database table.

    In the example below, the team.avgScore < player.score condition in the ON clause could be not achieved without table aliases.

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
     // SELECT player.*, team.*
     // JOIN team ON ... AND team.avgScore < player.score
    -let playerAlias = TableAlias()
    +let playerAlias = TableAlias()
     let request = Player
         .aliased(playerAlias)
    -    .including(required: Player.team.filter(Column("avgScore") < playerAlias[Column("score")])
    +    .including(required: Player.team.filter(Column("avgScore") < playerAlias[Column("score")])
     
    @@ -3343,7 +3343,7 @@ the ON clause could be not achieved without table aliases.

    @@ -3406,7 +3406,7 @@ the ON clause could be not achieved without table aliases.

    @@ -3441,7 +3441,7 @@ the ON clause could be not achieved without table aliases.

    The selection as an SQL String.

    For example:

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let databaseTableName = "player"
     }
     
    @@ -3462,7 +3462,7 @@ the ON clause could be not achieved without table aliases.

    @@ -3486,11 +3486,11 @@ the ON clause could be not achieved without table aliases.

    Returns the number of selected columns.

    For example:

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let databaseTableName = "player"
     }
     
    -try dbQueue.write { db in
    +try dbQueue.write { db in
         try db.create(table: "player") { t in
             t.autoIncrementedPrimaryKey("id")
             t.column("name", .text)
    @@ -3512,7 +3512,7 @@ the ON clause could be not achieved without table aliases.

    @@ -3581,7 +3581,7 @@ main queue.

    a ValueObservation.

    @@ -3650,7 +3650,7 @@ main queue.

    a ValueObservation.

    @@ -3708,7 +3708,7 @@ main queue.

    a ValueObservation.

    @@ -3718,7 +3718,7 @@ main queue. diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/TransactionObserver.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/TransactionObserver.html index feae9f48f..b551296ec 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/TransactionObserver.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/TransactionObserver.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1047,7 +1047,7 @@ databaseDidChange(with:) method.

    @@ -1095,7 +1095,7 @@ stopObservingDatabaseChangesUntilNextTransaction() method.

    @@ -1146,7 +1146,7 @@ has an opportunity to rollback pending changes by throwing an error.

    @@ -1178,7 +1178,7 @@ has an opportunity to rollback pending changes by throwing an error.

    @@ -1210,7 +1210,7 @@ has an opportunity to rollback pending changes by throwing an error.

    @@ -1307,10 +1307,10 @@ and may provide most/all of what you need. method won’t be called until the next transaction.

    For example:

    -
    class PlayerObserver: TransactionObserver {
    +
    class PlayerObserver: TransactionObserver {
         var playerTableWasModified = false
     
    -    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
    +    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
             return eventKind.tableName == "player"
         }
     
    @@ -1338,7 +1338,7 @@ method won’t be called until the next transaction.

    @@ -1348,7 +1348,7 @@ method won’t be called until the next transaction.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/ValueReducer.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/ValueReducer.html index d1c00bea9..87e30cc73 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/ValueReducer.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/ValueReducer.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1138,7 +1138,7 @@ when observer should not be notified.

    @@ -1178,7 +1178,7 @@ transformation which each element emitted by this reducer.

    @@ -1218,7 +1218,7 @@ transformation which each element emitted by this reducer.

    @@ -1258,7 +1258,7 @@ transformation which each element emitted by this reducer.

    @@ -1293,7 +1293,7 @@ transformation which each element emitted by this reducer.

    @@ -1303,7 +1303,7 @@ transformation which each element emitted by this reducer.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/VirtualTableModule.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/VirtualTableModule.html index 03bbe642c..0ac819b1f 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/VirtualTableModule.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Protocols/VirtualTableModule.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1057,7 +1057,7 @@ FTS4 and FTS5.

    @@ -1082,12 +1082,12 @@ FTS4 and FTS5.

    Declaration

    Swift

    -
    var moduleName: String { get }
    +
    var moduleName: String { get }
    @@ -1122,7 +1122,7 @@ FTS4 and FTS5.

    @@ -1152,7 +1152,7 @@ FTS4 and FTS5.

    @@ -1183,7 +1183,7 @@ been created.

    @@ -1193,7 +1193,7 @@ been created.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs.html index 77c622052..63583b266 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1038,7 +1038,7 @@ @@ -1089,7 +1089,7 @@ @@ -1122,7 +1122,7 @@ @@ -1191,7 +1191,7 @@ @@ -1223,7 +1223,7 @@ @@ -1258,7 +1258,7 @@ @@ -1289,7 +1289,7 @@ @@ -1352,7 +1352,7 @@ cover a full table, or the combination of columns and rows:

    @@ -1394,7 +1394,7 @@ cover a full table, or the combination of columns and rows:

    @@ -1421,7 +1421,7 @@ requests, and notifies each database transaction whenever the database changes.

    For example:

    -
    let observation = DatabaseRegionObservation(tracking: Player.all)
    +
    let observation = DatabaseRegionObservation(tracking: Player.all)
     let observer = try observation.start(in: dbQueue) { db: Database in
         print("Players have changed.")
     }
    @@ -1438,7 +1438,7 @@ database changes.

    @@ -1482,7 +1482,7 @@ database changes.

    @@ -1524,7 +1524,7 @@ database changes.

    @@ -1566,7 +1566,7 @@ database changes.

    @@ -1611,7 +1611,7 @@ hiding its specifics.

    @@ -1652,7 +1652,7 @@ hiding its specifics.

    @@ -1687,7 +1687,7 @@ hiding its specifics.

    @@ -1706,7 +1706,7 @@ hiding its specifics.

    ColumnMapping is a row adapter that maps column names.

    -
    let adapter = ColumnMapping(["foo": "bar"])
    +
    let adapter = ColumnMapping(["foo": "bar"])
     let sql = "SELECT 'foo' AS foo, 'bar' AS bar, 'baz' AS baz"
     
     // [foo:"bar"]
    @@ -1724,7 +1724,7 @@ hiding its specifics.

    @@ -1743,7 +1743,7 @@ hiding its specifics.

    SuffixRowAdapter is a row adapter that hides the first columns in a row.

    -
    let adapter = SuffixRowAdapter(fromIndex: 2)
    +
    let adapter = SuffixRowAdapter(fromIndex: 2)
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
     
     // [baz:3]
    @@ -1761,7 +1761,7 @@ hiding its specifics.

    @@ -1780,7 +1780,7 @@ hiding its specifics.

    RangeRowAdapter is a row adapter that only exposes a range of columns.

    -
    let adapter = RangeRowAdapter(1..<3)
    +
    let adapter = RangeRowAdapter(1..<3)
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz, 4 as qux"
     
     // [bar:2 baz:3]
    @@ -1798,7 +1798,7 @@ hiding its specifics.

    @@ -1818,11 +1818,11 @@ hiding its specifics.

    ScopeAdapter is a row adapter that lets you define scopes on rows.

    // Two adapters
    -let fooAdapter = ColumnMapping(["value": "foo"])
    -let barAdapter = ColumnMapping(["value": "bar"])
    +let fooAdapter = ColumnMapping(["value": "foo"])
    +let barAdapter = ColumnMapping(["value": "bar"])
     
     // Define scopes
    -let adapter = ScopeAdapter([
    +let adapter = ScopeAdapter([
         "foo": fooAdapter,
         "bar": barAdapter])
     
    @@ -1850,7 +1850,7 @@ hiding its specifics.

    @@ -1876,7 +1876,7 @@ hiding its specifics.

    Interpolation.

    For example:

    -
    try dbQueue.write { db in
    +
    try dbQueue.write { db in
         let name: String = ...
         let id: Int64 = ...
         let query: SQLLiteral = "UPDATE player SET name = \(name) WHERE id = \(id)"
    @@ -1895,7 +1895,7 @@ Interpolation.

    @@ -1930,7 +1930,7 @@ Interpolation.

    @@ -1977,7 +1977,7 @@ number already assigned

    To fill question marks placeholders, feed StatementArguments with an array:

    db.execute(
         sql: "INSERT ... (?, ?)",
    -    arguments: StatementArguments(["Arthur", 41]))
    +    arguments: StatementArguments(["Arthur", 41]))
     
     // Array literals are automatically converted:
     db.execute(
    @@ -1989,7 +1989,7 @@ number already assigned
     

    To fill named arguments, feed StatementArguments with a dictionary:

    db.execute(
         sql: "INSERT ... (:name, :score)",
    -    arguments: StatementArguments(["name": "Arthur", "score": 41]))
    +    arguments: StatementArguments(["name": "Arthur", "score": 41]))
     
     // Dictionary literals are automatically converted:
     db.execute(
    @@ -2048,7 +2048,7 @@ confusing, and it is best to avoid this practice:

    @@ -2083,7 +2083,7 @@ confusing, and it is best to avoid this practice:

    @@ -2125,7 +2125,7 @@ confusing, and it is best to avoid this practice:

    @@ -2168,7 +2168,7 @@ confusing, and it is best to avoid this practice:

    FTS3 lets you define fts3 virtual tables.

    // CREATE VIRTUAL TABLE document USING fts3(content)
    -try db.create(virtualTable: "document", using: FTS3()) { t in
    +try db.create(virtualTable: "document", using: FTS3()) { t in
         t.column("content")
     }
     
    @@ -2184,7 +2184,7 @@ confusing, and it is best to avoid this practice:

    @@ -2219,7 +2219,7 @@ confusing, and it is best to avoid this practice:

    @@ -2242,7 +2242,7 @@ confusing, and it is best to avoid this practice:

    An FTS3 tokenizer, suitable for FTS3 and FTS4 table definitions:

    -
    db.create(virtualTable: "book", using: FTS4()) { t in
    +
    db.create(virtualTable: "book", using: FTS4()) { t in
         t.tokenizer = .simple // FTS3TokenizerDescriptor
     }
     
    @@ -2260,7 +2260,7 @@ confusing, and it is best to avoid this practice:

    @@ -2284,7 +2284,7 @@ confusing, and it is best to avoid this practice:

    FTS4 lets you define fts4 virtual tables.

    // CREATE VIRTUAL TABLE document USING fts4(content)
    -try db.create(virtualTable: "document", using: FTS4()) { t in
    +try db.create(virtualTable: "document", using: FTS4()) { t in
         t.column("content")
     }
     
    @@ -2302,7 +2302,7 @@ confusing, and it is best to avoid this practice:

    @@ -2326,7 +2326,7 @@ confusing, and it is best to avoid this practice:

    FTS5 lets you define fts5 virtual tables.

    // CREATE VIRTUAL TABLE document USING fts5(content)
    -try db.create(virtualTable: "document", using: FTS5()) { t in
    +try db.create(virtualTable: "document", using: FTS5()) { t in
         t.column("content")
     }
     
    @@ -2406,7 +2406,7 @@ confusing, and it is best to avoid this practice:

    An FTS5 tokenizer, suitable for FTS5 table definitions:

    -
    db.create(virtualTable: "book", using: FTS5()) { t in
    +
    db.create(virtualTable: "book", using: FTS5()) { t in
         t.tokenizer = .unicode61() // FTS5TokenizerDescriptor
     }
     
    @@ -2469,7 +2469,7 @@ applied in order, once and only once.

    When a user upgrades your application, only non-applied migration are run.

    Usage:

    -
    var migrator = DatabaseMigrator()
    +
    var migrator = DatabaseMigrator()
     
     // 1st migration
     migrator.registerMigration("createLibrary") { db in
    @@ -2516,7 +2516,7 @@ applied in order, once and only once.

    @@ -2542,7 +2542,7 @@ applied in order, once and only once.

    population of associated records.

    For example:

    -
    struct Author: TableRecord {
    +
    struct Author: TableRecord {
         static let books = hasMany(Book.self)
     }
     
    @@ -2572,7 +2572,7 @@ of aggregates:

    @@ -2600,8 +2600,8 @@ type to another record type, such as each instance of the declaring record

    For example, if your application includes authors and books, and each book is assigned its author, you’d declare the association this way:

    -
    struct Author: TableRecord { ... }
    -struct Book: TableRecord {
    +
    struct Author: TableRecord { ... }
    +struct Book: TableRecord {
         static let author = belongsTo(Author.self)
         ...
     }
    @@ -2650,8 +2650,8 @@ speaking, all primary keys are supported.

    If the database schema does not define foreign keys between tables, you can still use BelongsTo associations. But your help is needed to define the missing foreign key:

    -
    struct Book: FetchableRecord, TableRecord {
    -    static let author = belongsTo(Author.self, using: ForeignKey(...))
    +
    struct Book: FetchableRecord, TableRecord {
    +    static let author = belongsTo(Author.self, using: ForeignKey(...))
     }
     
    @@ -2667,7 +2667,7 @@ missing foreign key:

    @@ -2695,8 +2695,8 @@ instances of the other record.

    For example, if your application includes authors and books, and each author is assigned zero or more books, you’d declare the association this way:

    -
    struct Book: TableRecord { ... }
    -struct Author: TableRecord {
    +
    struct Book: TableRecord { ... }
    +struct Author: TableRecord {
         static let books = hasMany(Book.self)
         ...
     }
    @@ -2745,8 +2745,8 @@ speaking, all primary keys are supported.

    If the database schema does not define foreign keys between tables, you can still use HasMany associations. But your help is needed to define the missing foreign key:

    -
    struct Author: TableRecord {
    -    static let books = hasMany(Book.self, using: ForeignKey(...))
    +
    struct Author: TableRecord {
    +    static let books = hasMany(Book.self, using: ForeignKey(...))
     }
     
    @@ -2762,7 +2762,7 @@ missing foreign key:

    @@ -2791,18 +2791,18 @@ record by proceeding through a third record.

    For example, consider the practice of passport delivery. One coutry has many citizens through its passports:

    -
    struct Country: TableRecord {
    +
    struct Country: TableRecord {
         static let passports = hasMany(Passport.self)
         static let citizens = hasMany(Citizen.self, through: passports, using: Passport.citizen)
         ...
     }
     
    -struct Passport: TableRecord {
    +struct Passport: TableRecord {
         static let citizen = belongsTo(Citizen.self)
         ...
     }
     
    -struct Citizen: TableRecord { ... }
    +struct Citizen: TableRecord { ... }
     

    The HasManyThrough association is also useful for setting up @@ -2810,16 +2810,16 @@ record by proceeding through a third record.

    has many sections, and a section has many paragraphs, you may sometimes want to get a simple collection of all paragraphs in the document. You could set that up this way:

    -
    struct Document: TableRecord {
    +
    struct Document: TableRecord {
         static let sections = hasMany(Section.self)
         static let paragraphs = hasMany(Paragraph.self, through: sections, using: Section.paragraphs)
     }
     
    -struct Section: TableRecord {
    +struct Section: TableRecord {
         static let paragraphs = hasMany(Paragraph.self)
     }
     
    -struct Paragraph: TableRecord {
    +struct Paragraph: TableRecord {
     }
     
    @@ -2838,7 +2838,7 @@ HasManyThrough, etc).

    @@ -2867,8 +2867,8 @@ instances of the other record.

    For example, if your application has one database table for countries, and another for their demographic profiles, you’d declare the association this way:

    -
    struct Demographics: TableRecord { ... }
    -struct Country: TableRecord {
    +
    struct Demographics: TableRecord { ... }
    +struct Country: TableRecord {
         static let demographics = hasOne(Demographics.self)
         ...
     }
    @@ -2918,8 +2918,8 @@ speaking, all primary keys are supported.

    If the database schema does not follow this convention, and does not define foreign keys between tables, you can still use HasOne associations. But your help is needed to define the missing foreign key:

    -
    struct Country: FetchableRecord, TableRecord {
    -    static let demographics = hasOne(Demographics.self, using: ForeignKey(...))
    +
    struct Country: FetchableRecord, TableRecord {
    +    static let demographics = hasOne(Demographics.self, using: ForeignKey(...))
     }
     
    @@ -2935,7 +2935,7 @@ your help is needed to define the missing foreign key:

    @@ -2962,18 +2962,18 @@ another record. This association indicates that the declaring record can be matched with one instance of another record by proceeding through a third record. For example, if each book belongs to a library, and each library has one address, then one knows where the book should be returned to:

    -
    struct Book: TableRecord {
    +
    struct Book: TableRecord {
         static let library = belongsTo(Library.self)
         static let returnAddress = hasOne(Address.self, through: library, using: library.address)
         ...
     }
     
    -struct Library: TableRecord {
    +struct Library: TableRecord {
         static let address = hasOne(Address.self)
         ...
     }
     
    -struct Address: TableRecord { ... }
    +struct Address: TableRecord { ... }
     

    As in the example above, HasOneThrough association is always built from @@ -2991,7 +2991,7 @@ HasOneThrough).

    @@ -3016,10 +3016,10 @@ HasOneThrough).

    QueryInterfaceRequest is a request that generates SQL for you.

    For example:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let request = Player
    -        .filter(Column("score") > 1000)
    -        .order(Column("name"))
    +        .filter(Column("score") > 1000)
    +        .order(Column("name"))
         let players = try request.fetchAll(db) // [Player]
     }
     
    @@ -3037,7 +3037,7 @@ HasOneThrough).

    @@ -3077,7 +3077,7 @@ Instead, adopt the ColumnExpression protocol.

    @@ -3109,12 +3109,12 @@ Instead, adopt the ColumnExpression protocol.

    Experimental

    SQLExpressionLiteral is an expression built from a raw SQL snippet.

    -
    SQLExpressionLiteral(sql: "1 + 2")
    +
    SQLExpressionLiteral(sql: "1 + 2")
     

    The SQL literal may contain ? and colon-prefixed arguments:

    -
    SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
    -SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
    +
    SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
    +SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
     
    See more @@ -3128,7 +3128,7 @@ Instead, adopt the ColumnExpression protocol.

    @@ -3172,7 +3172,7 @@ Instead, adopt the ColumnExpression protocol.

    @@ -3207,9 +3207,9 @@ Instead, adopt the ColumnExpression protocol.

    TableRecord.databaseSelection.

    For example:

    -
    struct Player : TableRecord {
    +
    struct Player : TableRecord {
         static var databaseTableName = "player"
    -    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
    +    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
     }
     
     // SELECT *, rowid FROM player
    @@ -3227,7 +3227,7 @@ TableRecord.databaseSelection.

    @@ -3269,10 +3269,10 @@ foreign key from book to person, or Could not infer foreign key from book to person.

    Your help is needed. You have to instruct GRDB which foreign key to use:

    -
    struct Book: TableRecord {
    +
    struct Book: TableRecord {
         // Define foreign keys
    -    static let authorForeignKey = ForeignKey(["authorId"]))
    -    static let translatorForeignKey = ForeignKey(["translatorId"]))
    +    static let authorForeignKey = ForeignKey(["authorId"]))
    +    static let translatorForeignKey = ForeignKey(["translatorId"]))
     
         // Use foreign keys to define associations:
         static let author = belongsTo(Person.self, using: authorForeignKey)
    @@ -3283,27 +3283,27 @@ to person.

    Foreign keys are always defined from the table that contains the columns at the origin of the foreign key. Person’s symmetric HasMany associations reuse Book’s foreign keys:

    -
    struct Person: TableRecord {
    +
    struct Person: TableRecord {
         static let writtenBooks = hasMany(Book.self, using: Book.authorForeignKey)
         static let translatedBooks = hasMany(Book.self, using: Book.translatorForeignKey)
     }
     

    Foreign keys can also be defined from query interface columns:

    -
    struct Book: TableRecord {
    -    enum Columns: String, ColumnExpression {
    +
    struct Book: TableRecord {
    +    enum Columns: String, ColumnExpression {
             case id, title, authorId, translatorId
         }
     
    -    static let authorForeignKey = ForeignKey([Columns.authorId]))
    -    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
    +    static let authorForeignKey = ForeignKey([Columns.authorId]))
    +    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
     }
     

    When the destination table of a foreign key does not define any primary key, you need to provide the full definition of a foreign key:

    -
    struct Book: TableRecord {
    -    static let authorForeignKey = ForeignKey(["authorId"], to: ["id"]))
    +
    struct Book: TableRecord {
    +    static let authorForeignKey = ForeignKey(["authorId"], to: ["id"]))
         static let author = belongsTo(Person.self, using: authorForeignKey)
     }
     
    @@ -3319,7 +3319,7 @@ you need to provide the full definition of a foreign key:

    @@ -3350,7 +3350,7 @@ you need to provide the full definition of a foreign key:

    Use persistence containers in the encode(to:) method of your encodable records:

    -
    struct Player: EncodableRecord {
    +
    struct Player: EncodableRecord {
         var id: Int64?
         var name: String?
     
    @@ -3372,7 +3372,7 @@ encodable records:

    @@ -3414,7 +3414,7 @@ encodable records:

    @@ -3454,7 +3454,7 @@ conflicts when records are inserted or updated.

    @@ -3491,7 +3491,7 @@ conflicts when records are inserted or updated.

    @@ -3541,7 +3541,7 @@ notifies fresh values whenever the database changes.

    @@ -3581,7 +3581,7 @@ hiding its specifics.

    @@ -3591,7 +3591,7 @@ hiding its specifics.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AdaptedFetchRequest.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AdaptedFetchRequest.html index 9c7ea36af..947fb6295 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AdaptedFetchRequest.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AdaptedFetchRequest.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1042,7 +1042,7 @@ @@ -1052,7 +1052,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AllColumns.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AllColumns.html index 33177e67d..5c0a4abff 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AllColumns.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AllColumns.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1018,9 +1018,9 @@ TableRecord.databaseSelection.

    For example:

    -
    struct Player : TableRecord {
    +
    struct Player : TableRecord {
         static var databaseTableName = "player"
    -    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
    +    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
     }
     
     // SELECT *, rowid FROM player
    @@ -1056,7 +1056,7 @@ TableRecord.databaseSelection.

    @@ -1066,7 +1066,7 @@ TableRecord.databaseSelection.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyDatabaseRegionConvertible.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyDatabaseRegionConvertible.html index 4d8090e36..1833dfdad 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyDatabaseRegionConvertible.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyDatabaseRegionConvertible.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyFetchRequest.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyFetchRequest.html index bb8f3f8e8..770623944 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyFetchRequest.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyFetchRequest.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ hiding its specifics.

    @@ -1075,7 +1075,7 @@ hiding its specifics.

    @@ -1107,7 +1107,7 @@ operations the argument closure.

    @@ -1117,7 +1117,7 @@ operations the argument closure.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyValueReducer.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyValueReducer.html index c30f04641..9320c8501 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyValueReducer.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AnyValueReducer.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1042,7 +1042,7 @@ forward operations the argument closures.

    For example, this reducer counts the number of a times the player table is modified:

    var count = 0
    -let reducer = AnyValueReducer(
    +let reducer = AnyValueReducer(
         fetch: { _ in },
         value: { _ -> Int? in
             count += 1
    @@ -1065,7 +1065,7 @@ is modified:

    @@ -1095,7 +1095,7 @@ is modified:

    @@ -1105,7 +1105,7 @@ is modified:

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AssociationAggregate.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AssociationAggregate.html index 598ac60bd..b93ebfc84 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AssociationAggregate.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/AssociationAggregate.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,7 +1016,7 @@ population of associated records.

    For example:

    -
    struct Author: TableRecord {
    +
    struct Author: TableRecord {
         static let books = hasMany(Book.self)
     }
     
    @@ -1073,7 +1073,7 @@ of aggregates:

    @@ -1111,7 +1111,7 @@ of aggregates:

    @@ -1133,7 +1133,7 @@ of aggregates:

    coding key.

    For example:

    -
    struct AuthorInfo: Decodable, FetchableRecord {
    +
    struct AuthorInfo: Decodable, FetchableRecord {
         var author: Author
         var numberOfBooks: Int
     
    @@ -1156,7 +1156,7 @@ coding key.

    @@ -1178,7 +1178,7 @@ coding key.

    coding key.

    For example:

    -
    struct AuthorInfo: Decodable, FetchableRecord {
    +
    struct AuthorInfo: Decodable, FetchableRecord {
         var author: Author
         var numberOfBooks: Int
     
    @@ -1200,7 +1200,7 @@ coding key.

    @@ -1210,7 +1210,7 @@ coding key.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Column.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Column.html index ceebf385a..d671991d8 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Column.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Column.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1048,7 +1048,7 @@ Instead, adopt the ColumnExpression protocol.

    @@ -1078,7 +1078,7 @@ Instead, adopt the ColumnExpression protocol.

    @@ -1108,7 +1108,7 @@ Instead, adopt the ColumnExpression protocol.

    @@ -1138,7 +1138,7 @@ Instead, adopt the ColumnExpression protocol.

    @@ -1148,7 +1148,7 @@ Instead, adopt the ColumnExpression protocol.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ColumnInfo.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ColumnInfo.html index 246d11a3e..51c5a84de 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ColumnInfo.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ColumnInfo.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1059,7 +1059,7 @@ @@ -1089,7 +1089,7 @@ @@ -1119,7 +1119,7 @@ @@ -1171,7 +1171,7 @@ non-constant expression such as CURRENT_TIMESTAMP.

    @@ -1214,7 +1214,7 @@ the primary key for columns that are part of the primary key.

    @@ -1224,7 +1224,7 @@ the primary key for columns that are part of the primary key.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ColumnMapping.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ColumnMapping.html index 35e9380c7..5513d79f5 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ColumnMapping.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ColumnMapping.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1013,7 +1013,7 @@

    ColumnMapping is a row adapter that maps column names.

    -
    let adapter = ColumnMapping(["foo": "bar"])
    +
    let adapter = ColumnMapping(["foo": "bar"])
     let sql = "SELECT 'foo' AS foo, 'bar' AS bar, 'baz' AS baz"
     
     // [foo:"bar"]
    @@ -1050,7 +1050,7 @@ column names in a base row.

    @@ -1060,7 +1060,7 @@ column names in a base row.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Configuration.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Configuration.html index 1b6796d95..690bf67ce 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Configuration.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Configuration.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1052,7 +1052,7 @@ @@ -1084,7 +1084,7 @@ @@ -1105,11 +1105,11 @@

    The database label.

    You can query this label at runtime:

    -
    var configuration = Configuration()
    +
    var configuration = Configuration()
     configuration.label = "MyDatabase"
    -let dbQueue = try DatabaseQueue(path: ..., configuration: configuration)
    +let dbQueue = try DatabaseQueue(path: ..., configuration: configuration)
     
    -try dbQueue.read { db in
    +try dbQueue.read { db in
         print(db.configuration.label) // Prints "MyDatabase"
     }
     
    @@ -1162,7 +1162,7 @@ DatabaseSnapshot. N grows with the number of snapshots. @@ -1194,7 +1194,7 @@ DatabaseSnapshot. N grows with the number of snapshots. @@ -1252,7 +1252,7 @@ before that connection has been made available to any read/write API’s.

    For example:

    -
    var config = Configuration()
    +
    var config = Configuration()
     config.prepareDatabase = { db in
         try db.execute(sql: "PRAGMA kdf_iter = 10000")
     }
    @@ -1268,7 +1268,7 @@ API’s.

    @@ -1311,7 +1311,7 @@ API’s.

    @@ -1333,25 +1333,25 @@ API’s.

    end of a database access block.

    For example:

    -
    let dbQueue = DatabaseQueue()
    +
    let dbQueue = DatabaseQueue()
     
     // fatal error: A transaction has been left opened at the end of a database access
    -try dbQueue.inDatabase { db in
    +try dbQueue.inDatabase { db in
         try db.beginTransaction()
     }
     

    If true, one can leave opened transaction at the end of database access blocks:

    -
    var config = Configuration()
    +
    var config = Configuration()
     config.allowsUnsafeTransactions = true
    -let dbQueue = DatabaseQueue(configuration: config)
    +let dbQueue = DatabaseQueue(configuration: config)
     
    -try dbQueue.inDatabase { db in
    +try dbQueue.inDatabase { db in
         try db.beginTransaction()
     }
     
    -try dbQueue.inDatabase { db in
    +try dbQueue.inDatabase { db in
         try db.commit()
     }
     
    @@ -1371,7 +1371,7 @@ never allow leaving a transaction opened at the end of a read access.

    @@ -1414,7 +1414,7 @@ never allow leaving a transaction opened at the end of a read access.

    @@ -1447,7 +1447,7 @@ pools only).

    @@ -1481,7 +1481,7 @@ pools only).

    @@ -1513,7 +1513,7 @@ pools only).

    @@ -1554,7 +1554,7 @@ pools only).

    @@ -1564,7 +1564,7 @@ pools only).

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseDateComponents.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseDateComponents.html index 5c680f6e5..73d8b7a0d 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseDateComponents.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseDateComponents.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1044,7 +1044,7 @@ @@ -1085,7 +1085,7 @@ @@ -1115,7 +1115,7 @@ @@ -1177,7 +1177,7 @@ the database.

    @@ -1249,7 +1249,7 @@ the database.

    @@ -1285,12 +1285,12 @@ the database.

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1321,7 +1321,7 @@ valid date.

    @@ -1331,7 +1331,7 @@ valid date.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseDateComponents/Format.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseDateComponents/Format.html index 381815ca6..c8b213f30 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseDateComponents/Format.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseDateComponents/Format.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1075,7 +1075,7 @@ @@ -1107,7 +1107,7 @@ @@ -1139,7 +1139,7 @@ @@ -1169,7 +1169,7 @@ @@ -1199,7 +1199,7 @@ @@ -1229,7 +1229,7 @@ @@ -1239,7 +1239,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseError.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseError.html index 2b12c3a1d..c2af07130 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseError.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseError.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1033,9 +1033,9 @@

    The SQLite error code (see https://www.sqlite.org/rescode.html#primary_result_code_list).

    -
    do {
    +
    do {
         ...
    -} catch let error as DatabaseError where error.resultCode == .SQL_CONSTRAINT {
    +} catch let error as DatabaseError where error.resultCode == .SQL_CONSTRAINT {
         // A constraint error
     }
     
    @@ -1051,12 +1051,12 @@ significant 8 bits of any SQLite result code. See

    Declaration

    Swift

    -
    public var resultCode: ResultCode { get }
    +
    public var resultCode: ResultCode { get }
    @@ -1076,9 +1076,9 @@ significant 8 bits of any SQLite result code. See

    The SQLite extended error code (see https://www.sqlite.org/rescode.html#extended_result_code_list).

    -
    do {
    +
    do {
         ...
    -} catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY {
    +} catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY {
         // A foreign key constraint error
     }
     
    @@ -1095,7 +1095,7 @@ significant 8 bits of any SQLite result code. See
    @@ -1125,7 +1125,7 @@ significant 8 bits of any SQLite result code. See @@ -1155,7 +1155,7 @@ significant 8 bits of any SQLite result code. See @@ -1189,7 +1189,7 @@ significant 8 bits of any SQLite result code. See @@ -1199,7 +1199,7 @@ significant 8 bits of any SQLite result code. See diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseEvent.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseEvent.html index 80f8c48cb..ffeba5c29 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseEvent.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseEvent.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1044,7 +1044,7 @@ @@ -1074,7 +1074,7 @@ @@ -1099,12 +1099,12 @@

    Declaration

    Swift

    -
    public var databaseName: String { get }
    +
    public var databaseName: String { get }
    @@ -1129,12 +1129,12 @@

    Declaration

    Swift

    -
    public var tableName: String { get }
    +
    public var tableName: String { get }
    @@ -1164,7 +1164,7 @@ @@ -1183,7 +1183,7 @@

    Returns an event that can be stored:

    -
    class MyObserver: TransactionObserver {
    +
    class MyObserver: TransactionObserver {
         var events: [DatabaseEvent]
         func databaseDidChange(with event: DatabaseEvent) {
             events.append(event.copy())
    @@ -1201,7 +1201,7 @@
                             
    @@ -1211,7 +1211,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseEvent/Kind.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseEvent/Kind.html index 2bfeee528..afa9259b1 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseEvent/Kind.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseEvent/Kind.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1103,7 +1103,7 @@ @@ -1113,7 +1113,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseMigrator.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseMigrator.html index f09243cae..df8f3aeda 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseMigrator.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseMigrator.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1020,7 +1020,7 @@ applied in order, once and only once.

    When a user upgrades your application, only non-applied migration are run.

    Usage:

    -
    var migrator = DatabaseMigrator()
    +
    var migrator = DatabaseMigrator()
     
     // 1st migration
     migrator.registerMigration("createLibrary") { db in
    @@ -1089,7 +1089,7 @@ migrations, and the schema changes often.

    In this case, it is recommended that you make sure this flag does not ship in the distributed application, in order to avoid undesired data loss:

    -
    var migrator = DatabaseMigrator()
    +
    var migrator = DatabaseMigrator()
     #if DEBUG
     // Speed up development by nuking the database when migrations change
     migrator.eraseDatabaseOnSchemaChange = true
    @@ -1109,7 +1109,7 @@ for some downloaded data.

    @@ -1139,7 +1139,7 @@ for some downloaded data.

    @@ -1213,7 +1213,7 @@ for some downloaded data.

    @@ -1245,7 +1245,7 @@ for some downloaded data.

    @@ -1302,7 +1302,7 @@ migrations should apply.

    @@ -1360,7 +1360,7 @@ migrations should apply.

    @@ -1390,7 +1390,7 @@ migrations should apply.

    @@ -1400,7 +1400,7 @@ migrations should apply.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabasePreUpdateEvent.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabasePreUpdateEvent.html index 794183a81..df88fb706 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabasePreUpdateEvent.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabasePreUpdateEvent.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1276,7 +1276,7 @@ righmost column.

    Returns an event that can be stored:

    -
    class MyObserver: TransactionObserver {
    +
    class MyObserver: TransactionObserver {
         var events: [DatabasePreUpdateEvent]
         func databaseWillChange(with event: DatabasePreUpdateEvent) {
             events.append(event.copy())
    @@ -1293,7 +1293,7 @@ righmost column.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabasePreUpdateEvent/Kind.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabasePreUpdateEvent/Kind.html index 3fca60692..7bbfadd3f 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabasePreUpdateEvent/Kind.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabasePreUpdateEvent/Kind.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1074,7 +1074,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseRegion.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseRegion.html index 85122e671..7dee69a0a 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseRegion.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseRegion.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1066,12 +1066,12 @@ cover a full table, or the combination of columns and rows:

    Declaration

    Swift

    -
    public var isEmpty: Bool { get }
    +
    public var isEmpty: Bool { get }
    @@ -1102,7 +1102,7 @@ from all tables.

    @@ -1132,7 +1132,7 @@ from all tables.

    @@ -1181,7 +1181,7 @@ from all tables.

    @@ -1211,7 +1211,7 @@ from all tables.

    @@ -1241,7 +1241,7 @@ from all tables.

    @@ -1283,7 +1283,7 @@ database were modified by an event of this kind.

    @@ -1320,7 +1320,7 @@ region.isModified(byEventsOfKind:) @@ -1330,7 +1330,7 @@ region.isModified(byEventsOfKind:) diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseRegionObservation.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseRegionObservation.html index f3a968092..a2bb24d86 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseRegionObservation.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseRegionObservation.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1017,7 +1017,7 @@ requests, and notifies each database transaction whenever the database changes.

    For example:

    -
    let observation = DatabaseRegionObservation(tracking: Player.all)
    +
    let observation = DatabaseRegionObservation(tracking: Player.all)
     let observer = try observation.start(in: dbQueue) { db: Database in
         print("Players have changed.")
     }
    @@ -1055,7 +1055,7 @@ is deallocated.

    @@ -1083,7 +1083,7 @@ database transaction.

    For example, this sample code counts the number of a times the player table is modified:

    -
    let observation = DatabaseRegionObservation(tracking: Player.all())
    +
    let observation = DatabaseRegionObservation(tracking: Player.all())
     
     var count = 0
     let observer = observation.start(in: dbQueue) { _ in
    @@ -1124,7 +1124,7 @@ deallocated. See the 
    -                        Show on GitHub
    +                        Show on GitHub
                           
                         
                       
    @@ -1148,7 +1148,7 @@ database transaction.

    For example, this sample code counts the number of a times the player table is modified:

    -
    let observation = DatabaseRegionObservation(tracking: [Player.all()])
    +
    let observation = DatabaseRegionObservation(tracking: [Player.all()])
     
     var count = 0
     let observer = observation.start(in: dbQueue) { _ in
    @@ -1189,7 +1189,7 @@ deallocated. See the 
    -                        Show on GitHub
    +                        Show on GitHub
                           
                         
                       
    @@ -1263,7 +1263,7 @@ with write access each time the observed region has been modified.

    a TransactionObserver

    @@ -1273,7 +1273,7 @@ with write access each time the observed region has been modified.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseValue.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseValue.html index 51ecb5ac6..569214a5a 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseValue.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseValue.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1106,7 +1106,7 @@ @@ -1138,7 +1138,7 @@ @@ -1174,12 +1174,12 @@

    Declaration

    Swift

    -
    public var isNull: Bool { get }
    +
    public var isNull: Bool { get }
    @@ -1234,7 +1234,7 @@ storages instead:

    @@ -1270,12 +1270,12 @@ storages instead:

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1305,7 +1305,7 @@ storages instead:

    @@ -1315,7 +1315,7 @@ storages instead:

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseValue/Storage.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseValue/Storage.html index 595b8cb56..b0d773d83 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseValue/Storage.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/DatabaseValue/Storage.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1103,7 +1103,7 @@ @@ -1133,7 +1133,7 @@ @@ -1163,7 +1163,7 @@ @@ -1188,12 +1188,12 @@

    Declaration

    Swift

    -
    public var value: DatabaseValueConvertible? { get }
    +
    public var value: DatabaseValueConvertible? { get }
    @@ -1227,7 +1227,7 @@ are never equal.

    @@ -1237,7 +1237,7 @@ are never equal.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/EmptyRowAdapter.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/EmptyRowAdapter.html index 0e5714a5e..48eac066c 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/EmptyRowAdapter.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/EmptyRowAdapter.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1053,7 +1053,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3.html index b95599147..49be8c270 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1014,7 +1014,7 @@

    FTS3 lets you define fts3 virtual tables.

    // CREATE VIRTUAL TABLE document USING fts3(content)
    -try db.create(virtualTable: "document", using: FTS3()) { t in
    +try db.create(virtualTable: "document", using: FTS3()) { t in
         t.column("content")
     }
     
    @@ -1052,7 +1052,7 @@ tokenizer argument.

    @@ -1073,7 +1073,7 @@ tokenizer argument.

    Creates a FTS3 module suitable for the Database create(virtualTable:using:) method.

    // CREATE VIRTUAL TABLE document USING fts3(content)
    -try db.create(virtualTable: "document", using: FTS3()) { t in
    +try db.create(virtualTable: "document", using: FTS3()) { t in
         t.column("content")
     }
     
    @@ -1088,7 +1088,7 @@ tokenizer argument.

    @@ -1129,7 +1129,7 @@ tokenizer argument.

    @@ -1161,7 +1161,7 @@ tokenizer argument.

    @@ -1193,7 +1193,7 @@ tokenizer argument.

    @@ -1225,7 +1225,7 @@ tokenizer argument.

    @@ -1235,7 +1235,7 @@ tokenizer argument.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3/Diacritics.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3/Diacritics.html index 84a6340b2..971df88d7 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3/Diacritics.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3/Diacritics.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1047,7 +1047,7 @@ option matches the raw remove_diacritics=0 tokenizer argument.

    @@ -1078,7 +1078,7 @@ option matches the raw remove_diacritics=1 tokenizer argument.

    @@ -1109,7 +1109,7 @@ available from SQLite 3.27.0

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3Pattern.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3Pattern.html index c4ddc26c3..5111e179a 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3Pattern.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3Pattern.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1065,8 +1065,8 @@ invalid syntax.

    The pattern syntax is documented at https://www.sqlite.org/fts3.html#full_text_index_queries

    -
    try FTS3Pattern(rawPattern: "and") // OK
    -try FTS3Pattern(rawPattern: "AND") // malformed MATCH expression: [AND]
    +
    try FTS3Pattern(rawPattern: "and") // OK
    +try FTS3Pattern(rawPattern: "AND") // malformed MATCH expression: [AND]
     
    @@ -1079,7 +1079,7 @@ invalid syntax.

    @@ -1099,8 +1099,8 @@ invalid syntax.

    Creates a pattern that matches any token found in the input string; returns nil if no pattern could be built.

    -
    FTS3Pattern(matchingAnyTokenIn: "")        // nil
    -FTS3Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
    +
    FTS3Pattern(matchingAnyTokenIn: "")        // nil
    +FTS3Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
     
    @@ -1122,8 +1122,8 @@ returns nil if no pattern could be built.

    Creates a pattern that matches all tokens found in the input string; returns nil if no pattern could be built.

    -
    FTS3Pattern(matchingAllTokensIn: "")        // nil
    -FTS3Pattern(matchingAllTokensIn: "foo bar") // foo bar
    +
    FTS3Pattern(matchingAllTokensIn: "")        // nil
    +FTS3Pattern(matchingAllTokensIn: "foo bar") // foo bar
     
    @@ -1145,8 +1145,8 @@ returns nil if no pattern could be built.

    Creates a pattern that matches a contiguous string; returns nil if no pattern could be built.

    -
    FTS3Pattern(matchingPhrase: "")        // nil
    -FTS3Pattern(matchingPhrase: "foo bar") // "foo bar"
    +
    FTS3Pattern(matchingPhrase: "")        // nil
    +FTS3Pattern(matchingPhrase: "foo bar") // "foo bar"
     
    @@ -1168,8 +1168,8 @@ pattern could be built.

    Creates a pattern that matches any token found in the input string; returns nil if no pattern could be built.

    -
    FTS3Pattern(matchingAnyTokenIn: "")        // nil
    -FTS3Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
    +
    FTS3Pattern(matchingAnyTokenIn: "")        // nil
    +FTS3Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
     
    @@ -1202,7 +1202,7 @@ returns nil if no pattern could be built.

    @@ -1222,8 +1222,8 @@ returns nil if no pattern could be built.

    Creates a pattern that matches all tokens found in the input string; returns nil if no pattern could be built.

    -
    FTS3Pattern(matchingAllTokensIn: "")        // nil
    -FTS3Pattern(matchingAllTokensIn: "foo bar") // foo bar
    +
    FTS3Pattern(matchingAllTokensIn: "")        // nil
    +FTS3Pattern(matchingAllTokensIn: "foo bar") // foo bar
     
    @@ -1256,7 +1256,7 @@ returns nil if no pattern could be built.

    @@ -1276,8 +1276,8 @@ returns nil if no pattern could be built.

    Creates a pattern that matches a contiguous string; returns nil if no pattern could be built.

    -
    FTS3Pattern(matchingPhrase: "")        // nil
    -FTS3Pattern(matchingPhrase: "foo bar") // "foo bar"
    +
    FTS3Pattern(matchingPhrase: "")        // nil
    +FTS3Pattern(matchingPhrase: "foo bar") // "foo bar"
     
    @@ -1310,7 +1310,7 @@ pattern could be built.

    @@ -1339,12 +1339,12 @@ pattern could be built.

    Declaration

    Swift

    -
    public var databaseValue: DatabaseValue { get }
    +
    public var databaseValue: DatabaseValue { get }
    @@ -1375,7 +1375,7 @@ a suitable value.

    @@ -1385,7 +1385,7 @@ a suitable value.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3TokenizerDescriptor.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3TokenizerDescriptor.html index 1f6bdee7e..6d0fa27a9 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3TokenizerDescriptor.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS3TokenizerDescriptor.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1013,7 +1013,7 @@

    An FTS3 tokenizer, suitable for FTS3 and FTS4 table definitions:

    -
    db.create(virtualTable: "book", using: FTS4()) { t in
    +
    db.create(virtualTable: "book", using: FTS4()) { t in
         t.tokenizer = .simple // FTS3TokenizerDescriptor
     }
     
    @@ -1038,7 +1038,7 @@

    The simple tokenizer.

    -
    db.create(virtualTable: "book", using: FTS4()) { t in
    +
    db.create(virtualTable: "book", using: FTS4()) { t in
         t.tokenizer = .simple
     }
     
    @@ -1055,7 +1055,7 @@
    @@ -1074,7 +1074,7 @@

    The porter tokenizer.

    -
    db.create(virtualTable: "book", using: FTS4()) { t in
    +
    db.create(virtualTable: "book", using: FTS4()) { t in
         t.tokenizer = .porter
     }
     
    @@ -1091,7 +1091,7 @@
    @@ -1110,7 +1110,7 @@

    The unicode61 tokenizer.

    -
    db.create(virtualTable: "book", using: FTS4()) { t in
    +
    db.create(virtualTable: "book", using: FTS4()) { t in
         t.tokenizer = .unicode61()
     }
     
    @@ -1135,7 +1135,7 @@

    The unicode61 tokenizer.

    -
    db.create(virtualTable: "book", using: FTS4()) { t in
    +
    db.create(virtualTable: "book", using: FTS4()) { t in
         t.tokenizer = .unicode61()
     }
     
    @@ -1203,7 +1203,7 @@ these characters as token characters.

    @@ -1213,7 +1213,7 @@ these characters as token characters.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS4.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS4.html index b08bf4ed8..8949b233b 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS4.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS4.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1014,7 +1014,7 @@

    FTS4 lets you define fts4 virtual tables.

    // CREATE VIRTUAL TABLE document USING fts4(content)
    -try db.create(virtualTable: "document", using: FTS4()) { t in
    +try db.create(virtualTable: "document", using: FTS4()) { t in
         t.column("content")
     }
     
    @@ -1041,7 +1041,7 @@

    Creates a FTS4 module suitable for the Database create(virtualTable:using:) method.

    // CREATE VIRTUAL TABLE document USING fts4(content)
    -try db.create(virtualTable: "document", using: FTS4()) { t in
    +try db.create(virtualTable: "document", using: FTS4()) { t in
         t.column("content")
     }
     
    @@ -1058,7 +1058,7 @@ @@ -1099,7 +1099,7 @@ @@ -1131,7 +1131,7 @@ @@ -1163,7 +1163,7 @@ @@ -1195,7 +1195,7 @@ @@ -1205,7 +1205,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5.html index fd6efb3fb..c86b43462 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1008,7 +1008,7 @@

    FTS5

    FTS5 lets you define fts5 virtual tables.

    // CREATE VIRTUAL TABLE document USING fts5(content)
    -try db.create(virtualTable: "document", using: FTS5()) { t in
    +try db.create(virtualTable: "document", using: FTS5()) { t in
         t.column("content")
     }
     
    @@ -1058,7 +1058,7 @@ tokenizer argument.

    Creates a FTS5 module suitable for the Database create(virtualTable:using:) method.

    // CREATE VIRTUAL TABLE document USING fts5(content)
    -try db.create(virtualTable: "document", using: FTS5()) { t in
    +try db.create(virtualTable: "document", using: FTS5()) { t in
         t.column("content")
     }
     
    @@ -1163,7 +1163,7 @@ tokenizer argument.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5/Diacritics.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5/Diacritics.html index cae98c5a0..9ad5344d2 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5/Diacritics.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5/Diacritics.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1081,7 +1081,7 @@ available from SQLite 3.27.0

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5Pattern.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5Pattern.html index b04859c47..3683221af 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5Pattern.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5Pattern.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1046,8 +1046,8 @@

    Creates a pattern that matches any token found in the input string; returns nil if no pattern could be built.

    -
    FTS5Pattern(matchingAnyTokenIn: "")        // nil
    -FTS5Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
    +
    FTS5Pattern(matchingAnyTokenIn: "")        // nil
    +FTS5Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
     
    @@ -1069,8 +1069,8 @@ returns nil if no pattern could be built.

    Creates a pattern that matches all tokens found in the input string; returns nil if no pattern could be built.

    -
    FTS5Pattern(matchingAllTokensIn: "")        // nil
    -FTS5Pattern(matchingAllTokensIn: "foo bar") // foo bar
    +
    FTS5Pattern(matchingAllTokensIn: "")        // nil
    +FTS5Pattern(matchingAllTokensIn: "foo bar") // foo bar
     
    @@ -1092,8 +1092,8 @@ returns nil if no pattern could be built.

    Creates a pattern that matches a contiguous string; returns nil if no pattern could be built.

    -
    FTS5Pattern(matchingPhrase: "")        // nil
    -FTS5Pattern(matchingPhrase: "foo bar") // "foo bar"
    +
    FTS5Pattern(matchingPhrase: "")        // nil
    +FTS5Pattern(matchingPhrase: "foo bar") // "foo bar"
     
    @@ -1115,8 +1115,8 @@ pattern could be built.

    Creates a pattern that matches a contiguous string prefix; returns nil if no pattern could be built.

    -
    FTS5Pattern(matchingPrefixPhrase: "")        // nil
    -FTS5Pattern(matchingPrefixPhrase: "foo bar") // ^"foo bar"
    +
    FTS5Pattern(matchingPrefixPhrase: "")        // nil
    +FTS5Pattern(matchingPrefixPhrase: "foo bar") // ^"foo bar"
     
    @@ -1171,7 +1171,7 @@ contains a suitable value.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5TokenFlags.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5TokenFlags.html index 041377360..eb2d22e40 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5TokenFlags.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5TokenFlags.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1074,7 +1074,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5Tokenization.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5Tokenization.html index b09bf588a..a9ac6071c 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5Tokenization.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5Tokenization.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1131,7 +1131,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5TokenizerDescriptor.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5TokenizerDescriptor.html index b839fd3fd..fa1552a32 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5TokenizerDescriptor.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FTS5TokenizerDescriptor.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1007,7 +1007,7 @@

    FTS5TokenizerDescriptor

    An FTS5 tokenizer, suitable for FTS5 table definitions:

    -
    db.create(virtualTable: "book", using: FTS5()) { t in
    +
    db.create(virtualTable: "book", using: FTS5()) { t in
         t.tokenizer = .unicode61() // FTS5TokenizerDescriptor
     }
     
    @@ -1057,8 +1057,8 @@

    Creates an FTS5 tokenizer descriptor.

    -
    db.create(virtualTable: "book", using: FTS5()) { t in
    -    let tokenizer = FTS5TokenizerDescriptor(components: ["porter", "unicode61", "remove_diacritics", "0"])
    +
    db.create(virtualTable: "book", using: FTS5()) { t in
    +    let tokenizer = FTS5TokenizerDescriptor(components: ["porter", "unicode61", "remove_diacritics", "0"])
         t.tokenizer = tokenizer
     }
     
    @@ -1086,7 +1086,7 @@

    The ascii tokenizer

    -
    db.create(virtualTable: "book", using: FTS5()) { t in
    +
    db.create(virtualTable: "book", using: FTS5()) { t in
         t.tokenizer = .ascii()
     }
     
    @@ -1130,7 +1130,7 @@

    An unicode61 tokenizer

    -
    db.create(virtualTable: "book", using: FTS5()) { t in
    +
    db.create(virtualTable: "book", using: FTS5()) { t in
         t.tokenizer = .unicode61()
     }
     
    @@ -1146,7 +1146,7 @@
    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FetchedRecordsSectionInfo.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FetchedRecordsSectionInfo.html index 5fb86e48e..1d0865851 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FetchedRecordsSectionInfo.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/FetchedRecordsSectionInfo.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1038,12 +1038,12 @@

    Declaration

    Swift

    -
    public var numberOfRecords: Int { get }
    +
    public var numberOfRecords: Int { get }
    @@ -1073,7 +1073,7 @@ @@ -1083,7 +1083,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ForeignKey.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ForeignKey.html index 5d4b05a7e..65bab6de4 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ForeignKey.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ForeignKey.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1032,10 +1032,10 @@ foreign key from book to person, or Could not infer foreign key from book to person.

    Your help is needed. You have to instruct GRDB which foreign key to use:

    -
    struct Book: TableRecord {
    +
    struct Book: TableRecord {
         // Define foreign keys
    -    static let authorForeignKey = ForeignKey(["authorId"]))
    -    static let translatorForeignKey = ForeignKey(["translatorId"]))
    +    static let authorForeignKey = ForeignKey(["authorId"]))
    +    static let translatorForeignKey = ForeignKey(["translatorId"]))
     
         // Use foreign keys to define associations:
         static let author = belongsTo(Person.self, using: authorForeignKey)
    @@ -1046,27 +1046,27 @@ to person.

    Foreign keys are always defined from the table that contains the columns at the origin of the foreign key. Person’s symmetric HasMany associations reuse Book’s foreign keys:

    -
    struct Person: TableRecord {
    +
    struct Person: TableRecord {
         static let writtenBooks = hasMany(Book.self, using: Book.authorForeignKey)
         static let translatedBooks = hasMany(Book.self, using: Book.translatorForeignKey)
     }
     

    Foreign keys can also be defined from query interface columns:

    -
    struct Book: TableRecord {
    -    enum Columns: String, ColumnExpression {
    +
    struct Book: TableRecord {
    +    enum Columns: String, ColumnExpression {
             case id, title, authorId, translatorId
         }
     
    -    static let authorForeignKey = ForeignKey([Columns.authorId]))
    -    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
    +    static let authorForeignKey = ForeignKey([Columns.authorId]))
    +    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
     }
     

    When the destination table of a foreign key does not define any primary key, you need to provide the full definition of a foreign key:

    -
    struct Book: TableRecord {
    -    static let authorForeignKey = ForeignKey(["authorId"], to: ["id"]))
    +
    struct Book: TableRecord {
    +    static let authorForeignKey = ForeignKey(["authorId"], to: ["id"]))
         static let author = belongsTo(Person.self, using: authorForeignKey)
     }
     
    @@ -1089,10 +1089,10 @@ you need to provide the full definition of a foreign key:

    Creates a ForeignKey intended to define a record association.

    -
    struct Book: TableRecord {
    +
    struct Book: TableRecord {
         // Define foreign keys
    -    static let authorForeignKey = ForeignKey(["authorId"]))
    -    static let translatorForeignKey = ForeignKey(["translatorId"]))
    +    static let authorForeignKey = ForeignKey(["authorId"]))
    +    static let translatorForeignKey = ForeignKey(["translatorId"]))
     
         // Use foreign keys to define associations:
         static let author = belongsTo(Person.self, using: authorForeignKey)
    @@ -1143,7 +1143,7 @@ primary key.

    @@ -1162,15 +1162,15 @@ primary key.

    Creates a ForeignKey intended to define a record association.

    -
    struct Book: TableRecord {
    +
    struct Book: TableRecord {
         // Define columns
    -    enum Columns: String, ColumnExpression {
    +    enum Columns: String, ColumnExpression {
             case id, title, authorId, translatorId
         }
     
         // Define foreign keys
    -    static let authorForeignKey = ForeignKey([Columns.authorId]))
    -    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
    +    static let authorForeignKey = ForeignKey([Columns.authorId]))
    +    static let translatorForeignKey = ForeignKey([Columns.translatorId]))
     
         // Use foreign keys to define associations:
         static let author = belongsTo(Person.self, using: authorForeignKey)
    @@ -1221,7 +1221,7 @@ primary key.

    @@ -1231,7 +1231,7 @@ primary key.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ForeignKeyInfo.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ForeignKeyInfo.html index 42ef28994..854e6e9a0 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ForeignKeyInfo.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ForeignKeyInfo.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1044,7 +1044,7 @@ @@ -1074,7 +1074,7 @@ @@ -1104,7 +1104,7 @@ @@ -1134,7 +1134,7 @@ @@ -1144,7 +1144,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/IndexInfo.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/IndexInfo.html index 0f2695d83..bd7c80aac 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/IndexInfo.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/IndexInfo.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1045,7 +1045,7 @@ @@ -1075,7 +1075,7 @@ @@ -1105,7 +1105,7 @@ @@ -1115,7 +1115,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Inflections.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Inflections.html index 35e657c15..9adea2f59 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Inflections.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/Inflections.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1052,7 +1052,7 @@ @@ -1082,7 +1082,7 @@

    Appends a pluralization rule.

    -
    var inflections = Inflections()
    +
    var inflections = Inflections()
     inflections.plural("$", "s")
     inflections.pluralize("player") // "players"
     
    @@ -1144,7 +1144,7 @@
    @@ -1163,7 +1163,7 @@

    Appends a singularization rule.

    -
    var inflections = Inflections()
    +
    var inflections = Inflections()
     inflections.singular("s$", "")
     inflections.singularize("players") // "player"
     
    @@ -1225,7 +1225,7 @@
    @@ -1244,7 +1244,7 @@

    Appends uncountable words.

    -
    var inflections = Inflections()
    +
    var inflections = Inflections()
     inflections.plural("$", "s")
     inflections.uncountableWords(["foo"])
     inflections.pluralize("foo") // "foo"
    @@ -1261,7 +1261,7 @@
                             
    @@ -1280,7 +1280,7 @@

    Appends an irregular singular/plural pair.

    -
    var inflections = Inflections()
    +
    var inflections = Inflections()
     inflections.plural("$", "s")
     inflections.irregularSuffix("man", "men")
     inflections.pluralize("man")      // "men"
    @@ -1328,7 +1328,7 @@
                             
                           
    @@ -1371,7 +1371,7 @@ @@ -1401,7 +1401,7 @@ @@ -1430,12 +1430,12 @@

    Declaration

    Swift

    -
    public static var `default`: Inflections
    +
    public static var `default`: Inflections
    @@ -1445,7 +1445,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PersistenceConflictPolicy.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PersistenceConflictPolicy.html index 71221e774..3ba5046cf 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PersistenceConflictPolicy.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PersistenceConflictPolicy.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1048,7 +1048,7 @@ conflicts when records are inserted or updated.

    @@ -1078,7 +1078,7 @@ conflicts when records are inserted or updated.

    @@ -1108,7 +1108,7 @@ conflicts when records are inserted or updated.

    @@ -1118,7 +1118,7 @@ conflicts when records are inserted or updated.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PersistenceContainer.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PersistenceContainer.html index 750a09eed..566828501 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PersistenceContainer.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PersistenceContainer.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1014,7 +1014,7 @@

    Use persistence containers in the encode(to:) method of your encodable records:

    -
    struct Player: EncodableRecord {
    +
    struct Player: EncodableRecord {
         var id: Int64?
         var name: String?
     
    @@ -1054,12 +1054,12 @@ is considered undefined behavior.

    Swift

    @inlinable
    -public subscript(column: String) -> DatabaseValueConvertible? { get set }
    +public subscript(column: String) -> DatabaseValueConvertible? { get set }
    @@ -1089,12 +1089,12 @@ is considered undefined behavior.

    Swift

    @inlinable
    -public subscript<Column>(column: Column) -> DatabaseValueConvertible? where Column : ColumnExpression { get set }
    +public subscript<Column>(column: Column) -> DatabaseValueConvertible? where Column : ColumnExpression { get set }
    @@ -1104,7 +1104,7 @@ is considered undefined behavior.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PreparedRequest.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PreparedRequest.html index 8783dbd54..5459336e2 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PreparedRequest.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PreparedRequest.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1043,7 +1043,7 @@ @@ -1073,7 +1073,7 @@ @@ -1138,7 +1138,7 @@ select statement.

    @@ -1148,7 +1148,7 @@ select statement.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PrimaryKeyInfo.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PrimaryKeyInfo.html index 362a667d1..5a01ccc9b 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PrimaryKeyInfo.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/PrimaryKeyInfo.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1081,7 +1081,7 @@ @@ -1106,12 +1106,12 @@

    Declaration

    Swift

    -
    public var rowIDColumn: String? { get }
    +
    public var rowIDColumn: String? { get }
    @@ -1136,12 +1136,12 @@

    Declaration

    Swift

    -
    public var isRowID: Bool { get }
    +
    public var isRowID: Bool { get }
    @@ -1151,7 +1151,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/QueryInterfaceRequest.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/QueryInterfaceRequest.html index 099ee1786..b76f5ea2a 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/QueryInterfaceRequest.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/QueryInterfaceRequest.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1015,10 +1015,10 @@

    QueryInterfaceRequest is a request that generates SQL for you.

    For example:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         let request = Player
    -        .filter(Column("score") > 1000)
    -        .order(Column("name"))
    +        .filter(Column("score") > 1000)
    +        .order(Column("name"))
         let players = try request.fetchAll(db) // [Player]
     }
     
    @@ -1066,7 +1066,7 @@ @@ -1101,7 +1101,7 @@ @@ -1138,7 +1138,7 @@ the eventual set of already applied predicates.

    @@ -1171,7 +1171,7 @@ the eventual set of already applied predicates.

    @@ -1203,14 +1203,14 @@ the eventual set of already applied predicates.

    Creates a request which selects selection.

    // SELECT id, email FROM player
     var request = Player.all()
    -request = request.select([Column("id"), Column("email")])
    +request = request.select([Column("id"), Column("email")])
     

    Any previous selection is replaced:

    // SELECT email FROM player
     request
    -    .select([Column("id")])
    -    .select([Column("email")])
    +    .select([Column("id")])
    +    .select([Column("email")])
     
    @@ -1223,7 +1223,7 @@ the eventual set of already applied predicates.

    @@ -1243,9 +1243,9 @@ the eventual set of already applied predicates.

    Creates a request which selects selection, and fetches values of type type.

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         // SELECT max(score) FROM player
    -    let request = Player.all().select([max(Column("score"))], as: Int.self)
    +    let request = Player.all().select([max(Column("score"))], as: Int.self)
         let maxScore: Int? = try request.fetchOne(db)
     }
     
    @@ -1261,7 +1261,7 @@ type type.

    @@ -1281,9 +1281,9 @@ type type.

    Creates a request which selects selection, and fetches values of type type.

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         // SELECT max(score) FROM player
    -    let request = Player.all().select(max(Column("score")), as: Int.self)
    +    let request = Player.all().select(max(Column("score")), as: Int.self)
         let maxScore: Int? = try request.fetchOne(db)
     }
     
    @@ -1299,7 +1299,7 @@ type type.

    @@ -1319,7 +1319,7 @@ type type.

    Creates a request which selects sql, and fetches values of type type.

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         // SELECT max(score) FROM player
         let request = Player.all().select(sql: "max(score)", as: Int.self)
         let maxScore: Int? = try request.fetchOne(db)
    @@ -1333,14 +1333,14 @@ type type.

    Swift

    public func select<RowDecoder>(
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         as type: RowDecoder.Type)
         -> QueryInterfaceRequest<RowDecoder>
    @@ -1360,12 +1360,12 @@ type type.

    Creates a request which selects an SQL literal, and fetches values of type type.

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         // SELECT IFNULL(name, 'Anonymous') FROM player WHERE id = 42
         let request = Player.
             .filter(primaryKey: 42)
             .select(
    -            SQLLiteral(
    +            SQLLiteral(
                     sql: "IFNULL(name, ?)",
                     arguments: ["Anonymous"]),
                 as: String.self)
    @@ -1375,7 +1375,7 @@ type type.

    With Swift 5, you can safely embed raw values in your SQL queries, without any risk of syntax errors or SQL injection:

    -
    try dbQueue.read { db in
    +
    try dbQueue.read { db in
         // SELECT IFNULL(name, 'Anonymous') FROM player WHERE id = 42
         let request = Player.
             .filter(primaryKey: 42)
    @@ -1399,7 +1399,7 @@ without any risk of syntax errors or SQL injection:

    @@ -1421,8 +1421,8 @@ without any risk of syntax errors or SQL injection:

    // SELECT id, email, name FROM player
     var request = Player.all()
     request = request
    -    .select([Column("id"), Column("email")])
    -    .annotated(with: [Column("name")])
    +    .select([Column("id"), Column("email")])
    +    .annotated(with: [Column("name")])
     
    @@ -1435,7 +1435,7 @@ without any risk of syntax errors or SQL injection:

    @@ -1468,7 +1468,7 @@ without any risk of syntax errors or SQL injection:

    eventual set of already applied predicates.

    // SELECT * FROM player WHERE 1
     var request = Player.all()
    -request = request.filter { db in true }
    +request = request.filter { db in true }
     
    @@ -1481,7 +1481,7 @@ eventual set of already applied predicates.

    @@ -1513,15 +1513,15 @@ eventual set of already applied predicates.

    Creates a request with the provided orderings promise.

    // SELECT * FROM player ORDER BY name
     var request = Player.all()
    -request = request.order { _ in [Column("name")] }
    +request = request.order { _ in [Column("name")] }
     

    Any previous ordering is replaced:

    // SELECT * FROM player ORDER BY name
     request
    -    .order{ _ in [Column("email")] }
    +    .order{ _ in [Column("email")] }
         .reversed()
    -    .order{ _ in [Column("name")] }
    +    .order{ _ in [Column("name")] }
     
    @@ -1534,7 +1534,7 @@ eventual set of already applied predicates.

    @@ -1554,7 +1554,7 @@ eventual set of already applied predicates.

    Creates a request that reverses applied orderings.

    // SELECT * FROM player ORDER BY name DESC
    -var request = Player.all().order(Column("name"))
    +var request = Player.all().order(Column("name"))
     request = request.reversed()
     
    @@ -1574,7 +1574,7 @@ eventual set of already applied predicates.

    @@ -1594,7 +1594,7 @@ eventual set of already applied predicates.

    Creates a request without any ordering.

    // SELECT * FROM player
    -var request = Player.all().order(Column("name"))
    +var request = Player.all().order(Column("name"))
     request = request.unordered()
     
    @@ -1608,7 +1608,7 @@ eventual set of already applied predicates.

    @@ -1649,7 +1649,7 @@ eventual set of already applied predicates.

    @@ -1680,7 +1680,7 @@ eventual set of already applied predicates.

    @@ -1715,7 +1715,7 @@ eventual set of already applied predicates.

    request = request.distinct() // SELECT DISTINCT name FROM player -var request = Player.select(Column("name")) +var request = Player.select(Column("name")) request = request.distinct()
    @@ -1729,7 +1729,7 @@ eventual set of already applied predicates.

    @@ -1765,7 +1765,7 @@ eventual set of already applied predicates.

    @@ -1788,17 +1788,17 @@ a specific database table.

    In the example below, the team.avgScore < player.score condition in the ON clause could be not achieved without table aliases.

    -
    struct Player: TableRecord {
    +
    struct Player: TableRecord {
         static let team = belongsTo(Team.self)
     }
     
     // SELECT player.*, team.*
     // JOIN team ON ... AND team.avgScore < player.score
    -let playerAlias = TableAlias()
    +let playerAlias = TableAlias()
     let request = Player
         .all()
         .aliased(playerAlias)
    -    .including(required: Player.team.filter(Column("avgScore") < playerAlias[Column("score")])
    +    .including(required: Player.team.filter(Column("avgScore") < playerAlias[Column("score")])
     
    @@ -1811,7 +1811,7 @@ the ON clause could be not achieved without table aliases.

    @@ -1873,7 +1873,7 @@ value, record).

    A typed request bound to type Target.

    @@ -1943,7 +1943,7 @@ value, record).

    The number of deleted rows

    @@ -1953,7 +1953,7 @@ value, record).

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/RangeRowAdapter.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/RangeRowAdapter.html index 68fbadbac..6cc77587a 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/RangeRowAdapter.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/RangeRowAdapter.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1013,7 +1013,7 @@

    RangeRowAdapter is a row adapter that only exposes a range of columns.

    -
    let adapter = RangeRowAdapter(1..<3)
    +
    let adapter = RangeRowAdapter(1..<3)
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz, 4 as qux"
     
     // [bar:2 baz:3]
    @@ -1049,7 +1049,7 @@
                             
                           
                           
                         
                       
    @@ -1079,7 +1079,7 @@
                             
                           
                           
                         
                       
    @@ -1089,7 +1089,7 @@
               
             
             
           
    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ResultCode.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ResultCode.html
    index 991bf4303..a8d757ee9 100644
    --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ResultCode.html
    +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ResultCode.html
    @@ -14,7 +14,7 @@
         
         
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1042,7 +1042,7 @@ @@ -1071,7 +1071,7 @@ @@ -1100,12 +1100,12 @@ See https://www.sqlite.org/rescode

    Declaration

    Swift

    -
    public var primaryResultCode: ResultCode { get }
    +
    public var primaryResultCode: ResultCode { get }
    @@ -1127,7 +1127,7 @@ See https://www.sqlite.org/rescode

    Primary result codes match themselves and their extended result codes, while extended result codes match only themselves:

    -
    switch error.extendedResultCode {
    +
    switch error.extendedResultCode {
     case .SQLITE_CONSTRAINT_FOREIGNKEY: // foreign key constraint error
     case .SQLITE_CONSTRAINT:            // any other constraint error
     default:                            // any other database error
    @@ -1144,7 +1144,7 @@ while extended result codes match only themselves:

    @@ -1174,7 +1174,7 @@ while extended result codes match only themselves:

    @@ -1204,7 +1204,7 @@ while extended result codes match only themselves:

    @@ -1234,7 +1234,7 @@ while extended result codes match only themselves:

    @@ -1264,7 +1264,7 @@ while extended result codes match only themselves:

    @@ -1294,7 +1294,7 @@ while extended result codes match only themselves:

    @@ -1324,7 +1324,7 @@ while extended result codes match only themselves:

    @@ -1354,7 +1354,7 @@ while extended result codes match only themselves:

    @@ -1384,7 +1384,7 @@ while extended result codes match only themselves:

    @@ -1414,7 +1414,7 @@ while extended result codes match only themselves:

    @@ -1444,7 +1444,7 @@ while extended result codes match only themselves:

    @@ -1474,7 +1474,7 @@ while extended result codes match only themselves:

    @@ -1504,7 +1504,7 @@ while extended result codes match only themselves:

    @@ -1534,7 +1534,7 @@ while extended result codes match only themselves:

    @@ -1564,7 +1564,7 @@ while extended result codes match only themselves:

    @@ -1594,7 +1594,7 @@ while extended result codes match only themselves:

    @@ -1624,7 +1624,7 @@ while extended result codes match only themselves:

    @@ -1654,7 +1654,7 @@ while extended result codes match only themselves:

    @@ -1684,7 +1684,7 @@ while extended result codes match only themselves:

    @@ -1714,7 +1714,7 @@ while extended result codes match only themselves:

    @@ -1744,7 +1744,7 @@ while extended result codes match only themselves:

    @@ -1774,7 +1774,7 @@ while extended result codes match only themselves:

    @@ -1804,7 +1804,7 @@ while extended result codes match only themselves:

    @@ -1834,7 +1834,7 @@ while extended result codes match only themselves:

    @@ -1864,7 +1864,7 @@ while extended result codes match only themselves:

    @@ -1894,7 +1894,7 @@ while extended result codes match only themselves:

    @@ -1924,7 +1924,7 @@ while extended result codes match only themselves:

    @@ -1954,7 +1954,7 @@ while extended result codes match only themselves:

    @@ -1984,7 +1984,7 @@ while extended result codes match only themselves:

    @@ -2014,7 +2014,7 @@ while extended result codes match only themselves:

    @@ -2044,7 +2044,7 @@ while extended result codes match only themselves:

    @@ -2074,7 +2074,7 @@ while extended result codes match only themselves:

    @@ -2104,7 +2104,7 @@ while extended result codes match only themselves:

    @@ -2134,7 +2134,7 @@ while extended result codes match only themselves:

    @@ -2164,7 +2164,7 @@ while extended result codes match only themselves:

    @@ -2194,7 +2194,7 @@ while extended result codes match only themselves:

    @@ -2224,7 +2224,7 @@ while extended result codes match only themselves:

    @@ -2254,7 +2254,7 @@ while extended result codes match only themselves:

    @@ -2284,7 +2284,7 @@ while extended result codes match only themselves:

    @@ -2314,7 +2314,7 @@ while extended result codes match only themselves:

    @@ -2344,7 +2344,7 @@ while extended result codes match only themselves:

    @@ -2374,7 +2374,7 @@ while extended result codes match only themselves:

    @@ -2404,7 +2404,7 @@ while extended result codes match only themselves:

    @@ -2434,7 +2434,7 @@ while extended result codes match only themselves:

    @@ -2464,7 +2464,7 @@ while extended result codes match only themselves:

    @@ -2494,7 +2494,7 @@ while extended result codes match only themselves:

    @@ -2524,7 +2524,7 @@ while extended result codes match only themselves:

    @@ -2554,7 +2554,7 @@ while extended result codes match only themselves:

    @@ -2584,7 +2584,7 @@ while extended result codes match only themselves:

    @@ -2614,7 +2614,7 @@ while extended result codes match only themselves:

    @@ -2644,7 +2644,7 @@ while extended result codes match only themselves:

    @@ -2674,7 +2674,7 @@ while extended result codes match only themselves:

    @@ -2704,7 +2704,7 @@ while extended result codes match only themselves:

    @@ -2734,7 +2734,7 @@ while extended result codes match only themselves:

    @@ -2764,7 +2764,7 @@ while extended result codes match only themselves:

    @@ -2794,7 +2794,7 @@ while extended result codes match only themselves:

    @@ -2824,7 +2824,7 @@ while extended result codes match only themselves:

    @@ -2854,7 +2854,7 @@ while extended result codes match only themselves:

    @@ -2884,7 +2884,7 @@ while extended result codes match only themselves:

    @@ -2914,7 +2914,7 @@ while extended result codes match only themselves:

    @@ -2944,7 +2944,7 @@ while extended result codes match only themselves:

    @@ -2974,7 +2974,7 @@ while extended result codes match only themselves:

    @@ -3004,7 +3004,7 @@ while extended result codes match only themselves:

    @@ -3034,7 +3034,7 @@ while extended result codes match only themselves:

    @@ -3064,7 +3064,7 @@ while extended result codes match only themselves:

    @@ -3094,7 +3094,7 @@ while extended result codes match only themselves:

    @@ -3124,7 +3124,7 @@ while extended result codes match only themselves:

    @@ -3154,7 +3154,7 @@ while extended result codes match only themselves:

    @@ -3184,7 +3184,7 @@ while extended result codes match only themselves:

    @@ -3214,7 +3214,7 @@ while extended result codes match only themselves:

    @@ -3244,7 +3244,7 @@ while extended result codes match only themselves:

    @@ -3274,7 +3274,7 @@ while extended result codes match only themselves:

    @@ -3304,7 +3304,7 @@ while extended result codes match only themselves:

    @@ -3334,7 +3334,7 @@ while extended result codes match only themselves:

    @@ -3364,7 +3364,7 @@ while extended result codes match only themselves:

    @@ -3394,7 +3394,7 @@ while extended result codes match only themselves:

    @@ -3424,7 +3424,7 @@ while extended result codes match only themselves:

    @@ -3454,7 +3454,7 @@ while extended result codes match only themselves:

    @@ -3484,7 +3484,7 @@ while extended result codes match only themselves:

    @@ -3514,7 +3514,7 @@ while extended result codes match only themselves:

    @@ -3544,7 +3544,7 @@ while extended result codes match only themselves:

    @@ -3574,7 +3574,7 @@ while extended result codes match only themselves:

    @@ -3604,7 +3604,7 @@ while extended result codes match only themselves:

    @@ -3634,7 +3634,7 @@ while extended result codes match only themselves:

    @@ -3664,7 +3664,7 @@ while extended result codes match only themselves:

    @@ -3694,7 +3694,7 @@ while extended result codes match only themselves:

    @@ -3724,7 +3724,7 @@ while extended result codes match only themselves:

    @@ -3754,7 +3754,7 @@ while extended result codes match only themselves:

    @@ -3764,7 +3764,7 @@ while extended result codes match only themselves:

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLExpressionLiteral.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLExpressionLiteral.html index 11df4eaa9..4c5d1e065 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLExpressionLiteral.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLExpressionLiteral.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1015,12 +1015,12 @@

    Experimental

    SQLExpressionLiteral is an expression built from a raw SQL snippet.

    -
    SQLExpressionLiteral(sql: "1 + 2")
    +
    SQLExpressionLiteral(sql: "1 + 2")
     

    The SQL literal may contain ? and colon-prefixed arguments:

    -
    SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
    -SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
    +
    SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
    +SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
     
    @@ -1047,12 +1047,12 @@

    Declaration

    Swift

    -
    public var sql: String { get }
    +
    public var sql: String { get }
    @@ -1077,12 +1077,12 @@

    Declaration

    Swift

    -
    public var arguments: StatementArguments { get }
    +
    public var arguments: StatementArguments { get }
    @@ -1103,9 +1103,9 @@

    Experimental

    Creates an SQL literal expression.

    -
    SQLExpressionLiteral(sql: "1 + 2")
    -SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
    -SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
    +
    SQLExpressionLiteral(sql: "1 + 2")
    +SQLExpressionLiteral(sql: "? + ?", arguments: [1, 2])
    +SQLExpressionLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2])
     
    @@ -1113,12 +1113,12 @@

    Declaration

    Swift

    -
    public init(sql: String, arguments: StatementArguments = StatementArguments())
    +
    public init(sql: String, arguments: StatementArguments = StatementArguments())
    @@ -1139,14 +1139,14 @@

    Experimental

    Creates an SQL literal expression.

    -
    SQLExpressionLiteral(literal: SQLLiteral(sql: "1 + 2")
    -SQLExpressionLiteral(literal: SQLLiteral(sql: "? + ?", arguments: [1, 2]))
    -SQLExpressionLiteral(literal: SQLLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2]))
    +
    SQLExpressionLiteral(literal: SQLLiteral(sql: "1 + 2")
    +SQLExpressionLiteral(literal: SQLLiteral(sql: "? + ?", arguments: [1, 2]))
    +SQLExpressionLiteral(literal: SQLLiteral(sql: ":one + :two", arguments: ["one": 1, "two": 2]))
     

    With Swift 5, you can safely embed raw values in your SQL queries, without any risk of syntax errors or SQL injection:

    -
    SQLExpressionLiteral(literal: "\(1) + \(2)")
    +
    SQLExpressionLiteral(literal: "\(1) + \(2)")
     
    @@ -1159,7 +1159,7 @@ without any risk of syntax errors or SQL injection:

    @@ -1169,7 +1169,7 @@ without any risk of syntax errors or SQL injection:

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLFunctionName.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLFunctionName.html index c488716f4..25a4ee970 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLFunctionName.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLFunctionName.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1052,7 +1052,7 @@ @@ -1093,7 +1093,7 @@ @@ -1134,7 +1134,7 @@ @@ -1175,7 +1175,7 @@ @@ -1216,7 +1216,7 @@ @@ -1257,7 +1257,7 @@ @@ -1298,7 +1298,7 @@ @@ -1308,7 +1308,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLLiteral.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLLiteral.html index 4413e0819..fce419a51 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLLiteral.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLLiteral.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1016,7 +1016,7 @@ Interpolation.

    For example:

    -
    try dbQueue.write { db in
    +
    try dbQueue.write { db in
         let name: String = ...
         let id: Int64 = ...
         let query: SQLLiteral = "UPDATE player SET name = \(name) WHERE id = \(id)"
    @@ -1053,7 +1053,7 @@ Interpolation.

    @@ -1083,7 +1083,7 @@ Interpolation.

    @@ -1104,7 +1104,7 @@ Interpolation.

    Creates an SQLLiteral from a plain SQL string, and eventual arguments.

    For example:

    -
    let query = SQLLiteral(
    +
    let query = SQLLiteral(
         sql: "UPDATE player SET name = ? WHERE id = ?",
         arguments: [name, id])
     
    @@ -1114,12 +1114,12 @@ Interpolation.

    Declaration

    Swift

    -
    public init(sql: String, arguments: StatementArguments = StatementArguments())
    +
    public init(sql: String, arguments: StatementArguments = StatementArguments())
    @@ -1149,7 +1149,7 @@ Interpolation.

    @@ -1188,7 +1188,7 @@ Interpolation.

    @@ -1222,7 +1222,7 @@ Interpolation.

    @@ -1256,7 +1256,7 @@ Interpolation.

    @@ -1285,12 +1285,12 @@ Interpolation.

    Declaration

    Swift

    -
    public mutating func append(sql: String, arguments: StatementArguments = StatementArguments())
    +
    public mutating func append(sql: String, arguments: StatementArguments = StatementArguments())
    @@ -1300,7 +1300,7 @@ Interpolation.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLRequest.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLRequest.html index fb18cb66d..74e6b5953 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLRequest.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SQLRequest.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1042,7 +1042,7 @@ @@ -1071,12 +1071,12 @@

    Declaration

    Swift

    -
    public var sql: String { get }
    +
    public var sql: String { get }
    @@ -1105,12 +1105,12 @@

    Declaration

    Swift

    -
    public var arguments: StatementArguments { get }
    +
    public var arguments: StatementArguments { get }
    @@ -1140,7 +1140,7 @@ @@ -1175,7 +1175,7 @@ optional row adapter.

    Swift

    public init(
         sql: String,
    -    arguments: StatementArguments = StatementArguments(),
    +    arguments: StatementArguments = StatementArguments(),
         adapter: RowAdapter? = nil,
         cached: Bool = false)
    @@ -1242,7 +1242,7 @@ prepared statement.

    A SQLRequest

    @@ -1261,10 +1261,10 @@ prepared statement.

    Creates a request from an SQLLiteral, and optional row adapter.

    -
    let request = SQLRequest<String>(literal: SQLLiteral(sql: """
    +
    let request = SQLRequest<String>(literal: SQLLiteral(sql: """
         SELECT name FROM player
         """))
    -let request = SQLRequest<Player>(literal: SQLLiteral(sql: """
    +let request = SQLRequest<Player>(literal: SQLLiteral(sql: """
         SELECT * FROM player WHERE name = ?
         """, arguments: ["O'Brien"]))
     
    @@ -1334,7 +1334,7 @@ prepared statement.

    A SQLRequest

    @@ -1417,7 +1417,7 @@ prepared statement.

    An SQLRequest

    @@ -1427,7 +1427,7 @@ prepared statement.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ScopeAdapter.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ScopeAdapter.html index 79ab18b65..fc7cad2a9 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ScopeAdapter.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ScopeAdapter.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1014,11 +1014,11 @@

    ScopeAdapter is a row adapter that lets you define scopes on rows.

    // Two adapters
    -let fooAdapter = ColumnMapping(["value": "foo"])
    -let barAdapter = ColumnMapping(["value": "bar"])
    +let fooAdapter = ColumnMapping(["value": "foo"])
    +let barAdapter = ColumnMapping(["value": "bar"])
     
     // Define scopes
    -let adapter = ScopeAdapter([
    +let adapter = ScopeAdapter([
         "foo": fooAdapter,
         "bar": barAdapter])
     
    @@ -1055,7 +1055,7 @@
                             

    Creates an adapter that preserves row contents and add scoped rows.

    For example:

    -
    let adapter = ScopeAdapter(["suffix": SuffixRowAdapter(fromIndex: 1)])
    +
    let adapter = ScopeAdapter(["suffix": SuffixRowAdapter(fromIndex: 1)])
     let row = try Row.fetchOne(db, sql: "SELECT 1, 2, 3", adapter: adapter)!
     row                  // [1, 2, 3]
     row.scopes["suffix"] // [2, 3]
    @@ -1091,7 +1091,7 @@ row adapters.

    @@ -1112,8 +1112,8 @@ row adapters.

    Creates an adapter based on the base adapter, and add scoped rows.

    For example:

    -
    let baseAdapter = RangeRowAdapter(0..<1)
    -let adapter = ScopeAdapter(base: baseAdapter, scopes: ["suffix": SuffixRowAdapter(fromIndex: 1)])
    +
    let baseAdapter = RangeRowAdapter(0..<1)
    +let adapter = ScopeAdapter(base: baseAdapter, scopes: ["suffix": SuffixRowAdapter(fromIndex: 1)])
     let row = try Row.fetchOne(db, sql: "SELECT 1, 2, 3", adapter: adapter)!
     row                   // [1]
     row.scopes["initial"] // [2, 3]
    @@ -1167,7 +1167,7 @@ row adapters.

    @@ -1177,7 +1177,7 @@ row adapters.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/StatementArguments.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/StatementArguments.html index bf1f559e7..dacf3f0e3 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/StatementArguments.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/StatementArguments.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1031,7 +1031,7 @@ number already assigned

    To fill question marks placeholders, feed StatementArguments with an array:

    db.execute(
         sql: "INSERT ... (?, ?)",
    -    arguments: StatementArguments(["Arthur", 41]))
    +    arguments: StatementArguments(["Arthur", 41]))
     
     // Array literals are automatically converted:
     db.execute(
    @@ -1043,7 +1043,7 @@ number already assigned
     

    To fill named arguments, feed StatementArguments with a dictionary:

    db.execute(
         sql: "INSERT ... (:name, :score)",
    -    arguments: StatementArguments(["name": "Arthur", "score": 41]))
    +    arguments: StatementArguments(["name": "Arthur", "score": 41]))
     
     // Dictionary literals are automatically converted:
     db.execute(
    @@ -1114,12 +1114,12 @@ confusing, and it is best to avoid this practice:

    Declaration

    Swift

    -
    public var isEmpty: Bool { get }
    +
    public var isEmpty: Bool { get }
    @@ -1160,7 +1160,7 @@ confusing, and it is best to avoid this practice:

    @@ -1191,7 +1191,7 @@ confusing, and it is best to avoid this practice:

    Creates statement arguments from a sequence of optional values.

    let values: [DatabaseValueConvertible?] = ["foo", 1, nil]
    -db.execute(sql: "INSERT ... (?,?,?)", arguments: StatementArguments(values))
    +db.execute(sql: "INSERT ... (?,?,?)", arguments: StatementArguments(values))
     
    @@ -1227,7 +1227,7 @@ confusing, and it is best to avoid this practice:

    A StatementArguments.

    @@ -1247,7 +1247,7 @@ confusing, and it is best to avoid this practice:

    Creates statement arguments from a sequence of optional values.

    let values: [String] = ["foo", "bar"]
    -db.execute(sql: "INSERT ... (?,?)", arguments: StatementArguments(values))
    +db.execute(sql: "INSERT ... (?,?)", arguments: StatementArguments(values))
     
    @@ -1283,7 +1283,7 @@ confusing, and it is best to avoid this practice:

    A StatementArguments.

    @@ -1337,7 +1337,7 @@ array elements adopt DatabaseValueConvertible.

    A StatementArguments.

    @@ -1369,7 +1369,7 @@ array elements adopt DatabaseValueConvertible.

    Creates statement arguments from a sequence of (key, value) dictionary, such as a dictionary.

    let values: [String: DatabaseValueConvertible?] = ["firstName": nil, "lastName": "Miller"]
    -db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
    +db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
     
    @@ -1405,7 +1405,7 @@ such as a dictionary.

    A StatementArguments.

    @@ -1426,7 +1426,7 @@ such as a dictionary.

    Creates statement arguments from a sequence of (key, value) pairs, such as a dictionary.

    let values: [String: DatabaseValueConvertible?] = ["firstName": nil, "lastName": "Miller"]
    -db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
    +db.execute(sql: "INSERT ... (:firstName, :lastName)", arguments: StatementArguments(values))
     
    @@ -1463,7 +1463,7 @@ as a dictionary.

    A StatementArguments.

    @@ -1519,7 +1519,7 @@ adopt DatabaseValueConvertible.

    A StatementArguments.

    @@ -1591,7 +1591,7 @@ the StatementArguments type for more information about mixed arguments):

    @@ -1650,7 +1650,7 @@ append(contentsOf:) method.

    @@ -1707,7 +1707,7 @@ side wins:

    @@ -1769,7 +1769,7 @@ append(contentsOf:) method.

    @@ -1815,7 +1815,7 @@ append(contentsOf:) method.

    @@ -1861,7 +1861,7 @@ append(contentsOf:) method.

    @@ -1871,7 +1871,7 @@ append(contentsOf:) method.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SuffixRowAdapter.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SuffixRowAdapter.html index 20a7c0616..03dca9b17 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SuffixRowAdapter.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/SuffixRowAdapter.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1013,7 +1013,7 @@

    SuffixRowAdapter is a row adapter that hides the first columns in a row.

    -
    let adapter = SuffixRowAdapter(fromIndex: 2)
    +
    let adapter = SuffixRowAdapter(fromIndex: 2)
     let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
     
     // [baz:3]
    @@ -1052,7 +1052,7 @@ provided index.

    @@ -1062,7 +1062,7 @@ provided index.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ValueObservation.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ValueObservation.html index 1804fffe3..a7acac3a4 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ValueObservation.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Structs/ValueObservation.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1056,7 +1056,7 @@ observation is less efficient than a read-only observation.

    @@ -1102,8 +1102,8 @@ value is also notified on the main queue, but asynchronously:

    When the database changes, fresh values are asynchronously notified:

    // Eventually prints "fresh players" on the main queue
    -try dbQueue.write { db in
    -    try Player(...).insert(db)
    +try dbQueue.write { db in
    +    try Player(...).insert(db)
     }
     
  • .onQueue(_:startImmediately:): all values are asychronously notified @@ -1140,7 +1140,7 @@ unspecified queues.

  • @@ -1227,7 +1227,7 @@ main queue.

    a ValueObservation.

    @@ -1261,7 +1261,7 @@ fresh values whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(Column("name"), as: String.self)
    +
    let request = Player.select(Column("name"), as: String.self)
     let observation = ValueObservation.trackingAll(request)
     
     let observer = try observation.start(in: dbQueue) { names: [String] in
    @@ -1316,7 +1316,7 @@ main queue.
                             

    a ValueObservation.

    @@ -1338,7 +1338,7 @@ main queue. fresh value whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(max(Column("score")), as: Int.self)
    +
    let request = Player.select(max(Column("score")), as: Int.self)
     let observation = ValueObservation.trackingOne(request)
     
     let observer = try observation.start(in: dbQueue) { maxScore: Int? in
    @@ -1393,7 +1393,7 @@ main queue.
                             

    a ValueObservation.

    @@ -1416,7 +1416,7 @@ fresh values whenever the request is modified by a database transaction.

    For example:

    -
    let request = Player.select(Column("name"), as: Optional<String>.self)
    +
    let request = Player.select(Column("name"), as: Optional<String>.self)
     let observation = ValueObservation.trackingAll(request)
     
     let observer = try observation.start(in: dbQueue) { names: [String?] in
    @@ -1472,7 +1472,7 @@ main queue.
                             

    a ValueObservation.

    @@ -1561,7 +1561,7 @@ main queue.

    a ValueObservation.

    @@ -1638,7 +1638,7 @@ main queue.

    a ValueObservation.

    @@ -1674,7 +1674,7 @@ main queue. @@ -1762,7 +1762,7 @@ main queue.

    a ValueObservation.

    @@ -1839,7 +1839,7 @@ main queue.

    a ValueObservation.

    @@ -1918,7 +1918,7 @@ a database queue or database pool), and returns a transaction observer.

    a TransactionObserver

    @@ -2000,7 +2000,7 @@ happen during observation

    a TransactionObserver

    @@ -2038,10 +2038,10 @@ regions is modified by a database transaction.

    For example, this observation counts the number of a times the player table is modified:

    var count = 0
    -let reducer = AnyValueReducer(
    +let reducer = AnyValueReducer(
         fetch: { _ in /* don't fetch anything */ },
         value: { _ -> Int? in
    -        defer { count += 1 }
    +        defer { count += 1 }
             return count })
     let observation = ValueObservation.tracking(Player.all(), reducer: { db in reducer })
     let observer = observation.start(in: dbQueue) { count: Int in
    @@ -2106,7 +2106,7 @@ the ValueReducer protocol are supported.

    @@ -2133,10 +2133,10 @@ regions is modified by a database transaction.

    For example, this observation counts the number of a times the player table is modified:

    var count = 0
    -let reducer = AnyValueReducer(
    +let reducer = AnyValueReducer(
         fetch: { _ in /* don't fetch anything */ },
         value: { _ -> Int? in
    -        defer { count += 1 }
    +        defer { count += 1 }
             return count })
     let observation = ValueObservation.tracking([Player.all()], reducer: { db in reducer })
     let observer = observation.start(in: dbQueue) { count: Int in
    @@ -2201,7 +2201,7 @@ the ValueReducer protocol are supported.

    @@ -2234,7 +2234,7 @@ the ValueReducer protocol are supported.

    fetch closure whenever a database transaction changes them.

    For example:

    -
    let observation = ValueObservation.tracking { db in
    +
    let observation = ValueObservation.tracking { db in
         try Player.fetchAll(db)
     }
     
    @@ -2285,7 +2285,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2372,7 +2372,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2459,7 +2459,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2505,7 +2505,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2551,7 +2551,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2599,7 +2599,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2647,7 +2647,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2697,7 +2697,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2747,7 +2747,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2799,7 +2799,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2851,7 +2851,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2905,7 +2905,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -2961,7 +2961,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -3019,7 +3019,7 @@ main queue.
                             
                           
                           
                         
                       
    @@ -3056,7 +3056,7 @@ value observation.

    @@ -3093,7 +3093,7 @@ value observation.

    @@ -3129,7 +3129,7 @@ value observation.

    @@ -3160,7 +3160,7 @@ value observation.

    @@ -3170,7 +3170,7 @@ value observation.

    diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Typealiases.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Typealiases.html index bd6b76405..dc70fba23 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Typealiases.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/Typealiases.html @@ -14,7 +14,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1037,7 +1037,7 @@ @@ -1071,7 +1071,7 @@ @@ -1105,7 +1105,7 @@ @@ -1165,7 +1165,7 @@ diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/index.html b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/index.html index 414fa5bd4..8a4a087e0 100644 --- a/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/index.html +++ b/docs/4.2/docsets/GRDB.docset/Contents/Resources/Documents/index.html @@ -13,7 +13,7 @@
    -

    GRDB 4.2.0 Docs (90% documented)

    +

    GRDB 4.2.1 Docs (90% documented)

    View on GitHub

    Install in Dash

    @@ -1010,7 +1010,7 @@
    -

    Latest release: August 6, 2019 • version 4.2.0 • CHANGELOG • Migrating From GRDB 3 to GRDB 4

    +

    Latest release: August 13, 2019 • version 4.2.1 • CHANGELOG • Migrating From GRDB 3 to GRDB 4

    Requirements: iOS 9.0+ / macOS 10.9+ / watchOS 2.0+ • Swift 4.2+ / Xcode 10.0+

    @@ -1022,11 +1022,11 @@ Swift 5 -v4.2.0 +v4.2.1 Swift 4.2 -v4.2.0 +v4.2.1 Swift 4.1 @@ -1365,9 +1365,9 @@ See [Database Changes Observation](#database-changes-observation)

    Swift Package Manager

    The Swift Package Manager automates the distribution of Swift code. To use GRDB with SPM, add a dependency to your Package.swift file:

    -
    let package = Package(
    +
    let package = Package(
         dependencies: [
    -        .package(url: "https://github.com/groue/GRDB.swift.git", .upToNextMajor(from: "4.2.0"))
    +        .package(url: "https://github.com/groue/GRDB.swift.git", .upToNextMajor(from: "4.2.1"))
         ]
     )
     
    @@ -1379,7 +1379,7 @@ See [Database Changes Observation](#database-changes-observation)

    Manually

      -
    1. Download a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the git checkout v4.2.0 command.

    2. +
    3. Download a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the git checkout v4.2.1 command.

    4. Embed the GRDB.xcodeproj project in your own project.

    5. Add the GRDBOSX, GRDBiOS, or GRDBWatchOS target in the Target Dependencies section of the Build Phases tab of your application target (extension target for WatchOS).

    6. Add the GRDB.framework from the targetted platform to the Embedded Binaries section of the General tab of your application target (extension target for WatchOS).

    7. @@ -1403,8 +1403,8 @@ See [Database Changes Observation](#database-changes-observation)
      import GRDB
       
       // Pick one:
      -let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
      -let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
      +let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
      +let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
       

      The differences are:

      @@ -1426,33 +1426,33 @@ See [Database Changes Observation](#database-changes-observation)

      Open a database queue with the path to a database file:

      import GRDB
       
      -let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
      -let inMemoryDBQueue = DatabaseQueue()
      +let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
      +let inMemoryDBQueue = DatabaseQueue()
       

      SQLite creates the database file if it does not already exist. The connection is closed when the database queue gets deallocated.

      A database queue can be used from any thread. The write and read methods are synchronous, and block the current thread until your database statements are executed in a protected dispatch queue:

      // Modify the database:
      -try dbQueue.write { db in
      +try dbQueue.write { db in
           try db.create(table: "place") { ... }
      -    try Place(...).insert(db)
      +    try Place(...).insert(db)
       }
       
       // Read values:
      -try dbQueue.read { db in
      +try dbQueue.read { db in
           let places = try Place.fetchAll(db)
           let placeCount = try Place.fetchCount(db)
       }
       

      Database access methods can return values:

      -
      let placeCount = try dbQueue.read { db in
      +
      let placeCount = try dbQueue.read { db in
           try Place.fetchCount(db)
       }
       
      -let newPlaceCount = try dbQueue.write { db -> Int in
      -    try Place(...).insert(db)
      +let newPlaceCount = try dbQueue.write { db -> Int in
      +    try Place(...).insert(db)
           return try Place.fetchCount(db)
       }
       
      @@ -1472,13 +1472,13 @@ See [Database Changes Observation](#database-changes-observation)

      :bulb: Tip: see the Demo Application for a sample code that sets up a database queue on iOS.

      DatabaseQueue Configuration

      -
      var config = Configuration()
      +
      var config = Configuration()
       config.readonly = true
       config.foreignKeysEnabled = true // Default is already true
       config.trace = { print($0) }     // Prints all SQL statements
       config.label = "MyDatabase"      // Useful when your app opens multiple databases
       
      -let dbQueue = try DatabaseQueue(
      +let dbQueue = try DatabaseQueue(
           path: "/path/to/database.sqlite",
           configuration: config)
       
      @@ -1488,7 +1488,7 @@ See [Database Changes Observation](#database-changes-observation)

      A database pool allows concurrent database accesses.

      import GRDB
      -let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
      +let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
       

      SQLite creates the database file if it does not already exist. The connection is closed when the database pool gets deallocated.

      @@ -1499,25 +1499,25 @@ See [Database Changes Observation](#database-changes-observation)

      A database pool can be used from any thread. The write and read methods are synchronous, and block the current thread until your database statements are executed in a protected dispatch queue:

      // Modify the database:
      -try dbPool.write { db in
      +try dbPool.write { db in
           try db.create(table: "place") { ... }
      -    try Place(...).insert(db)
      +    try Place(...).insert(db)
       }
       
       // Read values:
      -try dbPool.read { db in
      +try dbPool.read { db in
           let places = try Place.fetchAll(db)
           let placeCount = try Place.fetchCount(db)
       }
       

      Database access methods can return values:

      -
      let placeCount = try dbPool.read { db in
      +
      let placeCount = try dbPool.read { db in
           try Place.fetchCount(db)
       }
       
      -let newPlaceCount = try dbPool.write { db -> Int in
      -    try Place(...).insert(db)
      +let newPlaceCount = try dbPool.write { db -> Int in
      +    try Place(...).insert(db)
           return try Place.fetchCount(db)
       }
       
      @@ -1542,14 +1542,14 @@ See [Database Changes Observation](#database-changes-observation)

      :bulb: Tip: see the Demo Application for a sample code that sets up a database queue on iOS, and just replace DatabaseQueue with DatabasePool.

      DatabasePool Configuration

      -
      var config = Configuration()
      +
      var config = Configuration()
       config.readonly = true
       config.foreignKeysEnabled = true // Default is already true
       config.trace = { print($0) }     // Prints all SQL statements
       config.label = "MyDatabase"      // Useful when your app opens multiple databases
       config.maximumReaderCount = 10   // The default is 5
       
      -let dbPool = try DatabasePool(
      +let dbPool = try DatabasePool(
           path: "/path/to/database.sqlite",
           configuration: config)
       
      @@ -1597,7 +1597,7 @@ See [Database Changes Observation](#database-changes-observation)

      Once granted with a database connection, the execute method executes the SQL statements that do not return any database row, such as CREATE TABLE, INSERT, DELETE, ALTER, etc.

      For example:

      -
      try dbQueue.write { db in
      +
      try dbQueue.write { db in
           try db.execute(sql: """
               CREATE TABLE player (
                   id INTEGER PRIMARY KEY AUTOINCREMENT,
      @@ -1620,7 +1620,7 @@ See [Database Changes Observation](#database-changes-observation)
       
       

      In Swift 5, you can embed query arguments right into your SQL queries, with the literal argument label, as in the example below. See SQL Interpolation for more details.

      // Swift 5
      -try dbQueue.write { db in
      +try dbQueue.write { db in
           try db.execute(literal: """
               INSERT INTO player (name, score)
               VALUES (\("O'Brien"), \(550))
      @@ -1673,7 +1673,7 @@ See [Database Changes Observation](#database-changes-observation)
       

      Don’t miss Records, that provide classic persistence methods:

      -
      var player = Player(name: "Arthur", score: 1000)
      +
      var player = Player(name: "Arthur", score: 1000)
       try player.insert(db)
       let playerId = player.id
       
      @@ -1682,7 +1682,7 @@ See [Database Changes Observation](#database-changes-observation)

      Database connections let you fetch database rows, plain values, and custom models aka records.

      Rows are the raw results of SQL queries:

      -
      try dbQueue.read { db in
      +
      try dbQueue.read { db in
           if let row = try Row.fetchOne(db, sql: "SELECT * FROM wine WHERE id = ?", arguments: [1]) {
               let name: String = row["name"]
               let color: Color = row["color"]
      @@ -1692,7 +1692,7 @@ See [Database Changes Observation](#database-changes-observation)
       

      Values are the Bool, Int, String, Date, Swift enums, etc. stored in row columns:

      -
      try dbQueue.read { db in
      +
      try dbQueue.read { db in
           let urls = try URL.fetchCursor(db, sql: "SELECT url FROM wine")
           while let url = try urls.next() {
               print(url)
      @@ -1701,7 +1701,7 @@ See [Database Changes Observation](#database-changes-observation)
       

      Records are your application objects that can initialize themselves from rows:

      -
      let wines = try dbQueue.read { db in
      +
      let wines = try dbQueue.read { db in
           try Wine.fetchAll(db, sql: "SELECT * FROM wine")
       }
       
      @@ -1736,17 +1736,17 @@ See [Database Changes Observation](#database-changes-observation)

      Whenever you consume several rows from the database, you can fetch an Array, or a Cursor.

      The fetchAll() method returns a regular Swift array, that you iterate like all other arrays:

      -
      try dbQueue.read { db in
      +
      try dbQueue.read { db in
           // [Player]
           let players = try Player.fetchAll(db, sql: "SELECT ...")
      -    for player in players {
      +    for player in players {
               // use player
           }
       }
       

      Unlike arrays, cursors returned by fetchCursor() load their results step after step:

      -
      try dbQueue.read { db in
      +
      try dbQueue.read { db in
           // Cursor of Player
           let players = try Player.fetchCursor(db, sql: "SELECT ...")
           while let player = try players.next() {
      @@ -1760,7 +1760,7 @@ See [Database Changes Observation](#database-changes-observation)
       
      • Cursors can not be used on any thread: you must consume a cursor on the dispatch queue it was created in. Particularly, don’t extract a cursor out of a database access method:

        // Wrong
        -let cursor = try dbQueue.read { db in
        +let cursor = try dbQueue.read { db in
             try Player.fetchCursor(db, ...)
         }
         while let player = try cursor.next() { ... }
        @@ -1768,10 +1768,10 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        Conversely, arrays may be consumed on any thread:

        // OK
        -let array = try dbQueue.read { db in
        +let array = try dbQueue.read { db in
             try Player.fetchAll(db, ...)
         }
        -for player in array { ... }
        +for player in array { ... }
         
      • Cursors can be iterated only one time. Arrays can be iterated many times.

      • Cursors iterate database results in a lazy fashion, and don’t consume much memory. Arrays contain copies of database values, and may take a lot of memory when there are many fetched results.

      • @@ -1780,19 +1780,19 @@ See [Database Changes Observation](#database-changes-observation)
        // Prints all Github links
         try URL
             .fetchCursor(db, sql: "SELECT url FROM link")
        -    .filter { url in url.host == "github.com" }
        -    .forEach { url in print(url) }
        +    .filter { url in url.host == "github.com" }
        +    .forEach { url in print(url) }
         
         // An efficient cursor of coordinates:
         let locations = try Row.
             .fetchCursor(db, sql: "SELECT latitude, longitude FROM place")
        -    .map { row in
        -        CLLocationCoordinate2D(latitude: row[0], longitude: row[1])
        +    .map { row in
        +        CLLocationCoordinate2D(latitude: row[0], longitude: row[1])
             }
         
         // Turn cursors into arrays or sets:
        -let array = try Array(cursor)
        -let set = try Set(cursor)
        +let array = try Array(cursor)
        +let set = try Set(cursor)
         
      • Cursors are not Swift sequences. That’s because Swift sequences can’t handle iteration errors, when reading SQLite results may fail at any time. SQL functions may throw errors. On iOS, data protection may block access to the database file in the background. On macOS, your application users may mess with the file system.

      • Cursors require a little care:

        @@ -1820,7 +1820,7 @@ See [Database Changes Observation](#database-changes-observation)

        Fetching Rows

        Fetch cursors of rows, arrays, or single rows (see fetching methods):

        -
        try dbQueue.read { db in
        +
        try dbQueue.read { db in
             try Row.fetchCursor(db, sql: "SELECT ...", arguments: ...) // A Cursor of Row
             try Row.fetchAll(db, sql: "SELECT ...", arguments: ...)    // [Row]
             try Row.fetchOne(db, sql: "SELECT ...", arguments: ...)    // Row?
        @@ -1833,7 +1833,7 @@ See [Database Changes Observation](#database-changes-observation)
             }
         }
         
        -let rows = try dbQueue.read { db in
        +let rows = try dbQueue.read { db in
             try Row.fetchAll(db, sql: "SELECT * FROM player")
         }
         
        @@ -1860,7 +1860,7 @@ See [Database Changes Observation](#database-changes-observation)

        Read column values by index or column name:

        let name: String = row[0]      // 0 is the leftmost column
         let name: String = row["name"] // Leftmost matching column - lookup is case-insensitive
        -let name: String = row[Column("name")] // Using query interface's Column
        +let name: String = row[Column("name")] // Using query interface's Column
         

        Make sure to ask for an optional when the value may be NULL:

        @@ -1884,8 +1884,8 @@ See [Database Changes Observation](#database-changes-observation)

        :warning: Warning: avoid the as! and as? operators:

        -
        if let int = row[...] as? Int { ... } // BAD - doesn't work
        -if let int = row[...] as Int? { ... } // GOOD
        +
        if let int = row[...] as? Int { ... } // BAD - doesn't work
        +if let int = row[...] as Int? { ... } // GOOD
         
        @@ -1932,11 +1932,11 @@ See [Database Changes Observation](#database-changes-observation)

        Those conversion fatal errors can be avoided with the DatabaseValue type:

        let row = try Row.fetchOne(db, sql: "SELECT 'Mom’s birthday'")!
         let dbValue: DatabaseValue = row[0]
        -if dbValue.isNull {
        +if dbValue.isNull {
             // Handle NULL
         } else if let date = Date.fromDatabaseValue(dbValue) {
             // Handle valid date
        -} else {
        +} else {
             // Handle invalid date
         }
         
        @@ -1968,7 +1968,7 @@ See [Database Changes Observation](#database-changes-observation) dbValue.storage.value // Int64, Double, String, Data, or nil // All the five storage classes supported by SQLite: -switch dbValue.storage { +switch dbValue.storage { case .null: print("NULL") case .int64(let int64): print("Int64: \(int64)") case .double(let double): print("Double: \(double)") @@ -1999,15 +1999,15 @@ See [Database Changes Observation](#database-changes-observation)

        Row adopts the standard RandomAccessCollection protocol, and can be seen as a dictionary of DatabaseValue:

        // All the (columnName, dbValue) tuples, from left to right:
        -for (columnName, dbValue) in row {
        +for (columnName, dbValue) in row {
             ...
         }
         

        You can build rows from dictionaries (standard Swift dictionaries and NSDictionary). See Values for more information on supported types:

        let row: Row = ["name": "foo", "date": nil]
        -let row = Row(["name": "foo", "date": nil])
        -let row = Row(/* [AnyHashable: Any] */) // nil if invalid dictionary
        +let row = Row(["name": "foo", "date": nil])
        +let row = Row(/* [AnyHashable: Any] */) // nil if invalid dictionary
         

        Yet rows are not real dictionaries: they may contain duplicate columns:

        @@ -2015,25 +2015,25 @@ See [Database Changes Observation](#database-changes-observation) row.columnNames // ["foo", "foo"] row.databaseValues // [1, 2] row["foo"] // 1 (leftmost matching column) -for (columnName, dbValue) in row { ... } // ("foo", 1), ("foo", 2) +for (columnName, dbValue) in row { ... } // ("foo", 1), ("foo", 2)

        When you build a dictionary from a row, you have to disambiguate identical columns, and choose how to present database values. For example:

        • A [String: DatabaseValue] dictionary that keeps leftmost value in case of duplicated column name:

          -
          let dict = Dictionary(row, uniquingKeysWith: { (left, _) in left })
          +
          let dict = Dictionary(row, uniquingKeysWith: { (left, _) in left })
           
        • A [String: AnyObject] dictionary which keeps rightmost value in case of duplicated column name. This dictionary is identical to FMResultSet’s resultDictionary from FMDB. It contains NSNull values for null columns, and can be shared with Objective-C:

          -
          let dict = Dictionary(
          -    row.map { (column, dbValue) in
          +
          let dict = Dictionary(
          +    row.map { (column, dbValue) in
                   (column, dbValue.storage.value as AnyObject)
               },
               uniquingKeysWith: { (_, right) in right })
           
        • A [String: Any] dictionary that can feed, for example, JSONSerialization:

          -
          let dict = Dictionary(
          -    row.map { (column, dbValue) in
          +
          let dict = Dictionary(
          +    row.map { (column, dbValue) in
                   (column, dbValue.storage.value)
               },
               uniquingKeysWith: { (left, _) in left })
          @@ -2044,7 +2044,7 @@ See [Database Changes Observation](#database-changes-observation)
           

          Value Queries

          Instead of rows, you can directly fetch values. Like rows, fetch them as cursors, arrays, or single values (see fetching methods). Values are extracted from the leftmost column of the SQL queries:

          -
          try dbQueue.read { db in
          +
          try dbQueue.read { db in
               try Int.fetchCursor(db, sql: "SELECT ...", arguments: ...) // A Cursor of Int
               try Int.fetchAll(db, sql: "SELECT ...", arguments: ...)    // [Int]
               try Int.fetchOne(db, sql: "SELECT ...", arguments: ...)    // Int?
          @@ -2054,7 +2054,7 @@ See [Database Changes Observation](#database-changes-observation)
               try Optional<Int>.fetchAll(db, sql: "SELECT ...", arguments: ...)    // [Int?]
           }
           
          -let playerCount = try dbQueue.read { db in
          +let playerCount = try dbQueue.read { db in
               try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM player")!
           }
           
          @@ -2099,7 +2099,7 @@ See [Database Changes Observation](#database-changes-observation)

          Use values in Records:

          -
          struct Link: FetchableRecord {
          +
          struct Link: FetchableRecord {
               var url: URL
               var isVerified: Bool
           
          @@ -2112,7 +2112,7 @@ See [Database Changes Observation](#database-changes-observation)
           
           

          Use values in the query interface:

          let url: URL = ...
          -let link = try Link.filter(Column("url") == url).fetchOne(db)
          +let link = try Link.filter(Column("url") == url).fetchOne(db)
           

          Data (and Memory Savings)

          @@ -2215,7 +2215,7 @@ See [Database Changes Observation](#database-changes-observation)

          Date can be stored and fetched from the database just like other values:

          try db.execute(
               sql: "INSERT INTO player (creationDate, ...) VALUES (?, ...)",
          -    arguments: [Date(), ...])
          +    arguments: [Date(), ...])
           
           let row = try Row.fetchOne(db, ...)!
           let creationDate: Date = row["creationDate"]
          @@ -2237,10 +2237,10 @@ See [Database Changes Observation](#database-changes-observation)
           

          When the default format does not fit your needs, customize date conversions. For example:

          try db.execute(
               sql: "INSERT INTO player (creationDate, ...) VALUES (?, ...)",
          -    arguments: [Date().timeIntervalSinceReferenceDate, ...])
          +    arguments: [Date().timeIntervalSinceReferenceDate, ...])
           
           let row = try Row.fetchOne(db, ...)!
          -let creationDate = Date(timeIntervalSinceReferenceDate: row["creationDate"])
          +let creationDate = Date(timeIntervalSinceReferenceDate: row["creationDate"])
           

          See Codable Records for more date customization options.

          @@ -2251,13 +2251,13 @@ See [Database Changes Observation](#database-changes-observation)

          DatabaseDateComponents reads date components from all date formats supported by SQLite, and stores them in the format of your choice, from HH:MM to YYYY-MM-DD HH:MM:SS.SSS.

          DatabaseDateComponents can be stored and fetched from the database just like other values:

          -
          let components = DateComponents()
          +
          let components = DateComponents()
           components.year = 1973
           components.month = 9
           components.day = 18
           
           // Store "1973-09-18"
          -let dbComponents = DatabaseDateComponents(components, format: .YMD)
          +let dbComponents = DatabaseDateComponents(components, format: .YMD)
           try db.execute(
               sql: "INSERT INTO player (birthDate, ...) VALUES (?, ...)",
               arguments: [dbComponents, ...])
          @@ -2293,13 +2293,13 @@ See [Database Changes Observation](#database-changes-observation)
           
           

          A classic technique is to store integers instead, since SQLite performs exact computations of integers. For example, don’t store Euros, but store cents instead:

          // Write
          -let amount = NSDecimalNumber(string: "0.10")
          +let amount = NSDecimalNumber(string: "0.10")
           let integerAmount = amount.multiplying(byPowerOf10: 2).int64Value
           try db.execute(sql: "INSERT INTO transfer (amount) VALUES (?)", arguments: [integerAmount])
           
           // Read
           let integerAmount = try Int64.fetchOne(db, sql: "SELECT SUM(amount) FROM transfer")!
          -let amount = NSDecimalNumber(value: integerAmount).multiplying(byPowerOf10: -2) // 0.10
          +let amount = NSDecimalNumber(value: integerAmount).multiplying(byPowerOf10: -2) // 0.10
           

          UUID

          @@ -2309,17 +2309,17 @@ See [Database Changes Observation](#database-changes-observation)

          Swift Enums

          Swift enums and generally all types that adopt the RawRepresentable protocol can be stored and fetched from the database just like their raw values:

          -
          enum Color : Int {
          +
          enum Color : Int {
               case red, white, rose
           }
           
          -enum Grape : String {
          +enum Grape : String {
               case chardonnay, merlot, riesling
           }
           
           // Declare empty DatabaseValueConvertible adoption
          -extension Color : DatabaseValueConvertible { }
          -extension Grape : DatabaseValueConvertible { }
          +extension Color : DatabaseValueConvertible { }
          +extension Grape : DatabaseValueConvertible { }
           
           // Store
           try db.execute(
          @@ -2342,20 +2342,20 @@ See [Database Changes Observation](#database-changes-observation)
           row[0] as Grape   // fatal error: could not convert "syrah" to Grape.
           
           let dbValue: DatabaseValue = row[0]
          -if dbValue.isNull {
          +if dbValue.isNull {
               // Handle NULL
           } else if let grape = Grape.fromDatabaseValue(dbValue) {
               // Handle valid grape
          -} else {
          +} else {
               // Handle unknown grape
           }
           

          Custom Value Types

          Conversion to and from the database is based on the DatabaseValueConvertible protocol:

          -
          protocol DatabaseValueConvertible {
          +
          protocol DatabaseValueConvertible {
               /// Returns a value that can be stored in the database.
          -    var databaseValue: DatabaseValue { get }
          +    var databaseValue: DatabaseValue { get }
           
               /// Returns a value initialized from dbValue, if possible.
               static func fromDatabaseValue(_ dbValue: DatabaseValue) -> Self?
          @@ -2384,18 +2384,18 @@ See [Database Changes Observation](#database-changes-observation)
           // INSERT INTO credit ...
           // INSERT INTO debit ...
           // COMMIT
          -try dbQueue.write { db in
          -    try Credit(destinationAccout, amount).insert(db)
          -    try Debit(sourceAccount, amount).insert(db)
          +try dbQueue.write { db in
          +    try Credit(destinationAccout, amount).insert(db)
          +    try Debit(sourceAccount, amount).insert(db)
           }
           
           // BEGIN TRANSACTION
           // INSERT INTO credit ...
           // INSERT INTO debit ...
           // COMMIT
          -try dbPool.write { db in
          -    try Credit(destinationAccout, amount).insert(db)
          -    try Debit(sourceAccount, amount).insert(db)
          +try dbPool.write { db in
          +    try Credit(destinationAccout, amount).insert(db)
          +    try Debit(sourceAccount, amount).insert(db)
           }
           
          @@ -2405,16 +2405,16 @@ See [Database Changes Observation](#database-changes-observation)

          DatabaseQueue.inDatabase() and DatabasePool.writeWithoutTransaction() execute your database statements outside of any transaction:

          // INSERT INTO credit ...
           // INSERT INTO debit ...
          -try dbQueue.inDatabase { db in
          -    try Credit(destinationAccout, amount).insert(db)
          -    try Debit(sourceAccount, amount).insert(db)
          +try dbQueue.inDatabase { db in
          +    try Credit(destinationAccout, amount).insert(db)
          +    try Debit(sourceAccount, amount).insert(db)
           }
           
           // INSERT INTO credit ...
           // INSERT INTO debit ...
          -try dbPool.writeWithoutTransaction { db in
          -    try Credit(destinationAccout, amount).insert(db)
          -    try Debit(sourceAccount, amount).insert(db)
          +try dbPool.writeWithoutTransaction { db in
          +    try Credit(destinationAccout, amount).insert(db)
          +    try Debit(sourceAccount, amount).insert(db)
           }
           
          @@ -2423,19 +2423,19 @@ See [Database Changes Observation](#database-changes-observation)
          • In our credit/debit example, you may successfully insert a credit, but fail inserting the debit, and end up with unbalanced accounts (oops).

            // UNSAFE DATABASE INTEGRITY
            -try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
            -    try Credit(destinationAccout, amount).insert(db) // may succeed
            -    try Debit(sourceAccount, amount).insert(db)      // may fail
            +try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
            +    try Credit(destinationAccout, amount).insert(db) // may succeed
            +    try Debit(sourceAccount, amount).insert(db)      // may fail
             }
             

            Transactions avoid this kind of bug.

          • Database pool concurrent reads can see an inconsistent state of the database:

            // UNSAFE CONCURRENCY
            -try dbPool.writeWithoutTransaction { db in
            -    try Credit(destinationAccout, amount).insert(db)
            +try dbPool.writeWithoutTransaction { db in
            +    try Credit(destinationAccout, amount).insert(db)
                 // <- Concurrent dbPool.read sees a partial db update here
            -    try Debit(sourceAccount, amount).insert(db)
            +    try Debit(sourceAccount, amount).insert(db)
             }
             
            @@ -2447,10 +2447,10 @@ See [Database Changes Observation](#database-changes-observation) // INSERT INTO credit ... // INSERT INTO debit ... // COMMIT -try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction - try db.inTransaction { - try Credit(destinationAccout, amount).insert(db) - try Debit(sourceAccount, amount).insert(db) +try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction + try db.inTransaction { + try Credit(destinationAccout, amount).insert(db) + try Debit(sourceAccount, amount).insert(db) return .commit } } @@ -2459,9 +2459,9 @@ See [Database Changes Observation](#database-changes-observation) // INSERT INTO credit ... // INSERT INTO debit ... // COMMIT -try dbQueue.inTransaction { db in // or dbPool.writeInTransaction - try Credit(destinationAccout, amount).insert(db) - try Debit(sourceAccount, amount).insert(db) +try dbQueue.inTransaction { db in // or dbPool.writeInTransaction + try Credit(destinationAccout, amount).insert(db) + try Debit(sourceAccount, amount).insert(db) return .commit }
          @@ -2469,7 +2469,7 @@ See [Database Changes Observation](#database-changes-observation)

          If an error is thrown from the transaction block, the transaction is rollbacked and the error is rethrown by the inTransaction method. If you return .rollback instead of .commit, the transaction is also rollbacked, but no error is thrown.

          You can also perform manual transaction management:

          -
          try dbQueue.inDatabase { db in  // or dbPool.writeWithoutTransaction
          +
          try dbQueue.inDatabase { db in  // or dbPool.writeWithoutTransaction
               try db.beginTransaction()
               ...
               try db.commit()
          @@ -2482,22 +2482,22 @@ See [Database Changes Observation](#database-changes-observation)
           
           

          Transactions can’t be left opened unless you set the allowsUnsafeTransactions configuration flag:

          // fatal error: A transaction has been left opened at the end of a database access
          -try dbQueue.inDatabase { db in
          +try dbQueue.inDatabase { db in
               try db.execute(sql: "BEGIN TRANSACTION")
               // <- no commit or rollback
           }
           

          You can ask if a transaction is currently opened:

          -
          func myCriticalMethod(_ db: Database) throws {
          +
          func myCriticalMethod(_ db: Database) throws {
               precondition(db.isInsideTransaction, "This method requires a transaction")
               try ...
           }
           

          Yet, you have a better option than checking for transactions: critical database sections should use savepoints, described below:

          -
          func myCriticalMethod(_ db: Database) throws {
          -    try db.inSavepoint {
          +
          func myCriticalMethod(_ db: Database) throws {
          +    try db.inSavepoint {
                   // Here the database is guaranteed to be inside a transaction.
                   try ...
               }
          @@ -2506,11 +2506,11 @@ See [Database Changes Observation](#database-changes-observation)
           

          Savepoints

          Statements grouped in a savepoint can be rollbacked without invalidating a whole transaction:

          -
          try dbQueue.write { db in
          +
          try dbQueue.write { db in
               // Makes sure both inserts succeed, or none:
          -    try db.inSavepoint {
          -        try Credit(destinationAccout, amount).insert(db)
          -        try Debit(sourceAccount, amount).insert(db)
          +    try db.inSavepoint {
          +        try Credit(destinationAccout, amount).insert(db)
          +        try Debit(sourceAccount, amount).insert(db)
                   return .commit
               }
           
          @@ -2521,10 +2521,10 @@ See [Database Changes Observation](#database-changes-observation)
           

          If an error is thrown from the savepoint block, the savepoint is rollbacked and the error is rethrown by the inSavepoint method. If you return .rollback instead of .commit, the savepoint is also rollbacked, but no error is thrown.

          Unlike transactions, savepoints can be nested. They implicitly open a transaction if no one was opened when the savepoint begins. As such, they behave just like nested transactions. Yet the database changes are only written to disk when the outermost transaction is committed:

          -
          try dbQueue.inDatabase { db in
          -    try db.inSavepoint {
          +
          try dbQueue.inDatabase { db in
          +    try db.inSavepoint {
                   ...
          -        try db.inSavepoint {
          +        try db.inSavepoint {
                       ...
                       return .commit
                   }
          @@ -2541,21 +2541,21 @@ See [Database Changes Observation](#database-changes-observation)
           
           

          The transaction kind can be changed in the database configuration, or for each transaction:

          // 1) Default configuration:
          -let dbQueue = try DatabaseQueue(path: "...")
          +let dbQueue = try DatabaseQueue(path: "...")
           
           // BEGIN DEFERED TRANSACTION ...
          -dbQueue.write { db in ... }
          +dbQueue.write { db in ... }
           
           // BEGIN EXCLUSIVE TRANSACTION ...
           dbQueue.inTransaction(.exclusive) { db in ... }
           
           // 2) Customized default transaction kind:
          -var config = Configuration()
          +var config = Configuration()
           config.defaultTransactionKind = .immediate
          -let dbQueue = try DatabaseQueue(path: "...", configuration: config)
          +let dbQueue = try DatabaseQueue(path: "...", configuration: config)
           
           // BEGIN IMMEDIATE TRANSACTION ...
          -dbQueue.write { db in ... }
          +dbQueue.write { db in ... }
           
           // BEGIN EXCLUSIVE TRANSACTION ...
           dbQueue.inTransaction(.exclusive) { db in ... }
          @@ -2565,7 +2565,7 @@ See [Database Changes Observation](#database-changes-observation)
           

          Prepared Statements let you prepare an SQL query and execute it later, several times if you need, with different arguments.

          There are two kinds of prepared statements: select statements, and update statements:

          -
          try dbQueue.write { db in
          +
          try dbQueue.write { db in
               let updateSQL = "INSERT INTO player (name, score) VALUES (:name, :score)"
               let updateStatement = try db.makeUpdateStatement(sql: updateSQL)
           
          @@ -2629,17 +2629,17 @@ See [Database Changes Observation](#database-changes-observation)
           
        • Custom Aggregates

        Custom SQL Functions

        -
        let reverse = DatabaseFunction("reverse", argumentCount: 1, pure: true) { (values: [DatabaseValue]) in
        +
        let reverse = DatabaseFunction("reverse", argumentCount: 1, pure: true) { (values: [DatabaseValue]) in
             // Extract string value, if any...
        -    guard let string = String.fromDatabaseValue(values[0]) else {
        +    guard let string = String.fromDatabaseValue(values[0]) else {
                 return nil
             }
             // ... and return reversed string:
        -    return String(string.reversed())
        +    return String(string.reversed())
         }
         dbQueue.add(function: reverse)   // Or dbPool.add(function: ...)
         
        -try dbQueue.read { db in
        +try dbQueue.read { db in
             // "oof"
             try String.fetchOne(db, sql: "SELECT reverse('foo')")!
         }
        @@ -2652,32 +2652,32 @@ See [Database Changes Observation](#database-changes-observation)
         

        Functions can take a variable number of arguments:

        When you don’t provide any explicit argumentCount, the function can take any number of arguments:

        -
        let averageOf = DatabaseFunction("averageOf", pure: true) { (values: [DatabaseValue]) in
        -    let doubles = values.compactMap { Double.fromDatabaseValue($0) }
        -    return doubles.reduce(0, +) / Double(doubles.count)
        +
        let averageOf = DatabaseFunction("averageOf", pure: true) { (values: [DatabaseValue]) in
        +    let doubles = values.compactMap { Double.fromDatabaseValue($0) }
        +    return doubles.reduce(0, +) / Double(doubles.count)
         }
         dbQueue.add(function: averageOf)
         
        -try dbQueue.read { db in
        +try dbQueue.read { db in
             // 2.0
             try Double.fetchOne(db, sql: "SELECT averageOf(1, 2, 3)")!
         }
         

        Functions can throw:

        -
        let sqrt = DatabaseFunction("sqrt", argumentCount: 1, pure: true) { (values: [DatabaseValue]) in
        -    guard let double = Double.fromDatabaseValue(values[0]) else {
        +
        let sqrt = DatabaseFunction("sqrt", argumentCount: 1, pure: true) { (values: [DatabaseValue]) in
        +    guard let double = Double.fromDatabaseValue(values[0]) else {
                 return nil
             }
        -    guard double >= 0 else {
        -        throw DatabaseError(message: "invalid negative number")
        +    guard double >= 0 else {
        +        throw DatabaseError(message: "invalid negative number")
             }
             return sqrt(double)
         }
         dbQueue.add(function: sqrt)
         
         // SQLite error 1 with statement `SELECT sqrt(-1)`: invalid negative number
        -try dbQueue.read { db in
        +try dbQueue.read { db in
             try Double.fetchOne(db, sql: "SELECT sqrt(-1)")!
         }
         
        @@ -2691,7 +2691,7 @@ See [Database Changes Observation](#database-changes-observation)

        Custom Aggregates

        Before registering a custom aggregate, you need to define a type that adopts the DatabaseAggregate protocol:

        -
        protocol DatabaseAggregate {
        +
        protocol DatabaseAggregate {
             // Initializes an aggregate
             init()
         
        @@ -2704,27 +2704,27 @@ See [Database Changes Observation](#database-changes-observation)
         

        For example:

        -
        struct MaxLength : DatabaseAggregate {
        +
        struct MaxLength : DatabaseAggregate {
             var maxLength: Int = 0
         
             mutating func step(_ dbValues: [DatabaseValue]) {
                 // At each step, extract string value, if any...
        -        guard let string = String.fromDatabaseValue(dbValues[0]) else {
        +        guard let string = String.fromDatabaseValue(dbValues[0]) else {
                     return
                 }
                 // ... and update the result
                 let length = string.count
        -        if length > maxLength {
        +        if length > maxLength {
                     maxLength = length
                 }
             }
         
        -    func finalize() -> DatabaseValueConvertible? {
        +    func finalize() -> DatabaseValueConvertible? {
                 return maxLength
             }
         }
         
        -let maxLength = DatabaseFunction(
        +let maxLength = DatabaseFunction(
             "maxLength",
             argumentCount: 1,
             pure: true,
        @@ -2732,7 +2732,7 @@ See [Database Changes Observation](#database-changes-observation)
         
         dbQueue.add(function: maxLength)   // Or dbPool.add(function: ...)
         
        -try dbQueue.read { db in
        +try dbQueue.read { db in
             // Some Int
             try Int.fetchOne(db, sql: "SELECT maxLength(name) FROM player")!
         }
        @@ -2752,7 +2752,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        Database Schema Introspection

        GRDB comes with a set of schema introspection methods:

        -
        try dbQueue.read { db in
        +
        try dbQueue.read { db in
             // Bool, true if the table exists
             try db.tableExists("player")
         
        @@ -2786,7 +2786,7 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        In this case, the ColumnMapping row adapter comes in handy:

        // Fetch a 'produced' column, and consume a 'consumed' column:
        -let adapter = ColumnMapping(["consumed": "produced"])
        +let adapter = ColumnMapping(["consumed": "produced"])
         let row = try Row.fetchOne(db, sql: "SELECT 'Hello' AS produced", adapter: adapter)!
         row["consumed"] // "Hello"
         row["produced"] // nil
        @@ -2799,27 +2799,27 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        ColumnMapping renames columns. Build one with a dictionary whose keys are adapted column names, and values the column names in the raw row:

        // [newName:"Hello"]
        -let adapter = ColumnMapping(["newName": "oldName"])
        +let adapter = ColumnMapping(["newName": "oldName"])
         let row = try Row.fetchOne(db, sql: "SELECT 'Hello' AS oldName", adapter: adapter)!
         

        SuffixRowAdapter

        SuffixRowAdapter hides the first columns in a row:

        // [b:1 c:2]
        -let adapter = SuffixRowAdapter(fromIndex: 1)
        +let adapter = SuffixRowAdapter(fromIndex: 1)
         let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c", adapter: adapter)!
         

        RangeRowAdapter

        RangeRowAdapter only exposes a range of columns.

        // [b:1]
        -let adapter = RangeRowAdapter(1..<2)
        +let adapter = RangeRowAdapter(1..<2)
         let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c", adapter: adapter)!
         

        EmptyRowAdapter

        EmptyRowAdapter hides all columns.

        -
        let adapter = EmptyRowAdapter()
        +
        let adapter = EmptyRowAdapter()
         let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c", adapter: adapter)!
         row.isEmpty // true
         
        @@ -2828,9 +2828,9 @@ See [Database Changes Observation](#database-changes-observation)

        ScopeAdapter

        ScopeAdapter defines row scopes:

        -
        let adapter = ScopeAdapter([
        -    "left": RangeRowAdapter(0..<2),
        -    "right": RangeRowAdapter(2..<4)])
        +
        let adapter = ScopeAdapter([
        +    "left": RangeRowAdapter(0..<2),
        +    "right": RangeRowAdapter(2..<4)])
         let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c, 3 AS d", adapter: adapter)!
         
        @@ -2842,13 +2842,13 @@ See [Database Changes Observation](#database-changes-observation)

        Scopes can be nested:

        -
        let adapter = ScopeAdapter([
        -    "left": ScopeAdapter([
        -        "left": RangeRowAdapter(0..<1),
        -        "right": RangeRowAdapter(1..<2)]),
        -    "right": ScopeAdapter([
        -        "left": RangeRowAdapter(2..<3),
        -        "right": RangeRowAdapter(3..<4)])
        +
        let adapter = ScopeAdapter([
        +    "left": ScopeAdapter([
        +        "left": RangeRowAdapter(0..<1),
        +        "right": RangeRowAdapter(1..<2)]),
        +    "right": ScopeAdapter([
        +        "left": RangeRowAdapter(2..<3),
        +        "right": RangeRowAdapter(3..<4)])
             ])
         let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c, 3 AS d", adapter: adapter)!
         
        @@ -2862,9 +2862,9 @@ See [Database Changes Observation](#database-changes-observation)
         

        Any adapter can be extended with scopes:

        -
        let baseAdapter = RangeRowAdapter(0..<2)
        -let adapter = ScopeAdapter(base: baseAdapter, scopes: [
        -    "remainder": SuffixRowAdapter(fromIndex: 2)])
        +
        let baseAdapter = RangeRowAdapter(0..<2)
        +let adapter = ScopeAdapter(base: baseAdapter, scopes: [
        +    "remainder": SuffixRowAdapter(fromIndex: 2)])
         let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c, 3 AS d", adapter: adapter)!
         
         row // [a:0 b:1]
        @@ -2884,11 +2884,11 @@ See [Database Changes Observation](#database-changes-observation)
         // System SQLite
         import SQLite3
         
        -let sqliteVersion = String(cString: sqlite3_libversion())
        +let sqliteVersion = String(cString: sqlite3_libversion())
         

        Raw pointers to database connections and statements are available through the Database.sqliteConnection and Statement.sqliteStatement properties:

        -
        try dbQueue.read { db in
        +
        try dbQueue.read { db in
             // The raw pointer to a database connection:
             let sqliteConnection = db.sqliteConnection
         
        @@ -2933,7 +2933,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        Records

        On top of the SQLite API, GRDB provides protocols and a class that help manipulating database rows as regular objects named records:

        -
        try dbQueue.write { db in
        +
        try dbQueue.write { db in
             if var place = try Place.fetchOne(db, key: 1) {
                 place.isFavorite = true
                 try place.update(db)
        @@ -2992,7 +2992,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        Inserting Records

        To insert a record in the database, call the insert method:

        -
        let player = Player(name: "Arthur", email: "arthur@example.com")
        +
        let player = Player(name: "Arthur", email: "arthur@example.com")
         try player.insert(db)
         
        @@ -3005,7 +3005,7 @@ See [Database Changes Observation](#database-changes-observation) arguments: ["Arthur"]) let bestPlayers = try Player // [Player] - .order(Column("score").desc) + .order(Column("score").desc) .limit(10) .fetchAll(db) @@ -3054,7 +3054,7 @@ See [Database Changes Observation](#database-changes-observation)

        For batch deletes, execute an SQL query, or see the query interface:

        try Player
        -    .filter(Column("email") == nil)
        +    .filter(Column("email") == nil)
             .deleteAll(db)
         
        @@ -3065,7 +3065,7 @@ See [Database Changes Observation](#database-changes-observation)
        let playerCount: Int = try Player.fetchCount(db)
         
         let playerWithEmailCount: Int = try Player
        -    .filter(Column("email") == nil)
        +    .filter(Column("email") == nil)
             .fetchCount(db)
         
        @@ -3093,14 +3093,14 @@ See [Database Changes Observation](#database-changes-observation)
      • FetchableRecord is able to decode database rows.

        It is always possible to decode rows without this protocol:

        -
        struct Place { ... }
        -try dbQueue.read { db in
        +
        struct Place { ... }
        +try dbQueue.read { db in
             let rows = try Row.fetchAll(db, sql: "SELECT * FROM place")
        -    let places: [Place] = rows.map { row in
        -        return Place(
        +    let places: [Place] = rows.map { row in
        +        return Place(
                     id: row["id"],
                     title: row["title"],
        -            coordinate: CLLocationCoordinate2D(
        +            coordinate: CLLocationCoordinate2D(
                         latitude: row["latitude"],
                         longitude: row["longitude"]))
                 )
        @@ -3109,8 +3109,8 @@ See [Database Changes Observation](#database-changes-observation)
         

        But FetchableRecord lets you write code that is easier to read, and more efficient as well, both in terms of performance and memory usage:

        -
        struct Place: FetchableRecord { ... }
        -try dbQueue.read { db in
        +
        struct Place: FetchableRecord { ... }
        +try dbQueue.read { db in
             let places = try Place.fetchAll(db, sql: "SELECT * FROM place")
         }
         
        @@ -3121,23 +3121,23 @@ See [Database Changes Observation](#database-changes-observation)

        FetchableRecord can decode database rows, but it is not able to build SQL requests for you. For that, you also need TableRecord:

      • TableRecord is able to generate SQL queries:

        -
        struct Place: TableRecord { ... }
        +
        struct Place: TableRecord { ... }
         // SELECT * FROM place ORDER BY title
        -let request = Place.order(Column("title"))
        +let request = Place.order(Column("title"))
         

        When a type adopts both TableRecord and FetchableRecord, it can load from those requests:

        -
        struct Place: TableRecord, FetchableRecord { ... }
        -try dbQueue.read { db in
        -    let places = try Place.order(Column("title")).fetchAll(db)
        +
        struct Place: TableRecord, FetchableRecord { ... }
        +try dbQueue.read { db in
        +    let places = try Place.order(Column("title")).fetchAll(db)
             let paris = try Place.fetchOne(key: 1)
         }
         
      • PersistableRecord is able to write: it can create, update, and delete rows in the database:

        -
        struct Place : PersistableRecord { ... }
        -try dbQueue.write { db in
        +
        struct Place : PersistableRecord { ... }
        +try dbQueue.write { db in
             try Place.delete(db, key: 1)
        -    try Place(...).insert(db)
        +    try Place(...).insert(db)
         }
         
        @@ -3150,24 +3150,24 @@ See [Database Changes Observation](#database-changes-observation)

        FetchableRecord Protocol

        The FetchableRecord protocol grants fetching methods to any type that can be built from a database row:

        -
        protocol FetchableRecord {
        +
        protocol FetchableRecord {
             /// Row initializer
             init(row: Row)
         }
         

        To use FetchableRecord, subclass the Record class, or adopt it explicitly. For example:

        -
        struct Place {
        +
        struct Place {
             var id: Int64?
             var title: String
             var coordinate: CLLocationCoordinate2D
         }
         
        -extension Place : FetchableRecord {
        +extension Place : FetchableRecord {
             init(row: Row) {
                 id = row["id"]
                 title = row["title"]
        -        coordinate = CLLocationCoordinate2D(
        +        coordinate = CLLocationCoordinate2D(
                     latitude: row["latitude"],
                     longitude: row["longitude"])
             }
        @@ -3175,15 +3175,15 @@ See [Database Changes Observation](#database-changes-observation)
         

        Rows also accept column enums:

        -
        extension Place : FetchableRecord {
        -    enum Columns: String, ColumnExpression {
        +
        extension Place : FetchableRecord {
        +    enum Columns: String, ColumnExpression {
                 case id, title, latitude, longitude
             }
         
             init(row: Row) {
                 id = row[Columns.id]
                 title = row[Columns.title]
        -        coordinate = CLLocationCoordinate2D(
        +        coordinate = CLLocationCoordinate2D(
                     latitude: row[Columns.latitude],
                     longitude: row[Columns.longitude])
             }
        @@ -3194,7 +3194,7 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        When your record type adopts the standard Decodable protocol, you don’t have to provide the implementation for init(row:). See Codable Records for more information:

        // That's all
        -struct Player: Decodable, FetchableRecord {
        +struct Player: Decodable, FetchableRecord {
             var id: Int64
             var name: String
             var score: Int
        @@ -3217,8 +3217,8 @@ See [Database Changes Observation](#database-changes-observation)
         

        TableRecord Protocol

        The TableRecord protocol generates SQL for you. To use TableRecord, subclass the Record class, or adopt it explicitly:

        -
        protocol TableRecord {
        -    static var databaseTableName: String { get }
        +
        protocol TableRecord {
        +    static var databaseTableName: String { get }
             static var databaseSelection: [SQLSelectable] { get }
         }
         
        @@ -3226,7 +3226,7 @@ See [Database Changes Observation](#database-changes-observation)

        The databaseSelection type property is optional, and documented in the Columns Selected by a Request chapter.

        The databaseTableName type property is the name of a database table. By default, it is derived from the type name:

        -
        struct Place: TableRecord { }
        +
        struct Place: TableRecord { }
         print(Place.databaseTableName) // prints "place"
         
        @@ -3241,15 +3241,15 @@ See [Database Changes Observation](#database-changes-observation)

      You can still provide a custom table name:

      -
      struct Place: TableRecord {
      +
      struct Place: TableRecord {
           static let databaseTableName = "location"
       }
       print(Place.databaseTableName) // prints "location"
       

      Subclasses of the Record class must always override their superclass’s databaseTableName property:

      -
      class Place: Record {
      -    override class var databaseTableName: String {
      +
      class Place: Record {
      +    override class var databaseTableName: String {
               return "place"
           }
       }
      @@ -3284,20 +3284,20 @@ See [Database Changes Observation](#database-changes-observation)
       
       

      Those abilities are granted by three protocols:

      // Defines how a record encodes itself into the database
      -protocol EncodableRecord {
      +protocol EncodableRecord {
           /// Defines the values persisted in the database
           func encode(to container: inout PersistenceContainer)
       }
       
       // Adds persistence methods
      -protocol MutablePersistableRecord: TableRecord, EncodableRecord {
      +protocol MutablePersistableRecord: TableRecord, EncodableRecord {
           /// Optional method that lets your adopting type store its rowID upon
           /// successful insertion. Don't call it directly: it is called for you.
           mutating func didInsert(with rowID: Int64, for column: String?)
       }
       
       // Adds immutability
      -protocol PersistableRecord: MutablePersistableRecord {
      +protocol PersistableRecord: MutablePersistableRecord {
           /// Non-mutating version of the optional didInsert(with:for:)
           func didInsert(with rowID: Int64, for column: String?)
       }
      @@ -3316,7 +3316,7 @@ See [Database Changes Observation](#database-changes-observation)
       

      The optional didInsert method lets the adopting type store its rowID after successful insertion, and is only useful for tables that have an auto-incremented primary key. It is called from a protected dispatch queue, and serialized with all database updates.

      To use the persistable protocols, subclass the Record class, or adopt one of them explicitly. For example:

      -
      extension Place : MutablePersistableRecord {
      +
      extension Place : MutablePersistableRecord {
           /// The values persisted in the database
           func encode(to container: inout PersistenceContainer) {
               container["id"] = id
      @@ -3331,18 +3331,18 @@ See [Database Changes Observation](#database-changes-observation)
           }
       }
       
      -var paris = Place(
      +var paris = Place(
           id: nil,
           title: "Paris",
      -    coordinate: CLLocationCoordinate2D(latitude: 48.8534100, longitude: 2.3488000))
      +    coordinate: CLLocationCoordinate2D(latitude: 48.8534100, longitude: 2.3488000))
       
       try paris.insert(db)
       paris.id   // some value
       

      Persistence containers also accept column enums:

      -
      extension Place : MutablePersistableRecord {
      -    enum Columns: String, ColumnExpression {
      +
      extension Place : MutablePersistableRecord {
      +    enum Columns: String, ColumnExpression {
               case id, title, latitude, longitude
           }
       
      @@ -3357,7 +3357,7 @@ See [Database Changes Observation](#database-changes-observation)
       
       

      When your record type adopts the standard Encodable protocol, you don’t have to provide the implementation for encode(to:). See Codable Records for more information:

      // That's all
      -struct Player: Encodable, MutablePersistableRecord {
      +struct Player: Encodable, MutablePersistableRecord {
           var id: Int64?
           var name: String
           var score: Int
      @@ -3409,12 +3409,12 @@ See [Database Changes Observation](#database-changes-observation)
       

      For example, it may want to have its UUID automatically set before inserting. Or it may want to validate its values before saving.

      When you subclass Record, you simply have to override the customized method, and call super:

      -
      class Player : Record {
      +
      class Player : Record {
           var uuid: UUID?
       
      -    override func insert(_ db: Database) throws {
      -        if uuid == nil {
      -            uuid = UUID()
      +    override func insert(_ db: Database) throws {
      +        if uuid == nil {
      +            uuid = UUID()
               }
               try super.insert(db)
           }
      @@ -3422,22 +3422,22 @@ See [Database Changes Observation](#database-changes-observation)
       

      If you use the raw PersistableRecord protocol, use one of the special methods performInsert, performUpdate, performSave, performDelete, or performExists:

      -
      struct Link : PersistableRecord {
      +
      struct Link : PersistableRecord {
           var url: URL
       
      -    func insert(_ db: Database) throws {
      +    func insert(_ db: Database) throws {
               try validate()
               try performInsert(db)
           }
       
      -    func update(_ db: Database, columns: Set<String>) throws {
      +    func update(_ db: Database, columns: Set<String>) throws {
               try validate()
               try performUpdate(db, columns: columns)
           }
       
      -    func validate() throws {
      -        if url.host == nil {
      -            throw ValidationError("url must be absolute.")
      +    func validate() throws {
      +        if url.host == nil {
      +            throw ValidationError("url must be absolute.")
               }
           }
       }
      @@ -3452,14 +3452,14 @@ See [Database Changes Observation](#database-changes-observation)
       
       

      Record types that adopt an archival protocol (Codable, Encodable or Decodable) get free database support just by declaring conformance to the desired record protocols:

      // Declare a record...
      -struct Player: Codable, FetchableRecord, PersistableRecord {
      +struct Player: Codable, FetchableRecord, PersistableRecord {
           var name: String
           var score: Int
       }
       
       // ...and there you go:
      -try dbQueue.write { db in
      -    try Player(name: "Arthur", score: 100).insert(db)
      +try dbQueue.write { db in
      +    try Player(name: "Arthur", score: 100).insert(db)
           let players = try Player.fetchAll(db)
       }
       
      @@ -3487,29 +3487,29 @@ See [Database Changes Observation](#database-changes-observation)

      JSON Columns

      When a Codable record contains a property that is not a simple value (Bool, Int, String, Date, Swift enums, etc.), that value is encoded and decoded as a JSON string. For example:

      -
      enum AchievementColor: String, Codable {
      +
      enum AchievementColor: String, Codable {
           case bronze, silver, gold
       }
       
      -struct Achievement: Codable {
      +struct Achievement: Codable {
           var name: String
           var color: AchievementColor
       }
       
      -struct Player: Codable, FetchableRecord, PersistableRecord {
      +struct Player: Codable, FetchableRecord, PersistableRecord {
           var name: String
           var score: Int
           var achievements: [Achievement] // stored in a JSON column
       }
       
      -try! dbQueue.write { db in
      +try! dbQueue.write { db in
           // INSERT INTO player (name, score, achievements)
           // VALUES (
           //   'Arthur',
           //   100,
           //   '[{"color":"gold","name":"Use Codable Records"}]')
      -    let achievement = Achievement(name: "Use Codable Records", color: .gold)
      -    let player = Player(name: "Arthur", score: 100, achievements: [achievement])
      +    let achievement = Achievement(name: "Use Codable Records", color: .gold)
      +    let player = Player(name: "Arthur", score: 100, achievements: [achievement])
           try player.insert(db)
       }
       
      @@ -3517,11 +3517,11 @@ See [Database Changes Observation](#database-changes-observation)

      GRDB uses the standard JSONDecoder and JSONEncoder from Foundation. By default, Data values are handled with the .base64 strategy, Date with the .millisecondsSince1970 strategy, and non conforming floats with the .throw strategy.

      You can customize the JSON format by implementing those methods:

      -
      protocol FetchableRecord {
      +
      protocol FetchableRecord {
           static func databaseJSONDecoder(for column: String) -> JSONDecoder
       }
       
      -protocol EncodableRecord {
      +protocol EncodableRecord {
           static func databaseJSONEncoder(for column: String) -> JSONEncoder
       }
       
      @@ -3536,13 +3536,13 @@ See [Database Changes Observation](#database-changes-observation)

      To sum up: dates encode themselves in the YYYY-MM-DD HH:MM:SS.SSS format, in the UTC time zone, and decode a variety of date formats and timestamps. UUIDs encode themselves as 16-bytes data blobs, and decode both 16-bytes data blobs and strings such as E621E1F8-C36C-495A-93FC-0C247A3E6E5F.

      Those behaviors can be overridden:

      -
      protocol FetchableRecord {
      -    static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
      +
      protocol FetchableRecord {
      +    static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
       }
       
      -protocol EncodableRecord {
      -    static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
      -    static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
      +protocol EncodableRecord {
      +    static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
      +    static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
       }
       
      @@ -3556,21 +3556,21 @@ See [Database Changes Observation](#database-changes-observation)

      Your Codable Records can be stored in the database, but they may also have other purposes. In this case, you may need to customize their implementations of Decodable.init(from:) and Encodable.encode(to:), depending on the context.

      The standard way to provide such context is the userInfo dictionary. Implement those properties:

      -
      protocol FetchableRecord {
      +
      protocol FetchableRecord {
           static var databaseDecodingUserInfo: [CodingUserInfoKey: Any] { get }
       }
       
      -protocol EncodableRecord {
      +protocol EncodableRecord {
           static var databaseEncodingUserInfo: [CodingUserInfoKey: Any] { get }
       }
       

      For example, here is a Player type that customizes its decoding:

      // A key that holds a decoder's name
      -let decoderName = CodingUserInfoKey(rawValue: "decoderName")!
      +let decoderName = CodingUserInfoKey(rawValue: "decoderName")!
       
      -struct Player: FetchableRecord, Decodable {
      -    init(from decoder: Decoder) throws {
      +struct Player: FetchableRecord, Decodable {
      +    init(from decoder: Decoder) throws {
               // Print the decoder name
               let decoderName = decoder.userInfo[decoderName] as? String
               print("Decoded from \(decoderName ?? "unknown decoder")")
      @@ -3581,13 +3581,13 @@ See [Database Changes Observation](#database-changes-observation)
       
       

      You can have a specific decoding from JSON…

      // prints "Decoded from JSON"
      -let decoder = JSONDecoder()
      +let decoder = JSONDecoder()
       decoder.userInfo = [decoderName: "JSON"]
       let player = try decoder.decode(Player.self, from: jsonData)
       

      … and another one from database rows:

      -
      extension Player: FetchableRecord {
      +
      extension Player: FetchableRecord {
           static let databaseDecodingUserInfo: [CodingUserInfoKey: Any] = [decoderName: "database row"]
       }
       
      @@ -3601,17 +3601,17 @@ See [Database Changes Observation](#database-changes-observation)
       

      Tip: Derive Columns from Coding Keys

      Codable types are granted with a CodingKeys enum. You can use them to safely define database columns:

      -
      struct Player: Codable {
      +
      struct Player: Codable {
           var id: Int64
           var name: String
           var score: Int
       }
       
      -extension Player: FetchableRecord, PersistableRecord {
      -    enum Columns {
      -        static let id = Column(CodingKeys.id)
      -        static let name = Column(CodingKeys.name)
      -        static let score = Column(CodingKeys.score)
      +extension Player: FetchableRecord, PersistableRecord {
      +    enum Columns {
      +        static let id = Column(CodingKeys.id)
      +        static let name = Column(CodingKeys.name)
      +        static let score = Column(CodingKeys.score)
           }
       }
       
      @@ -3622,7 +3622,7 @@ See [Database Changes Observation](#database-changes-observation)

      Record is a class that is designed to be subclassed. It inherits its features from the FetchableRecord, TableRecord, and PersistableRecord protocols. On top of that, Record instances can compare against previous versions of themselves in order to avoid useless updates.

      Record subclasses define their custom database relationship by overriding database methods. For example:

      -
      class Place: Record {
      +
      class Place: Record {
           var id: Int64?
           var title: String
           var isFavorite: Bool
      @@ -3637,12 +3637,12 @@ See [Database Changes Observation](#database-changes-observation)
           }
       
           /// The table name
      -    override class var databaseTableName: String {
      +    override class var databaseTableName: String {
               return "place"
           }
       
           /// The table columns
      -    enum Columns: String, ColumnExpression {
      +    enum Columns: String, ColumnExpression {
               case id, title, favorite, latitude, longitude
           }
       
      @@ -3651,7 +3651,7 @@ See [Database Changes Observation](#database-changes-observation)
               id = row[Columns.id]
               title = row[Columns.title]
               isFavorite = row[Columns.favorite]
      -        coordinate = CLLocationCoordinate2D(
      +        coordinate = CLLocationCoordinate2D(
                   latitude: row[Columns.latitude],
                   longitude: row[Columns.longitude])
               super.init(row: row)
      @@ -3696,7 +3696,7 @@ See [Database Changes Observation](#database-changes-observation)
           newPlayer.score = 100
           if try newPlayer.updateChanges(db, from: oldPlayer) {
               print("player was modified, and updated in the database")
      -    } else {
      +    } else {
               print("player was not modified, and database was not hit")
           }
       }
      @@ -3708,9 +3708,9 @@ See [Database Changes Observation](#database-changes-observation)
           let modified = try player.updateChanges(db) {
               $0.score = 100
           }
      -    if modified {
      +    if modified {
               print("player was modified, and updated in the database")
      -    } else {
      +    } else {
               print("player was not modified, and database was not hit")
           }
       }
      @@ -3723,7 +3723,7 @@ See [Database Changes Observation](#database-changes-observation)
           player.score = 100
           if try player.updateChanges(db) {
               print("player was modified, and updated in the database")
      -    } else {
      +    } else {
               print("player was not modified, and database was not hit")
           }
       }
      @@ -3734,7 +3734,7 @@ See [Database Changes Observation](#database-changes-observation)
       

      This method returns whether two records have the same database representation:

      let oldPlayer: Player = ...
       var newPlayer: Player = ...
      -if newPlayer.databaseEquals(oldPlayer) == false {
      +if newPlayer.databaseEquals(oldPlayer) == false {
           try newPlayer.save(db)
       }
       
      @@ -3745,8 +3745,8 @@ See [Database Changes Observation](#database-changes-observation)

      The databaseChanges and hasDatabaseChanges Methods

      databaseChanges(from:) returns a dictionary of differences between two records:

      -
      let oldPlayer = Player(id: 1, name: "Arthur", score: 100)
      -let newPlayer = Player(id: 1, name: "Arthur", score: 1000)
      +
      let oldPlayer = Player(id: 1, name: "Arthur", score: 100)
      +let newPlayer = Player(id: 1, name: "Arthur", score: 1000)
       for (column, oldValue) in newPlayer.databaseChanges(from: oldPlayer) {
           print("\(column) was \(oldValue)")
       }
      @@ -3755,10 +3755,10 @@ See [Database Changes Observation](#database-changes-observation)
       
       

      The Record class is able to compare against itself:

      // Record class only
      -let player = Player(id: 1, name: "Arthur", score: 100)
      +let player = Player(id: 1, name: "Arthur", score: 100)
       try player.insert(db)
       player.score = 1000
      -for (column, oldValue) in player.databaseChanges {
      +for (column, oldValue) in player.databaseChanges {
           print("\(column) was \(oldValue)")
       }
       // prints "score was 100"
      @@ -3767,13 +3767,13 @@ See [Database Changes Observation](#database-changes-observation)
       

      Record instances also have a hasDatabaseChanges property:

      // Record class only
       player.score = 1000
      -if player.hasDatabaseChanges {
      +if player.hasDatabaseChanges {
           try player.save(db)
       }
       

      Record.hasDatabaseChanges is false after a Record instance has been fetched or saved into the database. Subsequent modifications may set it, or not: hasDatabaseChanges is based on value comparison. Setting a property to the same value does not set the changed flag:

      -
      let player = Player(name: "Barbara", score: 750)
      +
      let player = Player(name: "Barbara", score: 750)
       player.hasDatabaseChanges // true
       
       try player.insert(db)
      @@ -3850,18 +3850,18 @@ See [Database Changes Observation](#database-changes-observation)
       
       
       

      When you want to handle conflicts at the query level, specify a custom persistenceConflictPolicy in your type that adopts the PersistableRecord protocol. It will alter the INSERT and UPDATE queries run by the insert, update and save persistence methods:

      -
      protocol MutablePersistableRecord {
      +
      protocol MutablePersistableRecord {
           /// The policy that handles SQLite conflicts when records are
           /// inserted or updated.
           ///
           /// This property is optional: its default value uses the ABORT
           /// policy for both insertions and updates, so that GRDB generate
           /// regular INSERT and UPDATE queries.
      -    static var persistenceConflictPolicy: PersistenceConflictPolicy { get }
      +    static var persistenceConflictPolicy: PersistenceConflictPolicy { get }
       }
       
      -struct Player : MutablePersistableRecord {
      -    static let persistenceConflictPolicy = PersistenceConflictPolicy(
      +struct Player : MutablePersistableRecord {
      +    static let persistenceConflictPolicy = PersistenceConflictPolicy(
               insert: .replace,
               update: .replace)
       }
      @@ -3890,7 +3890,7 @@ See [Database Changes Observation](#database-changes-observation)
       }
       
       // No way to define an explicit primary key
      -try db.create(virtualTable: "book", using: FTS4()) { t in
      +try db.create(virtualTable: "book", using: FTS4()) { t in
           t.column("title")
           t.column("author")
           t.column("body")
      @@ -3916,14 +3916,14 @@ See [Database Changes Observation](#database-changes-observation)
       
       
      1. Have the databaseSelection static property (from the TableRecord protocol) return the hidden rowid column:

        -
        struct Event : TableRecord {
        -    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
        +
        struct Event : TableRecord {
        +    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
         }
         
         // When you subclass Record, you need an override:
        -class Book : Record {
        +class Book : Record {
             override class var databaseSelection: [SQLSelectable] {
        -        return [AllColums(), Column.rowID]
        +        return [AllColums(), Column.rowID]
             }
         }
         
        @@ -3933,7 +3933,7 @@ See [Database Changes Observation](#database-changes-observation) let events = try Event.fetchAll(db)
      2. Have init(row:) from the FetchableRecord protocol consume the rowid column:

        -
        struct Event : FetchableRecord {
        +
        struct Event : FetchableRecord {
             var id: Int64?
         
             init(row: Row) {
        @@ -3947,7 +3947,7 @@ See [Database Changes Observation](#database-changes-observation)
         event.id // some value
         
      3. Encode the rowid in encode(to:), and keep it in the didInsert(with:for:) method (both from the PersistableRecord and MutablePersistableRecord protocols):

        -
        struct Event : MutablePersistableRecord {
        +
        struct Event : MutablePersistableRecord {
             var id: Int64?
         
             func encode(to container: inout PersistenceContainer) {
        @@ -3964,7 +3964,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        You will then be able to track your record ids, update them, or check for their existence:

        -
        let event = Event(message: "foo", date: Date())
        +
        let event = Event(message: "foo", date: Date())
         
         // Insertion sets the record id:
         try event.insert(db)
        @@ -3994,7 +3994,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        Examples of Record Definitions

        We will show below how to declare a record type for the following database table:

        -
        try dbQueue.write { db in
        +
        try dbQueue.write { db in
             try db.create(table: "place") { t in
                 t.autoIncrementedPrimaryKey("id")
                 t.column("title", .text).notNull()
        @@ -4713,7 +4713,7 @@ class Place: Record {
         

        The Query Interface

        The query interface lets you write pure Swift instead of SQL:

        -
        try dbQueue.write { db in
        +
        try dbQueue.write { db in
             // Update database schema
             try db.create(table: "wine") { t in ... }
         
        @@ -4731,7 +4731,7 @@ class Place: Record {
         

        You need to open a database connection before you can query the database.

        Please bear in mind that the query interface can not generate all possible SQL queries. You may also prefer writing SQL, and this is just OK. From little snippets to full queries, your SQL skills are welcome:

        -
        try dbQueue.write { db in
        +
        try dbQueue.write { db in
             // Update database schema (with SQL)
             try db.execute(sql: "CREATE TABLE wine (...)")
         
        @@ -4870,7 +4870,7 @@ class Place: Record {
         

        Perform integrity checks on individual columns, and SQLite will only let conforming rows in. In the example below, the $0 closure variable is a column which lets you build any SQL expression.

            // name TEXT CHECK (LENGTH(name) > 0)
             // score INTEGER CHECK (score > 0)
        -    t.column("name", .text).check { length($0) > 0 }
        +    t.column("name", .text).check { length($0) > 0 }
             t.column("score", .integer).check(sql: "score > 0")
         
        @@ -4885,7 +4885,7 @@ class Place: Record { t.foreignKey(["a", "b"], references: "parents") // CHECK (a + b < 10), - t.check(Column("a") + Column("b") < 10) + t.check(Column("a") + Column("b") < 10) // CHECK (a + b < 10) t.check(sql: "a + b < 10") @@ -4934,18 +4934,18 @@ class Place: Record {

        All requests start from a type that adopts the TableRecord protocol, such as a Record subclass (see Records):

        -
        class Player : Record { ... }
        +
        class Player : Record { ... }
         

        Declare the table columns that you want to use for filtering, or sorting:

        -
        let idColumn = Column("id")
        -let nameColumn = Column("name")
        +
        let idColumn = Column("id")
        +let nameColumn = Column("name")
         

        You can also declare column enums, if you prefer:

        // Columns.id and Columns.name can be used just as
         // idColumn and nameColumn declared above.
        -enum Columns: String, ColumnExpression {
        +enum Columns: String, ColumnExpression {
             case id
             case name
         }
        @@ -4997,7 +4997,7 @@ class Place: Record {
         
      4. matching(pattern) performs full-text search.

        // SELECT * FROM document WHERE document MATCH 'sqlite database'
        -let pattern = FTS3Pattern(matchingAllTokensIn: "SQLite database")
        +let pattern = FTS3Pattern(matchingAllTokensIn: "SQLite database")
         Document.matching(pattern)
         
        @@ -5102,19 +5102,19 @@ class Place: Record {

        The selection can be changed for each individual requests, or for all requests built from a given type.

        The select(...) and select(..., as:) methods change the selection of a single request (see Fetching from Requests for detailed information):

        -
        let request = Player.select(max(Column("score")))
        +
        let request = Player.select(max(Column("score")))
         let maxScore: Int? = try Int.fetchOne(db, request)
         

        The default selection for a record type is controlled by the databaseSelection property:

        -
        struct RestrictedPlayer : TableRecord {
        +
        struct RestrictedPlayer : TableRecord {
             static let databaseTableName = "player"
        -    static let databaseSelection: [SQLSelectable] = [Column("id"), Column("name")]
        +    static let databaseSelection: [SQLSelectable] = [Column("id"), Column("name")]
         }
         
        -struct ExtendedPlayer : TableRecord {
        +struct ExtendedPlayer : TableRecord {
             static let databaseTableName = "player"
        -    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
        +    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
         }
         
         // SELECT id, name FROM player
        @@ -5225,7 +5225,7 @@ class Place: Record {
         

        The full-text MATCH operator is available through FTS3Pattern (for FTS3 and FTS4 tables) and FTS5Pattern (for FTS5):

        FTS3 and FTS4:

        -
        let pattern = FTS3Pattern(matchingAllTokensIn: "SQLite database")
        +
        let pattern = FTS3Pattern(matchingAllTokensIn: "SQLite database")
         
         // SELECT * FROM document WHERE document MATCH 'sqlite database'
         Document.matching(pattern)
        @@ -5235,7 +5235,7 @@ class Place: Record {
         

        FTS5:

        -
        let pattern = FTS5Pattern(matchingAllTokensIn: "SQLite database")
        +
        let pattern = FTS5Pattern(matchingAllTokensIn: "SQLite database")
         
         // SELECT * FROM document WHERE document MATCH 'sqlite database'
         Document.matching(pattern)
        @@ -5287,7 +5287,7 @@ class Place: Record {
         
      5. Custom SQL functions and aggregates

        You can apply your own custom SQL functions and aggregates:

        -
        let f = DatabaseFunction("f", ...)
        +
        let f = DatabaseFunction("f", ...)
         
         // SELECT f(name) FROM player
         Player.select(f.apply(nameColumn))
        @@ -5330,7 +5330,7 @@ class Place: Record {
         
         
        • With asRequest(of:), useful when you use Associations:

          -
          struct BookInfo: FetchableRecord, Decodable {
          +
          struct BookInfo: FetchableRecord, Decodable {
               var book: Book
               var author: Author
           }
          @@ -5340,7 +5340,7 @@ class Place: Record {
               .including(required: Book.author)
               .asRequest(of: BookInfo.self)
           
          -let bookInfos = try dbQueue.read { db in
          +let bookInfos = try dbQueue.read { db in
               try request.fetchAll(db) // [BookInfo]
           }
           
        • @@ -5348,7 +5348,7 @@ class Place: Record {
          // A request of Int
           let request = Player.select(max(scoreColumn), as: Int.self)
           
          -let maxScore = try dbQueue.read { db in
          +let maxScore = try dbQueue.read { db in
               try request.fetchOne(db) // Int?
           }
           
          @@ -5501,7 +5501,7 @@ class Place: Record {

          FetchRequest Protocol

          FetchRequest is the protocol for all requests that run from a single select statement, and know how fetched rows should be interpreted:

          -
          protocol FetchRequest: DatabaseRegionConvertible {
          +
          protocol FetchRequest: DatabaseRegionConvertible {
               /// The type that tells how fetched rows should be decoded
               associatedtype RowDecoder
           
          @@ -5532,7 +5532,7 @@ class Place: Record {
           
           
          • SQLRequest is a fetch request built from raw SQL. For example:

            -
            extension Player {
            +
            extension Player {
                 static func filter(color: Color) -> SQLRequest<Player> {
                     return SQLRequest<Player>(
                         sql: "SELECT * FROM player WHERE color = ?"
            @@ -5546,14 +5546,14 @@ class Place: Record {
             
             

            In Swift 5, you can build SQLRequest with SQL Interpolation:

            // Swift 5
            -extension Player {
            +extension Player {
                 static func filter(color: Color) -> SQLRequest<Player> {
                     return "SELECT * FROM player WHERE color = \(color)"
                 }
             }
             
          • The asRequest(of:) method changes the type fetched by the request. It is useful, for example, when you use Associations:

            -
            struct BookInfo: FetchableRecord, Decodable {
            +
            struct BookInfo: FetchableRecord, Decodable {
                 var book: Book
                 var author: Author
             }
            @@ -5598,7 +5598,7 @@ class Place: Record {
             

            Migrations run in order, once and only once. When a user upgrades your application, only non-applied migrations are run.

            Inside each migration, you typically define and update your database tables according to your evolving application needs:

            -
            var migrator = DatabaseMigrator()
            +
            var migrator = DatabaseMigrator()
             
             // 1st migration
             migrator.registerMigration("v1") { db in
            @@ -5647,7 +5647,7 @@ class Place: Record {
             

            The eraseDatabaseOnSchemaChange Option

            A DatabaseMigrator can automatically wipe out the full database content, and recreate the whole database from scratch, if it detects that a migration has changed its definition:

            -
            var migrator = DatabaseMigrator()
            +
            var migrator = DatabaseMigrator()
             migrator.eraseDatabaseOnSchemaChange = true
             
            @@ -5659,7 +5659,7 @@ class Place: Record {
          • During application development, as you are still designing migrations, and the schema changes often.

            In this case, it is recommended that this flag does not ship in the distributed application:

            -
            var migrator = DatabaseMigrator()
            +
            var migrator = DatabaseMigrator()
             #if DEBUG
             // Speed up development by nuking the database when migrations change
             migrator.eraseDatabaseOnSchemaChange = true
            @@ -5691,20 +5691,20 @@ class Place: Record {
             
             

            Full-Text Search is an efficient way to search a corpus of textual documents.

            // Create full-text tables
            -try db.create(virtualTable: "book", using: FTS4()) { t in // or FTS3(), or FTS5()
            +try db.create(virtualTable: "book", using: FTS4()) { t in // or FTS3(), or FTS5()
                 t.column("author")
                 t.column("title")
                 t.column("body")
             }
             
             // Populate full-text table with records or SQL
            -try Book(...).insert(db)
            +try Book(...).insert(db)
             try db.execute(
                 sql: "INSERT INTO book (author, title, body) VALUES (?, ?, ?)",
                 arguments: [...])
             
             // Build search patterns
            -let pattern = FTS3Pattern(matchingPhrase: "Moby-Dick")
            +let pattern = FTS3Pattern(matchingPhrase: "Moby-Dick")
             
             // Search with the query interface or SQL
             let books = try Book.matching(pattern).fetchAll(db)
            @@ -5892,12 +5892,12 @@ class Place: Record {
             
             

            Create tables with the create(virtualTable:using:) method:

            // CREATE VIRTUAL TABLE document USING fts3(content)
            -try db.create(virtualTable: "document", using: FTS3()) { t in
            +try db.create(virtualTable: "document", using: FTS3()) { t in
                 t.column("content")
             }
             
             // CREATE VIRTUAL TABLE document USING fts4(content)
            -try db.create(virtualTable: "document", using: FTS4()) { t in
            +try db.create(virtualTable: "document", using: FTS4()) { t in
                 t.column("content")
             }
             
            @@ -5911,7 +5911,7 @@ class Place: Record { // title, // body // ) -try db.create(virtualTable: "book", using: FTS4()) { t in +try db.create(virtualTable: "book", using: FTS4()) { t in t.tokenizer = .porter t.column("author") t.column("title") @@ -5930,7 +5930,7 @@ class Place: Record { // notindexed=uuid, // languageid=lid // ) -try db.create(virtualTable: "document", using: FTS4()) { t in +try db.create(virtualTable: "document", using: FTS4()) { t in t.content = "" t.compress = "zip" t.uncompress = "unzip" @@ -5949,7 +5949,7 @@ class Place: Record {

            A tokenizer defines what matching means. Depending on the tokenizer you choose, full-text searches won’t return the same results.

            SQLite ships with three built-in FTS3/4 tokenizers: simple, porter and unicode61 that use different algorithms to match queries with indexed content:

            -
            try db.create(virtualTable: "book", using: FTS4()) { t in
            +
            try db.create(virtualTable: "book", using: FTS4()) { t in
                 // Pick one:
                 t.tokenizer = .simple // default
                 t.tokenizer = .porter
            @@ -6023,7 +6023,7 @@ class Place: Record {
             
             
            • simple

              -
              try db.create(virtualTable: "book", using: FTS4()) { t in
              +
              try db.create(virtualTable: "book", using: FTS4()) { t in
                   t.tokenizer = .simple   // default
               }
               
              @@ -6034,7 +6034,7 @@ class Place: Record {

              It does not strip diacritics from latin script characters, and won’t match jérôme with jerome.

            • porter

              -
              try db.create(virtualTable: "book", using: FTS4()) { t in
              +
              try db.create(virtualTable: "book", using: FTS4()) { t in
                   t.tokenizer = .porter
               }
               
              @@ -6043,7 +6043,7 @@ class Place: Record {

              It does not strip diacritics from latin script characters, and won’t match jérôme with jerome.

            • unicode61

              -
              try db.create(virtualTable: "book", using: FTS4()) { t in
              +
              try db.create(virtualTable: "book", using: FTS4()) { t in
                   t.tokenizer = .unicode61()
                   t.tokenizer = .unicode61(diacritics: .keep)
               }
              @@ -6072,7 +6072,7 @@ class Place: Record {
               

              Not all search patterns are valid: they must follow the Full-Text Index Queries Grammar.

              The FTS3Pattern type helps you validating patterns, and building valid patterns from untrusted strings (such as strings typed by users):

              -
              struct FTS3Pattern {
              +
              struct FTS3Pattern {
                   init(rawPattern: String) throws
                   init?(matchingAnyTokenIn string: String)
                   init?(matchingAllTokensIn string: String)
              @@ -6082,24 +6082,24 @@ class Place: Record {
               
               

              The first initializer validates your raw patterns against the query grammar, and may throw a DatabaseError:

              // OK: FTS3Pattern
              -let pattern = try FTS3Pattern(rawPattern: "sqlite AND database")
              +let pattern = try FTS3Pattern(rawPattern: "sqlite AND database")
               // DatabaseError: malformed MATCH expression: [AND]
              -let pattern = try FTS3Pattern(rawPattern: "AND")
              +let pattern = try FTS3Pattern(rawPattern: "AND")
               

              The three other initializers don’t throw. They build a valid pattern from any string, including strings provided by users of your application. They let you find documents that match all given words, any given word, or a full phrase, depending on the needs of your application:

              let query = "SQLite database"
               // Matches documents that contain "SQLite" or "database"
              -let pattern = FTS3Pattern(matchingAnyTokenIn: query)
              +let pattern = FTS3Pattern(matchingAnyTokenIn: query)
               // Matches documents that contain both "SQLite" and "database"
              -let pattern = FTS3Pattern(matchingAllTokensIn: query)
              +let pattern = FTS3Pattern(matchingAllTokensIn: query)
               // Matches documents that contain "SQLite database"
              -let pattern = FTS3Pattern(matchingPhrase: query)
              +let pattern = FTS3Pattern(matchingPhrase: query)
               

              They return nil when no pattern could be built from the input string:

              -
              let pattern = FTS3Pattern(matchingAnyTokenIn: "")  // nil
              -let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
              +
              let pattern = FTS3Pattern(matchingAnyTokenIn: "")  // nil
              +let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
               

              FTS3Pattern are regular values. You can use them as query arguments:

              @@ -6113,7 +6113,7 @@ class Place: Record { let documents = try Document.matching(pattern).fetchAll(db) // Search in a specific column: -let documents = try Document.filter(Column("content").match(pattern)).fetchAll(db) +let documents = try Document.filter(Column("content").match(pattern)).fetchAll(db)

              Enabling FTS5 Support

              @@ -6153,7 +6153,7 @@ class Place: Record {

              Create FTS5 tables with the create(virtualTable:using:) method:

              // CREATE VIRTUAL TABLE document USING fts5(content)
              -try db.create(virtualTable: "document", using: FTS5()) { t in
              +try db.create(virtualTable: "document", using: FTS5()) { t in
                   t.column("content")
               }
               
              @@ -6167,7 +6167,7 @@ class Place: Record { // title, // body // ) -try db.create(virtualTable: "book", using: FTS5()) { t in +try db.create(virtualTable: "book", using: FTS5()) { t in t.tokenizer = .porter() t.column("author") t.column("title") @@ -6185,7 +6185,7 @@ class Place: Record { // columnsize=0, // detail=column // ) -try db.create(virtualTable: "document", using: FTS5()) { t in +try db.create(virtualTable: "document", using: FTS5()) { t in t.column("content") t.column("uuid").notIndexed() t.content = "table" @@ -6204,7 +6204,7 @@ class Place: Record {

              A tokenizer defines what matching means. Depending on the tokenizer you choose, full-text searches won’t return the same results.

              SQLite ships with three built-in FTS5 tokenizers: ascii, porter and unicode61 that use different algorithms to match queries with indexed content.

              -
              try db.create(virtualTable: "book", using: FTS5()) { t in
              +
              try db.create(virtualTable: "book", using: FTS5()) { t in
                   // Pick one:
                   t.tokenizer = .unicode61() // default
                   t.tokenizer = .unicode61(...)
              @@ -6287,7 +6287,7 @@ class Place: Record {
               
               
              • unicode61

                -
                try db.create(virtualTable: "book", using: FTS5()) { t in
                +
                try db.create(virtualTable: "book", using: FTS5()) { t in
                     t.tokenizer = .unicode61()
                     t.tokenizer = .unicode61(diacritics: .keep)
                 }
                @@ -6299,7 +6299,7 @@ class Place: Record {
                 
                 

                It does not provide stemming, and won’t match databases with database.

              • ascii

                -
                try db.create(virtualTable: "book", using: FTS5()) { t in
                +
                try db.create(virtualTable: "book", using: FTS5()) { t in
                     t.tokenizer = .ascii
                 }
                 
                @@ -6310,7 +6310,7 @@ class Place: Record {

                It does not strip diacritics from latin script characters, and won’t match jérôme with jerome.

              • porter

                -
                try db.create(virtualTable: "book", using: FTS5()) { t in
                +
                try db.create(virtualTable: "book", using: FTS5()) { t in
                     t.tokenizer = .porter()       // porter wrapping unicode61 (the default)
                     t.tokenizer = .porter(.ascii) // porter wrapping ascii
                     t.tokenizer = .porter(.unicode61(diacritics: .keep)) // porter wrapping unicode61 without diacritics stripping
                @@ -6338,11 +6338,11 @@ class Place: Record {
                 

                Not all search patterns are valid: they must follow the Full-Text Query Syntax.

                The FTS5Pattern type helps you validating patterns, and building valid patterns from untrusted strings (such as strings typed by users):

                -
                extension Database {
                +
                extension Database {
                     func makeFTS5Pattern(rawPattern: String, forTable table: String) throws -> FTS5Pattern
                 }
                 
                -struct FTS5Pattern {
                +struct FTS5Pattern {
                     init?(matchingAnyTokenIn string: String)
                     init?(matchingAllTokensIn string: String)
                     init?(matchingPhrase string: String)
                @@ -6361,18 +6361,18 @@ class Place: Record {
                 

                The FTS5Pattern initializers don’t throw. They build a valid pattern from any string, including strings provided by users of your application. They let you find documents that match all given words, any given word, or a full phrase, depending on the needs of your application:

                let query = "SQLite database"
                 // Matches documents that contain "SQLite" or "database"
                -let pattern = FTS5Pattern(matchingAnyTokenIn: query)
                +let pattern = FTS5Pattern(matchingAnyTokenIn: query)
                 // Matches documents that contain both "SQLite" and "database"
                -let pattern = FTS5Pattern(matchingAllTokensIn: query)
                +let pattern = FTS5Pattern(matchingAllTokensIn: query)
                 // Matches documents that contain "SQLite database"
                -let pattern = FTS5Pattern(matchingPhrase: query)
                +let pattern = FTS5Pattern(matchingPhrase: query)
                 // Matches documents that start with "SQLite database"
                -let pattern = FTS5Pattern(matchingPrefixPhrase: query)
                +let pattern = FTS5Pattern(matchingPrefixPhrase: query)
                 

                They return nil when no pattern could be built from the input string:

                -
                let pattern = FTS5Pattern(matchingAnyTokenIn: "")  // nil
                -let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
                +
                let pattern = FTS5Pattern(matchingAnyTokenIn: "")  // nil
                +let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
                 

                FTS5Pattern are regular values. You can use them as query arguments:

                @@ -6415,7 +6415,7 @@ class Place: Record { } // A full-text table synchronized with the regular table -try db.create(virtualTable: "book_ft", using: FTS4()) { t in // or FTS5() +try db.create(virtualTable: "book_ft", using: FTS4()) { t in // or FTS5() t.synchronize(withTable: "book") t.column("author") t.column("title") @@ -6441,7 +6441,7 @@ class Place: Record { try db.create(table: "book") { t in ... } -try db.create(virtualTable: "book_ft", using: FTS4()) { t in +try db.create(virtualTable: "book_ft", using: FTS4()) { t in t.synchronize(withTable: "book") ... } @@ -6560,7 +6560,7 @@ class Place: Record {

                To split rows, we will use row adapters. Row adapters adapt rows so that row consumers see exactly the columns they want. Among other things, row adapters can define several row scopes that give access to as many row slices. Sounds like a perfect match.

                At the very beginning, there is an SQL query:

                -
                try dbQueue.read { db in
                +
                try dbQueue.read { db in
                     let sql = """
                         SELECT player.*, team.*, MAX(round.score) AS maxScore
                         FROM player
                @@ -6574,20 +6574,20 @@ class Place: Record {
                 
                    // SELECT player.*, team.*, ...
                     //        <------>
                     let playerWidth = try db.columns(in: "player").count
                -    let playerAdapter = RangeRowAdapter(0 ..< playerWidth)
                +    let playerAdapter = RangeRowAdapter(0 ..< playerWidth)
                 

                We also need an adapter that extracts team columns:

                    // SELECT player.*, team.*, ...
                     //                  <---->
                     let teamWidth = try db.columns(in: "team").count
                -    let teamAdapter = RangeRowAdapter(playerWidth ..< (playerWidth + teamWidth))
                +    let teamAdapter = RangeRowAdapter(playerWidth ..< (playerWidth + teamWidth))
                 

                We merge those two adapters in a single ScopeAdapter that will allow us to access both sliced rows:

                    let playerScope = "player"
                     let teamScope = "team"
                -    let adapter = ScopeAdapter([
                +    let adapter = ScopeAdapter([
                         playerScope: playerAdapter,
                         teamScope: teamAdapter])
                 
                @@ -6637,15 +6637,15 @@ class Place: Record {

      To address the first bullet, let’s define a record that holds our player, optional team, and maximum score. Since it can decode database rows, it adopts the FetchableRecord protocol:

      -
      struct PlayerInfo {
      +
      struct PlayerInfo {
           var player: Player
           var team: Team?
           var maxScore: Int
       }
       
       /// PlayerInfo can decode rows:
      -extension PlayerInfo: FetchableRecord {
      -    private enum Scopes {
      +extension PlayerInfo: FetchableRecord {
      +    private enum Scopes {
               static let player = "player"
               static let team = "team"
           }
      @@ -6659,7 +6659,7 @@ class Place: Record {
       

      Let’s now write the method that fetches PlayerInfo records:

      -
      extension PlayerInfo {
      +
      extension PlayerInfo {
           static func fetchAll(_ db: Database) throws -> [PlayerInfo] {
       
      @@ -6699,7 +6699,7 @@ class Place: Record { Player.numberOfSelectedColumns(db), Team.numberOfSelectedColumns(db)]) - let adapter = ScopeAdapter([ + let adapter = ScopeAdapter([ Scopes.player: adapters[0], Scopes.team: adapters[1]])
      @@ -6716,7 +6716,7 @@ class Place: Record {

      And when your app needs to fetch player infos, it now reads:

      // Fetch player infos
      -let playerInfos = try dbQueue.read { db in
      +let playerInfos = try dbQueue.read { db in
           try PlayerInfo.fetchAll(db)
       }
       
      @@ -6736,15 +6736,15 @@ class Place: Record {

      The PlayerInfo.fetchAll method above directly fetches records. It’s all good, but in order to profit from database observation, you’ll need a custom request that defines a database query.

      It is recommended that you read the previous paragraphs before you dive in this sample code. We start with the same PlayerInfo record as above:

      -
      struct PlayerInfo {
      +
      struct PlayerInfo {
           var player: Player
           var team: Team?
           var maxScore: Int
       }
       
       /// PlayerInfo can decode rows:
      -extension PlayerInfo: FetchableRecord {
      -    private enum Scopes {
      +extension PlayerInfo: FetchableRecord {
      +    private enum Scopes {
               static let player = "player"
               static let team = "team"
           }
      @@ -6758,7 +6758,7 @@ class Place: Record {
       

      Now we write a method that returns a request, and build the fetching method on top of that request:

      -
      extension PlayerInfo {
      +
      extension PlayerInfo {
           /// The request for all player infos
           static func all() -> AdaptedFetchRequest<SQLRequest<PlayerInfo>> {
               let sql = """
      @@ -6771,11 +6771,11 @@ class Place: Record {
                   LEFT JOIN round ON ...
                   GROUP BY ...
                   """
      -        return SQLRequest<PlayerInfo>(sql: sql).adapted { db in
      +        return SQLRequest<PlayerInfo>(sql: sql).adapted { db in
                   let adapters = try splittingRowAdapters(columnCounts: [
                       Player.numberOfSelectedColumns(db),
                       Team.numberOfSelectedColumns(db)])
      -            return ScopeAdapter([
      +            return ScopeAdapter([
                       Scopes.player: adapters[0],
                       Scopes.team: adapters[1]])
               }
      @@ -6790,7 +6790,7 @@ class Place: Record {
       
       

      It is now time to use our request:

      // Fetch player infos
      -let playerInfos = try dbQueue.read { db in
      +let playerInfos = try dbQueue.read { db in
           try PlayerInfo.fetchAll(db)
       }
       
      @@ -6810,22 +6810,22 @@ class Place: Record {
       

      Codable Records build on top of the standard Decodable protocol in order to decode database rows.

      You can consume complex joined queries with Codable records as well. As a demonstration, we’ll rewrite the above sample code:

      -
      struct Player: Decodable, FetchableRecord, TableRecord {
      +
      struct Player: Decodable, FetchableRecord, TableRecord {
           var id: Int64
           var name: String
       }
      -struct Team: Decodable, FetchableRecord, TableRecord {
      +struct Team: Decodable, FetchableRecord, TableRecord {
           var id: Int64
           var name: String
           var color: Color
       }
      -struct PlayerInfo: Decodable, FetchableRecord {
      +struct PlayerInfo: Decodable, FetchableRecord {
           var player: Player
           var team: Team?
           var maxScore: Int
       }
       
      -extension PlayerInfo {
      +extension PlayerInfo {
           /// The request for all player infos
           static func all() -> AdaptedFetchRequest<SQLRequest<PlayerInfo>> {
               let sql = """
      @@ -6838,11 +6838,11 @@ class Place: Record {
                   LEFT JOIN round ON ...
                   GROUP BY ...
                   """
      -        return SQLRequest<PlayerInfo>(sql: sql).adapted { db in
      +        return SQLRequest<PlayerInfo>(sql: sql).adapted { db in
                   let adapters = try splittingRowAdapters(columnCounts: [
                       Player.numberOfSelectedColumns(db),
                       Team.numberOfSelectedColumns(db)])
      -            return ScopeAdapter([
      +            return ScopeAdapter([
                       CodingKeys.player.stringValue: adapters[0],
                       CodingKeys.team.stringValue: adapters[1]])
               }
      @@ -6855,7 +6855,7 @@ class Place: Record {
       }
       
       // Fetch player infos
      -let playerInfos = try dbQueue.read { db in
      +let playerInfos = try dbQueue.read { db in
           try PlayerInfo.fetchAll(db)
       }
       
      @@ -6891,8 +6891,8 @@ class Place: Record {
       

      When your application needs to make sure a specific database transaction has been successfully committed before it executes some work, use the Database.afterNextTransactionCommit(_:) method.

      Its closure argument is called right after database changes have been successfully written to disk:

      -
      try dbQueue.write { db in
      -    db.afterNextTransactionCommit { db in
      +
      try dbQueue.write { db in
      +    db.afterNextTransactionCommit { db in
               print("success")
           }
           ...
      @@ -6906,18 +6906,18 @@ class Place: Record {
       

      In the example below, a location manager starts monitoring a CLRegion if and only if it has successfully been stored in the database:

      /// Inserts a region in the database, and start monitoring upon
       /// successful insertion.
      -func startMonitoring(_ db: Database, region: CLRegion) throws {
      +func startMonitoring(_ db: Database, region: CLRegion) throws {
           // Make sure database is inside a transaction
      -    try db.inSavepoint {
      +    try db.inSavepoint {
       
               // Save the region in the database
               try insert(...)
       
               // Start monitoring if and only if the insertion is
               // eventually committed
      -        db.afterNextTransactionCommit { _ in
      +        db.afterNextTransactionCommit { _ in
                   // locationManager prefers the main queue:
      -            DispatchQueue.main.async {
      +            DispatchQueue.main.async {
                       locationManager.startMonitoring(for: region)
                   }
               }
      @@ -6928,7 +6928,7 @@ class Place: Record {
       

      The method above won’t trigger the location manager if the transaction is eventually rollbacked (explicitly, or because of an error), as in the sample code below:

      -
      try dbQueue.write { db in
      +
      try dbQueue.write { db in
           // success
           try startMonitoring(db, region)
       
      @@ -6945,7 +6945,7 @@ class Place: Record {
       

      ValueObservation notifies your application with fresh values (this is what most applications need :+1:):

      -
      let observation = ValueObservation.tracking { db in
      +
      let observation = ValueObservation.tracking { db in
           try request.fetchAll(db)
       }
       let observer = observation.start(
      @@ -6954,24 +6954,24 @@ class Place: Record {
               print("fresh players could not be fetched")
           },
           onChange: { (players: [Player]) in
      -        let names = players.map { $0.name }.joined(separator: ", ")
      +        let names = players.map { $0.name }.joined(separator: ", ")
               print("Fresh players: \(names)")
           })
       
      -try dbQueue.write { db in
      -    try Player(name: "Arthur").insert(db)
      +try dbQueue.write { db in
      +    try Player(name: "Arthur").insert(db)
       }
       // Prints "Fresh players: Arthur, ..."
       

      DatabaseRegionObservation notifies your application with database connections, right after an impactful database transaction has been committed (reserved for more advanced use cases :nerd_face:):

      -
      let observation = DatabaseRegionObservation(tracking: request)
      +
      let observation = DatabaseRegionObservation(tracking: request)
       let observer = try observation.start(in: dbQueue) { (db: Database) in
           print("Players have changed.")
       }
       
      -try dbQueue.write { db in
      -    try Player(name: "Barbara").insert(db)
      +try dbQueue.write { db in
      +    try Player(name: "Barbara").insert(db)
       }
       // Prints "Players have changed."
       
      @@ -6999,7 +6999,7 @@ class Place: Record {

      ValueObservation Usage

      Here is a typical UIViewController which observes the database in order to keep its view up-to-date:

      -
      class PlayerViewController: UIViewController {
      +
      class PlayerViewController: UIViewController {
           @IBOutlet weak var nameLabel: UILabel!
           private var observer: TransactionObserver?
       
      @@ -7007,7 +7007,7 @@ class Place: Record {
               super.viewWillAppear(animated)
       
               // Define a ValueObservation which tracks a player
      -        let observation = ValueObservation.tracking { db in
      +        let observation = ValueObservation.tracking { db in
                   try Player.fetchOne(db, key: 42)
               }
       
      @@ -7019,7 +7019,7 @@ class Place: Record {
                   },
                   onChange: { [weak self] (player: Player?) in
                       // Player has been refreshed: update view
      -                guard let self = self else { return }
      +                guard let self = self else { return }
                       self.nameLabel.text = player?.name
                   })
           }
      @@ -7047,7 +7047,7 @@ class Place: Record {
           super.viewWillAppear(animated)
       
           // Define a ValueObservation which tracks a player
      -    let observation = ValueObservation.tracking { db in
      +    let observation = ValueObservation.tracking { db in
               try Player.fetchOne(db, key: 42)
           }
       
      @@ -7062,7 +7062,7 @@ class Place: Record {
               },
               onChange: { [weak self] (player: Player?) in
                   // Player has been refreshed: update view
      -            guard let self = self else { return }
      +            guard let self = self else { return }
                   self.activityIndicator.stopAnimating()
                   self.nameLabel.text = player?.name
               })
      @@ -7081,7 +7081,7 @@ class Place: Record {
       
       

      For example:

      // Track changes in a single player
      -let observation = ValueObservation.tracking { db in
      +let observation = ValueObservation.tracking { db in
           try Player.fetchOne(db, key: 42)
       }
       
      @@ -7098,15 +7098,15 @@ class Place: Record {
       

      It may happen that such an observation notifies identical consecutive values. This is because it will fetch a fresh value whenever a change could happen. For example, the observation for the maximum player score will notify a fresh value everytime a score is changed, inserted, or deleted, even if the maximum score is unchanged:

      // Track changes in the maximum player score
       // This observation may notify duplicate values
      -let observation = ValueObservation.tracking { db in
      -    try Player.select(max(Column("score")), as: Int.self).fetchOne(db)
      +let observation = ValueObservation.tracking { db in
      +    try Player.select(max(Column("score")), as: Int.self).fetchOne(db)
       }
       

      You can filter out those duplicates with the ValueObservation.removeDuplicates method. It requires the observed value to adopt the Equatable protocol:

      let observation = ValueObservation
      -    .tracking { db in
      -        try Player.select(max(Column("score")), as: Int.self).fetchOne(db)
      +    .tracking { db in
      +        try Player.select(max(Column("score")), as: Int.self).fetchOne(db)
           }
           .removeDuplicates()
       
      @@ -7128,20 +7128,20 @@ class Place: Record {

      Changes that happen outside of the observed requests are ignored, so make sure you fully cover the database region you want to observe. This is the price you pay for the optimization.

      Let’s give a practical example, and observe the Hall of Fame:

      -
      struct HallOfFame {
      +
      struct HallOfFame {
           var totalPlayerCount: Int
           var bestPlayers: [Player]
       }
       
      -extension HallOfFame {
      +extension HallOfFame {
           /// Fetch the HallOfFame
      -    static fetch(_ db: Database) throws -> HallOfFame {
      +    static fetch(_ db: Database) throws -> HallOfFame {
               let totalPlayerCount = try Player.fetchCount(db)
               let bestPlayers = try Player
      -            .order(Column("score").desc)
      +            .order(Column("score").desc)
                   .limit(10)
                   .fetchAll(db)
      -        return HallOfFame(
      +        return HallOfFame(
                   totalPlayerCount: totalPlayerCount,
                   bestPlayers: bestPlayers)
           }
      @@ -7166,9 +7166,9 @@ class Place: Record {
       

      Those observations are equivalent to the following ones, defined with ValueObservation.tracking(value:):

      -
      ValueObservation.tracking { db in try request.fetchCount(db) }
      -ValueObservation.tracking { db in try request.fetchAll(db) }
      -ValueObservation.tracking { db in try request.fetchOne(db) }
      +
      ValueObservation.tracking { db in try request.fetchCount(db) }
      +ValueObservation.tracking { db in try request.fetchAll(db) }
      +ValueObservation.tracking { db in try request.fetchOne(db) }
       

      Yet they are optimized:

      @@ -7192,8 +7192,8 @@ class Place: Record {

      For example:

      // Observe a player's profile image
       let observation = ValueObservation
      -    .tracking { db in try Player.fetchOne(db, key: 42) }
      -    .map { player in player?.image }
      +    .tracking { db in try Player.fetchOne(db, key: 42) }
      +    .map { player in player?.image }
       
       let observer = observation.start(
           in: dbQueue,
      @@ -7211,8 +7211,8 @@ class Place: Record {
       

      For example:

      // Observe a player
       let observation = ValueObservation
      -    .tracking { db in try Player.fetchOne(db, key: 42) }
      -    .compactMap { $0 }
      +    .tracking { db in try Player.fetchOne(db, key: 42) }
      +    .compactMap { $0 }
       
       let observer = observation.start(
           in: dbQueue,
      @@ -7229,7 +7229,7 @@ class Place: Record {
       
       

      For example:

      let observation = ValueObservation
      -    .tracking { db in try Player.fetchOne(db, key: 42) }
      +    .tracking { db in try Player.fetchOne(db, key: 42) }
           .removeDuplicates()
       
       let observer = observation.start(
      @@ -7247,13 +7247,13 @@ class Place: Record {
       
       

      The ValueObservation.combine(...) method builds a single observation from several:

      // Two base observations
      -let playerCountObservation = ValueObservation.tracking { db in
      +let playerCountObservation = ValueObservation.tracking { db in
           try Player.fetchCount(db)
       }
      -let bestPlayersObservation = ValueObservation.tracking { db in
      +let bestPlayersObservation = ValueObservation.tracking { db in
           try Player
               .limit(10)
      -        .order(Column("score").desc)
      +        .order(Column("score").desc)
               .fetchAll(db)
       }
       
      @@ -7275,13 +7275,13 @@ class Place: Record {
       

      combine also exists as an instance method:

      -
      struct HallOfFame {
      +
      struct HallOfFame {
           var totalPlayerCount: Int
           var bestPlayers: [Player]
       }
       
       let observation = playerCountObservation.combine(bestPlayersObservation) {
      -    HallOfFame(totalPlayerCount: $0, bestPlayers: $1)
      +    HallOfFame(totalPlayerCount: $0, bestPlayers: $1)
       }
       
      @@ -7354,7 +7354,7 @@ class Place: Record {

      After the initial value has been notified, all subsequent values are notified asynchronously:

      -
      try dbQueue.write { db in ... }
      +
      try dbQueue.write { db in ... }
       // <- Eventually prints "fresh value" on the main queue
       
    8. .async(onQueue:startImmediately:): all values are asychronously notified on the specified queue.

      @@ -7398,7 +7398,7 @@ class Place: Record {

      ValueObservation.requiresWriteAccess

      The requiresWriteAccess property is false by default. When true, a ValueObservation has a write access to the database, and its fetches are automatically wrapped in a savepoint:

      -
      var observation = ValueObservation.tracking { db in
      +
      var observation = ValueObservation.tracking { db in
           // write access allowed
           ...
       }
      @@ -7409,7 +7409,7 @@ class Place: Record {
       

      Advanced: ValueObservation.tracking(_:reducer:)

      The most low-level way to define a ValueObservation is to create one from an observed database region (see above), and a reducer that adopts the ValueReducer protocol (:fire: EXPERIMENTAL):

      -
      protocol ValueReducer {
      +
      protocol ValueReducer {
           associatedtype Fetched
           associatedtype Value
       
      @@ -7427,10 +7427,10 @@ class Place: Record {
       
       

      The sample code below counts the number of times the player table is modified:

      var count = 0
      -let reducer = AnyValueReducer(
      +let reducer = AnyValueReducer(
           fetch: { _ in /* don't fetch anything */ },
           value: { _ -> Int? in
      -        defer { count += 1 }
      +        defer { count += 1 }
               return count })
       let observation = ValueObservation.tracking(Player.all(), reducer: { _ in reducer })
       let observer = observation.start(
      @@ -7441,8 +7441,8 @@ class Place: Record {
           })
       // Prints "Number of transactions that have modified players: 0"
       
      -try dbQueue.write { db in
      -    try Player(...).insert(db)
      +try dbQueue.write { db in
      +    try Player(...).insert(db)
       }
       // Prints "Number of transactions that have modified players: 1"
       
      @@ -7457,7 +7457,7 @@ class Place: Record {

      Define an observation by providing one or several requests to track:

      // Track all players
      -let observation = DatabaseRegionObservation(tracking: Player.all())
      +let observation = DatabaseRegionObservation(tracking: Player.all())
       

      Then start the observation from a database queue or pool:

      @@ -7467,8 +7467,8 @@ class Place: Record {

      And enjoy the changes notifications:

      -
      try dbQueue.write { db in
      -    try Player(name: "Arthur").insert(db)
      +
      try dbQueue.write { db in
      +    try Player(name: "Arthur").insert(db)
       }
       // Prints "Players were changed"
       
      @@ -7477,7 +7477,7 @@ class Place: Record {

      You can also feed DatabaseRegionObservation with DatabaseRegion, or any type which conforms to the DatabaseRegionConvertible protocol. For example:

      // Observe the full database
      -let observation = DatabaseRegionObservation(tracking: DatabaseRegion.fullDatabase)
      +let observation = DatabaseRegionObservation(tracking: DatabaseRegion.fullDatabase)
       let observer = try observation.start(in: dbQueue) { (db: Database) in
           print("Database was changed")
       }
      @@ -7550,13 +7550,13 @@ class Place: Record {
       
    9. The type of the fetched records. It must be a type that adopts the FetchableRecord protocol, such as a subclass of the Record class
    10. A fetch request
    11. -
      class Player : Record { ... }
      -let dbQueue = DatabaseQueue(...)    // or DatabasePool
      +
      class Player : Record { ... }
      +let dbQueue = DatabaseQueue(...)    // or DatabasePool
       
       // Using a Request from the Query Interface:
      -let controller = FetchedRecordsController(
      +let controller = FetchedRecordsController(
           dbQueue,
      -    request: Player.order(Column("name")))
      +    request: Player.order(Column("name")))
       
       // Using SQL, and eventual arguments:
       let controller = FetchedRecordsController<Player>(
      @@ -7587,20 +7587,20 @@ the fetch.

      Changes are not reflected until they are applied in the database by a successful transaction:

      // One transaction
      -try dbQueue.write { db in         // or dbPool.write
      +try dbQueue.write { db in         // or dbPool.write
           try player1.insert(db)
           try player2.insert(db)
       }
       
       // One transaction
      -try dbQueue.inTransaction { db in // or dbPool.writeInTransaction
      +try dbQueue.inTransaction { db in // or dbPool.writeInTransaction
           try player1.insert(db)
           try player2.insert(db)
           return .commit
       }
       
       // Two transactions
      -try dbQueue.inDatabase { db in    // or dbPool.writeWithoutTransaction
      +try dbQueue.inDatabase { db in    // or dbPool.writeWithoutTransaction
           try player1.insert(db)
           try player2.insert(db)
       }
      @@ -7610,7 +7610,7 @@ the fetch.

      The Changes Notifications

      An instance of FetchedRecordsController notifies that the controller’s fetched records have been changed by the mean of callbacks:

      -
      let controller = try FetchedRecordsController(...)
      +
      let controller = try FetchedRecordsController(...)
       
       controller.trackChanges(
           // controller's records are about to change:
      @@ -7628,7 +7628,7 @@ the fetch.

      See Implementing Table View Updates for more detail on table view updates.

      All callbacks are optional. When you only need to grab the latest results, you can omit the didChange argument name:

      -
      controller.trackChanges { controller in
      +
      controller.trackChanges { controller in
           let newPlayers = controller.fetchedRecords // [Player]
       }
       
      @@ -7639,12 +7639,12 @@ the fetch.

      Callbacks have the fetched record controller itself as an argument: use it in order to avoid memory leaks:

      // BAD: memory leak
      -controller.trackChanges { _ in
      +controller.trackChanges { _ in
           let newPlayers = controller.fetchedRecords
       }
       
       // GOOD
      -controller.trackChanges { controller in
      +controller.trackChanges { controller in
           let newPlayers = controller.fetchedRecords
       }
       
      @@ -7667,14 +7667,14 @@ the fetch.

      Whenever the fetched records controller can not look for changes after a transaction has potentially modified the tracked request, an error handler is called. The request observation is not stopped, though: future transactions may successfully be handled, and the notified changes will then be based on the last successful fetch.

      -
      controller.trackErrors { (controller, error) in
      +
      controller.trackErrors { (controller, error) in
           print("Missed a transaction because \(error)")
       }
       

      Modifying the Fetch Request

      You can change a fetched records controller’s fetch request or SQL query.

      -
      controller.setRequest(Player.order(Column("name")))
      +
      controller.setRequest(Player.order(Column("name")))
       controller.setRequest(sql: "SELECT ...", arguments: ...)
       
      @@ -7686,7 +7686,7 @@ the fetch.

      Change callbacks are invoked asynchronously. This means that modifying the request from the main thread does not immediately triggers callbacks. When you need to take immediate action, force the controller to refresh immediately with its performFetch method. In this case, changes callbacks are not called:

      // Change request on the main thread:
      -controller.setRequest(Player.order(Column("name")))
      +controller.setRequest(Player.order(Column("name")))
       // Here callbacks have not been called yet.
       // You can cancel them, and refresh records immediately:
       try controller.performFetch()
      @@ -7696,14 +7696,14 @@ the fetch.

      FetchedRecordsController let you feed table and collection views, and keep them up-to-date with the database content.

      For nice animated updates, a fetched records controller needs to recognize identical records between two different result sets. When records adopt the TableRecord protocol, they are automatically compared according to their primary key:

      -
      class Player : TableRecord { ... }
      -let controller = FetchedRecordsController(
      +
      class Player : TableRecord { ... }
      +let controller = FetchedRecordsController(
           dbQueue,
           request: Player.all())
       

      For other types, the fetched records controller needs you to be more explicit:

      -
      let controller = FetchedRecordsController(
      +
      let controller = FetchedRecordsController(
           dbQueue,
           request: ...,
           isSameRecord: { (player1, player2) in player1.id == player2.id })
      @@ -7711,15 +7711,15 @@ the fetch.

      Implementing the Table View Datasource Methods

      The table view data source asks the fetched records controller to provide relevant information:

      -
      func numberOfSections(in tableView: UITableView) -> Int {
      +
      func numberOfSections(in tableView: UITableView) -> Int {
           return fetchedRecordsController.sections.count
       }
       
      -func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
      +func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
           return fetchedRecordsController.sections[section].numberOfRecords
       }
       
      -func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
      +func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
           let cell = ...
           let record = fetchedRecordsController.record(at: indexPath)
           // Configure the cell
      @@ -7733,7 +7733,7 @@ the fetch.

      Implementing Table View Updates

      When changes in the fetched records should reload the whole table view, you can simply tell so:

      -
      controller.trackChanges { [unowned self] _ in
      +
      controller.trackChanges { [unowned self] _ in
           self.tableView.reloadData()
       }
       
      @@ -7753,7 +7753,7 @@ the fetch.

      // notification of individual record changes: onChange: { [unowned self] (controller, record, change) in - switch change { + switch change { case .insertion(let indexPath): self.tableView.insertRows(at: [indexPath], with: .fade) @@ -7799,8 +7799,8 @@ the fetch.

      Change callbacks are invoked asynchronously. This means that changes made from the main thread are not immediately notified. When you need to take immediate action, force the controller to refresh immediately with its performFetch method. In this case, changes callbacks are not called:

      // Change database on the main thread:
      -try dbQueue.write { db in
      -    try Player(...).insert(db)
      +try dbQueue.write { db in
      +    try Player(...).insert(db)
       }
       // Here callbacks have not been called yet.
       // You can cancel them, and refresh records immediately:
      @@ -7809,10 +7809,10 @@ the fetch.

      :point_up: Note: when the main thread does not fit your needs, give a serial dispatch queue to the controller initializer: the controller must then be used from this queue, and record changes are notified on this queue as well.

      -
      let queue = DispatchQueue()
      -queue.async {
      -    let controller = try FetchedRecordsController(..., queue: queue)
      -    controller.trackChanges { /* in queue */ }
      +
      let queue = DispatchQueue()
      +queue.async {
      +    let controller = try FetchedRecordsController(..., queue: queue)
      +    controller.trackChanges { /* in queue */ }
           try controller.performFetch()
       }
       
      @@ -7820,7 +7820,7 @@ the fetch.

      TransactionObserver Protocol

      The TransactionObserver protocol lets you observe individual database changes and transactions:

      -
      protocol TransactionObserver : class {
      +
      protocol TransactionObserver : class {
           /// Notifies a database change:
           /// - event.kind (insert, update, or delete)
           /// - event.tableName
      @@ -7857,7 +7857,7 @@ the fetch.

      Activate a Transaction Observer

      To activate a transaction observer, add it to the database queue or pool:

      -
      let observer = MyObserver()
      +
      let observer = MyObserver()
       dbQueue.add(transactionObserver: observer)
       
      @@ -7871,32 +7871,32 @@ the fetch.

      Notified changes are not actually written to disk until the transaction commits, and the databaseDidCommit callback is called. On the other side, databaseDidRollback confirms their invalidation:

      -
      try dbQueue.write { db in
      +
      try dbQueue.write { db in
           try db.execute(sql: "INSERT ...") // 1. didChange
           try db.execute(sql: "UPDATE ...") // 2. didChange
       }                                     // 3. willCommit, 4. didCommit
       
      -try dbQueue.inTransaction { db in
      +try dbQueue.inTransaction { db in
           try db.execute(sql: "INSERT ...") // 1. didChange
           try db.execute(sql: "UPDATE ...") // 2. didChange
           return .rollback                  // 3. didRollback
       }
       
      -try dbQueue.write { db in
      +try dbQueue.write { db in
           try db.execute(sql: "INSERT ...") // 1. didChange
      -    throw SomeError()
      +    throw SomeError()
       }                                     // 2. didRollback
       

      Database statements that are executed outside of any transaction do not drop off the radar:

      -
      try dbQueue.inDatabase { db in
      +
      try dbQueue.inDatabase { db in
           try db.execute(sql: "INSERT ...") // 1. didChange, 2. willCommit, 3. didCommit
           try db.execute(sql: "UPDATE ...") // 4. didChange, 5. willCommit, 6. didCommit
       }
       

      Changes that are on hold because of a savepoint are only notified after the savepoint has been released. This makes sure that notified events are only events that have an opportunity to be committed:

      -
      try dbQueue.inTransaction { db in
      +
      try dbQueue.inTransaction { db in
           try db.execute(sql: "INSERT ...")            // 1. didChange
       
           try db.execute(sql: "SAVEPOINT foo")
      @@ -7913,12 +7913,12 @@ the fetch.

      Eventual errors thrown from databaseWillCommit are exposed to the application code:

      -
      do {
      -    try dbQueue.inTransaction { db in
      +
      do {
      +    try dbQueue.inTransaction { db in
               ...
               return .commit           // 1. willCommit (throws), 2. didRollback
           }
      -} catch {
      +} catch {
           // 3. The error thrown by the transaction observer.
       }
       
      @@ -7937,8 +7937,8 @@ the fetch.

      Transaction observers can avoid being notified of database changes they are not interested in.

      The filtering happens in the observes(eventsOfKind:) method, which tells whether the observer wants notification of specific kinds of changes, or not. For example, here is how an observer can focus on the changes that happen on the player database table:

      -
      class PlayerObserver: TransactionObserver {
      -    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
      +
      class PlayerObserver: TransactionObserver {
      +    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
               // Only observe changes to the "player" table.
               return eventKind.tableName == "player"
           }
      @@ -7951,10 +7951,10 @@ the fetch.

      Generally speaking, the observes(eventsOfKind:) method can distinguish insertions from deletions and updates, and is also able to inspect the columns that are about to be changed:

      -
      class PlayerScoreObserver: TransactionObserver {
      -    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
      +
      class PlayerScoreObserver: TransactionObserver {
      +    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
               // Only observe changes to the "score" column of the "player" table.
      -        switch eventKind {
      +        switch eventKind {
               case .insert(let tableName):
                   return tableName == "player"
               case .delete(let tableName):
      @@ -7967,14 +7967,14 @@ the fetch.

      When the observes(eventsOfKind:) method returns false for all event kinds, the observer is still notified of commits and rollbacks:

      -
      class PureTransactionObserver: TransactionObserver {
      -    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
      +
      class PureTransactionObserver: TransactionObserver {
      +    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
               // Ignore all individual changes
               return false
           }
       
           func databaseDidChange(with event: DatabaseEvent) { /* Never called */ }
      -    func databaseWillCommit() throws { /* Called before commit */ }
      +    func databaseWillCommit() throws { /* Called before commit */ }
           func databaseDidRollback(_ db: Database) { /* Called on rollback */ }
           func databaseDidCommit(_ db: Database) { /* Called on commit */ }
       }
      @@ -7990,13 +7990,13 @@ the fetch.

      dbQueue.remove(transactionObserver: observer) // From a database connection: -dbQueue.inDatabase { db in +dbQueue.inDatabase { db in db.remove(transactionObserver: observer) }

      Alternatively, use the extent parameter of the add(transactionObserver:extent:) method:

      -
      let observer = MyObserver()
      +
      let observer = MyObserver()
       
       // On a database queue or pool:
       dbQueue.add(transactionObserver: observer) // default extent
      @@ -8005,7 +8005,7 @@ the fetch.

      dbQueue.add(transactionObserver: observer, extent: .databaseLifetime) // On a database connection: -dbQueue.inDatabase { db in +dbQueue.inDatabase { db in db.add(transactionObserver: ...) }
      @@ -8017,10 +8017,10 @@ the fetch.

      Finally, an observer may ignore all database changes until the end of the current transaction:

      -
      class PlayerObserver: TransactionObserver {
      +
      class PlayerObserver: TransactionObserver {
           var playerTableWasModified = false
       
      -    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
      +    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
               return eventKind.tableName == "player"
           }
       
      @@ -8050,7 +8050,7 @@ the fetch.

      The DatabaseRegionConvertible Protocol

      DatabaseRegionConvertible is a protocol for all types that can turn into a DatabaseRegion:

      -
      protocol DatabaseRegionConvertible {
      +
      protocol DatabaseRegionConvertible {
           func databaseRegion(_ db: Database) throws -> DatabaseRegion
       }
       
      @@ -8061,7 +8061,7 @@ the fetch.

      Support for SQLite Pre-Update Hooks

      A custom SQLite build can activate SQLite preupdate hooks. In this case, TransactionObserverType gets an extra callback which lets you observe individual column values in the rows modified by a transaction:

      -
      protocol TransactionObserverType : class {
      +
      protocol TransactionObserverType : class {
           #if SQLITE_ENABLE_PREUPDATE_HOOK
           /// Notifies before a database change (insert, update, or delete)
           /// with change information (initial / final values for the row's
      @@ -8092,21 +8092,21 @@ the fetch.

      When you want to open your existing SQLCipher 3 database with SQLCipher 4, you may want to run the cipher_compatibility pragma:

      // Open an SQLCipher 3 database with SQLCipher 4
      -var configuration = Configuration()
      +var configuration = Configuration()
       configuration.passphrase = "..."
       configuration.prepareDatabase = { db in
           try db.execute(sql: "PRAGMA cipher_compatibility = 3")
       }
      -let dbQueue = try DatabaseQueue(path: dbPath, configuration: configuration)
      +let dbQueue = try DatabaseQueue(path: dbPath, configuration: configuration)
       

      See SQLCipher 4.0.0 Release and Upgrading to SQLCipher 4 for more information. See also Advanced configuration options for SQLCipher below.

      You create and open an encrypted database by providing a passphrase to your database connection:

      -
      var configuration = Configuration()
      +
      var configuration = Configuration()
       configuration.passphrase = "secret"
      -let dbQueue = try DatabaseQueue(path: "...", configuration: configuration)
      +let dbQueue = try DatabaseQueue(path: "...", configuration: configuration)
       

      You can change the passphrase of an already encrypted database:

      @@ -8117,14 +8117,14 @@ the fetch.

      To encrypt an existing clear-text database, create a new and empty encrypted database, and copy the content of the clear-text database in it. The technique to do that is documented by SQLCipher. With GRDB, it gives:

      // The clear-text database
      -let clearDBQueue = try DatabaseQueue(path: "/path/to/clear.db")
      +let clearDBQueue = try DatabaseQueue(path: "/path/to/clear.db")
       
       // The encrypted database, at some distinct location:
      -var configuration = Configuration()
      +var configuration = Configuration()
       configuration.passphrase = "secret"
      -let encryptedDBQueue = try DatabaseQueue(path: "/path/to/encrypted.db", configuration: config)
      +let encryptedDBQueue = try DatabaseQueue(path: "/path/to/encrypted.db", configuration: config)
       
      -try clearDBQueue.inDatabase { db in
      +try clearDBQueue.inDatabase { db in
           try db.execute(sql: "ATTACH DATABASE ? AS encrypted KEY ?", arguments: [encryptedDBQueue.path, "secret"])
           try db.execute(sql: "SELECT sqlcipher_export('encrypted')")
           try db.execute(sql: "DETACH DATABASE encrypted")
      @@ -8135,13 +8135,13 @@ the fetch.

      Advanced configuration options for SQLCipher

      Some advanced SQLCipher configuration steps must happen very early in the database lifetime, and you will have to use the configuration.prepareDatabase property in order to run them correctly:

      -
      var configuration = Configuration()
      +
      var configuration = Configuration()
       configuration.passphrase = "secret"
       configuration.prepareDatabase = { db in
           try db.execute(sql: "PRAGMA cipher_page_size = 4096")
           try db.execute(sql: "PRAGMA kdf_iter = 128000")
       }
      -let dbQueue = try DatabaseQueue(path: "...", configuration: configuration)
      +let dbQueue = try DatabaseQueue(path: "...", configuration: configuration)
       

      See PRAGMA cipher_page_size and PRAGMA kdf_iter for more information.

      @@ -8172,7 +8172,7 @@ the fetch.

      // BAD BAD BAD
       let id = 1
       let name = textField.text
      -try dbQueue.write { db in
      +try dbQueue.write { db in
           try db.execute(sql: "UPDATE students SET name = '\(name)' WHERE id = \(id)")
       }
       
      @@ -8185,7 +8185,7 @@ the fetch.

      To avoid those problems, never embed raw values in your SQL queries. The only correct technique is to provide arguments to your raw SQL queries:

      let name = textField.text
      -try dbQueue.write { db in
      +try dbQueue.write { db in
           // Good
           try db.execute(
               sql: "UPDATE students SET name = ? WHERE id = ?",
      @@ -8201,7 +8201,7 @@ the fetch.

      When you use records and the query interface, GRDB always prevents SQL injection for you:

      let id = 1
       let name = textField.text
      -try dbQueue.write { db in
      +try dbQueue.write { db in
           if var student = try Student.fetchOne(db, key: id) {
               student.name = name
               try student.update(db)
      @@ -8224,11 +8224,11 @@ the fetch.

      DatabaseError

      DatabaseError are thrown on SQLite errors:

      -
      do {
      +
      do {
           try db.execute(
               sql: "INSERT INTO pet (masterId, name) VALUES (?, ?)",
               arguments: [1, "Bobby"])
      -} catch let error as DatabaseError {
      +} catch let error as DatabaseError {
           // The SQLite error code: 19 (SQLITE_CONSTRAINT)
           error.resultCode
       
      @@ -8250,13 +8250,13 @@ the fetch.

      SQLite uses codes to distinguish between various errors:

      -
      do {
      +
      do {
           try ...
      -} catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY {
      +} catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY {
           // foreign key constraint error
      -} catch let error as DatabaseError where error.resultCode == .SQLITE_CONSTRAINT {
      +} catch let error as DatabaseError where error.resultCode == .SQLITE_CONSTRAINT {
           // any other constraint error
      -} catch let error as DatabaseError {
      +} catch let error as DatabaseError {
           // any other database error
       }
       
      @@ -8264,10 +8264,10 @@ the fetch.

      In the example above, error.extendedResultCode is a precise extended result code, and error.resultCode is a less precise primary result code. Extended result codes are refinements of primary result codes, as SQLITE_CONSTRAINT_FOREIGNKEY is to SQLITE_CONSTRAINT, for example. See SQLite result codes for more information.

      As a convenience, extended result codes match their primary result code in a switch statement:

      -
      do {
      +
      do {
           try ...
      -} catch let error as DatabaseError {
      -    switch error.extendedResultCode {
      +} catch let error as DatabaseError {
      +    switch error.extendedResultCode {
           case ResultCode.SQLITE_CONSTRAINT_FOREIGNKEY:
               // foreign key constraint error
           case ResultCode.SQLITE_CONSTRAINT:
      @@ -8284,7 +8284,7 @@ the fetch.

      PersistenceError

      PersistenceError is thrown by the PersistableRecord protocol, in a single case: when the update method could not find any row to update:

      -
      do {
      +
      do {
           try player.update(db)
       } catch let PersistenceError.recordNotFound(databaseTableName: table, key: key) {
           print("Key \(key) was not found in table \(table).")
      @@ -8315,11 +8315,11 @@ the fetch.

      Solution: fix the contents of the database, or use DatabaseValue to handle all possible cases:

      let dbValue: DatabaseValue = row["date"]
      -if dbValue.isNull {
      +if dbValue.isNull {
           // Handle NULL
       } else if let date = Date.fromDatabaseValue(dbValue) {
           // Handle valid date
      -} else {
      +} else {
           // Handle invalid date
       }
       
    12. @@ -8329,12 +8329,12 @@ the fetch.

      Solution: add a unique index to the player.email column, or use the deleteAll method to make it clear that you may delete more than one row:

      -
      try Player.filter(Column("email") == "arthur@example.com").deleteAll(db)
      +
      try Player.filter(Column("email") == "arthur@example.com").deleteAll(db)
       
    13. Database connections are not reentrant:

      // fatal error: Database methods are not reentrant.
      -dbQueue.write { db in
      -    dbQueue.write { db in
      +dbQueue.write { db in
      +    dbQueue.write { db in
               ...
           }
       }
      @@ -8349,7 +8349,7 @@ the fetch.

      // Some untrusted arguments for the query let arguments: [String: Any] = ... -let rows = try Row.fetchCursor(db, sql: sql, arguments: StatementArguments(arguments)) +let rows = try Row.fetchCursor(db, sql: sql, arguments: StatementArguments(arguments)) while let row = try rows.next() { // Some untrusted database value: @@ -8366,7 +8366,7 @@ the fetch.

      In such a situation, you can still avoid fatal errors by exposing and handling each failure point, one level down in the GRDB API:

      // Untrusted arguments
      -if let arguments = StatementArguments(arguments) {
      +if let arguments = StatementArguments(arguments) {
           let statement = try db.makeSelectStatement(sql: sql)
           try statement.validate(arguments: arguments)
           statement.unsafeSetArguments(arguments)
      @@ -8375,11 +8375,11 @@ the fetch.

      while let row = try iterator.next() { // Untrusted database content let dbValue: DatabaseValue = row[0] - if dbValue.isNull { + if dbValue.isNull { // Handle NULL if let date = Date.fromDatabaseValue(dbValue) { // Handle valid date - } else { + } else { // Handle invalid date } } @@ -8393,7 +8393,7 @@ the fetch.

      This global error callback must be configured early in the lifetime of your application:

      Database.logError = { (resultCode, message) in
      -    NSLog("%@", "SQLite error \(resultCode): \(message)")
      +    NSLog("%@", "SQLite error \(resultCode): \(message)")
       }
       
      @@ -8464,7 +8464,7 @@ the fetch.

      You can also define your own collations:

      -
      let collation = DatabaseCollation("customCollation") { (lhs, rhs) -> NSComparisonResult in
      +
      let collation = DatabaseCollation("customCollation") { (lhs, rhs) -> NSComparisonResult in
           // return the comparison of lhs and rhs strings.
       }
       dbQueue.add(collation: collation) // Or dbPool.add(collation: ...)
      @@ -8508,15 +8508,15 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       var isDirectory: ObjCBool = false
       if !fileManager.fileExists(atPath: directoryURL.path, isDirectory: &isDirectory) {
           try fileManager.createDirectory(atPath: directoryURL.path, withIntermediateDirectories: false)
      -} else if !isDirectory.boolValue {
      -    throw NSError(domain: NSCocoaErrorDomain, code: NSFileWriteFileExistsError, userInfo: nil)
      +} else if !isDirectory.boolValue {
      +    throw NSError(domain: NSCocoaErrorDomain, code: NSFileWriteFileExistsError, userInfo: nil)
       }
       
       // Enable data protection
       try fileManager.setAttributes([.protectionKey : FileProtectionType.complete], ofItemAtPath: directoryURL.path)
       
       // Open database
      -let dbQueue = try DatabaseQueue(path: databaseURL.path)
      +let dbQueue = try DatabaseQueue(path: databaseURL.path)
       

      When a database is protected, an application that runs in the background on a locked device won’t be able to read or write from it. Instead, it will get DatabaseError with code SQLITE_IOERR (10) disk I/O error, or SQLITE_AUTH (23) not authorized.

      @@ -8553,7 +8553,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

      Database writes always happen in a unique serial dispatch queue, named the writer protected dispatch queue.

    14. :bowtie: Guarantee 2: reads are always isolated. This means that they are guaranteed an immutable view of the last committed state of the database, and that you can perform subsequent fetches without fearing eventual concurrent writes to mess with your application logic:

      -
      try dbPool.read { db in // or dbQueue.read
      +
      try dbPool.read { db in // or dbQueue.read
           // Guaranteed to be equal
           let count1 = try Player.fetchCount(db)
           let count2 = try Player.fetchCount(db)
      @@ -8579,20 +8579,20 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      If there are several instances of database queues or pools that write in the same database, a multi-threaded application will eventually face database is locked errors. See Dealing with External Connections.

      // SAFE CONCURRENCY
      -func fetchCurrentUser(_ db: Database) throws -> User? {
      +func fetchCurrentUser(_ db: Database) throws -> User? {
           return try User.fetchOne(db)
       }
       // dbQueue is a singleton defined somewhere in your app
      -let user = try dbQueue.read { db in // or dbPool.read
      +let user = try dbQueue.read { db in // or dbPool.read
           try fetchCurrentUser(db)
       }
       
       // UNSAFE CONCURRENCY
       // This method fails when some other thread is currently writing into
       // the database.
      -func currentUser() throws -> User? {
      -    let dbQueue = try DatabaseQueue(...)
      -    return try dbQueue.read { db in
      +func currentUser() throws -> User? {
      +    let dbQueue = try DatabaseQueue(...)
      +    return try dbQueue.read { db in
               try User.fetchOne(db)
           }
       }
      @@ -8602,7 +8602,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      Database access methods isolate your groups of related statements against eventual database updates performed by other threads, and guarantee a consistent view of the database. This isolation is only guaranteed inside the closure argument of those methods. Two consecutive calls do not guarantee isolation:

      // SAFE CONCURRENCY
      -try dbPool.read { db in  // or dbQueue.read
      +try dbPool.read { db in  // or dbQueue.read
           // Guaranteed to be equal:
           let count1 = try Place.fetchCount(db)
           let count2 = try Place.fetchCount(db)
      @@ -8611,45 +8611,45 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       // UNSAFE CONCURRENCY
       // Those two values may be different because some other thread may have
       // modified the database between the two blocks:
      -let count1 = try dbPool.read { db in try Place.fetchCount(db) }
      -let count2 = try dbPool.read { db in try Place.fetchCount(db) }
      +let count1 = try dbPool.read { db in try Place.fetchCount(db) }
      +let count2 = try dbPool.read { db in try Place.fetchCount(db) }
       

      In the same vein, when you fetch values that depends on some database updates, group them:

      // SAFE CONCURRENCY
      -try dbPool.write { db in
      +try dbPool.write { db in
           // The count is guaranteed to be non-zero
      -    try Place(...).insert(db)
      +    try Place(...).insert(db)
           let count = try Place.fetchCount(db)
       }
       
       // UNSAFE CONCURRENCY
       // The count may be zero because some other thread may have performed
       // a deletion between the two blocks:
      -try dbPool.write { db in try Place(...).insert(db) }
      -let count = try dbPool.read { db in try Place.fetchCount(db) }
      +try dbPool.write { db in try Place(...).insert(db) }
      +let count = try dbPool.read { db in try Place.fetchCount(db) }
       

      On that last example, see Advanced DatabasePool if you look after extra performance.

    15. :point_up: Rule 3: When you perform several modifications of the database that temporarily put the database in an inconsistent state, make sure those modifications are grouped within a transaction.

      // SAFE CONCURRENCY
      -try dbPool.write { db in               // or dbQueue.write
      -    try Credit(destinationAccout, amount).insert(db)
      -    try Debit(sourceAccount, amount).insert(db)
      +try dbPool.write { db in               // or dbQueue.write
      +    try Credit(destinationAccout, amount).insert(db)
      +    try Debit(sourceAccount, amount).insert(db)
       }
       
       // SAFE CONCURRENCY
      -try dbPool.writeInTransaction { db in  // or dbQueue.inTransaction
      -    try Credit(destinationAccout, amount).insert(db)
      -    try Debit(sourceAccount, amount).insert(db)
      +try dbPool.writeInTransaction { db in  // or dbQueue.inTransaction
      +    try Credit(destinationAccout, amount).insert(db)
      +    try Debit(sourceAccount, amount).insert(db)
           return .commit
       }
       
       // UNSAFE CONCURRENCY
      -try dbPool.writeWithoutTransaction { db in
      -    try Credit(destinationAccout, amount).insert(db)
      +try dbPool.writeWithoutTransaction { db in
      +    try Credit(destinationAccout, amount).insert(db)
           // <- Concurrent dbPool.read sees a partial db update here
      -    try Debit(sourceAccount, amount).insert(db)
      +    try Debit(sourceAccount, amount).insert(db)
       }
       
      @@ -8677,9 +8677,9 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

      Database pools are very concurrent, since all reads can run in parallel, and can even run during write operations. But writes are still serialized: at any given point in time, there is no more than a single thread that is writing into the database.

      When your application modifies the database, and then reads some value that depends on those modifications, you may want to avoid locking the writer queue longer than necessary:

      -
      try dbPool.write { db in
      +
      try dbPool.write { db in
           // Increment the number of players
      -    try Player(...).insert(db)
      +    try Player(...).insert(db)
       
           // Read the number of players. The writer queue is still locked :-(
           let count = try Player.fetchCount(db)
      @@ -8688,12 +8688,12 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      A wrong solution is to chain a write then a read, as below. Don’t do that, because another thread may modify the database in between, and make the read unreliable:

      // WRONG
      -try dbPool.write { db in
      +try dbPool.write { db in
           // Increment the number of players
      -    try Player(...).insert(db)
      +    try Player(...).insert(db)
       }
       // <- other threads can write in the database here
      -try dbPool.read { db in
      +try dbPool.read { db in
           // Read some random value :-(
           let count = try Player.fetchCount(db)
       }
      @@ -8703,12 +8703,12 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      concurrentRead returns a future value which you consume on any dispatch queue, with the wait() method:

      // CORRECT
      -let futureCount: DatabaseFuture<Int> = try dbPool.writeWithoutTransaction { db in
      +let futureCount: DatabaseFuture<Int> = try dbPool.writeWithoutTransaction { db in
           // increment the number of players
      -    try Player(...).insert(db)
      +    try Player(...).insert(db)
       
           // <- not in a transaction here
      -    let futureCount = dbPool.concurrentRead { db
      +    let futureCount = dbPool.concurrentRead { db
               return try Player.fetchCount(db)
           }
           return futureCount
      @@ -8722,11 +8722,11 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       

      concurrentRead blocks until it can guarantee its closure argument an isolated access to the last committed state of the database. It then asynchronously executes the closure.

      The closure can run concurrently with eventual updates performed after concurrentRead: those updates won’t be visible from within the closure. In the example below, the number of players is guaranteed to be non-zero, even though it is fetched concurrently with the player deletion:

      -
      try dbPool.writeWithoutTransaction { db in
      +
      try dbPool.writeWithoutTransaction { db in
           // Increment the number of players
      -    try Player(...).insert(db)
      +    try Player(...).insert(db)
       
      -    let futureCount = dbPool.concurrentRead { db
      +    let futureCount = dbPool.concurrentRead { db
               // Guaranteed to be non-zero
               return try Player.fetchCount(db)
           }
      @@ -8750,20 +8750,20 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      A snapshot can be used from any thread. Its read methods is synchronous, and blocks the current thread until your database statements are executed:

      // Read values:
      -try snapshot.read { db in
      +try snapshot.read { db in
           let players = try Player.fetchAll(db)
           let playerCount = try Player.fetchCount(db)
       }
       
       // Extract a value from the database:
      -let playerCount = try snapshot.read { db in
      +let playerCount = try snapshot.read { db in
           try Player.fetchCount(db)
       }
       

      When you want to control the latest committed changes seen by a snapshot, create it from the pool’s writer protected dispatch queue, outside of any transaction:

      -
      let snapshot1 = try dbPool.writeWithoutTransaction { db -> DatabaseSnapshot in
      -    try db.inTransaction {
      +
      let snapshot1 = try dbPool.writeWithoutTransaction { db -> DatabaseSnapshot in
      +    try db.inTransaction {
               // delete all players
               try Player.deleteAll()
               return .commit
      @@ -8775,12 +8775,12 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       // <- Other threads may modify the database here
       let snapshot2 = try dbPool.makeSnapshot()
       
      -try snapshot1.read { db in
      +try snapshot1.read { db in
           // Guaranteed to be zero
           try Player.fetchCount(db)
       }
       
      -try snapshot2.read { db in
      +try snapshot2.read { db in
           // Could be anything
           try Player.fetchCount(db)
       }
      @@ -8810,7 +8810,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      However, you can prevent some parts of your application from writing in the database by giving them a DatabaseReader:

      // This class can read in the database, but can't write into it.
      -class MyReadOnlyComponent {
      +class MyReadOnlyComponent {
           let reader: DatabaseReader
       
           init(reader: DatabaseReader) {
      @@ -8819,13 +8819,13 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       }
       
       let dbQueue: DatabaseQueue = ...
      -let component = MyReadOnlyComponent(reader: dbQueue)
      +let component = MyReadOnlyComponent(reader: dbQueue)
       

      :point_up: Note: DatabaseReader is not a secure way to prevent an application component from writing in the database, because write access is just a cast away:

      -
      if let dbQueue = reader as? DatabaseQueue {
      -    try dbQueue.write { ... }
      +
      if let dbQueue = reader as? DatabaseQueue {
      +    try dbQueue.write { ... }
       }
       
      @@ -8842,11 +8842,11 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

      asyncRead

      The asyncRead method can be used from any thread. It submits your database statements for asynchronous execution on a protected dispatch queue:

      -
      reader.asyncRead { (result: Result<Database>) in
      -    try {
      +
      reader.asyncRead { (result: Result<Database>) in
      +    try {
               let db = try result.get()
               let players = try Player.fetchAll(db)
      -    } catch {
      +    } catch {
               // handle error
           }
       }
      @@ -8867,9 +8867,9 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      The asyncWrite method can be used from any thread. It submits your database statements for asynchronous execution on a protected dispatch queue, wrapped inside a database transaction:

      writer.asyncWrite({ (db: Database) in
      -    try Player(...).insert(db)
      +    try Player(...).insert(db)
       }, completion: { (db: Database, result: Result<Void, Error>) in
      -    switch result {
      +    switch result {
           case let .success:
               // handle transaction success
           case let .failure(error):
      @@ -8884,10 +8884,10 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      When the transaction completes successfully, the result of the first function is contained in the standard Result passed to the completion function:

      writer.asyncWrite({ (db: Database) -> Int in
      -    try Player(...).insert(db)
      +    try Player(...).insert(db)
           return try Player.fetchCount(db)
       }, completion: { (db: Database, result: Result<Int, Error>) in
      -    switch result {
      +    switch result {
           case let .success(newPlayerCount):
               print("new player count: \(newPlayerCount)")
           case let .failure(error):
      @@ -8904,10 +8904,10 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       

      asyncWriteWithoutTransaction

      The asyncWriteWithoutTransaction method can be used from any thread. It submits your database statements for asynchronous execution on a protected dispatch queue, outside of any transaction:

      -
      writer.asyncWriteWithoutTransaction { (db: Database) in
      -    try {
      -        try Player(...).insert(db)
      -    } catch {
      +
      writer.asyncWriteWithoutTransaction { (db: Database) in
      +    try {
      +        try Player(...).insert(db)
      +    } catch {
               // handle error
           }
       }
      @@ -8927,26 +8927,26 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       

      asyncConcurrentRead blocks until it can guarantee its closure argument an isolated access to the last committed state of the database. It then asynchronously executes the closure.

      In the example below, the number of players is fetched concurrently with the player insertion. Yet the future is guaranteed to return zero:

      -
      try writer.asyncWriteWithoutTransaction { db in
      -    do {
      +
      try writer.asyncWriteWithoutTransaction { db in
      +    do {
               // Delete all players
               try Player.deleteAll()
       
               // <- not in a transaction here
               // Count players concurrently
      -        writer.asyncConcurrentRead { (result: Result<Database>) in
      -            try {
      +        writer.asyncConcurrentRead { (result: Result<Database>) in
      +            try {
                       let db = try result.get()
                       // Guaranteed to be zero
                       let count = try Player.fetchCount()
      -            } catch {
      +            } catch {
                       // handle error
                   }
               }
       
               // Insert a player
      -        try Player(...).insert(db)
      -    } catch {
      +        try Player(...).insert(db)
      +    } catch {
               // handle error
           }
       }
      @@ -8965,7 +8965,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       

      The unsafeRead method is synchronous, and blocks the current thread until your database statements are executed in a protected dispatch queue. GRDB does just the bare minimum to provide a database connection that can read.

      When used on a database pool, reads are no longer isolated:

      -
      dbPool.unsafeRead { db in
      +
      dbPool.unsafeRead { db in
           // Those two values may be different because some other thread
           // may have inserted or deleted a player between the two requests:
           let count1 = try Player.fetchCount(db)
      @@ -8977,10 +8977,10 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
    16. unsafeReentrantRead

      The unsafeReentrantRead behaves just as unsafeRead (see above), and allows reentrant calls:

      -
      dbPool.read { db1 in
      +
      dbPool.read { db1 in
           // No "Database methods are not reentrant" fatal error:
      -    dbPool.unsafeReentrantRead { db2 in
      -        dbPool.unsafeReentrantRead { db3 in
      +    dbPool.unsafeReentrantRead { db2 in
      +        dbPool.unsafeReentrantRead { db3 in
                   ...
               }
           }
      @@ -8995,10 +8995,10 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       

      The unsafeReentrantWrite method is synchronous, and blocks the current thread until your database statements are executed in a protected dispatch queue. Writes are serialized: eventual concurrent database updates are postponed until the block has executed.

      Reentrant calls are allowed:

      -
      dbQueue.write { db1 in
      +
      dbQueue.write { db1 in
           // No "Database methods are not reentrant" fatal error:
      -    dbQueue.unsafeReentrantWrite { db2 in
      -        dbQueue.unsafeReentrantWrite { db3 in
      +    dbQueue.unsafeReentrantWrite { db2 in
      +        dbQueue.unsafeReentrantWrite { db3 in
                   ...
               }
           }
      @@ -9055,11 +9055,11 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       

      If not done yet, read the Concurrency Programming Guide and learn how to perform heavy computations without blocking your application.

      Most GRBD APIs are synchronous. Spawning them into parallel queues is as easy as:

      -
      DispatchQueue.global().async { 
      -    dbQueue.write { db in
      +
      DispatchQueue.global().async { 
      +    dbQueue.write { db in
               // Perform database work
           }
      -    DispatchQueue.main.async { 
      +    DispatchQueue.main.async { 
               // update your user interface
           }
       }
      @@ -9068,22 +9068,22 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      Performing multiple updates to the database is much faster when executed inside a transaction. This is because a transaction allows SQLite to postpone writing changes to disk until the final commit:

      // Inefficient
      -try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
      -    for player in players {
      +try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
      +    for player in players {
               try player.insert(db)
           }
       }
       
       // Efficient
      -try dbQueue.write { db in      // or dbPool.write
      -    for player in players {
      +try dbQueue.write { db in      // or dbPool.write
      +    for player in players {
               try player.insert(db)
           }
       }
       
       // Efficient
      -try dbQueue.inTransaction { db in // or dbPool.writeInTransaction
      -    for player in players {
      +try dbQueue.inTransaction { db in // or dbPool.writeInTransaction
      +    for player in players {
               try player.insert(db)
           }
           return .commit
      @@ -9131,7 +9131,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       

      An UPDATE statement is costly: SQLite has to look for the updated row, update values, and write changes to disk.

      When the overwritten values are the same as the existing ones, it’s thus better to avoid performing the UPDATE statement:.

      -
      if player.hasDatabaseChanges {
      +
      if player.hasDatabaseChanges {
           try player.update(db)
       }
       
      @@ -9152,7 +9152,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

      The following code is inefficient. It is an example of the N+1 problem, because it performs one query to load the authors, and then N queries, as many as there are authors. This turns very inefficient as the number of authors grows:

      // SELECT * FROM author
       let authors = try Author.fetchAll(db)
      -for author in authors {
      +for author in authors {
           // SELECT COUNT(*) FROM book WHERE authorId = ...
           author.bookCount = try Book.filter(authorIdColumn == author.id).fetchCount(db)
       }
      @@ -9183,7 +9183,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       

      The String and Dictionary Swift types are better avoided when you look for the best performance.

      Now GRDB records, for your convenience, do use strings and dictionaries:

      -
      class Player : Record {
      +
      class Player : Record {
           var id: Int64?
           var name: String
           var email: String
      @@ -9217,20 +9217,20 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
           let id: Int64 = row[0]
           let name: String = row[1]
           let email: String = row[2]
      -    let player = Player(id: id, name: name, email: email)
      +    let player = Player(id: id, name: name, email: email)
           ...
       }
       

      When inserting values, use reusable prepared statements, and set statements values with an array:

      // Strings & dictionaries
      -for player in players {
      +for player in players {
           try player.insert(db)
       }
       
       // Prepared statement
       let insertStatement = db.prepareStatement("INSERT INTO player (name, email) VALUES (?, ?)")
      -for player in players {
      +for player in players {
           // Only use the unsafe arguments setter if you are sure that you provide
           // all statement arguments. A mistake can store unexpected values in
           // the database.
      @@ -9258,15 +9258,15 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
      let databaseURL = try FileManager.default
           .url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
           .appendingPathComponent("db.sqlite")
      -let dbQueue = try DatabaseQueue(path: databaseURL.path)
      +let dbQueue = try DatabaseQueue(path: databaseURL.path)
       

      How do I open a database stored as a resource of my application?

      If your application does not need to modify the database, open a read-only connection to your resource:

      -
      var configuration = Configuration()
      +
      var configuration = Configuration()
       configuration.readonly = true
       let dbPath = Bundle.main.path(forResource: "db", ofType: "sqlite")!
      -let dbQueue = try DatabaseQueue(path: dbPath, configuration: configuration)
      +let dbQueue = try DatabaseQueue(path: dbPath, configuration: configuration)
       

      If the application should modify the database, you need to copy it to a place where it can be modified. For example, in the Application Support directory. Only then, open a connection:

      @@ -9279,7 +9279,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared) let dbResourcePath = Bundle.main.path(forResource: "db", ofType: "sqlite")! try fileManager.copyItem(atPath: dbResourcePath, toPath: dbPath) } -let dbQueue = try DatabaseQueue(path: dbPath) +let dbQueue = try DatabaseQueue(path: dbPath)

      How do I close a database connection?

      @@ -9291,12 +9291,12 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

      When you want to debug a request that does not deliver the expected results, you may want to print the SQL that is actually executed.

      You can turn your request into a SQLRequest instance:

      -
      try dbQueue.read { db in
      +
      try dbQueue.read { db in
           let request = Wine
      -        .filter(Column("origin") == "Burgundy")
      -        .order(Column("price")
      +        .filter(Column("origin") == "Burgundy")
      +        .order(Column("price")
       
      -    let sqlRequest = try SQLRequest(db, request: request)
      +    let sqlRequest = try SQLRequest(db, request: request)
           print(sqlRequest.sql)
           // Prints SELECT * FROM wine WHERE origin = ? ORDER BY price
           print(sqlRequest.arguments)
      @@ -9305,14 +9305,14 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       

      Another option is to setup a tracing function that will print out all SQL requests executed by your application. You provide the trace function when you connect to the database:

      -
      var config = Configuration()
      +
      var config = Configuration()
       config.trace = { print($0) } // Prints all SQL statements
      -let dbQueue = try DatabaseQueue(path: dbPath, configuration: config)
      +let dbQueue = try DatabaseQueue(path: dbPath, configuration: config)
       
      -try dbQueue.read { db in
      +try dbQueue.read { db in
           let wines = Wine
      -        .filter(Column("origin") == "Burgundy")
      -        .order(Column("price")
      +        .filter(Column("origin") == "Burgundy")
      +        .order(Column("price")
               .fetchAll(db)
           // Prints SELECT * FROM wine WHERE origin = 'Burgundy' ORDER BY price
       }
      @@ -9325,7 +9325,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      You may get this error when using the read and write methods of database queues and pools:

      // Generic parameter 'T' could not be inferred
      -let string = try dbQueue.read { db in
      +let string = try dbQueue.read { db in
           let result = try String.fetchOne(db, ...)
           return result
       }
      @@ -9335,7 +9335,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      The general workaround is to explicitly declare the type of the closure result:

      // General Workaround
      -let string = try dbQueue.read { db -> String? in
      +let string = try dbQueue.read { db -> String? in
           let result = try String.fetchOne(db, ...)
           return result
       }
      @@ -9343,7 +9343,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      You can also, when possible, write a single-line closure:

      // Single-line closure workaround:
      -let string = try dbQueue.read { db in
      +let string = try dbQueue.read { db in
           try String.fetchOne(db, ...)
       }
       
      @@ -9352,11 +9352,11 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

      Those errors may be the sign that SQLite can’t access the database due to data protection.

      When your application should be able to run in the background on a locked device, it has to catch this error, and, for example, wait for UIApplicationDelegate.applicationProtectedDataDidBecomeAvailable(_:) or UIApplicationProtectedDataDidBecomeAvailable notification and retry the failed database operation.

      -
      do {
      +
      do {
           try ...
       } catch let error as DatabaseError where
           error.resultCode == .SQLITE_IOERR ||
      -    error.resultCode == .SQLITE_AUTH
      +    error.resultCode == .SQLITE_AUTH
       {
           // Handle possible data protection error
       }
      @@ -9367,7 +9367,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
       
       

      You may get the error wrong number of statement arguments when executing a LIKE query similar to:

      let name = textField.text
      -let players = try dbQueue.read { db in
      +let players = try dbQueue.read { db in
           try Player.fetchAll(db, sql: "SELECT * FROM player WHERE name LIKE '%?%'", arguments: [name])
       }
       
      @@ -9378,7 +9378,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

      To fix the error, you can feed the request with the pattern itself, instead of the name:

      let name = textField.text
      -let players: [Player] = try dbQueue.read { db in
      +let players: [Player] = try dbQueue.read { db in
           let pattern = "%\(name)%"
           return try Player.fetchAll(db, sql: "SELECT * FROM player WHERE name LIKE ?", arguments: [pattern])
       }
      @@ -9430,7 +9430,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
                 
               
               
             
      diff --git a/docs/4.2/docsets/GRDB.docset/Contents/Resources/docSet.dsidx b/docs/4.2/docsets/GRDB.docset/Contents/Resources/docSet.dsidx
      index 4f59d0aac..688dc7bb3 100644
      Binary files a/docs/4.2/docsets/GRDB.docset/Contents/Resources/docSet.dsidx and b/docs/4.2/docsets/GRDB.docset/Contents/Resources/docSet.dsidx differ
      diff --git a/docs/4.2/docsets/GRDB.tgz b/docs/4.2/docsets/GRDB.tgz
      index 386517d44..5b26cb0f3 100644
      Binary files a/docs/4.2/docsets/GRDB.tgz and b/docs/4.2/docsets/GRDB.tgz differ
      diff --git a/docs/4.2/docsets/GRDB.xml b/docs/4.2/docsets/GRDB.xml
      index de94a97cd..2be4411d6 100644
      --- a/docs/4.2/docsets/GRDB.xml
      +++ b/docs/4.2/docsets/GRDB.xml
      @@ -1 +1 @@
      -4.2.0http://groue.github.io/GRDB.swift/docs/4.2/docsets/GRDB.tgz
      +4.2.1http://groue.github.io/GRDB.swift/docs/4.2/docsets/GRDB.tgz
      diff --git a/docs/4.2/index.html b/docs/4.2/index.html
      index 414fa5bd4..8a4a087e0 100644
      --- a/docs/4.2/index.html
      +++ b/docs/4.2/index.html
      @@ -13,7 +13,7 @@
           
           
      -

      GRDB 4.2.0 Docs (90% documented)

      +

      GRDB 4.2.1 Docs (90% documented)

      View on GitHub

      Install in Dash

      @@ -1010,7 +1010,7 @@
      -

      Latest release: August 6, 2019 • version 4.2.0 • CHANGELOG • Migrating From GRDB 3 to GRDB 4

      +

      Latest release: August 13, 2019 • version 4.2.1 • CHANGELOG • Migrating From GRDB 3 to GRDB 4

      Requirements: iOS 9.0+ / macOS 10.9+ / watchOS 2.0+ • Swift 4.2+ / Xcode 10.0+

      @@ -1022,11 +1022,11 @@ Swift 5 -v4.2.0 +v4.2.1 Swift 4.2 -v4.2.0 +v4.2.1 Swift 4.1 @@ -1365,9 +1365,9 @@ See [Database Changes Observation](#database-changes-observation)

      Swift Package Manager

      The Swift Package Manager automates the distribution of Swift code. To use GRDB with SPM, add a dependency to your Package.swift file:

      -
      let package = Package(
      +
      let package = Package(
           dependencies: [
      -        .package(url: "https://github.com/groue/GRDB.swift.git", .upToNextMajor(from: "4.2.0"))
      +        .package(url: "https://github.com/groue/GRDB.swift.git", .upToNextMajor(from: "4.2.1"))
           ]
       )
       
      @@ -1379,7 +1379,7 @@ See [Database Changes Observation](#database-changes-observation)

      Manually

        -
      1. Download a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the git checkout v4.2.0 command.

      2. +
      3. Download a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the git checkout v4.2.1 command.

      4. Embed the GRDB.xcodeproj project in your own project.

      5. Add the GRDBOSX, GRDBiOS, or GRDBWatchOS target in the Target Dependencies section of the Build Phases tab of your application target (extension target for WatchOS).

      6. Add the GRDB.framework from the targetted platform to the Embedded Binaries section of the General tab of your application target (extension target for WatchOS).

      7. @@ -1403,8 +1403,8 @@ See [Database Changes Observation](#database-changes-observation)
        import GRDB
         
         // Pick one:
        -let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
        -let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
        +let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
        +let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
         

        The differences are:

        @@ -1426,33 +1426,33 @@ See [Database Changes Observation](#database-changes-observation)

        Open a database queue with the path to a database file:

        import GRDB
         
        -let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
        -let inMemoryDBQueue = DatabaseQueue()
        +let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
        +let inMemoryDBQueue = DatabaseQueue()
         

        SQLite creates the database file if it does not already exist. The connection is closed when the database queue gets deallocated.

        A database queue can be used from any thread. The write and read methods are synchronous, and block the current thread until your database statements are executed in a protected dispatch queue:

        // Modify the database:
        -try dbQueue.write { db in
        +try dbQueue.write { db in
             try db.create(table: "place") { ... }
        -    try Place(...).insert(db)
        +    try Place(...).insert(db)
         }
         
         // Read values:
        -try dbQueue.read { db in
        +try dbQueue.read { db in
             let places = try Place.fetchAll(db)
             let placeCount = try Place.fetchCount(db)
         }
         

        Database access methods can return values:

        -
        let placeCount = try dbQueue.read { db in
        +
        let placeCount = try dbQueue.read { db in
             try Place.fetchCount(db)
         }
         
        -let newPlaceCount = try dbQueue.write { db -> Int in
        -    try Place(...).insert(db)
        +let newPlaceCount = try dbQueue.write { db -> Int in
        +    try Place(...).insert(db)
             return try Place.fetchCount(db)
         }
         
        @@ -1472,13 +1472,13 @@ See [Database Changes Observation](#database-changes-observation)

        :bulb: Tip: see the Demo Application for a sample code that sets up a database queue on iOS.

        DatabaseQueue Configuration

        -
        var config = Configuration()
        +
        var config = Configuration()
         config.readonly = true
         config.foreignKeysEnabled = true // Default is already true
         config.trace = { print($0) }     // Prints all SQL statements
         config.label = "MyDatabase"      // Useful when your app opens multiple databases
         
        -let dbQueue = try DatabaseQueue(
        +let dbQueue = try DatabaseQueue(
             path: "/path/to/database.sqlite",
             configuration: config)
         
        @@ -1488,7 +1488,7 @@ See [Database Changes Observation](#database-changes-observation)

        A database pool allows concurrent database accesses.

        import GRDB
        -let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
        +let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
         

        SQLite creates the database file if it does not already exist. The connection is closed when the database pool gets deallocated.

        @@ -1499,25 +1499,25 @@ See [Database Changes Observation](#database-changes-observation)

        A database pool can be used from any thread. The write and read methods are synchronous, and block the current thread until your database statements are executed in a protected dispatch queue:

        // Modify the database:
        -try dbPool.write { db in
        +try dbPool.write { db in
             try db.create(table: "place") { ... }
        -    try Place(...).insert(db)
        +    try Place(...).insert(db)
         }
         
         // Read values:
        -try dbPool.read { db in
        +try dbPool.read { db in
             let places = try Place.fetchAll(db)
             let placeCount = try Place.fetchCount(db)
         }
         

        Database access methods can return values:

        -
        let placeCount = try dbPool.read { db in
        +
        let placeCount = try dbPool.read { db in
             try Place.fetchCount(db)
         }
         
        -let newPlaceCount = try dbPool.write { db -> Int in
        -    try Place(...).insert(db)
        +let newPlaceCount = try dbPool.write { db -> Int in
        +    try Place(...).insert(db)
             return try Place.fetchCount(db)
         }
         
        @@ -1542,14 +1542,14 @@ See [Database Changes Observation](#database-changes-observation)

        :bulb: Tip: see the Demo Application for a sample code that sets up a database queue on iOS, and just replace DatabaseQueue with DatabasePool.

        DatabasePool Configuration

        -
        var config = Configuration()
        +
        var config = Configuration()
         config.readonly = true
         config.foreignKeysEnabled = true // Default is already true
         config.trace = { print($0) }     // Prints all SQL statements
         config.label = "MyDatabase"      // Useful when your app opens multiple databases
         config.maximumReaderCount = 10   // The default is 5
         
        -let dbPool = try DatabasePool(
        +let dbPool = try DatabasePool(
             path: "/path/to/database.sqlite",
             configuration: config)
         
        @@ -1597,7 +1597,7 @@ See [Database Changes Observation](#database-changes-observation)

        Once granted with a database connection, the execute method executes the SQL statements that do not return any database row, such as CREATE TABLE, INSERT, DELETE, ALTER, etc.

        For example:

        -
        try dbQueue.write { db in
        +
        try dbQueue.write { db in
             try db.execute(sql: """
                 CREATE TABLE player (
                     id INTEGER PRIMARY KEY AUTOINCREMENT,
        @@ -1620,7 +1620,7 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        In Swift 5, you can embed query arguments right into your SQL queries, with the literal argument label, as in the example below. See SQL Interpolation for more details.

        // Swift 5
        -try dbQueue.write { db in
        +try dbQueue.write { db in
             try db.execute(literal: """
                 INSERT INTO player (name, score)
                 VALUES (\("O'Brien"), \(550))
        @@ -1673,7 +1673,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        Don’t miss Records, that provide classic persistence methods:

        -
        var player = Player(name: "Arthur", score: 1000)
        +
        var player = Player(name: "Arthur", score: 1000)
         try player.insert(db)
         let playerId = player.id
         
        @@ -1682,7 +1682,7 @@ See [Database Changes Observation](#database-changes-observation)

        Database connections let you fetch database rows, plain values, and custom models aka records.

        Rows are the raw results of SQL queries:

        -
        try dbQueue.read { db in
        +
        try dbQueue.read { db in
             if let row = try Row.fetchOne(db, sql: "SELECT * FROM wine WHERE id = ?", arguments: [1]) {
                 let name: String = row["name"]
                 let color: Color = row["color"]
        @@ -1692,7 +1692,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        Values are the Bool, Int, String, Date, Swift enums, etc. stored in row columns:

        -
        try dbQueue.read { db in
        +
        try dbQueue.read { db in
             let urls = try URL.fetchCursor(db, sql: "SELECT url FROM wine")
             while let url = try urls.next() {
                 print(url)
        @@ -1701,7 +1701,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        Records are your application objects that can initialize themselves from rows:

        -
        let wines = try dbQueue.read { db in
        +
        let wines = try dbQueue.read { db in
             try Wine.fetchAll(db, sql: "SELECT * FROM wine")
         }
         
        @@ -1736,17 +1736,17 @@ See [Database Changes Observation](#database-changes-observation)

        Whenever you consume several rows from the database, you can fetch an Array, or a Cursor.

        The fetchAll() method returns a regular Swift array, that you iterate like all other arrays:

        -
        try dbQueue.read { db in
        +
        try dbQueue.read { db in
             // [Player]
             let players = try Player.fetchAll(db, sql: "SELECT ...")
        -    for player in players {
        +    for player in players {
                 // use player
             }
         }
         

        Unlike arrays, cursors returned by fetchCursor() load their results step after step:

        -
        try dbQueue.read { db in
        +
        try dbQueue.read { db in
             // Cursor of Player
             let players = try Player.fetchCursor(db, sql: "SELECT ...")
             while let player = try players.next() {
        @@ -1760,7 +1760,7 @@ See [Database Changes Observation](#database-changes-observation)
         
        • Cursors can not be used on any thread: you must consume a cursor on the dispatch queue it was created in. Particularly, don’t extract a cursor out of a database access method:

          // Wrong
          -let cursor = try dbQueue.read { db in
          +let cursor = try dbQueue.read { db in
               try Player.fetchCursor(db, ...)
           }
           while let player = try cursor.next() { ... }
          @@ -1768,10 +1768,10 @@ See [Database Changes Observation](#database-changes-observation)
           
           

          Conversely, arrays may be consumed on any thread:

          // OK
          -let array = try dbQueue.read { db in
          +let array = try dbQueue.read { db in
               try Player.fetchAll(db, ...)
           }
          -for player in array { ... }
          +for player in array { ... }
           
        • Cursors can be iterated only one time. Arrays can be iterated many times.

        • Cursors iterate database results in a lazy fashion, and don’t consume much memory. Arrays contain copies of database values, and may take a lot of memory when there are many fetched results.

        • @@ -1780,19 +1780,19 @@ See [Database Changes Observation](#database-changes-observation)
          // Prints all Github links
           try URL
               .fetchCursor(db, sql: "SELECT url FROM link")
          -    .filter { url in url.host == "github.com" }
          -    .forEach { url in print(url) }
          +    .filter { url in url.host == "github.com" }
          +    .forEach { url in print(url) }
           
           // An efficient cursor of coordinates:
           let locations = try Row.
               .fetchCursor(db, sql: "SELECT latitude, longitude FROM place")
          -    .map { row in
          -        CLLocationCoordinate2D(latitude: row[0], longitude: row[1])
          +    .map { row in
          +        CLLocationCoordinate2D(latitude: row[0], longitude: row[1])
               }
           
           // Turn cursors into arrays or sets:
          -let array = try Array(cursor)
          -let set = try Set(cursor)
          +let array = try Array(cursor)
          +let set = try Set(cursor)
           
        • Cursors are not Swift sequences. That’s because Swift sequences can’t handle iteration errors, when reading SQLite results may fail at any time. SQL functions may throw errors. On iOS, data protection may block access to the database file in the background. On macOS, your application users may mess with the file system.

        • Cursors require a little care:

          @@ -1820,7 +1820,7 @@ See [Database Changes Observation](#database-changes-observation)

          Fetching Rows

          Fetch cursors of rows, arrays, or single rows (see fetching methods):

          -
          try dbQueue.read { db in
          +
          try dbQueue.read { db in
               try Row.fetchCursor(db, sql: "SELECT ...", arguments: ...) // A Cursor of Row
               try Row.fetchAll(db, sql: "SELECT ...", arguments: ...)    // [Row]
               try Row.fetchOne(db, sql: "SELECT ...", arguments: ...)    // Row?
          @@ -1833,7 +1833,7 @@ See [Database Changes Observation](#database-changes-observation)
               }
           }
           
          -let rows = try dbQueue.read { db in
          +let rows = try dbQueue.read { db in
               try Row.fetchAll(db, sql: "SELECT * FROM player")
           }
           
          @@ -1860,7 +1860,7 @@ See [Database Changes Observation](#database-changes-observation)

          Read column values by index or column name:

          let name: String = row[0]      // 0 is the leftmost column
           let name: String = row["name"] // Leftmost matching column - lookup is case-insensitive
          -let name: String = row[Column("name")] // Using query interface's Column
          +let name: String = row[Column("name")] // Using query interface's Column
           

          Make sure to ask for an optional when the value may be NULL:

          @@ -1884,8 +1884,8 @@ See [Database Changes Observation](#database-changes-observation)

          :warning: Warning: avoid the as! and as? operators:

          -
          if let int = row[...] as? Int { ... } // BAD - doesn't work
          -if let int = row[...] as Int? { ... } // GOOD
          +
          if let int = row[...] as? Int { ... } // BAD - doesn't work
          +if let int = row[...] as Int? { ... } // GOOD
           
          @@ -1932,11 +1932,11 @@ See [Database Changes Observation](#database-changes-observation)

          Those conversion fatal errors can be avoided with the DatabaseValue type:

          let row = try Row.fetchOne(db, sql: "SELECT 'Mom’s birthday'")!
           let dbValue: DatabaseValue = row[0]
          -if dbValue.isNull {
          +if dbValue.isNull {
               // Handle NULL
           } else if let date = Date.fromDatabaseValue(dbValue) {
               // Handle valid date
          -} else {
          +} else {
               // Handle invalid date
           }
           
          @@ -1968,7 +1968,7 @@ See [Database Changes Observation](#database-changes-observation) dbValue.storage.value // Int64, Double, String, Data, or nil // All the five storage classes supported by SQLite: -switch dbValue.storage { +switch dbValue.storage { case .null: print("NULL") case .int64(let int64): print("Int64: \(int64)") case .double(let double): print("Double: \(double)") @@ -1999,15 +1999,15 @@ See [Database Changes Observation](#database-changes-observation)

          Row adopts the standard RandomAccessCollection protocol, and can be seen as a dictionary of DatabaseValue:

          // All the (columnName, dbValue) tuples, from left to right:
          -for (columnName, dbValue) in row {
          +for (columnName, dbValue) in row {
               ...
           }
           

          You can build rows from dictionaries (standard Swift dictionaries and NSDictionary). See Values for more information on supported types:

          let row: Row = ["name": "foo", "date": nil]
          -let row = Row(["name": "foo", "date": nil])
          -let row = Row(/* [AnyHashable: Any] */) // nil if invalid dictionary
          +let row = Row(["name": "foo", "date": nil])
          +let row = Row(/* [AnyHashable: Any] */) // nil if invalid dictionary
           

          Yet rows are not real dictionaries: they may contain duplicate columns:

          @@ -2015,25 +2015,25 @@ See [Database Changes Observation](#database-changes-observation) row.columnNames // ["foo", "foo"] row.databaseValues // [1, 2] row["foo"] // 1 (leftmost matching column) -for (columnName, dbValue) in row { ... } // ("foo", 1), ("foo", 2) +for (columnName, dbValue) in row { ... } // ("foo", 1), ("foo", 2)

          When you build a dictionary from a row, you have to disambiguate identical columns, and choose how to present database values. For example:

          • A [String: DatabaseValue] dictionary that keeps leftmost value in case of duplicated column name:

            -
            let dict = Dictionary(row, uniquingKeysWith: { (left, _) in left })
            +
            let dict = Dictionary(row, uniquingKeysWith: { (left, _) in left })
             
          • A [String: AnyObject] dictionary which keeps rightmost value in case of duplicated column name. This dictionary is identical to FMResultSet’s resultDictionary from FMDB. It contains NSNull values for null columns, and can be shared with Objective-C:

            -
            let dict = Dictionary(
            -    row.map { (column, dbValue) in
            +
            let dict = Dictionary(
            +    row.map { (column, dbValue) in
                     (column, dbValue.storage.value as AnyObject)
                 },
                 uniquingKeysWith: { (_, right) in right })
             
          • A [String: Any] dictionary that can feed, for example, JSONSerialization:

            -
            let dict = Dictionary(
            -    row.map { (column, dbValue) in
            +
            let dict = Dictionary(
            +    row.map { (column, dbValue) in
                     (column, dbValue.storage.value)
                 },
                 uniquingKeysWith: { (left, _) in left })
            @@ -2044,7 +2044,7 @@ See [Database Changes Observation](#database-changes-observation)
             

            Value Queries

            Instead of rows, you can directly fetch values. Like rows, fetch them as cursors, arrays, or single values (see fetching methods). Values are extracted from the leftmost column of the SQL queries:

            -
            try dbQueue.read { db in
            +
            try dbQueue.read { db in
                 try Int.fetchCursor(db, sql: "SELECT ...", arguments: ...) // A Cursor of Int
                 try Int.fetchAll(db, sql: "SELECT ...", arguments: ...)    // [Int]
                 try Int.fetchOne(db, sql: "SELECT ...", arguments: ...)    // Int?
            @@ -2054,7 +2054,7 @@ See [Database Changes Observation](#database-changes-observation)
                 try Optional<Int>.fetchAll(db, sql: "SELECT ...", arguments: ...)    // [Int?]
             }
             
            -let playerCount = try dbQueue.read { db in
            +let playerCount = try dbQueue.read { db in
                 try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM player")!
             }
             
            @@ -2099,7 +2099,7 @@ See [Database Changes Observation](#database-changes-observation)

            Use values in Records:

            -
            struct Link: FetchableRecord {
            +
            struct Link: FetchableRecord {
                 var url: URL
                 var isVerified: Bool
             
            @@ -2112,7 +2112,7 @@ See [Database Changes Observation](#database-changes-observation)
             
             

            Use values in the query interface:

            let url: URL = ...
            -let link = try Link.filter(Column("url") == url).fetchOne(db)
            +let link = try Link.filter(Column("url") == url).fetchOne(db)
             

            Data (and Memory Savings)

            @@ -2215,7 +2215,7 @@ See [Database Changes Observation](#database-changes-observation)

            Date can be stored and fetched from the database just like other values:

            try db.execute(
                 sql: "INSERT INTO player (creationDate, ...) VALUES (?, ...)",
            -    arguments: [Date(), ...])
            +    arguments: [Date(), ...])
             
             let row = try Row.fetchOne(db, ...)!
             let creationDate: Date = row["creationDate"]
            @@ -2237,10 +2237,10 @@ See [Database Changes Observation](#database-changes-observation)
             

            When the default format does not fit your needs, customize date conversions. For example:

            try db.execute(
                 sql: "INSERT INTO player (creationDate, ...) VALUES (?, ...)",
            -    arguments: [Date().timeIntervalSinceReferenceDate, ...])
            +    arguments: [Date().timeIntervalSinceReferenceDate, ...])
             
             let row = try Row.fetchOne(db, ...)!
            -let creationDate = Date(timeIntervalSinceReferenceDate: row["creationDate"])
            +let creationDate = Date(timeIntervalSinceReferenceDate: row["creationDate"])
             

            See Codable Records for more date customization options.

            @@ -2251,13 +2251,13 @@ See [Database Changes Observation](#database-changes-observation)

            DatabaseDateComponents reads date components from all date formats supported by SQLite, and stores them in the format of your choice, from HH:MM to YYYY-MM-DD HH:MM:SS.SSS.

            DatabaseDateComponents can be stored and fetched from the database just like other values:

            -
            let components = DateComponents()
            +
            let components = DateComponents()
             components.year = 1973
             components.month = 9
             components.day = 18
             
             // Store "1973-09-18"
            -let dbComponents = DatabaseDateComponents(components, format: .YMD)
            +let dbComponents = DatabaseDateComponents(components, format: .YMD)
             try db.execute(
                 sql: "INSERT INTO player (birthDate, ...) VALUES (?, ...)",
                 arguments: [dbComponents, ...])
            @@ -2293,13 +2293,13 @@ See [Database Changes Observation](#database-changes-observation)
             
             

            A classic technique is to store integers instead, since SQLite performs exact computations of integers. For example, don’t store Euros, but store cents instead:

            // Write
            -let amount = NSDecimalNumber(string: "0.10")
            +let amount = NSDecimalNumber(string: "0.10")
             let integerAmount = amount.multiplying(byPowerOf10: 2).int64Value
             try db.execute(sql: "INSERT INTO transfer (amount) VALUES (?)", arguments: [integerAmount])
             
             // Read
             let integerAmount = try Int64.fetchOne(db, sql: "SELECT SUM(amount) FROM transfer")!
            -let amount = NSDecimalNumber(value: integerAmount).multiplying(byPowerOf10: -2) // 0.10
            +let amount = NSDecimalNumber(value: integerAmount).multiplying(byPowerOf10: -2) // 0.10
             

            UUID

            @@ -2309,17 +2309,17 @@ See [Database Changes Observation](#database-changes-observation)

            Swift Enums

            Swift enums and generally all types that adopt the RawRepresentable protocol can be stored and fetched from the database just like their raw values:

            -
            enum Color : Int {
            +
            enum Color : Int {
                 case red, white, rose
             }
             
            -enum Grape : String {
            +enum Grape : String {
                 case chardonnay, merlot, riesling
             }
             
             // Declare empty DatabaseValueConvertible adoption
            -extension Color : DatabaseValueConvertible { }
            -extension Grape : DatabaseValueConvertible { }
            +extension Color : DatabaseValueConvertible { }
            +extension Grape : DatabaseValueConvertible { }
             
             // Store
             try db.execute(
            @@ -2342,20 +2342,20 @@ See [Database Changes Observation](#database-changes-observation)
             row[0] as Grape   // fatal error: could not convert "syrah" to Grape.
             
             let dbValue: DatabaseValue = row[0]
            -if dbValue.isNull {
            +if dbValue.isNull {
                 // Handle NULL
             } else if let grape = Grape.fromDatabaseValue(dbValue) {
                 // Handle valid grape
            -} else {
            +} else {
                 // Handle unknown grape
             }
             

            Custom Value Types

            Conversion to and from the database is based on the DatabaseValueConvertible protocol:

            -
            protocol DatabaseValueConvertible {
            +
            protocol DatabaseValueConvertible {
                 /// Returns a value that can be stored in the database.
            -    var databaseValue: DatabaseValue { get }
            +    var databaseValue: DatabaseValue { get }
             
                 /// Returns a value initialized from dbValue, if possible.
                 static func fromDatabaseValue(_ dbValue: DatabaseValue) -> Self?
            @@ -2384,18 +2384,18 @@ See [Database Changes Observation](#database-changes-observation)
             // INSERT INTO credit ...
             // INSERT INTO debit ...
             // COMMIT
            -try dbQueue.write { db in
            -    try Credit(destinationAccout, amount).insert(db)
            -    try Debit(sourceAccount, amount).insert(db)
            +try dbQueue.write { db in
            +    try Credit(destinationAccout, amount).insert(db)
            +    try Debit(sourceAccount, amount).insert(db)
             }
             
             // BEGIN TRANSACTION
             // INSERT INTO credit ...
             // INSERT INTO debit ...
             // COMMIT
            -try dbPool.write { db in
            -    try Credit(destinationAccout, amount).insert(db)
            -    try Debit(sourceAccount, amount).insert(db)
            +try dbPool.write { db in
            +    try Credit(destinationAccout, amount).insert(db)
            +    try Debit(sourceAccount, amount).insert(db)
             }
             
            @@ -2405,16 +2405,16 @@ See [Database Changes Observation](#database-changes-observation)

            DatabaseQueue.inDatabase() and DatabasePool.writeWithoutTransaction() execute your database statements outside of any transaction:

            // INSERT INTO credit ...
             // INSERT INTO debit ...
            -try dbQueue.inDatabase { db in
            -    try Credit(destinationAccout, amount).insert(db)
            -    try Debit(sourceAccount, amount).insert(db)
            +try dbQueue.inDatabase { db in
            +    try Credit(destinationAccout, amount).insert(db)
            +    try Debit(sourceAccount, amount).insert(db)
             }
             
             // INSERT INTO credit ...
             // INSERT INTO debit ...
            -try dbPool.writeWithoutTransaction { db in
            -    try Credit(destinationAccout, amount).insert(db)
            -    try Debit(sourceAccount, amount).insert(db)
            +try dbPool.writeWithoutTransaction { db in
            +    try Credit(destinationAccout, amount).insert(db)
            +    try Debit(sourceAccount, amount).insert(db)
             }
             
            @@ -2423,19 +2423,19 @@ See [Database Changes Observation](#database-changes-observation)
            • In our credit/debit example, you may successfully insert a credit, but fail inserting the debit, and end up with unbalanced accounts (oops).

              // UNSAFE DATABASE INTEGRITY
              -try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
              -    try Credit(destinationAccout, amount).insert(db) // may succeed
              -    try Debit(sourceAccount, amount).insert(db)      // may fail
              +try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
              +    try Credit(destinationAccout, amount).insert(db) // may succeed
              +    try Debit(sourceAccount, amount).insert(db)      // may fail
               }
               

              Transactions avoid this kind of bug.

            • Database pool concurrent reads can see an inconsistent state of the database:

              // UNSAFE CONCURRENCY
              -try dbPool.writeWithoutTransaction { db in
              -    try Credit(destinationAccout, amount).insert(db)
              +try dbPool.writeWithoutTransaction { db in
              +    try Credit(destinationAccout, amount).insert(db)
                   // <- Concurrent dbPool.read sees a partial db update here
              -    try Debit(sourceAccount, amount).insert(db)
              +    try Debit(sourceAccount, amount).insert(db)
               }
               
              @@ -2447,10 +2447,10 @@ See [Database Changes Observation](#database-changes-observation) // INSERT INTO credit ... // INSERT INTO debit ... // COMMIT -try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction - try db.inTransaction { - try Credit(destinationAccout, amount).insert(db) - try Debit(sourceAccount, amount).insert(db) +try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction + try db.inTransaction { + try Credit(destinationAccout, amount).insert(db) + try Debit(sourceAccount, amount).insert(db) return .commit } } @@ -2459,9 +2459,9 @@ See [Database Changes Observation](#database-changes-observation) // INSERT INTO credit ... // INSERT INTO debit ... // COMMIT -try dbQueue.inTransaction { db in // or dbPool.writeInTransaction - try Credit(destinationAccout, amount).insert(db) - try Debit(sourceAccount, amount).insert(db) +try dbQueue.inTransaction { db in // or dbPool.writeInTransaction + try Credit(destinationAccout, amount).insert(db) + try Debit(sourceAccount, amount).insert(db) return .commit }
            @@ -2469,7 +2469,7 @@ See [Database Changes Observation](#database-changes-observation)

            If an error is thrown from the transaction block, the transaction is rollbacked and the error is rethrown by the inTransaction method. If you return .rollback instead of .commit, the transaction is also rollbacked, but no error is thrown.

            You can also perform manual transaction management:

            -
            try dbQueue.inDatabase { db in  // or dbPool.writeWithoutTransaction
            +
            try dbQueue.inDatabase { db in  // or dbPool.writeWithoutTransaction
                 try db.beginTransaction()
                 ...
                 try db.commit()
            @@ -2482,22 +2482,22 @@ See [Database Changes Observation](#database-changes-observation)
             
             

            Transactions can’t be left opened unless you set the allowsUnsafeTransactions configuration flag:

            // fatal error: A transaction has been left opened at the end of a database access
            -try dbQueue.inDatabase { db in
            +try dbQueue.inDatabase { db in
                 try db.execute(sql: "BEGIN TRANSACTION")
                 // <- no commit or rollback
             }
             

            You can ask if a transaction is currently opened:

            -
            func myCriticalMethod(_ db: Database) throws {
            +
            func myCriticalMethod(_ db: Database) throws {
                 precondition(db.isInsideTransaction, "This method requires a transaction")
                 try ...
             }
             

            Yet, you have a better option than checking for transactions: critical database sections should use savepoints, described below:

            -
            func myCriticalMethod(_ db: Database) throws {
            -    try db.inSavepoint {
            +
            func myCriticalMethod(_ db: Database) throws {
            +    try db.inSavepoint {
                     // Here the database is guaranteed to be inside a transaction.
                     try ...
                 }
            @@ -2506,11 +2506,11 @@ See [Database Changes Observation](#database-changes-observation)
             

            Savepoints

            Statements grouped in a savepoint can be rollbacked without invalidating a whole transaction:

            -
            try dbQueue.write { db in
            +
            try dbQueue.write { db in
                 // Makes sure both inserts succeed, or none:
            -    try db.inSavepoint {
            -        try Credit(destinationAccout, amount).insert(db)
            -        try Debit(sourceAccount, amount).insert(db)
            +    try db.inSavepoint {
            +        try Credit(destinationAccout, amount).insert(db)
            +        try Debit(sourceAccount, amount).insert(db)
                     return .commit
                 }
             
            @@ -2521,10 +2521,10 @@ See [Database Changes Observation](#database-changes-observation)
             

            If an error is thrown from the savepoint block, the savepoint is rollbacked and the error is rethrown by the inSavepoint method. If you return .rollback instead of .commit, the savepoint is also rollbacked, but no error is thrown.

            Unlike transactions, savepoints can be nested. They implicitly open a transaction if no one was opened when the savepoint begins. As such, they behave just like nested transactions. Yet the database changes are only written to disk when the outermost transaction is committed:

            -
            try dbQueue.inDatabase { db in
            -    try db.inSavepoint {
            +
            try dbQueue.inDatabase { db in
            +    try db.inSavepoint {
                     ...
            -        try db.inSavepoint {
            +        try db.inSavepoint {
                         ...
                         return .commit
                     }
            @@ -2541,21 +2541,21 @@ See [Database Changes Observation](#database-changes-observation)
             
             

            The transaction kind can be changed in the database configuration, or for each transaction:

            // 1) Default configuration:
            -let dbQueue = try DatabaseQueue(path: "...")
            +let dbQueue = try DatabaseQueue(path: "...")
             
             // BEGIN DEFERED TRANSACTION ...
            -dbQueue.write { db in ... }
            +dbQueue.write { db in ... }
             
             // BEGIN EXCLUSIVE TRANSACTION ...
             dbQueue.inTransaction(.exclusive) { db in ... }
             
             // 2) Customized default transaction kind:
            -var config = Configuration()
            +var config = Configuration()
             config.defaultTransactionKind = .immediate
            -let dbQueue = try DatabaseQueue(path: "...", configuration: config)
            +let dbQueue = try DatabaseQueue(path: "...", configuration: config)
             
             // BEGIN IMMEDIATE TRANSACTION ...
            -dbQueue.write { db in ... }
            +dbQueue.write { db in ... }
             
             // BEGIN EXCLUSIVE TRANSACTION ...
             dbQueue.inTransaction(.exclusive) { db in ... }
            @@ -2565,7 +2565,7 @@ See [Database Changes Observation](#database-changes-observation)
             

            Prepared Statements let you prepare an SQL query and execute it later, several times if you need, with different arguments.

            There are two kinds of prepared statements: select statements, and update statements:

            -
            try dbQueue.write { db in
            +
            try dbQueue.write { db in
                 let updateSQL = "INSERT INTO player (name, score) VALUES (:name, :score)"
                 let updateStatement = try db.makeUpdateStatement(sql: updateSQL)
             
            @@ -2629,17 +2629,17 @@ See [Database Changes Observation](#database-changes-observation)
             
          • Custom Aggregates

          Custom SQL Functions

          -
          let reverse = DatabaseFunction("reverse", argumentCount: 1, pure: true) { (values: [DatabaseValue]) in
          +
          let reverse = DatabaseFunction("reverse", argumentCount: 1, pure: true) { (values: [DatabaseValue]) in
               // Extract string value, if any...
          -    guard let string = String.fromDatabaseValue(values[0]) else {
          +    guard let string = String.fromDatabaseValue(values[0]) else {
                   return nil
               }
               // ... and return reversed string:
          -    return String(string.reversed())
          +    return String(string.reversed())
           }
           dbQueue.add(function: reverse)   // Or dbPool.add(function: ...)
           
          -try dbQueue.read { db in
          +try dbQueue.read { db in
               // "oof"
               try String.fetchOne(db, sql: "SELECT reverse('foo')")!
           }
          @@ -2652,32 +2652,32 @@ See [Database Changes Observation](#database-changes-observation)
           

          Functions can take a variable number of arguments:

          When you don’t provide any explicit argumentCount, the function can take any number of arguments:

          -
          let averageOf = DatabaseFunction("averageOf", pure: true) { (values: [DatabaseValue]) in
          -    let doubles = values.compactMap { Double.fromDatabaseValue($0) }
          -    return doubles.reduce(0, +) / Double(doubles.count)
          +
          let averageOf = DatabaseFunction("averageOf", pure: true) { (values: [DatabaseValue]) in
          +    let doubles = values.compactMap { Double.fromDatabaseValue($0) }
          +    return doubles.reduce(0, +) / Double(doubles.count)
           }
           dbQueue.add(function: averageOf)
           
          -try dbQueue.read { db in
          +try dbQueue.read { db in
               // 2.0
               try Double.fetchOne(db, sql: "SELECT averageOf(1, 2, 3)")!
           }
           

          Functions can throw:

          -
          let sqrt = DatabaseFunction("sqrt", argumentCount: 1, pure: true) { (values: [DatabaseValue]) in
          -    guard let double = Double.fromDatabaseValue(values[0]) else {
          +
          let sqrt = DatabaseFunction("sqrt", argumentCount: 1, pure: true) { (values: [DatabaseValue]) in
          +    guard let double = Double.fromDatabaseValue(values[0]) else {
                   return nil
               }
          -    guard double >= 0 else {
          -        throw DatabaseError(message: "invalid negative number")
          +    guard double >= 0 else {
          +        throw DatabaseError(message: "invalid negative number")
               }
               return sqrt(double)
           }
           dbQueue.add(function: sqrt)
           
           // SQLite error 1 with statement `SELECT sqrt(-1)`: invalid negative number
          -try dbQueue.read { db in
          +try dbQueue.read { db in
               try Double.fetchOne(db, sql: "SELECT sqrt(-1)")!
           }
           
          @@ -2691,7 +2691,7 @@ See [Database Changes Observation](#database-changes-observation)

          Custom Aggregates

          Before registering a custom aggregate, you need to define a type that adopts the DatabaseAggregate protocol:

          -
          protocol DatabaseAggregate {
          +
          protocol DatabaseAggregate {
               // Initializes an aggregate
               init()
           
          @@ -2704,27 +2704,27 @@ See [Database Changes Observation](#database-changes-observation)
           

          For example:

          -
          struct MaxLength : DatabaseAggregate {
          +
          struct MaxLength : DatabaseAggregate {
               var maxLength: Int = 0
           
               mutating func step(_ dbValues: [DatabaseValue]) {
                   // At each step, extract string value, if any...
          -        guard let string = String.fromDatabaseValue(dbValues[0]) else {
          +        guard let string = String.fromDatabaseValue(dbValues[0]) else {
                       return
                   }
                   // ... and update the result
                   let length = string.count
          -        if length > maxLength {
          +        if length > maxLength {
                       maxLength = length
                   }
               }
           
          -    func finalize() -> DatabaseValueConvertible? {
          +    func finalize() -> DatabaseValueConvertible? {
                   return maxLength
               }
           }
           
          -let maxLength = DatabaseFunction(
          +let maxLength = DatabaseFunction(
               "maxLength",
               argumentCount: 1,
               pure: true,
          @@ -2732,7 +2732,7 @@ See [Database Changes Observation](#database-changes-observation)
           
           dbQueue.add(function: maxLength)   // Or dbPool.add(function: ...)
           
          -try dbQueue.read { db in
          +try dbQueue.read { db in
               // Some Int
               try Int.fetchOne(db, sql: "SELECT maxLength(name) FROM player")!
           }
          @@ -2752,7 +2752,7 @@ See [Database Changes Observation](#database-changes-observation)
           

          Database Schema Introspection

          GRDB comes with a set of schema introspection methods:

          -
          try dbQueue.read { db in
          +
          try dbQueue.read { db in
               // Bool, true if the table exists
               try db.tableExists("player")
           
          @@ -2786,7 +2786,7 @@ See [Database Changes Observation](#database-changes-observation)
           
           

          In this case, the ColumnMapping row adapter comes in handy:

          // Fetch a 'produced' column, and consume a 'consumed' column:
          -let adapter = ColumnMapping(["consumed": "produced"])
          +let adapter = ColumnMapping(["consumed": "produced"])
           let row = try Row.fetchOne(db, sql: "SELECT 'Hello' AS produced", adapter: adapter)!
           row["consumed"] // "Hello"
           row["produced"] // nil
          @@ -2799,27 +2799,27 @@ See [Database Changes Observation](#database-changes-observation)
           
           

          ColumnMapping renames columns. Build one with a dictionary whose keys are adapted column names, and values the column names in the raw row:

          // [newName:"Hello"]
          -let adapter = ColumnMapping(["newName": "oldName"])
          +let adapter = ColumnMapping(["newName": "oldName"])
           let row = try Row.fetchOne(db, sql: "SELECT 'Hello' AS oldName", adapter: adapter)!
           

          SuffixRowAdapter

          SuffixRowAdapter hides the first columns in a row:

          // [b:1 c:2]
          -let adapter = SuffixRowAdapter(fromIndex: 1)
          +let adapter = SuffixRowAdapter(fromIndex: 1)
           let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c", adapter: adapter)!
           

          RangeRowAdapter

          RangeRowAdapter only exposes a range of columns.

          // [b:1]
          -let adapter = RangeRowAdapter(1..<2)
          +let adapter = RangeRowAdapter(1..<2)
           let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c", adapter: adapter)!
           

          EmptyRowAdapter

          EmptyRowAdapter hides all columns.

          -
          let adapter = EmptyRowAdapter()
          +
          let adapter = EmptyRowAdapter()
           let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c", adapter: adapter)!
           row.isEmpty // true
           
          @@ -2828,9 +2828,9 @@ See [Database Changes Observation](#database-changes-observation)

          ScopeAdapter

          ScopeAdapter defines row scopes:

          -
          let adapter = ScopeAdapter([
          -    "left": RangeRowAdapter(0..<2),
          -    "right": RangeRowAdapter(2..<4)])
          +
          let adapter = ScopeAdapter([
          +    "left": RangeRowAdapter(0..<2),
          +    "right": RangeRowAdapter(2..<4)])
           let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c, 3 AS d", adapter: adapter)!
           
          @@ -2842,13 +2842,13 @@ See [Database Changes Observation](#database-changes-observation)

          Scopes can be nested:

          -
          let adapter = ScopeAdapter([
          -    "left": ScopeAdapter([
          -        "left": RangeRowAdapter(0..<1),
          -        "right": RangeRowAdapter(1..<2)]),
          -    "right": ScopeAdapter([
          -        "left": RangeRowAdapter(2..<3),
          -        "right": RangeRowAdapter(3..<4)])
          +
          let adapter = ScopeAdapter([
          +    "left": ScopeAdapter([
          +        "left": RangeRowAdapter(0..<1),
          +        "right": RangeRowAdapter(1..<2)]),
          +    "right": ScopeAdapter([
          +        "left": RangeRowAdapter(2..<3),
          +        "right": RangeRowAdapter(3..<4)])
               ])
           let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c, 3 AS d", adapter: adapter)!
           
          @@ -2862,9 +2862,9 @@ See [Database Changes Observation](#database-changes-observation)
           

          Any adapter can be extended with scopes:

          -
          let baseAdapter = RangeRowAdapter(0..<2)
          -let adapter = ScopeAdapter(base: baseAdapter, scopes: [
          -    "remainder": SuffixRowAdapter(fromIndex: 2)])
          +
          let baseAdapter = RangeRowAdapter(0..<2)
          +let adapter = ScopeAdapter(base: baseAdapter, scopes: [
          +    "remainder": SuffixRowAdapter(fromIndex: 2)])
           let row = try Row.fetchOne(db, sql: "SELECT 0 AS a, 1 AS b, 2 AS c, 3 AS d", adapter: adapter)!
           
           row // [a:0 b:1]
          @@ -2884,11 +2884,11 @@ See [Database Changes Observation](#database-changes-observation)
           // System SQLite
           import SQLite3
           
          -let sqliteVersion = String(cString: sqlite3_libversion())
          +let sqliteVersion = String(cString: sqlite3_libversion())
           

          Raw pointers to database connections and statements are available through the Database.sqliteConnection and Statement.sqliteStatement properties:

          -
          try dbQueue.read { db in
          +
          try dbQueue.read { db in
               // The raw pointer to a database connection:
               let sqliteConnection = db.sqliteConnection
           
          @@ -2933,7 +2933,7 @@ See [Database Changes Observation](#database-changes-observation)
           

          Records

          On top of the SQLite API, GRDB provides protocols and a class that help manipulating database rows as regular objects named records:

          -
          try dbQueue.write { db in
          +
          try dbQueue.write { db in
               if var place = try Place.fetchOne(db, key: 1) {
                   place.isFavorite = true
                   try place.update(db)
          @@ -2992,7 +2992,7 @@ See [Database Changes Observation](#database-changes-observation)
           

          Inserting Records

          To insert a record in the database, call the insert method:

          -
          let player = Player(name: "Arthur", email: "arthur@example.com")
          +
          let player = Player(name: "Arthur", email: "arthur@example.com")
           try player.insert(db)
           
          @@ -3005,7 +3005,7 @@ See [Database Changes Observation](#database-changes-observation) arguments: ["Arthur"]) let bestPlayers = try Player // [Player] - .order(Column("score").desc) + .order(Column("score").desc) .limit(10) .fetchAll(db) @@ -3054,7 +3054,7 @@ See [Database Changes Observation](#database-changes-observation)

          For batch deletes, execute an SQL query, or see the query interface:

          try Player
          -    .filter(Column("email") == nil)
          +    .filter(Column("email") == nil)
               .deleteAll(db)
           
          @@ -3065,7 +3065,7 @@ See [Database Changes Observation](#database-changes-observation)
          let playerCount: Int = try Player.fetchCount(db)
           
           let playerWithEmailCount: Int = try Player
          -    .filter(Column("email") == nil)
          +    .filter(Column("email") == nil)
               .fetchCount(db)
           
          @@ -3093,14 +3093,14 @@ See [Database Changes Observation](#database-changes-observation)
        • FetchableRecord is able to decode database rows.

          It is always possible to decode rows without this protocol:

          -
          struct Place { ... }
          -try dbQueue.read { db in
          +
          struct Place { ... }
          +try dbQueue.read { db in
               let rows = try Row.fetchAll(db, sql: "SELECT * FROM place")
          -    let places: [Place] = rows.map { row in
          -        return Place(
          +    let places: [Place] = rows.map { row in
          +        return Place(
                       id: row["id"],
                       title: row["title"],
          -            coordinate: CLLocationCoordinate2D(
          +            coordinate: CLLocationCoordinate2D(
                           latitude: row["latitude"],
                           longitude: row["longitude"]))
                   )
          @@ -3109,8 +3109,8 @@ See [Database Changes Observation](#database-changes-observation)
           

          But FetchableRecord lets you write code that is easier to read, and more efficient as well, both in terms of performance and memory usage:

          -
          struct Place: FetchableRecord { ... }
          -try dbQueue.read { db in
          +
          struct Place: FetchableRecord { ... }
          +try dbQueue.read { db in
               let places = try Place.fetchAll(db, sql: "SELECT * FROM place")
           }
           
          @@ -3121,23 +3121,23 @@ See [Database Changes Observation](#database-changes-observation)

          FetchableRecord can decode database rows, but it is not able to build SQL requests for you. For that, you also need TableRecord:

        • TableRecord is able to generate SQL queries:

          -
          struct Place: TableRecord { ... }
          +
          struct Place: TableRecord { ... }
           // SELECT * FROM place ORDER BY title
          -let request = Place.order(Column("title"))
          +let request = Place.order(Column("title"))
           

          When a type adopts both TableRecord and FetchableRecord, it can load from those requests:

          -
          struct Place: TableRecord, FetchableRecord { ... }
          -try dbQueue.read { db in
          -    let places = try Place.order(Column("title")).fetchAll(db)
          +
          struct Place: TableRecord, FetchableRecord { ... }
          +try dbQueue.read { db in
          +    let places = try Place.order(Column("title")).fetchAll(db)
               let paris = try Place.fetchOne(key: 1)
           }
           
        • PersistableRecord is able to write: it can create, update, and delete rows in the database:

          -
          struct Place : PersistableRecord { ... }
          -try dbQueue.write { db in
          +
          struct Place : PersistableRecord { ... }
          +try dbQueue.write { db in
               try Place.delete(db, key: 1)
          -    try Place(...).insert(db)
          +    try Place(...).insert(db)
           }
           
          @@ -3150,24 +3150,24 @@ See [Database Changes Observation](#database-changes-observation)

          FetchableRecord Protocol

          The FetchableRecord protocol grants fetching methods to any type that can be built from a database row:

          -
          protocol FetchableRecord {
          +
          protocol FetchableRecord {
               /// Row initializer
               init(row: Row)
           }
           

          To use FetchableRecord, subclass the Record class, or adopt it explicitly. For example:

          -
          struct Place {
          +
          struct Place {
               var id: Int64?
               var title: String
               var coordinate: CLLocationCoordinate2D
           }
           
          -extension Place : FetchableRecord {
          +extension Place : FetchableRecord {
               init(row: Row) {
                   id = row["id"]
                   title = row["title"]
          -        coordinate = CLLocationCoordinate2D(
          +        coordinate = CLLocationCoordinate2D(
                       latitude: row["latitude"],
                       longitude: row["longitude"])
               }
          @@ -3175,15 +3175,15 @@ See [Database Changes Observation](#database-changes-observation)
           

          Rows also accept column enums:

          -
          extension Place : FetchableRecord {
          -    enum Columns: String, ColumnExpression {
          +
          extension Place : FetchableRecord {
          +    enum Columns: String, ColumnExpression {
                   case id, title, latitude, longitude
               }
           
               init(row: Row) {
                   id = row[Columns.id]
                   title = row[Columns.title]
          -        coordinate = CLLocationCoordinate2D(
          +        coordinate = CLLocationCoordinate2D(
                       latitude: row[Columns.latitude],
                       longitude: row[Columns.longitude])
               }
          @@ -3194,7 +3194,7 @@ See [Database Changes Observation](#database-changes-observation)
           
           

          When your record type adopts the standard Decodable protocol, you don’t have to provide the implementation for init(row:). See Codable Records for more information:

          // That's all
          -struct Player: Decodable, FetchableRecord {
          +struct Player: Decodable, FetchableRecord {
               var id: Int64
               var name: String
               var score: Int
          @@ -3217,8 +3217,8 @@ See [Database Changes Observation](#database-changes-observation)
           

          TableRecord Protocol

          The TableRecord protocol generates SQL for you. To use TableRecord, subclass the Record class, or adopt it explicitly:

          -
          protocol TableRecord {
          -    static var databaseTableName: String { get }
          +
          protocol TableRecord {
          +    static var databaseTableName: String { get }
               static var databaseSelection: [SQLSelectable] { get }
           }
           
          @@ -3226,7 +3226,7 @@ See [Database Changes Observation](#database-changes-observation)

          The databaseSelection type property is optional, and documented in the Columns Selected by a Request chapter.

          The databaseTableName type property is the name of a database table. By default, it is derived from the type name:

          -
          struct Place: TableRecord { }
          +
          struct Place: TableRecord { }
           print(Place.databaseTableName) // prints "place"
           
          @@ -3241,15 +3241,15 @@ See [Database Changes Observation](#database-changes-observation)

        You can still provide a custom table name:

        -
        struct Place: TableRecord {
        +
        struct Place: TableRecord {
             static let databaseTableName = "location"
         }
         print(Place.databaseTableName) // prints "location"
         

        Subclasses of the Record class must always override their superclass’s databaseTableName property:

        -
        class Place: Record {
        -    override class var databaseTableName: String {
        +
        class Place: Record {
        +    override class var databaseTableName: String {
                 return "place"
             }
         }
        @@ -3284,20 +3284,20 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        Those abilities are granted by three protocols:

        // Defines how a record encodes itself into the database
        -protocol EncodableRecord {
        +protocol EncodableRecord {
             /// Defines the values persisted in the database
             func encode(to container: inout PersistenceContainer)
         }
         
         // Adds persistence methods
        -protocol MutablePersistableRecord: TableRecord, EncodableRecord {
        +protocol MutablePersistableRecord: TableRecord, EncodableRecord {
             /// Optional method that lets your adopting type store its rowID upon
             /// successful insertion. Don't call it directly: it is called for you.
             mutating func didInsert(with rowID: Int64, for column: String?)
         }
         
         // Adds immutability
        -protocol PersistableRecord: MutablePersistableRecord {
        +protocol PersistableRecord: MutablePersistableRecord {
             /// Non-mutating version of the optional didInsert(with:for:)
             func didInsert(with rowID: Int64, for column: String?)
         }
        @@ -3316,7 +3316,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        The optional didInsert method lets the adopting type store its rowID after successful insertion, and is only useful for tables that have an auto-incremented primary key. It is called from a protected dispatch queue, and serialized with all database updates.

        To use the persistable protocols, subclass the Record class, or adopt one of them explicitly. For example:

        -
        extension Place : MutablePersistableRecord {
        +
        extension Place : MutablePersistableRecord {
             /// The values persisted in the database
             func encode(to container: inout PersistenceContainer) {
                 container["id"] = id
        @@ -3331,18 +3331,18 @@ See [Database Changes Observation](#database-changes-observation)
             }
         }
         
        -var paris = Place(
        +var paris = Place(
             id: nil,
             title: "Paris",
        -    coordinate: CLLocationCoordinate2D(latitude: 48.8534100, longitude: 2.3488000))
        +    coordinate: CLLocationCoordinate2D(latitude: 48.8534100, longitude: 2.3488000))
         
         try paris.insert(db)
         paris.id   // some value
         

        Persistence containers also accept column enums:

        -
        extension Place : MutablePersistableRecord {
        -    enum Columns: String, ColumnExpression {
        +
        extension Place : MutablePersistableRecord {
        +    enum Columns: String, ColumnExpression {
                 case id, title, latitude, longitude
             }
         
        @@ -3357,7 +3357,7 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        When your record type adopts the standard Encodable protocol, you don’t have to provide the implementation for encode(to:). See Codable Records for more information:

        // That's all
        -struct Player: Encodable, MutablePersistableRecord {
        +struct Player: Encodable, MutablePersistableRecord {
             var id: Int64?
             var name: String
             var score: Int
        @@ -3409,12 +3409,12 @@ See [Database Changes Observation](#database-changes-observation)
         

        For example, it may want to have its UUID automatically set before inserting. Or it may want to validate its values before saving.

        When you subclass Record, you simply have to override the customized method, and call super:

        -
        class Player : Record {
        +
        class Player : Record {
             var uuid: UUID?
         
        -    override func insert(_ db: Database) throws {
        -        if uuid == nil {
        -            uuid = UUID()
        +    override func insert(_ db: Database) throws {
        +        if uuid == nil {
        +            uuid = UUID()
                 }
                 try super.insert(db)
             }
        @@ -3422,22 +3422,22 @@ See [Database Changes Observation](#database-changes-observation)
         

        If you use the raw PersistableRecord protocol, use one of the special methods performInsert, performUpdate, performSave, performDelete, or performExists:

        -
        struct Link : PersistableRecord {
        +
        struct Link : PersistableRecord {
             var url: URL
         
        -    func insert(_ db: Database) throws {
        +    func insert(_ db: Database) throws {
                 try validate()
                 try performInsert(db)
             }
         
        -    func update(_ db: Database, columns: Set<String>) throws {
        +    func update(_ db: Database, columns: Set<String>) throws {
                 try validate()
                 try performUpdate(db, columns: columns)
             }
         
        -    func validate() throws {
        -        if url.host == nil {
        -            throw ValidationError("url must be absolute.")
        +    func validate() throws {
        +        if url.host == nil {
        +            throw ValidationError("url must be absolute.")
                 }
             }
         }
        @@ -3452,14 +3452,14 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        Record types that adopt an archival protocol (Codable, Encodable or Decodable) get free database support just by declaring conformance to the desired record protocols:

        // Declare a record...
        -struct Player: Codable, FetchableRecord, PersistableRecord {
        +struct Player: Codable, FetchableRecord, PersistableRecord {
             var name: String
             var score: Int
         }
         
         // ...and there you go:
        -try dbQueue.write { db in
        -    try Player(name: "Arthur", score: 100).insert(db)
        +try dbQueue.write { db in
        +    try Player(name: "Arthur", score: 100).insert(db)
             let players = try Player.fetchAll(db)
         }
         
        @@ -3487,29 +3487,29 @@ See [Database Changes Observation](#database-changes-observation)

        JSON Columns

        When a Codable record contains a property that is not a simple value (Bool, Int, String, Date, Swift enums, etc.), that value is encoded and decoded as a JSON string. For example:

        -
        enum AchievementColor: String, Codable {
        +
        enum AchievementColor: String, Codable {
             case bronze, silver, gold
         }
         
        -struct Achievement: Codable {
        +struct Achievement: Codable {
             var name: String
             var color: AchievementColor
         }
         
        -struct Player: Codable, FetchableRecord, PersistableRecord {
        +struct Player: Codable, FetchableRecord, PersistableRecord {
             var name: String
             var score: Int
             var achievements: [Achievement] // stored in a JSON column
         }
         
        -try! dbQueue.write { db in
        +try! dbQueue.write { db in
             // INSERT INTO player (name, score, achievements)
             // VALUES (
             //   'Arthur',
             //   100,
             //   '[{"color":"gold","name":"Use Codable Records"}]')
        -    let achievement = Achievement(name: "Use Codable Records", color: .gold)
        -    let player = Player(name: "Arthur", score: 100, achievements: [achievement])
        +    let achievement = Achievement(name: "Use Codable Records", color: .gold)
        +    let player = Player(name: "Arthur", score: 100, achievements: [achievement])
             try player.insert(db)
         }
         
        @@ -3517,11 +3517,11 @@ See [Database Changes Observation](#database-changes-observation)

        GRDB uses the standard JSONDecoder and JSONEncoder from Foundation. By default, Data values are handled with the .base64 strategy, Date with the .millisecondsSince1970 strategy, and non conforming floats with the .throw strategy.

        You can customize the JSON format by implementing those methods:

        -
        protocol FetchableRecord {
        +
        protocol FetchableRecord {
             static func databaseJSONDecoder(for column: String) -> JSONDecoder
         }
         
        -protocol EncodableRecord {
        +protocol EncodableRecord {
             static func databaseJSONEncoder(for column: String) -> JSONEncoder
         }
         
        @@ -3536,13 +3536,13 @@ See [Database Changes Observation](#database-changes-observation)

        To sum up: dates encode themselves in the YYYY-MM-DD HH:MM:SS.SSS format, in the UTC time zone, and decode a variety of date formats and timestamps. UUIDs encode themselves as 16-bytes data blobs, and decode both 16-bytes data blobs and strings such as E621E1F8-C36C-495A-93FC-0C247A3E6E5F.

        Those behaviors can be overridden:

        -
        protocol FetchableRecord {
        -    static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
        +
        protocol FetchableRecord {
        +    static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
         }
         
        -protocol EncodableRecord {
        -    static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
        -    static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
        +protocol EncodableRecord {
        +    static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
        +    static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
         }
         
        @@ -3556,21 +3556,21 @@ See [Database Changes Observation](#database-changes-observation)

        Your Codable Records can be stored in the database, but they may also have other purposes. In this case, you may need to customize their implementations of Decodable.init(from:) and Encodable.encode(to:), depending on the context.

        The standard way to provide such context is the userInfo dictionary. Implement those properties:

        -
        protocol FetchableRecord {
        +
        protocol FetchableRecord {
             static var databaseDecodingUserInfo: [CodingUserInfoKey: Any] { get }
         }
         
        -protocol EncodableRecord {
        +protocol EncodableRecord {
             static var databaseEncodingUserInfo: [CodingUserInfoKey: Any] { get }
         }
         

        For example, here is a Player type that customizes its decoding:

        // A key that holds a decoder's name
        -let decoderName = CodingUserInfoKey(rawValue: "decoderName")!
        +let decoderName = CodingUserInfoKey(rawValue: "decoderName")!
         
        -struct Player: FetchableRecord, Decodable {
        -    init(from decoder: Decoder) throws {
        +struct Player: FetchableRecord, Decodable {
        +    init(from decoder: Decoder) throws {
                 // Print the decoder name
                 let decoderName = decoder.userInfo[decoderName] as? String
                 print("Decoded from \(decoderName ?? "unknown decoder")")
        @@ -3581,13 +3581,13 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        You can have a specific decoding from JSON…

        // prints "Decoded from JSON"
        -let decoder = JSONDecoder()
        +let decoder = JSONDecoder()
         decoder.userInfo = [decoderName: "JSON"]
         let player = try decoder.decode(Player.self, from: jsonData)
         

        … and another one from database rows:

        -
        extension Player: FetchableRecord {
        +
        extension Player: FetchableRecord {
             static let databaseDecodingUserInfo: [CodingUserInfoKey: Any] = [decoderName: "database row"]
         }
         
        @@ -3601,17 +3601,17 @@ See [Database Changes Observation](#database-changes-observation)
         

        Tip: Derive Columns from Coding Keys

        Codable types are granted with a CodingKeys enum. You can use them to safely define database columns:

        -
        struct Player: Codable {
        +
        struct Player: Codable {
             var id: Int64
             var name: String
             var score: Int
         }
         
        -extension Player: FetchableRecord, PersistableRecord {
        -    enum Columns {
        -        static let id = Column(CodingKeys.id)
        -        static let name = Column(CodingKeys.name)
        -        static let score = Column(CodingKeys.score)
        +extension Player: FetchableRecord, PersistableRecord {
        +    enum Columns {
        +        static let id = Column(CodingKeys.id)
        +        static let name = Column(CodingKeys.name)
        +        static let score = Column(CodingKeys.score)
             }
         }
         
        @@ -3622,7 +3622,7 @@ See [Database Changes Observation](#database-changes-observation)

        Record is a class that is designed to be subclassed. It inherits its features from the FetchableRecord, TableRecord, and PersistableRecord protocols. On top of that, Record instances can compare against previous versions of themselves in order to avoid useless updates.

        Record subclasses define their custom database relationship by overriding database methods. For example:

        -
        class Place: Record {
        +
        class Place: Record {
             var id: Int64?
             var title: String
             var isFavorite: Bool
        @@ -3637,12 +3637,12 @@ See [Database Changes Observation](#database-changes-observation)
             }
         
             /// The table name
        -    override class var databaseTableName: String {
        +    override class var databaseTableName: String {
                 return "place"
             }
         
             /// The table columns
        -    enum Columns: String, ColumnExpression {
        +    enum Columns: String, ColumnExpression {
                 case id, title, favorite, latitude, longitude
             }
         
        @@ -3651,7 +3651,7 @@ See [Database Changes Observation](#database-changes-observation)
                 id = row[Columns.id]
                 title = row[Columns.title]
                 isFavorite = row[Columns.favorite]
        -        coordinate = CLLocationCoordinate2D(
        +        coordinate = CLLocationCoordinate2D(
                     latitude: row[Columns.latitude],
                     longitude: row[Columns.longitude])
                 super.init(row: row)
        @@ -3696,7 +3696,7 @@ See [Database Changes Observation](#database-changes-observation)
             newPlayer.score = 100
             if try newPlayer.updateChanges(db, from: oldPlayer) {
                 print("player was modified, and updated in the database")
        -    } else {
        +    } else {
                 print("player was not modified, and database was not hit")
             }
         }
        @@ -3708,9 +3708,9 @@ See [Database Changes Observation](#database-changes-observation)
             let modified = try player.updateChanges(db) {
                 $0.score = 100
             }
        -    if modified {
        +    if modified {
                 print("player was modified, and updated in the database")
        -    } else {
        +    } else {
                 print("player was not modified, and database was not hit")
             }
         }
        @@ -3723,7 +3723,7 @@ See [Database Changes Observation](#database-changes-observation)
             player.score = 100
             if try player.updateChanges(db) {
                 print("player was modified, and updated in the database")
        -    } else {
        +    } else {
                 print("player was not modified, and database was not hit")
             }
         }
        @@ -3734,7 +3734,7 @@ See [Database Changes Observation](#database-changes-observation)
         

        This method returns whether two records have the same database representation:

        let oldPlayer: Player = ...
         var newPlayer: Player = ...
        -if newPlayer.databaseEquals(oldPlayer) == false {
        +if newPlayer.databaseEquals(oldPlayer) == false {
             try newPlayer.save(db)
         }
         
        @@ -3745,8 +3745,8 @@ See [Database Changes Observation](#database-changes-observation)

        The databaseChanges and hasDatabaseChanges Methods

        databaseChanges(from:) returns a dictionary of differences between two records:

        -
        let oldPlayer = Player(id: 1, name: "Arthur", score: 100)
        -let newPlayer = Player(id: 1, name: "Arthur", score: 1000)
        +
        let oldPlayer = Player(id: 1, name: "Arthur", score: 100)
        +let newPlayer = Player(id: 1, name: "Arthur", score: 1000)
         for (column, oldValue) in newPlayer.databaseChanges(from: oldPlayer) {
             print("\(column) was \(oldValue)")
         }
        @@ -3755,10 +3755,10 @@ See [Database Changes Observation](#database-changes-observation)
         
         

        The Record class is able to compare against itself:

        // Record class only
        -let player = Player(id: 1, name: "Arthur", score: 100)
        +let player = Player(id: 1, name: "Arthur", score: 100)
         try player.insert(db)
         player.score = 1000
        -for (column, oldValue) in player.databaseChanges {
        +for (column, oldValue) in player.databaseChanges {
             print("\(column) was \(oldValue)")
         }
         // prints "score was 100"
        @@ -3767,13 +3767,13 @@ See [Database Changes Observation](#database-changes-observation)
         

        Record instances also have a hasDatabaseChanges property:

        // Record class only
         player.score = 1000
        -if player.hasDatabaseChanges {
        +if player.hasDatabaseChanges {
             try player.save(db)
         }
         

        Record.hasDatabaseChanges is false after a Record instance has been fetched or saved into the database. Subsequent modifications may set it, or not: hasDatabaseChanges is based on value comparison. Setting a property to the same value does not set the changed flag:

        -
        let player = Player(name: "Barbara", score: 750)
        +
        let player = Player(name: "Barbara", score: 750)
         player.hasDatabaseChanges // true
         
         try player.insert(db)
        @@ -3850,18 +3850,18 @@ See [Database Changes Observation](#database-changes-observation)
         
         
         

        When you want to handle conflicts at the query level, specify a custom persistenceConflictPolicy in your type that adopts the PersistableRecord protocol. It will alter the INSERT and UPDATE queries run by the insert, update and save persistence methods:

        -
        protocol MutablePersistableRecord {
        +
        protocol MutablePersistableRecord {
             /// The policy that handles SQLite conflicts when records are
             /// inserted or updated.
             ///
             /// This property is optional: its default value uses the ABORT
             /// policy for both insertions and updates, so that GRDB generate
             /// regular INSERT and UPDATE queries.
        -    static var persistenceConflictPolicy: PersistenceConflictPolicy { get }
        +    static var persistenceConflictPolicy: PersistenceConflictPolicy { get }
         }
         
        -struct Player : MutablePersistableRecord {
        -    static let persistenceConflictPolicy = PersistenceConflictPolicy(
        +struct Player : MutablePersistableRecord {
        +    static let persistenceConflictPolicy = PersistenceConflictPolicy(
                 insert: .replace,
                 update: .replace)
         }
        @@ -3890,7 +3890,7 @@ See [Database Changes Observation](#database-changes-observation)
         }
         
         // No way to define an explicit primary key
        -try db.create(virtualTable: "book", using: FTS4()) { t in
        +try db.create(virtualTable: "book", using: FTS4()) { t in
             t.column("title")
             t.column("author")
             t.column("body")
        @@ -3916,14 +3916,14 @@ See [Database Changes Observation](#database-changes-observation)
         
         
        1. Have the databaseSelection static property (from the TableRecord protocol) return the hidden rowid column:

          -
          struct Event : TableRecord {
          -    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
          +
          struct Event : TableRecord {
          +    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
           }
           
           // When you subclass Record, you need an override:
          -class Book : Record {
          +class Book : Record {
               override class var databaseSelection: [SQLSelectable] {
          -        return [AllColums(), Column.rowID]
          +        return [AllColums(), Column.rowID]
               }
           }
           
          @@ -3933,7 +3933,7 @@ See [Database Changes Observation](#database-changes-observation) let events = try Event.fetchAll(db)
        2. Have init(row:) from the FetchableRecord protocol consume the rowid column:

          -
          struct Event : FetchableRecord {
          +
          struct Event : FetchableRecord {
               var id: Int64?
           
               init(row: Row) {
          @@ -3947,7 +3947,7 @@ See [Database Changes Observation](#database-changes-observation)
           event.id // some value
           
        3. Encode the rowid in encode(to:), and keep it in the didInsert(with:for:) method (both from the PersistableRecord and MutablePersistableRecord protocols):

          -
          struct Event : MutablePersistableRecord {
          +
          struct Event : MutablePersistableRecord {
               var id: Int64?
           
               func encode(to container: inout PersistenceContainer) {
          @@ -3964,7 +3964,7 @@ See [Database Changes Observation](#database-changes-observation)
           

          You will then be able to track your record ids, update them, or check for their existence:

          -
          let event = Event(message: "foo", date: Date())
          +
          let event = Event(message: "foo", date: Date())
           
           // Insertion sets the record id:
           try event.insert(db)
          @@ -3994,7 +3994,7 @@ See [Database Changes Observation](#database-changes-observation)
           

          Examples of Record Definitions

          We will show below how to declare a record type for the following database table:

          -
          try dbQueue.write { db in
          +
          try dbQueue.write { db in
               try db.create(table: "place") { t in
                   t.autoIncrementedPrimaryKey("id")
                   t.column("title", .text).notNull()
          @@ -4713,7 +4713,7 @@ class Place: Record {
           

          The Query Interface

          The query interface lets you write pure Swift instead of SQL:

          -
          try dbQueue.write { db in
          +
          try dbQueue.write { db in
               // Update database schema
               try db.create(table: "wine") { t in ... }
           
          @@ -4731,7 +4731,7 @@ class Place: Record {
           

          You need to open a database connection before you can query the database.

          Please bear in mind that the query interface can not generate all possible SQL queries. You may also prefer writing SQL, and this is just OK. From little snippets to full queries, your SQL skills are welcome:

          -
          try dbQueue.write { db in
          +
          try dbQueue.write { db in
               // Update database schema (with SQL)
               try db.execute(sql: "CREATE TABLE wine (...)")
           
          @@ -4870,7 +4870,7 @@ class Place: Record {
           

          Perform integrity checks on individual columns, and SQLite will only let conforming rows in. In the example below, the $0 closure variable is a column which lets you build any SQL expression.

              // name TEXT CHECK (LENGTH(name) > 0)
               // score INTEGER CHECK (score > 0)
          -    t.column("name", .text).check { length($0) > 0 }
          +    t.column("name", .text).check { length($0) > 0 }
               t.column("score", .integer).check(sql: "score > 0")
           
          @@ -4885,7 +4885,7 @@ class Place: Record { t.foreignKey(["a", "b"], references: "parents") // CHECK (a + b < 10), - t.check(Column("a") + Column("b") < 10) + t.check(Column("a") + Column("b") < 10) // CHECK (a + b < 10) t.check(sql: "a + b < 10") @@ -4934,18 +4934,18 @@ class Place: Record {

          All requests start from a type that adopts the TableRecord protocol, such as a Record subclass (see Records):

          -
          class Player : Record { ... }
          +
          class Player : Record { ... }
           

          Declare the table columns that you want to use for filtering, or sorting:

          -
          let idColumn = Column("id")
          -let nameColumn = Column("name")
          +
          let idColumn = Column("id")
          +let nameColumn = Column("name")
           

          You can also declare column enums, if you prefer:

          // Columns.id and Columns.name can be used just as
           // idColumn and nameColumn declared above.
          -enum Columns: String, ColumnExpression {
          +enum Columns: String, ColumnExpression {
               case id
               case name
           }
          @@ -4997,7 +4997,7 @@ class Place: Record {
           
        4. matching(pattern) performs full-text search.

          // SELECT * FROM document WHERE document MATCH 'sqlite database'
          -let pattern = FTS3Pattern(matchingAllTokensIn: "SQLite database")
          +let pattern = FTS3Pattern(matchingAllTokensIn: "SQLite database")
           Document.matching(pattern)
           
          @@ -5102,19 +5102,19 @@ class Place: Record {

          The selection can be changed for each individual requests, or for all requests built from a given type.

          The select(...) and select(..., as:) methods change the selection of a single request (see Fetching from Requests for detailed information):

          -
          let request = Player.select(max(Column("score")))
          +
          let request = Player.select(max(Column("score")))
           let maxScore: Int? = try Int.fetchOne(db, request)
           

          The default selection for a record type is controlled by the databaseSelection property:

          -
          struct RestrictedPlayer : TableRecord {
          +
          struct RestrictedPlayer : TableRecord {
               static let databaseTableName = "player"
          -    static let databaseSelection: [SQLSelectable] = [Column("id"), Column("name")]
          +    static let databaseSelection: [SQLSelectable] = [Column("id"), Column("name")]
           }
           
          -struct ExtendedPlayer : TableRecord {
          +struct ExtendedPlayer : TableRecord {
               static let databaseTableName = "player"
          -    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
          +    static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID]
           }
           
           // SELECT id, name FROM player
          @@ -5225,7 +5225,7 @@ class Place: Record {
           

          The full-text MATCH operator is available through FTS3Pattern (for FTS3 and FTS4 tables) and FTS5Pattern (for FTS5):

          FTS3 and FTS4:

          -
          let pattern = FTS3Pattern(matchingAllTokensIn: "SQLite database")
          +
          let pattern = FTS3Pattern(matchingAllTokensIn: "SQLite database")
           
           // SELECT * FROM document WHERE document MATCH 'sqlite database'
           Document.matching(pattern)
          @@ -5235,7 +5235,7 @@ class Place: Record {
           

          FTS5:

          -
          let pattern = FTS5Pattern(matchingAllTokensIn: "SQLite database")
          +
          let pattern = FTS5Pattern(matchingAllTokensIn: "SQLite database")
           
           // SELECT * FROM document WHERE document MATCH 'sqlite database'
           Document.matching(pattern)
          @@ -5287,7 +5287,7 @@ class Place: Record {
           
        5. Custom SQL functions and aggregates

          You can apply your own custom SQL functions and aggregates:

          -
          let f = DatabaseFunction("f", ...)
          +
          let f = DatabaseFunction("f", ...)
           
           // SELECT f(name) FROM player
           Player.select(f.apply(nameColumn))
          @@ -5330,7 +5330,7 @@ class Place: Record {
           
           
          • With asRequest(of:), useful when you use Associations:

            -
            struct BookInfo: FetchableRecord, Decodable {
            +
            struct BookInfo: FetchableRecord, Decodable {
                 var book: Book
                 var author: Author
             }
            @@ -5340,7 +5340,7 @@ class Place: Record {
                 .including(required: Book.author)
                 .asRequest(of: BookInfo.self)
             
            -let bookInfos = try dbQueue.read { db in
            +let bookInfos = try dbQueue.read { db in
                 try request.fetchAll(db) // [BookInfo]
             }
             
          • @@ -5348,7 +5348,7 @@ class Place: Record {
            // A request of Int
             let request = Player.select(max(scoreColumn), as: Int.self)
             
            -let maxScore = try dbQueue.read { db in
            +let maxScore = try dbQueue.read { db in
                 try request.fetchOne(db) // Int?
             }
             
            @@ -5501,7 +5501,7 @@ class Place: Record {

            FetchRequest Protocol

            FetchRequest is the protocol for all requests that run from a single select statement, and know how fetched rows should be interpreted:

            -
            protocol FetchRequest: DatabaseRegionConvertible {
            +
            protocol FetchRequest: DatabaseRegionConvertible {
                 /// The type that tells how fetched rows should be decoded
                 associatedtype RowDecoder
             
            @@ -5532,7 +5532,7 @@ class Place: Record {
             
             
            • SQLRequest is a fetch request built from raw SQL. For example:

              -
              extension Player {
              +
              extension Player {
                   static func filter(color: Color) -> SQLRequest<Player> {
                       return SQLRequest<Player>(
                           sql: "SELECT * FROM player WHERE color = ?"
              @@ -5546,14 +5546,14 @@ class Place: Record {
               
               

              In Swift 5, you can build SQLRequest with SQL Interpolation:

              // Swift 5
              -extension Player {
              +extension Player {
                   static func filter(color: Color) -> SQLRequest<Player> {
                       return "SELECT * FROM player WHERE color = \(color)"
                   }
               }
               
            • The asRequest(of:) method changes the type fetched by the request. It is useful, for example, when you use Associations:

              -
              struct BookInfo: FetchableRecord, Decodable {
              +
              struct BookInfo: FetchableRecord, Decodable {
                   var book: Book
                   var author: Author
               }
              @@ -5598,7 +5598,7 @@ class Place: Record {
               

              Migrations run in order, once and only once. When a user upgrades your application, only non-applied migrations are run.

              Inside each migration, you typically define and update your database tables according to your evolving application needs:

              -
              var migrator = DatabaseMigrator()
              +
              var migrator = DatabaseMigrator()
               
               // 1st migration
               migrator.registerMigration("v1") { db in
              @@ -5647,7 +5647,7 @@ class Place: Record {
               

              The eraseDatabaseOnSchemaChange Option

              A DatabaseMigrator can automatically wipe out the full database content, and recreate the whole database from scratch, if it detects that a migration has changed its definition:

              -
              var migrator = DatabaseMigrator()
              +
              var migrator = DatabaseMigrator()
               migrator.eraseDatabaseOnSchemaChange = true
               
              @@ -5659,7 +5659,7 @@ class Place: Record {
            • During application development, as you are still designing migrations, and the schema changes often.

              In this case, it is recommended that this flag does not ship in the distributed application:

              -
              var migrator = DatabaseMigrator()
              +
              var migrator = DatabaseMigrator()
               #if DEBUG
               // Speed up development by nuking the database when migrations change
               migrator.eraseDatabaseOnSchemaChange = true
              @@ -5691,20 +5691,20 @@ class Place: Record {
               
               

              Full-Text Search is an efficient way to search a corpus of textual documents.

              // Create full-text tables
              -try db.create(virtualTable: "book", using: FTS4()) { t in // or FTS3(), or FTS5()
              +try db.create(virtualTable: "book", using: FTS4()) { t in // or FTS3(), or FTS5()
                   t.column("author")
                   t.column("title")
                   t.column("body")
               }
               
               // Populate full-text table with records or SQL
              -try Book(...).insert(db)
              +try Book(...).insert(db)
               try db.execute(
                   sql: "INSERT INTO book (author, title, body) VALUES (?, ?, ?)",
                   arguments: [...])
               
               // Build search patterns
              -let pattern = FTS3Pattern(matchingPhrase: "Moby-Dick")
              +let pattern = FTS3Pattern(matchingPhrase: "Moby-Dick")
               
               // Search with the query interface or SQL
               let books = try Book.matching(pattern).fetchAll(db)
              @@ -5892,12 +5892,12 @@ class Place: Record {
               
               

              Create tables with the create(virtualTable:using:) method:

              // CREATE VIRTUAL TABLE document USING fts3(content)
              -try db.create(virtualTable: "document", using: FTS3()) { t in
              +try db.create(virtualTable: "document", using: FTS3()) { t in
                   t.column("content")
               }
               
               // CREATE VIRTUAL TABLE document USING fts4(content)
              -try db.create(virtualTable: "document", using: FTS4()) { t in
              +try db.create(virtualTable: "document", using: FTS4()) { t in
                   t.column("content")
               }
               
              @@ -5911,7 +5911,7 @@ class Place: Record { // title, // body // ) -try db.create(virtualTable: "book", using: FTS4()) { t in +try db.create(virtualTable: "book", using: FTS4()) { t in t.tokenizer = .porter t.column("author") t.column("title") @@ -5930,7 +5930,7 @@ class Place: Record { // notindexed=uuid, // languageid=lid // ) -try db.create(virtualTable: "document", using: FTS4()) { t in +try db.create(virtualTable: "document", using: FTS4()) { t in t.content = "" t.compress = "zip" t.uncompress = "unzip" @@ -5949,7 +5949,7 @@ class Place: Record {

              A tokenizer defines what matching means. Depending on the tokenizer you choose, full-text searches won’t return the same results.

              SQLite ships with three built-in FTS3/4 tokenizers: simple, porter and unicode61 that use different algorithms to match queries with indexed content:

              -
              try db.create(virtualTable: "book", using: FTS4()) { t in
              +
              try db.create(virtualTable: "book", using: FTS4()) { t in
                   // Pick one:
                   t.tokenizer = .simple // default
                   t.tokenizer = .porter
              @@ -6023,7 +6023,7 @@ class Place: Record {
               
               
              • simple

                -
                try db.create(virtualTable: "book", using: FTS4()) { t in
                +
                try db.create(virtualTable: "book", using: FTS4()) { t in
                     t.tokenizer = .simple   // default
                 }
                 
                @@ -6034,7 +6034,7 @@ class Place: Record {

                It does not strip diacritics from latin script characters, and won’t match jérôme with jerome.

              • porter

                -
                try db.create(virtualTable: "book", using: FTS4()) { t in
                +
                try db.create(virtualTable: "book", using: FTS4()) { t in
                     t.tokenizer = .porter
                 }
                 
                @@ -6043,7 +6043,7 @@ class Place: Record {

                It does not strip diacritics from latin script characters, and won’t match jérôme with jerome.

              • unicode61

                -
                try db.create(virtualTable: "book", using: FTS4()) { t in
                +
                try db.create(virtualTable: "book", using: FTS4()) { t in
                     t.tokenizer = .unicode61()
                     t.tokenizer = .unicode61(diacritics: .keep)
                 }
                @@ -6072,7 +6072,7 @@ class Place: Record {
                 

                Not all search patterns are valid: they must follow the Full-Text Index Queries Grammar.

                The FTS3Pattern type helps you validating patterns, and building valid patterns from untrusted strings (such as strings typed by users):

                -
                struct FTS3Pattern {
                +
                struct FTS3Pattern {
                     init(rawPattern: String) throws
                     init?(matchingAnyTokenIn string: String)
                     init?(matchingAllTokensIn string: String)
                @@ -6082,24 +6082,24 @@ class Place: Record {
                 
                 

                The first initializer validates your raw patterns against the query grammar, and may throw a DatabaseError:

                // OK: FTS3Pattern
                -let pattern = try FTS3Pattern(rawPattern: "sqlite AND database")
                +let pattern = try FTS3Pattern(rawPattern: "sqlite AND database")
                 // DatabaseError: malformed MATCH expression: [AND]
                -let pattern = try FTS3Pattern(rawPattern: "AND")
                +let pattern = try FTS3Pattern(rawPattern: "AND")
                 

                The three other initializers don’t throw. They build a valid pattern from any string, including strings provided by users of your application. They let you find documents that match all given words, any given word, or a full phrase, depending on the needs of your application:

                let query = "SQLite database"
                 // Matches documents that contain "SQLite" or "database"
                -let pattern = FTS3Pattern(matchingAnyTokenIn: query)
                +let pattern = FTS3Pattern(matchingAnyTokenIn: query)
                 // Matches documents that contain both "SQLite" and "database"
                -let pattern = FTS3Pattern(matchingAllTokensIn: query)
                +let pattern = FTS3Pattern(matchingAllTokensIn: query)
                 // Matches documents that contain "SQLite database"
                -let pattern = FTS3Pattern(matchingPhrase: query)
                +let pattern = FTS3Pattern(matchingPhrase: query)
                 

                They return nil when no pattern could be built from the input string:

                -
                let pattern = FTS3Pattern(matchingAnyTokenIn: "")  // nil
                -let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
                +
                let pattern = FTS3Pattern(matchingAnyTokenIn: "")  // nil
                +let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
                 

                FTS3Pattern are regular values. You can use them as query arguments:

                @@ -6113,7 +6113,7 @@ class Place: Record { let documents = try Document.matching(pattern).fetchAll(db) // Search in a specific column: -let documents = try Document.filter(Column("content").match(pattern)).fetchAll(db) +let documents = try Document.filter(Column("content").match(pattern)).fetchAll(db)

                Enabling FTS5 Support

                @@ -6153,7 +6153,7 @@ class Place: Record {

                Create FTS5 tables with the create(virtualTable:using:) method:

                // CREATE VIRTUAL TABLE document USING fts5(content)
                -try db.create(virtualTable: "document", using: FTS5()) { t in
                +try db.create(virtualTable: "document", using: FTS5()) { t in
                     t.column("content")
                 }
                 
                @@ -6167,7 +6167,7 @@ class Place: Record { // title, // body // ) -try db.create(virtualTable: "book", using: FTS5()) { t in +try db.create(virtualTable: "book", using: FTS5()) { t in t.tokenizer = .porter() t.column("author") t.column("title") @@ -6185,7 +6185,7 @@ class Place: Record { // columnsize=0, // detail=column // ) -try db.create(virtualTable: "document", using: FTS5()) { t in +try db.create(virtualTable: "document", using: FTS5()) { t in t.column("content") t.column("uuid").notIndexed() t.content = "table" @@ -6204,7 +6204,7 @@ class Place: Record {

                A tokenizer defines what matching means. Depending on the tokenizer you choose, full-text searches won’t return the same results.

                SQLite ships with three built-in FTS5 tokenizers: ascii, porter and unicode61 that use different algorithms to match queries with indexed content.

                -
                try db.create(virtualTable: "book", using: FTS5()) { t in
                +
                try db.create(virtualTable: "book", using: FTS5()) { t in
                     // Pick one:
                     t.tokenizer = .unicode61() // default
                     t.tokenizer = .unicode61(...)
                @@ -6287,7 +6287,7 @@ class Place: Record {
                 
                 
                • unicode61

                  -
                  try db.create(virtualTable: "book", using: FTS5()) { t in
                  +
                  try db.create(virtualTable: "book", using: FTS5()) { t in
                       t.tokenizer = .unicode61()
                       t.tokenizer = .unicode61(diacritics: .keep)
                   }
                  @@ -6299,7 +6299,7 @@ class Place: Record {
                   
                   

                  It does not provide stemming, and won’t match databases with database.

                • ascii

                  -
                  try db.create(virtualTable: "book", using: FTS5()) { t in
                  +
                  try db.create(virtualTable: "book", using: FTS5()) { t in
                       t.tokenizer = .ascii
                   }
                   
                  @@ -6310,7 +6310,7 @@ class Place: Record {

                  It does not strip diacritics from latin script characters, and won’t match jérôme with jerome.

                • porter

                  -
                  try db.create(virtualTable: "book", using: FTS5()) { t in
                  +
                  try db.create(virtualTable: "book", using: FTS5()) { t in
                       t.tokenizer = .porter()       // porter wrapping unicode61 (the default)
                       t.tokenizer = .porter(.ascii) // porter wrapping ascii
                       t.tokenizer = .porter(.unicode61(diacritics: .keep)) // porter wrapping unicode61 without diacritics stripping
                  @@ -6338,11 +6338,11 @@ class Place: Record {
                   

                  Not all search patterns are valid: they must follow the Full-Text Query Syntax.

                  The FTS5Pattern type helps you validating patterns, and building valid patterns from untrusted strings (such as strings typed by users):

                  -
                  extension Database {
                  +
                  extension Database {
                       func makeFTS5Pattern(rawPattern: String, forTable table: String) throws -> FTS5Pattern
                   }
                   
                  -struct FTS5Pattern {
                  +struct FTS5Pattern {
                       init?(matchingAnyTokenIn string: String)
                       init?(matchingAllTokensIn string: String)
                       init?(matchingPhrase string: String)
                  @@ -6361,18 +6361,18 @@ class Place: Record {
                   

                  The FTS5Pattern initializers don’t throw. They build a valid pattern from any string, including strings provided by users of your application. They let you find documents that match all given words, any given word, or a full phrase, depending on the needs of your application:

                  let query = "SQLite database"
                   // Matches documents that contain "SQLite" or "database"
                  -let pattern = FTS5Pattern(matchingAnyTokenIn: query)
                  +let pattern = FTS5Pattern(matchingAnyTokenIn: query)
                   // Matches documents that contain both "SQLite" and "database"
                  -let pattern = FTS5Pattern(matchingAllTokensIn: query)
                  +let pattern = FTS5Pattern(matchingAllTokensIn: query)
                   // Matches documents that contain "SQLite database"
                  -let pattern = FTS5Pattern(matchingPhrase: query)
                  +let pattern = FTS5Pattern(matchingPhrase: query)
                   // Matches documents that start with "SQLite database"
                  -let pattern = FTS5Pattern(matchingPrefixPhrase: query)
                  +let pattern = FTS5Pattern(matchingPrefixPhrase: query)
                   

                  They return nil when no pattern could be built from the input string:

                  -
                  let pattern = FTS5Pattern(matchingAnyTokenIn: "")  // nil
                  -let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
                  +
                  let pattern = FTS5Pattern(matchingAnyTokenIn: "")  // nil
                  +let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
                   

                  FTS5Pattern are regular values. You can use them as query arguments:

                  @@ -6415,7 +6415,7 @@ class Place: Record { } // A full-text table synchronized with the regular table -try db.create(virtualTable: "book_ft", using: FTS4()) { t in // or FTS5() +try db.create(virtualTable: "book_ft", using: FTS4()) { t in // or FTS5() t.synchronize(withTable: "book") t.column("author") t.column("title") @@ -6441,7 +6441,7 @@ class Place: Record { try db.create(table: "book") { t in ... } -try db.create(virtualTable: "book_ft", using: FTS4()) { t in +try db.create(virtualTable: "book_ft", using: FTS4()) { t in t.synchronize(withTable: "book") ... } @@ -6560,7 +6560,7 @@ class Place: Record {

                  To split rows, we will use row adapters. Row adapters adapt rows so that row consumers see exactly the columns they want. Among other things, row adapters can define several row scopes that give access to as many row slices. Sounds like a perfect match.

                  At the very beginning, there is an SQL query:

                  -
                  try dbQueue.read { db in
                  +
                  try dbQueue.read { db in
                       let sql = """
                           SELECT player.*, team.*, MAX(round.score) AS maxScore
                           FROM player
                  @@ -6574,20 +6574,20 @@ class Place: Record {
                   
                      // SELECT player.*, team.*, ...
                       //        <------>
                       let playerWidth = try db.columns(in: "player").count
                  -    let playerAdapter = RangeRowAdapter(0 ..< playerWidth)
                  +    let playerAdapter = RangeRowAdapter(0 ..< playerWidth)
                   

                  We also need an adapter that extracts team columns:

                      // SELECT player.*, team.*, ...
                       //                  <---->
                       let teamWidth = try db.columns(in: "team").count
                  -    let teamAdapter = RangeRowAdapter(playerWidth ..< (playerWidth + teamWidth))
                  +    let teamAdapter = RangeRowAdapter(playerWidth ..< (playerWidth + teamWidth))
                   

                  We merge those two adapters in a single ScopeAdapter that will allow us to access both sliced rows:

                      let playerScope = "player"
                       let teamScope = "team"
                  -    let adapter = ScopeAdapter([
                  +    let adapter = ScopeAdapter([
                           playerScope: playerAdapter,
                           teamScope: teamAdapter])
                   
                  @@ -6637,15 +6637,15 @@ class Place: Record {

        To address the first bullet, let’s define a record that holds our player, optional team, and maximum score. Since it can decode database rows, it adopts the FetchableRecord protocol:

        -
        struct PlayerInfo {
        +
        struct PlayerInfo {
             var player: Player
             var team: Team?
             var maxScore: Int
         }
         
         /// PlayerInfo can decode rows:
        -extension PlayerInfo: FetchableRecord {
        -    private enum Scopes {
        +extension PlayerInfo: FetchableRecord {
        +    private enum Scopes {
                 static let player = "player"
                 static let team = "team"
             }
        @@ -6659,7 +6659,7 @@ class Place: Record {
         

        Let’s now write the method that fetches PlayerInfo records:

        -
        extension PlayerInfo {
        +
        extension PlayerInfo {
             static func fetchAll(_ db: Database) throws -> [PlayerInfo] {
         
        @@ -6699,7 +6699,7 @@ class Place: Record { Player.numberOfSelectedColumns(db), Team.numberOfSelectedColumns(db)]) - let adapter = ScopeAdapter([ + let adapter = ScopeAdapter([ Scopes.player: adapters[0], Scopes.team: adapters[1]])
        @@ -6716,7 +6716,7 @@ class Place: Record {

        And when your app needs to fetch player infos, it now reads:

        // Fetch player infos
        -let playerInfos = try dbQueue.read { db in
        +let playerInfos = try dbQueue.read { db in
             try PlayerInfo.fetchAll(db)
         }
         
        @@ -6736,15 +6736,15 @@ class Place: Record {

        The PlayerInfo.fetchAll method above directly fetches records. It’s all good, but in order to profit from database observation, you’ll need a custom request that defines a database query.

        It is recommended that you read the previous paragraphs before you dive in this sample code. We start with the same PlayerInfo record as above:

        -
        struct PlayerInfo {
        +
        struct PlayerInfo {
             var player: Player
             var team: Team?
             var maxScore: Int
         }
         
         /// PlayerInfo can decode rows:
        -extension PlayerInfo: FetchableRecord {
        -    private enum Scopes {
        +extension PlayerInfo: FetchableRecord {
        +    private enum Scopes {
                 static let player = "player"
                 static let team = "team"
             }
        @@ -6758,7 +6758,7 @@ class Place: Record {
         

        Now we write a method that returns a request, and build the fetching method on top of that request:

        -
        extension PlayerInfo {
        +
        extension PlayerInfo {
             /// The request for all player infos
             static func all() -> AdaptedFetchRequest<SQLRequest<PlayerInfo>> {
                 let sql = """
        @@ -6771,11 +6771,11 @@ class Place: Record {
                     LEFT JOIN round ON ...
                     GROUP BY ...
                     """
        -        return SQLRequest<PlayerInfo>(sql: sql).adapted { db in
        +        return SQLRequest<PlayerInfo>(sql: sql).adapted { db in
                     let adapters = try splittingRowAdapters(columnCounts: [
                         Player.numberOfSelectedColumns(db),
                         Team.numberOfSelectedColumns(db)])
        -            return ScopeAdapter([
        +            return ScopeAdapter([
                         Scopes.player: adapters[0],
                         Scopes.team: adapters[1]])
                 }
        @@ -6790,7 +6790,7 @@ class Place: Record {
         
         

        It is now time to use our request:

        // Fetch player infos
        -let playerInfos = try dbQueue.read { db in
        +let playerInfos = try dbQueue.read { db in
             try PlayerInfo.fetchAll(db)
         }
         
        @@ -6810,22 +6810,22 @@ class Place: Record {
         

        Codable Records build on top of the standard Decodable protocol in order to decode database rows.

        You can consume complex joined queries with Codable records as well. As a demonstration, we’ll rewrite the above sample code:

        -
        struct Player: Decodable, FetchableRecord, TableRecord {
        +
        struct Player: Decodable, FetchableRecord, TableRecord {
             var id: Int64
             var name: String
         }
        -struct Team: Decodable, FetchableRecord, TableRecord {
        +struct Team: Decodable, FetchableRecord, TableRecord {
             var id: Int64
             var name: String
             var color: Color
         }
        -struct PlayerInfo: Decodable, FetchableRecord {
        +struct PlayerInfo: Decodable, FetchableRecord {
             var player: Player
             var team: Team?
             var maxScore: Int
         }
         
        -extension PlayerInfo {
        +extension PlayerInfo {
             /// The request for all player infos
             static func all() -> AdaptedFetchRequest<SQLRequest<PlayerInfo>> {
                 let sql = """
        @@ -6838,11 +6838,11 @@ class Place: Record {
                     LEFT JOIN round ON ...
                     GROUP BY ...
                     """
        -        return SQLRequest<PlayerInfo>(sql: sql).adapted { db in
        +        return SQLRequest<PlayerInfo>(sql: sql).adapted { db in
                     let adapters = try splittingRowAdapters(columnCounts: [
                         Player.numberOfSelectedColumns(db),
                         Team.numberOfSelectedColumns(db)])
        -            return ScopeAdapter([
        +            return ScopeAdapter([
                         CodingKeys.player.stringValue: adapters[0],
                         CodingKeys.team.stringValue: adapters[1]])
                 }
        @@ -6855,7 +6855,7 @@ class Place: Record {
         }
         
         // Fetch player infos
        -let playerInfos = try dbQueue.read { db in
        +let playerInfos = try dbQueue.read { db in
             try PlayerInfo.fetchAll(db)
         }
         
        @@ -6891,8 +6891,8 @@ class Place: Record {
         

        When your application needs to make sure a specific database transaction has been successfully committed before it executes some work, use the Database.afterNextTransactionCommit(_:) method.

        Its closure argument is called right after database changes have been successfully written to disk:

        -
        try dbQueue.write { db in
        -    db.afterNextTransactionCommit { db in
        +
        try dbQueue.write { db in
        +    db.afterNextTransactionCommit { db in
                 print("success")
             }
             ...
        @@ -6906,18 +6906,18 @@ class Place: Record {
         

        In the example below, a location manager starts monitoring a CLRegion if and only if it has successfully been stored in the database:

        /// Inserts a region in the database, and start monitoring upon
         /// successful insertion.
        -func startMonitoring(_ db: Database, region: CLRegion) throws {
        +func startMonitoring(_ db: Database, region: CLRegion) throws {
             // Make sure database is inside a transaction
        -    try db.inSavepoint {
        +    try db.inSavepoint {
         
                 // Save the region in the database
                 try insert(...)
         
                 // Start monitoring if and only if the insertion is
                 // eventually committed
        -        db.afterNextTransactionCommit { _ in
        +        db.afterNextTransactionCommit { _ in
                     // locationManager prefers the main queue:
        -            DispatchQueue.main.async {
        +            DispatchQueue.main.async {
                         locationManager.startMonitoring(for: region)
                     }
                 }
        @@ -6928,7 +6928,7 @@ class Place: Record {
         

        The method above won’t trigger the location manager if the transaction is eventually rollbacked (explicitly, or because of an error), as in the sample code below:

        -
        try dbQueue.write { db in
        +
        try dbQueue.write { db in
             // success
             try startMonitoring(db, region)
         
        @@ -6945,7 +6945,7 @@ class Place: Record {
         

        ValueObservation notifies your application with fresh values (this is what most applications need :+1:):

        -
        let observation = ValueObservation.tracking { db in
        +
        let observation = ValueObservation.tracking { db in
             try request.fetchAll(db)
         }
         let observer = observation.start(
        @@ -6954,24 +6954,24 @@ class Place: Record {
                 print("fresh players could not be fetched")
             },
             onChange: { (players: [Player]) in
        -        let names = players.map { $0.name }.joined(separator: ", ")
        +        let names = players.map { $0.name }.joined(separator: ", ")
                 print("Fresh players: \(names)")
             })
         
        -try dbQueue.write { db in
        -    try Player(name: "Arthur").insert(db)
        +try dbQueue.write { db in
        +    try Player(name: "Arthur").insert(db)
         }
         // Prints "Fresh players: Arthur, ..."
         

        DatabaseRegionObservation notifies your application with database connections, right after an impactful database transaction has been committed (reserved for more advanced use cases :nerd_face:):

        -
        let observation = DatabaseRegionObservation(tracking: request)
        +
        let observation = DatabaseRegionObservation(tracking: request)
         let observer = try observation.start(in: dbQueue) { (db: Database) in
             print("Players have changed.")
         }
         
        -try dbQueue.write { db in
        -    try Player(name: "Barbara").insert(db)
        +try dbQueue.write { db in
        +    try Player(name: "Barbara").insert(db)
         }
         // Prints "Players have changed."
         
        @@ -6999,7 +6999,7 @@ class Place: Record {

        ValueObservation Usage

        Here is a typical UIViewController which observes the database in order to keep its view up-to-date:

        -
        class PlayerViewController: UIViewController {
        +
        class PlayerViewController: UIViewController {
             @IBOutlet weak var nameLabel: UILabel!
             private var observer: TransactionObserver?
         
        @@ -7007,7 +7007,7 @@ class Place: Record {
                 super.viewWillAppear(animated)
         
                 // Define a ValueObservation which tracks a player
        -        let observation = ValueObservation.tracking { db in
        +        let observation = ValueObservation.tracking { db in
                     try Player.fetchOne(db, key: 42)
                 }
         
        @@ -7019,7 +7019,7 @@ class Place: Record {
                     },
                     onChange: { [weak self] (player: Player?) in
                         // Player has been refreshed: update view
        -                guard let self = self else { return }
        +                guard let self = self else { return }
                         self.nameLabel.text = player?.name
                     })
             }
        @@ -7047,7 +7047,7 @@ class Place: Record {
             super.viewWillAppear(animated)
         
             // Define a ValueObservation which tracks a player
        -    let observation = ValueObservation.tracking { db in
        +    let observation = ValueObservation.tracking { db in
                 try Player.fetchOne(db, key: 42)
             }
         
        @@ -7062,7 +7062,7 @@ class Place: Record {
                 },
                 onChange: { [weak self] (player: Player?) in
                     // Player has been refreshed: update view
        -            guard let self = self else { return }
        +            guard let self = self else { return }
                     self.activityIndicator.stopAnimating()
                     self.nameLabel.text = player?.name
                 })
        @@ -7081,7 +7081,7 @@ class Place: Record {
         
         

        For example:

        // Track changes in a single player
        -let observation = ValueObservation.tracking { db in
        +let observation = ValueObservation.tracking { db in
             try Player.fetchOne(db, key: 42)
         }
         
        @@ -7098,15 +7098,15 @@ class Place: Record {
         

        It may happen that such an observation notifies identical consecutive values. This is because it will fetch a fresh value whenever a change could happen. For example, the observation for the maximum player score will notify a fresh value everytime a score is changed, inserted, or deleted, even if the maximum score is unchanged:

        // Track changes in the maximum player score
         // This observation may notify duplicate values
        -let observation = ValueObservation.tracking { db in
        -    try Player.select(max(Column("score")), as: Int.self).fetchOne(db)
        +let observation = ValueObservation.tracking { db in
        +    try Player.select(max(Column("score")), as: Int.self).fetchOne(db)
         }
         

        You can filter out those duplicates with the ValueObservation.removeDuplicates method. It requires the observed value to adopt the Equatable protocol:

        let observation = ValueObservation
        -    .tracking { db in
        -        try Player.select(max(Column("score")), as: Int.self).fetchOne(db)
        +    .tracking { db in
        +        try Player.select(max(Column("score")), as: Int.self).fetchOne(db)
             }
             .removeDuplicates()
         
        @@ -7128,20 +7128,20 @@ class Place: Record {

        Changes that happen outside of the observed requests are ignored, so make sure you fully cover the database region you want to observe. This is the price you pay for the optimization.

        Let’s give a practical example, and observe the Hall of Fame:

        -
        struct HallOfFame {
        +
        struct HallOfFame {
             var totalPlayerCount: Int
             var bestPlayers: [Player]
         }
         
        -extension HallOfFame {
        +extension HallOfFame {
             /// Fetch the HallOfFame
        -    static fetch(_ db: Database) throws -> HallOfFame {
        +    static fetch(_ db: Database) throws -> HallOfFame {
                 let totalPlayerCount = try Player.fetchCount(db)
                 let bestPlayers = try Player
        -            .order(Column("score").desc)
        +            .order(Column("score").desc)
                     .limit(10)
                     .fetchAll(db)
        -        return HallOfFame(
        +        return HallOfFame(
                     totalPlayerCount: totalPlayerCount,
                     bestPlayers: bestPlayers)
             }
        @@ -7166,9 +7166,9 @@ class Place: Record {
         

        Those observations are equivalent to the following ones, defined with ValueObservation.tracking(value:):

        -
        ValueObservation.tracking { db in try request.fetchCount(db) }
        -ValueObservation.tracking { db in try request.fetchAll(db) }
        -ValueObservation.tracking { db in try request.fetchOne(db) }
        +
        ValueObservation.tracking { db in try request.fetchCount(db) }
        +ValueObservation.tracking { db in try request.fetchAll(db) }
        +ValueObservation.tracking { db in try request.fetchOne(db) }
         

        Yet they are optimized:

        @@ -7192,8 +7192,8 @@ class Place: Record {

        For example:

        // Observe a player's profile image
         let observation = ValueObservation
        -    .tracking { db in try Player.fetchOne(db, key: 42) }
        -    .map { player in player?.image }
        +    .tracking { db in try Player.fetchOne(db, key: 42) }
        +    .map { player in player?.image }
         
         let observer = observation.start(
             in: dbQueue,
        @@ -7211,8 +7211,8 @@ class Place: Record {
         

        For example:

        // Observe a player
         let observation = ValueObservation
        -    .tracking { db in try Player.fetchOne(db, key: 42) }
        -    .compactMap { $0 }
        +    .tracking { db in try Player.fetchOne(db, key: 42) }
        +    .compactMap { $0 }
         
         let observer = observation.start(
             in: dbQueue,
        @@ -7229,7 +7229,7 @@ class Place: Record {
         
         

        For example:

        let observation = ValueObservation
        -    .tracking { db in try Player.fetchOne(db, key: 42) }
        +    .tracking { db in try Player.fetchOne(db, key: 42) }
             .removeDuplicates()
         
         let observer = observation.start(
        @@ -7247,13 +7247,13 @@ class Place: Record {
         
         

        The ValueObservation.combine(...) method builds a single observation from several:

        // Two base observations
        -let playerCountObservation = ValueObservation.tracking { db in
        +let playerCountObservation = ValueObservation.tracking { db in
             try Player.fetchCount(db)
         }
        -let bestPlayersObservation = ValueObservation.tracking { db in
        +let bestPlayersObservation = ValueObservation.tracking { db in
             try Player
                 .limit(10)
        -        .order(Column("score").desc)
        +        .order(Column("score").desc)
                 .fetchAll(db)
         }
         
        @@ -7275,13 +7275,13 @@ class Place: Record {
         

        combine also exists as an instance method:

        -
        struct HallOfFame {
        +
        struct HallOfFame {
             var totalPlayerCount: Int
             var bestPlayers: [Player]
         }
         
         let observation = playerCountObservation.combine(bestPlayersObservation) {
        -    HallOfFame(totalPlayerCount: $0, bestPlayers: $1)
        +    HallOfFame(totalPlayerCount: $0, bestPlayers: $1)
         }
         
        @@ -7354,7 +7354,7 @@ class Place: Record {

        After the initial value has been notified, all subsequent values are notified asynchronously:

        -
        try dbQueue.write { db in ... }
        +
        try dbQueue.write { db in ... }
         // <- Eventually prints "fresh value" on the main queue
         
      8. .async(onQueue:startImmediately:): all values are asychronously notified on the specified queue.

        @@ -7398,7 +7398,7 @@ class Place: Record {

        ValueObservation.requiresWriteAccess

        The requiresWriteAccess property is false by default. When true, a ValueObservation has a write access to the database, and its fetches are automatically wrapped in a savepoint:

        -
        var observation = ValueObservation.tracking { db in
        +
        var observation = ValueObservation.tracking { db in
             // write access allowed
             ...
         }
        @@ -7409,7 +7409,7 @@ class Place: Record {
         

        Advanced: ValueObservation.tracking(_:reducer:)

        The most low-level way to define a ValueObservation is to create one from an observed database region (see above), and a reducer that adopts the ValueReducer protocol (:fire: EXPERIMENTAL):

        -
        protocol ValueReducer {
        +
        protocol ValueReducer {
             associatedtype Fetched
             associatedtype Value
         
        @@ -7427,10 +7427,10 @@ class Place: Record {
         
         

        The sample code below counts the number of times the player table is modified:

        var count = 0
        -let reducer = AnyValueReducer(
        +let reducer = AnyValueReducer(
             fetch: { _ in /* don't fetch anything */ },
             value: { _ -> Int? in
        -        defer { count += 1 }
        +        defer { count += 1 }
                 return count })
         let observation = ValueObservation.tracking(Player.all(), reducer: { _ in reducer })
         let observer = observation.start(
        @@ -7441,8 +7441,8 @@ class Place: Record {
             })
         // Prints "Number of transactions that have modified players: 0"
         
        -try dbQueue.write { db in
        -    try Player(...).insert(db)
        +try dbQueue.write { db in
        +    try Player(...).insert(db)
         }
         // Prints "Number of transactions that have modified players: 1"
         
        @@ -7457,7 +7457,7 @@ class Place: Record {

        Define an observation by providing one or several requests to track:

        // Track all players
        -let observation = DatabaseRegionObservation(tracking: Player.all())
        +let observation = DatabaseRegionObservation(tracking: Player.all())
         

        Then start the observation from a database queue or pool:

        @@ -7467,8 +7467,8 @@ class Place: Record {

        And enjoy the changes notifications:

        -
        try dbQueue.write { db in
        -    try Player(name: "Arthur").insert(db)
        +
        try dbQueue.write { db in
        +    try Player(name: "Arthur").insert(db)
         }
         // Prints "Players were changed"
         
        @@ -7477,7 +7477,7 @@ class Place: Record {

        You can also feed DatabaseRegionObservation with DatabaseRegion, or any type which conforms to the DatabaseRegionConvertible protocol. For example:

        // Observe the full database
        -let observation = DatabaseRegionObservation(tracking: DatabaseRegion.fullDatabase)
        +let observation = DatabaseRegionObservation(tracking: DatabaseRegion.fullDatabase)
         let observer = try observation.start(in: dbQueue) { (db: Database) in
             print("Database was changed")
         }
        @@ -7550,13 +7550,13 @@ class Place: Record {
         
      9. The type of the fetched records. It must be a type that adopts the FetchableRecord protocol, such as a subclass of the Record class
      10. A fetch request
      11. -
        class Player : Record { ... }
        -let dbQueue = DatabaseQueue(...)    // or DatabasePool
        +
        class Player : Record { ... }
        +let dbQueue = DatabaseQueue(...)    // or DatabasePool
         
         // Using a Request from the Query Interface:
        -let controller = FetchedRecordsController(
        +let controller = FetchedRecordsController(
             dbQueue,
        -    request: Player.order(Column("name")))
        +    request: Player.order(Column("name")))
         
         // Using SQL, and eventual arguments:
         let controller = FetchedRecordsController<Player>(
        @@ -7587,20 +7587,20 @@ the fetch.

        Changes are not reflected until they are applied in the database by a successful transaction:

        // One transaction
        -try dbQueue.write { db in         // or dbPool.write
        +try dbQueue.write { db in         // or dbPool.write
             try player1.insert(db)
             try player2.insert(db)
         }
         
         // One transaction
        -try dbQueue.inTransaction { db in // or dbPool.writeInTransaction
        +try dbQueue.inTransaction { db in // or dbPool.writeInTransaction
             try player1.insert(db)
             try player2.insert(db)
             return .commit
         }
         
         // Two transactions
        -try dbQueue.inDatabase { db in    // or dbPool.writeWithoutTransaction
        +try dbQueue.inDatabase { db in    // or dbPool.writeWithoutTransaction
             try player1.insert(db)
             try player2.insert(db)
         }
        @@ -7610,7 +7610,7 @@ the fetch.

        The Changes Notifications

        An instance of FetchedRecordsController notifies that the controller’s fetched records have been changed by the mean of callbacks:

        -
        let controller = try FetchedRecordsController(...)
        +
        let controller = try FetchedRecordsController(...)
         
         controller.trackChanges(
             // controller's records are about to change:
        @@ -7628,7 +7628,7 @@ the fetch.

        See Implementing Table View Updates for more detail on table view updates.

        All callbacks are optional. When you only need to grab the latest results, you can omit the didChange argument name:

        -
        controller.trackChanges { controller in
        +
        controller.trackChanges { controller in
             let newPlayers = controller.fetchedRecords // [Player]
         }
         
        @@ -7639,12 +7639,12 @@ the fetch.

        Callbacks have the fetched record controller itself as an argument: use it in order to avoid memory leaks:

        // BAD: memory leak
        -controller.trackChanges { _ in
        +controller.trackChanges { _ in
             let newPlayers = controller.fetchedRecords
         }
         
         // GOOD
        -controller.trackChanges { controller in
        +controller.trackChanges { controller in
             let newPlayers = controller.fetchedRecords
         }
         
        @@ -7667,14 +7667,14 @@ the fetch.

        Whenever the fetched records controller can not look for changes after a transaction has potentially modified the tracked request, an error handler is called. The request observation is not stopped, though: future transactions may successfully be handled, and the notified changes will then be based on the last successful fetch.

        -
        controller.trackErrors { (controller, error) in
        +
        controller.trackErrors { (controller, error) in
             print("Missed a transaction because \(error)")
         }
         

        Modifying the Fetch Request

        You can change a fetched records controller’s fetch request or SQL query.

        -
        controller.setRequest(Player.order(Column("name")))
        +
        controller.setRequest(Player.order(Column("name")))
         controller.setRequest(sql: "SELECT ...", arguments: ...)
         
        @@ -7686,7 +7686,7 @@ the fetch.

        Change callbacks are invoked asynchronously. This means that modifying the request from the main thread does not immediately triggers callbacks. When you need to take immediate action, force the controller to refresh immediately with its performFetch method. In this case, changes callbacks are not called:

        // Change request on the main thread:
        -controller.setRequest(Player.order(Column("name")))
        +controller.setRequest(Player.order(Column("name")))
         // Here callbacks have not been called yet.
         // You can cancel them, and refresh records immediately:
         try controller.performFetch()
        @@ -7696,14 +7696,14 @@ the fetch.

        FetchedRecordsController let you feed table and collection views, and keep them up-to-date with the database content.

        For nice animated updates, a fetched records controller needs to recognize identical records between two different result sets. When records adopt the TableRecord protocol, they are automatically compared according to their primary key:

        -
        class Player : TableRecord { ... }
        -let controller = FetchedRecordsController(
        +
        class Player : TableRecord { ... }
        +let controller = FetchedRecordsController(
             dbQueue,
             request: Player.all())
         

        For other types, the fetched records controller needs you to be more explicit:

        -
        let controller = FetchedRecordsController(
        +
        let controller = FetchedRecordsController(
             dbQueue,
             request: ...,
             isSameRecord: { (player1, player2) in player1.id == player2.id })
        @@ -7711,15 +7711,15 @@ the fetch.

        Implementing the Table View Datasource Methods

        The table view data source asks the fetched records controller to provide relevant information:

        -
        func numberOfSections(in tableView: UITableView) -> Int {
        +
        func numberOfSections(in tableView: UITableView) -> Int {
             return fetchedRecordsController.sections.count
         }
         
        -func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        +func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
             return fetchedRecordsController.sections[section].numberOfRecords
         }
         
        -func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        +func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
             let cell = ...
             let record = fetchedRecordsController.record(at: indexPath)
             // Configure the cell
        @@ -7733,7 +7733,7 @@ the fetch.

        Implementing Table View Updates

        When changes in the fetched records should reload the whole table view, you can simply tell so:

        -
        controller.trackChanges { [unowned self] _ in
        +
        controller.trackChanges { [unowned self] _ in
             self.tableView.reloadData()
         }
         
        @@ -7753,7 +7753,7 @@ the fetch.

        // notification of individual record changes: onChange: { [unowned self] (controller, record, change) in - switch change { + switch change { case .insertion(let indexPath): self.tableView.insertRows(at: [indexPath], with: .fade) @@ -7799,8 +7799,8 @@ the fetch.

        Change callbacks are invoked asynchronously. This means that changes made from the main thread are not immediately notified. When you need to take immediate action, force the controller to refresh immediately with its performFetch method. In this case, changes callbacks are not called:

        // Change database on the main thread:
        -try dbQueue.write { db in
        -    try Player(...).insert(db)
        +try dbQueue.write { db in
        +    try Player(...).insert(db)
         }
         // Here callbacks have not been called yet.
         // You can cancel them, and refresh records immediately:
        @@ -7809,10 +7809,10 @@ the fetch.

        :point_up: Note: when the main thread does not fit your needs, give a serial dispatch queue to the controller initializer: the controller must then be used from this queue, and record changes are notified on this queue as well.

        -
        let queue = DispatchQueue()
        -queue.async {
        -    let controller = try FetchedRecordsController(..., queue: queue)
        -    controller.trackChanges { /* in queue */ }
        +
        let queue = DispatchQueue()
        +queue.async {
        +    let controller = try FetchedRecordsController(..., queue: queue)
        +    controller.trackChanges { /* in queue */ }
             try controller.performFetch()
         }
         
        @@ -7820,7 +7820,7 @@ the fetch.

        TransactionObserver Protocol

        The TransactionObserver protocol lets you observe individual database changes and transactions:

        -
        protocol TransactionObserver : class {
        +
        protocol TransactionObserver : class {
             /// Notifies a database change:
             /// - event.kind (insert, update, or delete)
             /// - event.tableName
        @@ -7857,7 +7857,7 @@ the fetch.

        Activate a Transaction Observer

        To activate a transaction observer, add it to the database queue or pool:

        -
        let observer = MyObserver()
        +
        let observer = MyObserver()
         dbQueue.add(transactionObserver: observer)
         
        @@ -7871,32 +7871,32 @@ the fetch.

        Notified changes are not actually written to disk until the transaction commits, and the databaseDidCommit callback is called. On the other side, databaseDidRollback confirms their invalidation:

        -
        try dbQueue.write { db in
        +
        try dbQueue.write { db in
             try db.execute(sql: "INSERT ...") // 1. didChange
             try db.execute(sql: "UPDATE ...") // 2. didChange
         }                                     // 3. willCommit, 4. didCommit
         
        -try dbQueue.inTransaction { db in
        +try dbQueue.inTransaction { db in
             try db.execute(sql: "INSERT ...") // 1. didChange
             try db.execute(sql: "UPDATE ...") // 2. didChange
             return .rollback                  // 3. didRollback
         }
         
        -try dbQueue.write { db in
        +try dbQueue.write { db in
             try db.execute(sql: "INSERT ...") // 1. didChange
        -    throw SomeError()
        +    throw SomeError()
         }                                     // 2. didRollback
         

        Database statements that are executed outside of any transaction do not drop off the radar:

        -
        try dbQueue.inDatabase { db in
        +
        try dbQueue.inDatabase { db in
             try db.execute(sql: "INSERT ...") // 1. didChange, 2. willCommit, 3. didCommit
             try db.execute(sql: "UPDATE ...") // 4. didChange, 5. willCommit, 6. didCommit
         }
         

        Changes that are on hold because of a savepoint are only notified after the savepoint has been released. This makes sure that notified events are only events that have an opportunity to be committed:

        -
        try dbQueue.inTransaction { db in
        +
        try dbQueue.inTransaction { db in
             try db.execute(sql: "INSERT ...")            // 1. didChange
         
             try db.execute(sql: "SAVEPOINT foo")
        @@ -7913,12 +7913,12 @@ the fetch.

        Eventual errors thrown from databaseWillCommit are exposed to the application code:

        -
        do {
        -    try dbQueue.inTransaction { db in
        +
        do {
        +    try dbQueue.inTransaction { db in
                 ...
                 return .commit           // 1. willCommit (throws), 2. didRollback
             }
        -} catch {
        +} catch {
             // 3. The error thrown by the transaction observer.
         }
         
        @@ -7937,8 +7937,8 @@ the fetch.

        Transaction observers can avoid being notified of database changes they are not interested in.

        The filtering happens in the observes(eventsOfKind:) method, which tells whether the observer wants notification of specific kinds of changes, or not. For example, here is how an observer can focus on the changes that happen on the player database table:

        -
        class PlayerObserver: TransactionObserver {
        -    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
        +
        class PlayerObserver: TransactionObserver {
        +    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
                 // Only observe changes to the "player" table.
                 return eventKind.tableName == "player"
             }
        @@ -7951,10 +7951,10 @@ the fetch.

        Generally speaking, the observes(eventsOfKind:) method can distinguish insertions from deletions and updates, and is also able to inspect the columns that are about to be changed:

        -
        class PlayerScoreObserver: TransactionObserver {
        -    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
        +
        class PlayerScoreObserver: TransactionObserver {
        +    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
                 // Only observe changes to the "score" column of the "player" table.
        -        switch eventKind {
        +        switch eventKind {
                 case .insert(let tableName):
                     return tableName == "player"
                 case .delete(let tableName):
        @@ -7967,14 +7967,14 @@ the fetch.

        When the observes(eventsOfKind:) method returns false for all event kinds, the observer is still notified of commits and rollbacks:

        -
        class PureTransactionObserver: TransactionObserver {
        -    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
        +
        class PureTransactionObserver: TransactionObserver {
        +    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
                 // Ignore all individual changes
                 return false
             }
         
             func databaseDidChange(with event: DatabaseEvent) { /* Never called */ }
        -    func databaseWillCommit() throws { /* Called before commit */ }
        +    func databaseWillCommit() throws { /* Called before commit */ }
             func databaseDidRollback(_ db: Database) { /* Called on rollback */ }
             func databaseDidCommit(_ db: Database) { /* Called on commit */ }
         }
        @@ -7990,13 +7990,13 @@ the fetch.

        dbQueue.remove(transactionObserver: observer) // From a database connection: -dbQueue.inDatabase { db in +dbQueue.inDatabase { db in db.remove(transactionObserver: observer) }

        Alternatively, use the extent parameter of the add(transactionObserver:extent:) method:

        -
        let observer = MyObserver()
        +
        let observer = MyObserver()
         
         // On a database queue or pool:
         dbQueue.add(transactionObserver: observer) // default extent
        @@ -8005,7 +8005,7 @@ the fetch.

        dbQueue.add(transactionObserver: observer, extent: .databaseLifetime) // On a database connection: -dbQueue.inDatabase { db in +dbQueue.inDatabase { db in db.add(transactionObserver: ...) }
        @@ -8017,10 +8017,10 @@ the fetch.

        Finally, an observer may ignore all database changes until the end of the current transaction:

        -
        class PlayerObserver: TransactionObserver {
        +
        class PlayerObserver: TransactionObserver {
             var playerTableWasModified = false
         
        -    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
        +    func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
                 return eventKind.tableName == "player"
             }
         
        @@ -8050,7 +8050,7 @@ the fetch.

        The DatabaseRegionConvertible Protocol

        DatabaseRegionConvertible is a protocol for all types that can turn into a DatabaseRegion:

        -
        protocol DatabaseRegionConvertible {
        +
        protocol DatabaseRegionConvertible {
             func databaseRegion(_ db: Database) throws -> DatabaseRegion
         }
         
        @@ -8061,7 +8061,7 @@ the fetch.

        Support for SQLite Pre-Update Hooks

        A custom SQLite build can activate SQLite preupdate hooks. In this case, TransactionObserverType gets an extra callback which lets you observe individual column values in the rows modified by a transaction:

        -
        protocol TransactionObserverType : class {
        +
        protocol TransactionObserverType : class {
             #if SQLITE_ENABLE_PREUPDATE_HOOK
             /// Notifies before a database change (insert, update, or delete)
             /// with change information (initial / final values for the row's
        @@ -8092,21 +8092,21 @@ the fetch.

        When you want to open your existing SQLCipher 3 database with SQLCipher 4, you may want to run the cipher_compatibility pragma:

        // Open an SQLCipher 3 database with SQLCipher 4
        -var configuration = Configuration()
        +var configuration = Configuration()
         configuration.passphrase = "..."
         configuration.prepareDatabase = { db in
             try db.execute(sql: "PRAGMA cipher_compatibility = 3")
         }
        -let dbQueue = try DatabaseQueue(path: dbPath, configuration: configuration)
        +let dbQueue = try DatabaseQueue(path: dbPath, configuration: configuration)
         

        See SQLCipher 4.0.0 Release and Upgrading to SQLCipher 4 for more information. See also Advanced configuration options for SQLCipher below.

        You create and open an encrypted database by providing a passphrase to your database connection:

        -
        var configuration = Configuration()
        +
        var configuration = Configuration()
         configuration.passphrase = "secret"
        -let dbQueue = try DatabaseQueue(path: "...", configuration: configuration)
        +let dbQueue = try DatabaseQueue(path: "...", configuration: configuration)
         

        You can change the passphrase of an already encrypted database:

        @@ -8117,14 +8117,14 @@ the fetch.

        To encrypt an existing clear-text database, create a new and empty encrypted database, and copy the content of the clear-text database in it. The technique to do that is documented by SQLCipher. With GRDB, it gives:

        // The clear-text database
        -let clearDBQueue = try DatabaseQueue(path: "/path/to/clear.db")
        +let clearDBQueue = try DatabaseQueue(path: "/path/to/clear.db")
         
         // The encrypted database, at some distinct location:
        -var configuration = Configuration()
        +var configuration = Configuration()
         configuration.passphrase = "secret"
        -let encryptedDBQueue = try DatabaseQueue(path: "/path/to/encrypted.db", configuration: config)
        +let encryptedDBQueue = try DatabaseQueue(path: "/path/to/encrypted.db", configuration: config)
         
        -try clearDBQueue.inDatabase { db in
        +try clearDBQueue.inDatabase { db in
             try db.execute(sql: "ATTACH DATABASE ? AS encrypted KEY ?", arguments: [encryptedDBQueue.path, "secret"])
             try db.execute(sql: "SELECT sqlcipher_export('encrypted')")
             try db.execute(sql: "DETACH DATABASE encrypted")
        @@ -8135,13 +8135,13 @@ the fetch.

        Advanced configuration options for SQLCipher

        Some advanced SQLCipher configuration steps must happen very early in the database lifetime, and you will have to use the configuration.prepareDatabase property in order to run them correctly:

        -
        var configuration = Configuration()
        +
        var configuration = Configuration()
         configuration.passphrase = "secret"
         configuration.prepareDatabase = { db in
             try db.execute(sql: "PRAGMA cipher_page_size = 4096")
             try db.execute(sql: "PRAGMA kdf_iter = 128000")
         }
        -let dbQueue = try DatabaseQueue(path: "...", configuration: configuration)
        +let dbQueue = try DatabaseQueue(path: "...", configuration: configuration)
         

        See PRAGMA cipher_page_size and PRAGMA kdf_iter for more information.

        @@ -8172,7 +8172,7 @@ the fetch.

        // BAD BAD BAD
         let id = 1
         let name = textField.text
        -try dbQueue.write { db in
        +try dbQueue.write { db in
             try db.execute(sql: "UPDATE students SET name = '\(name)' WHERE id = \(id)")
         }
         
        @@ -8185,7 +8185,7 @@ the fetch.

        To avoid those problems, never embed raw values in your SQL queries. The only correct technique is to provide arguments to your raw SQL queries:

        let name = textField.text
        -try dbQueue.write { db in
        +try dbQueue.write { db in
             // Good
             try db.execute(
                 sql: "UPDATE students SET name = ? WHERE id = ?",
        @@ -8201,7 +8201,7 @@ the fetch.

        When you use records and the query interface, GRDB always prevents SQL injection for you:

        let id = 1
         let name = textField.text
        -try dbQueue.write { db in
        +try dbQueue.write { db in
             if var student = try Student.fetchOne(db, key: id) {
                 student.name = name
                 try student.update(db)
        @@ -8224,11 +8224,11 @@ the fetch.

        DatabaseError

        DatabaseError are thrown on SQLite errors:

        -
        do {
        +
        do {
             try db.execute(
                 sql: "INSERT INTO pet (masterId, name) VALUES (?, ?)",
                 arguments: [1, "Bobby"])
        -} catch let error as DatabaseError {
        +} catch let error as DatabaseError {
             // The SQLite error code: 19 (SQLITE_CONSTRAINT)
             error.resultCode
         
        @@ -8250,13 +8250,13 @@ the fetch.

        SQLite uses codes to distinguish between various errors:

        -
        do {
        +
        do {
             try ...
        -} catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY {
        +} catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY {
             // foreign key constraint error
        -} catch let error as DatabaseError where error.resultCode == .SQLITE_CONSTRAINT {
        +} catch let error as DatabaseError where error.resultCode == .SQLITE_CONSTRAINT {
             // any other constraint error
        -} catch let error as DatabaseError {
        +} catch let error as DatabaseError {
             // any other database error
         }
         
        @@ -8264,10 +8264,10 @@ the fetch.

        In the example above, error.extendedResultCode is a precise extended result code, and error.resultCode is a less precise primary result code. Extended result codes are refinements of primary result codes, as SQLITE_CONSTRAINT_FOREIGNKEY is to SQLITE_CONSTRAINT, for example. See SQLite result codes for more information.

        As a convenience, extended result codes match their primary result code in a switch statement:

        -
        do {
        +
        do {
             try ...
        -} catch let error as DatabaseError {
        -    switch error.extendedResultCode {
        +} catch let error as DatabaseError {
        +    switch error.extendedResultCode {
             case ResultCode.SQLITE_CONSTRAINT_FOREIGNKEY:
                 // foreign key constraint error
             case ResultCode.SQLITE_CONSTRAINT:
        @@ -8284,7 +8284,7 @@ the fetch.

        PersistenceError

        PersistenceError is thrown by the PersistableRecord protocol, in a single case: when the update method could not find any row to update:

        -
        do {
        +
        do {
             try player.update(db)
         } catch let PersistenceError.recordNotFound(databaseTableName: table, key: key) {
             print("Key \(key) was not found in table \(table).")
        @@ -8315,11 +8315,11 @@ the fetch.

        Solution: fix the contents of the database, or use DatabaseValue to handle all possible cases:

        let dbValue: DatabaseValue = row["date"]
        -if dbValue.isNull {
        +if dbValue.isNull {
             // Handle NULL
         } else if let date = Date.fromDatabaseValue(dbValue) {
             // Handle valid date
        -} else {
        +} else {
             // Handle invalid date
         }
         
      12. @@ -8329,12 +8329,12 @@ the fetch.

        Solution: add a unique index to the player.email column, or use the deleteAll method to make it clear that you may delete more than one row:

        -
        try Player.filter(Column("email") == "arthur@example.com").deleteAll(db)
        +
        try Player.filter(Column("email") == "arthur@example.com").deleteAll(db)
         
      13. Database connections are not reentrant:

        // fatal error: Database methods are not reentrant.
        -dbQueue.write { db in
        -    dbQueue.write { db in
        +dbQueue.write { db in
        +    dbQueue.write { db in
                 ...
             }
         }
        @@ -8349,7 +8349,7 @@ the fetch.

        // Some untrusted arguments for the query let arguments: [String: Any] = ... -let rows = try Row.fetchCursor(db, sql: sql, arguments: StatementArguments(arguments)) +let rows = try Row.fetchCursor(db, sql: sql, arguments: StatementArguments(arguments)) while let row = try rows.next() { // Some untrusted database value: @@ -8366,7 +8366,7 @@ the fetch.

        In such a situation, you can still avoid fatal errors by exposing and handling each failure point, one level down in the GRDB API:

        // Untrusted arguments
        -if let arguments = StatementArguments(arguments) {
        +if let arguments = StatementArguments(arguments) {
             let statement = try db.makeSelectStatement(sql: sql)
             try statement.validate(arguments: arguments)
             statement.unsafeSetArguments(arguments)
        @@ -8375,11 +8375,11 @@ the fetch.

        while let row = try iterator.next() { // Untrusted database content let dbValue: DatabaseValue = row[0] - if dbValue.isNull { + if dbValue.isNull { // Handle NULL if let date = Date.fromDatabaseValue(dbValue) { // Handle valid date - } else { + } else { // Handle invalid date } } @@ -8393,7 +8393,7 @@ the fetch.

        This global error callback must be configured early in the lifetime of your application:

        Database.logError = { (resultCode, message) in
        -    NSLog("%@", "SQLite error \(resultCode): \(message)")
        +    NSLog("%@", "SQLite error \(resultCode): \(message)")
         }
         
        @@ -8464,7 +8464,7 @@ the fetch.

        You can also define your own collations:

        -
        let collation = DatabaseCollation("customCollation") { (lhs, rhs) -> NSComparisonResult in
        +
        let collation = DatabaseCollation("customCollation") { (lhs, rhs) -> NSComparisonResult in
             // return the comparison of lhs and rhs strings.
         }
         dbQueue.add(collation: collation) // Or dbPool.add(collation: ...)
        @@ -8508,15 +8508,15 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         var isDirectory: ObjCBool = false
         if !fileManager.fileExists(atPath: directoryURL.path, isDirectory: &isDirectory) {
             try fileManager.createDirectory(atPath: directoryURL.path, withIntermediateDirectories: false)
        -} else if !isDirectory.boolValue {
        -    throw NSError(domain: NSCocoaErrorDomain, code: NSFileWriteFileExistsError, userInfo: nil)
        +} else if !isDirectory.boolValue {
        +    throw NSError(domain: NSCocoaErrorDomain, code: NSFileWriteFileExistsError, userInfo: nil)
         }
         
         // Enable data protection
         try fileManager.setAttributes([.protectionKey : FileProtectionType.complete], ofItemAtPath: directoryURL.path)
         
         // Open database
        -let dbQueue = try DatabaseQueue(path: databaseURL.path)
        +let dbQueue = try DatabaseQueue(path: databaseURL.path)
         

        When a database is protected, an application that runs in the background on a locked device won’t be able to read or write from it. Instead, it will get DatabaseError with code SQLITE_IOERR (10) disk I/O error, or SQLITE_AUTH (23) not authorized.

        @@ -8553,7 +8553,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

        Database writes always happen in a unique serial dispatch queue, named the writer protected dispatch queue.

      14. :bowtie: Guarantee 2: reads are always isolated. This means that they are guaranteed an immutable view of the last committed state of the database, and that you can perform subsequent fetches without fearing eventual concurrent writes to mess with your application logic:

        -
        try dbPool.read { db in // or dbQueue.read
        +
        try dbPool.read { db in // or dbQueue.read
             // Guaranteed to be equal
             let count1 = try Player.fetchCount(db)
             let count2 = try Player.fetchCount(db)
        @@ -8579,20 +8579,20 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        If there are several instances of database queues or pools that write in the same database, a multi-threaded application will eventually face database is locked errors. See Dealing with External Connections.

        // SAFE CONCURRENCY
        -func fetchCurrentUser(_ db: Database) throws -> User? {
        +func fetchCurrentUser(_ db: Database) throws -> User? {
             return try User.fetchOne(db)
         }
         // dbQueue is a singleton defined somewhere in your app
        -let user = try dbQueue.read { db in // or dbPool.read
        +let user = try dbQueue.read { db in // or dbPool.read
             try fetchCurrentUser(db)
         }
         
         // UNSAFE CONCURRENCY
         // This method fails when some other thread is currently writing into
         // the database.
        -func currentUser() throws -> User? {
        -    let dbQueue = try DatabaseQueue(...)
        -    return try dbQueue.read { db in
        +func currentUser() throws -> User? {
        +    let dbQueue = try DatabaseQueue(...)
        +    return try dbQueue.read { db in
                 try User.fetchOne(db)
             }
         }
        @@ -8602,7 +8602,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        Database access methods isolate your groups of related statements against eventual database updates performed by other threads, and guarantee a consistent view of the database. This isolation is only guaranteed inside the closure argument of those methods. Two consecutive calls do not guarantee isolation:

        // SAFE CONCURRENCY
        -try dbPool.read { db in  // or dbQueue.read
        +try dbPool.read { db in  // or dbQueue.read
             // Guaranteed to be equal:
             let count1 = try Place.fetchCount(db)
             let count2 = try Place.fetchCount(db)
        @@ -8611,45 +8611,45 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         // UNSAFE CONCURRENCY
         // Those two values may be different because some other thread may have
         // modified the database between the two blocks:
        -let count1 = try dbPool.read { db in try Place.fetchCount(db) }
        -let count2 = try dbPool.read { db in try Place.fetchCount(db) }
        +let count1 = try dbPool.read { db in try Place.fetchCount(db) }
        +let count2 = try dbPool.read { db in try Place.fetchCount(db) }
         

        In the same vein, when you fetch values that depends on some database updates, group them:

        // SAFE CONCURRENCY
        -try dbPool.write { db in
        +try dbPool.write { db in
             // The count is guaranteed to be non-zero
        -    try Place(...).insert(db)
        +    try Place(...).insert(db)
             let count = try Place.fetchCount(db)
         }
         
         // UNSAFE CONCURRENCY
         // The count may be zero because some other thread may have performed
         // a deletion between the two blocks:
        -try dbPool.write { db in try Place(...).insert(db) }
        -let count = try dbPool.read { db in try Place.fetchCount(db) }
        +try dbPool.write { db in try Place(...).insert(db) }
        +let count = try dbPool.read { db in try Place.fetchCount(db) }
         

        On that last example, see Advanced DatabasePool if you look after extra performance.

      15. :point_up: Rule 3: When you perform several modifications of the database that temporarily put the database in an inconsistent state, make sure those modifications are grouped within a transaction.

        // SAFE CONCURRENCY
        -try dbPool.write { db in               // or dbQueue.write
        -    try Credit(destinationAccout, amount).insert(db)
        -    try Debit(sourceAccount, amount).insert(db)
        +try dbPool.write { db in               // or dbQueue.write
        +    try Credit(destinationAccout, amount).insert(db)
        +    try Debit(sourceAccount, amount).insert(db)
         }
         
         // SAFE CONCURRENCY
        -try dbPool.writeInTransaction { db in  // or dbQueue.inTransaction
        -    try Credit(destinationAccout, amount).insert(db)
        -    try Debit(sourceAccount, amount).insert(db)
        +try dbPool.writeInTransaction { db in  // or dbQueue.inTransaction
        +    try Credit(destinationAccout, amount).insert(db)
        +    try Debit(sourceAccount, amount).insert(db)
             return .commit
         }
         
         // UNSAFE CONCURRENCY
        -try dbPool.writeWithoutTransaction { db in
        -    try Credit(destinationAccout, amount).insert(db)
        +try dbPool.writeWithoutTransaction { db in
        +    try Credit(destinationAccout, amount).insert(db)
             // <- Concurrent dbPool.read sees a partial db update here
        -    try Debit(sourceAccount, amount).insert(db)
        +    try Debit(sourceAccount, amount).insert(db)
         }
         
        @@ -8677,9 +8677,9 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

        Database pools are very concurrent, since all reads can run in parallel, and can even run during write operations. But writes are still serialized: at any given point in time, there is no more than a single thread that is writing into the database.

        When your application modifies the database, and then reads some value that depends on those modifications, you may want to avoid locking the writer queue longer than necessary:

        -
        try dbPool.write { db in
        +
        try dbPool.write { db in
             // Increment the number of players
        -    try Player(...).insert(db)
        +    try Player(...).insert(db)
         
             // Read the number of players. The writer queue is still locked :-(
             let count = try Player.fetchCount(db)
        @@ -8688,12 +8688,12 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        A wrong solution is to chain a write then a read, as below. Don’t do that, because another thread may modify the database in between, and make the read unreliable:

        // WRONG
        -try dbPool.write { db in
        +try dbPool.write { db in
             // Increment the number of players
        -    try Player(...).insert(db)
        +    try Player(...).insert(db)
         }
         // <- other threads can write in the database here
        -try dbPool.read { db in
        +try dbPool.read { db in
             // Read some random value :-(
             let count = try Player.fetchCount(db)
         }
        @@ -8703,12 +8703,12 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        concurrentRead returns a future value which you consume on any dispatch queue, with the wait() method:

        // CORRECT
        -let futureCount: DatabaseFuture<Int> = try dbPool.writeWithoutTransaction { db in
        +let futureCount: DatabaseFuture<Int> = try dbPool.writeWithoutTransaction { db in
             // increment the number of players
        -    try Player(...).insert(db)
        +    try Player(...).insert(db)
         
             // <- not in a transaction here
        -    let futureCount = dbPool.concurrentRead { db
        +    let futureCount = dbPool.concurrentRead { db
                 return try Player.fetchCount(db)
             }
             return futureCount
        @@ -8722,11 +8722,11 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         

        concurrentRead blocks until it can guarantee its closure argument an isolated access to the last committed state of the database. It then asynchronously executes the closure.

        The closure can run concurrently with eventual updates performed after concurrentRead: those updates won’t be visible from within the closure. In the example below, the number of players is guaranteed to be non-zero, even though it is fetched concurrently with the player deletion:

        -
        try dbPool.writeWithoutTransaction { db in
        +
        try dbPool.writeWithoutTransaction { db in
             // Increment the number of players
        -    try Player(...).insert(db)
        +    try Player(...).insert(db)
         
        -    let futureCount = dbPool.concurrentRead { db
        +    let futureCount = dbPool.concurrentRead { db
                 // Guaranteed to be non-zero
                 return try Player.fetchCount(db)
             }
        @@ -8750,20 +8750,20 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        A snapshot can be used from any thread. Its read methods is synchronous, and blocks the current thread until your database statements are executed:

        // Read values:
        -try snapshot.read { db in
        +try snapshot.read { db in
             let players = try Player.fetchAll(db)
             let playerCount = try Player.fetchCount(db)
         }
         
         // Extract a value from the database:
        -let playerCount = try snapshot.read { db in
        +let playerCount = try snapshot.read { db in
             try Player.fetchCount(db)
         }
         

        When you want to control the latest committed changes seen by a snapshot, create it from the pool’s writer protected dispatch queue, outside of any transaction:

        -
        let snapshot1 = try dbPool.writeWithoutTransaction { db -> DatabaseSnapshot in
        -    try db.inTransaction {
        +
        let snapshot1 = try dbPool.writeWithoutTransaction { db -> DatabaseSnapshot in
        +    try db.inTransaction {
                 // delete all players
                 try Player.deleteAll()
                 return .commit
        @@ -8775,12 +8775,12 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         // <- Other threads may modify the database here
         let snapshot2 = try dbPool.makeSnapshot()
         
        -try snapshot1.read { db in
        +try snapshot1.read { db in
             // Guaranteed to be zero
             try Player.fetchCount(db)
         }
         
        -try snapshot2.read { db in
        +try snapshot2.read { db in
             // Could be anything
             try Player.fetchCount(db)
         }
        @@ -8810,7 +8810,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        However, you can prevent some parts of your application from writing in the database by giving them a DatabaseReader:

        // This class can read in the database, but can't write into it.
        -class MyReadOnlyComponent {
        +class MyReadOnlyComponent {
             let reader: DatabaseReader
         
             init(reader: DatabaseReader) {
        @@ -8819,13 +8819,13 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         }
         
         let dbQueue: DatabaseQueue = ...
        -let component = MyReadOnlyComponent(reader: dbQueue)
        +let component = MyReadOnlyComponent(reader: dbQueue)
         

        :point_up: Note: DatabaseReader is not a secure way to prevent an application component from writing in the database, because write access is just a cast away:

        -
        if let dbQueue = reader as? DatabaseQueue {
        -    try dbQueue.write { ... }
        +
        if let dbQueue = reader as? DatabaseQueue {
        +    try dbQueue.write { ... }
         }
         
        @@ -8842,11 +8842,11 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

        asyncRead

        The asyncRead method can be used from any thread. It submits your database statements for asynchronous execution on a protected dispatch queue:

        -
        reader.asyncRead { (result: Result<Database>) in
        -    try {
        +
        reader.asyncRead { (result: Result<Database>) in
        +    try {
                 let db = try result.get()
                 let players = try Player.fetchAll(db)
        -    } catch {
        +    } catch {
                 // handle error
             }
         }
        @@ -8867,9 +8867,9 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        The asyncWrite method can be used from any thread. It submits your database statements for asynchronous execution on a protected dispatch queue, wrapped inside a database transaction:

        writer.asyncWrite({ (db: Database) in
        -    try Player(...).insert(db)
        +    try Player(...).insert(db)
         }, completion: { (db: Database, result: Result<Void, Error>) in
        -    switch result {
        +    switch result {
             case let .success:
                 // handle transaction success
             case let .failure(error):
        @@ -8884,10 +8884,10 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        When the transaction completes successfully, the result of the first function is contained in the standard Result passed to the completion function:

        writer.asyncWrite({ (db: Database) -> Int in
        -    try Player(...).insert(db)
        +    try Player(...).insert(db)
             return try Player.fetchCount(db)
         }, completion: { (db: Database, result: Result<Int, Error>) in
        -    switch result {
        +    switch result {
             case let .success(newPlayerCount):
                 print("new player count: \(newPlayerCount)")
             case let .failure(error):
        @@ -8904,10 +8904,10 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         

        asyncWriteWithoutTransaction

        The asyncWriteWithoutTransaction method can be used from any thread. It submits your database statements for asynchronous execution on a protected dispatch queue, outside of any transaction:

        -
        writer.asyncWriteWithoutTransaction { (db: Database) in
        -    try {
        -        try Player(...).insert(db)
        -    } catch {
        +
        writer.asyncWriteWithoutTransaction { (db: Database) in
        +    try {
        +        try Player(...).insert(db)
        +    } catch {
                 // handle error
             }
         }
        @@ -8927,26 +8927,26 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         

        asyncConcurrentRead blocks until it can guarantee its closure argument an isolated access to the last committed state of the database. It then asynchronously executes the closure.

        In the example below, the number of players is fetched concurrently with the player insertion. Yet the future is guaranteed to return zero:

        -
        try writer.asyncWriteWithoutTransaction { db in
        -    do {
        +
        try writer.asyncWriteWithoutTransaction { db in
        +    do {
                 // Delete all players
                 try Player.deleteAll()
         
                 // <- not in a transaction here
                 // Count players concurrently
        -        writer.asyncConcurrentRead { (result: Result<Database>) in
        -            try {
        +        writer.asyncConcurrentRead { (result: Result<Database>) in
        +            try {
                         let db = try result.get()
                         // Guaranteed to be zero
                         let count = try Player.fetchCount()
        -            } catch {
        +            } catch {
                         // handle error
                     }
                 }
         
                 // Insert a player
        -        try Player(...).insert(db)
        -    } catch {
        +        try Player(...).insert(db)
        +    } catch {
                 // handle error
             }
         }
        @@ -8965,7 +8965,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         

        The unsafeRead method is synchronous, and blocks the current thread until your database statements are executed in a protected dispatch queue. GRDB does just the bare minimum to provide a database connection that can read.

        When used on a database pool, reads are no longer isolated:

        -
        dbPool.unsafeRead { db in
        +
        dbPool.unsafeRead { db in
             // Those two values may be different because some other thread
             // may have inserted or deleted a player between the two requests:
             let count1 = try Player.fetchCount(db)
        @@ -8977,10 +8977,10 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
      16. unsafeReentrantRead

        The unsafeReentrantRead behaves just as unsafeRead (see above), and allows reentrant calls:

        -
        dbPool.read { db1 in
        +
        dbPool.read { db1 in
             // No "Database methods are not reentrant" fatal error:
        -    dbPool.unsafeReentrantRead { db2 in
        -        dbPool.unsafeReentrantRead { db3 in
        +    dbPool.unsafeReentrantRead { db2 in
        +        dbPool.unsafeReentrantRead { db3 in
                     ...
                 }
             }
        @@ -8995,10 +8995,10 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         

        The unsafeReentrantWrite method is synchronous, and blocks the current thread until your database statements are executed in a protected dispatch queue. Writes are serialized: eventual concurrent database updates are postponed until the block has executed.

        Reentrant calls are allowed:

        -
        dbQueue.write { db1 in
        +
        dbQueue.write { db1 in
             // No "Database methods are not reentrant" fatal error:
        -    dbQueue.unsafeReentrantWrite { db2 in
        -        dbQueue.unsafeReentrantWrite { db3 in
        +    dbQueue.unsafeReentrantWrite { db2 in
        +        dbQueue.unsafeReentrantWrite { db3 in
                     ...
                 }
             }
        @@ -9055,11 +9055,11 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         

        If not done yet, read the Concurrency Programming Guide and learn how to perform heavy computations without blocking your application.

        Most GRBD APIs are synchronous. Spawning them into parallel queues is as easy as:

        -
        DispatchQueue.global().async { 
        -    dbQueue.write { db in
        +
        DispatchQueue.global().async { 
        +    dbQueue.write { db in
                 // Perform database work
             }
        -    DispatchQueue.main.async { 
        +    DispatchQueue.main.async { 
                 // update your user interface
             }
         }
        @@ -9068,22 +9068,22 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        Performing multiple updates to the database is much faster when executed inside a transaction. This is because a transaction allows SQLite to postpone writing changes to disk until the final commit:

        // Inefficient
        -try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
        -    for player in players {
        +try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
        +    for player in players {
                 try player.insert(db)
             }
         }
         
         // Efficient
        -try dbQueue.write { db in      // or dbPool.write
        -    for player in players {
        +try dbQueue.write { db in      // or dbPool.write
        +    for player in players {
                 try player.insert(db)
             }
         }
         
         // Efficient
        -try dbQueue.inTransaction { db in // or dbPool.writeInTransaction
        -    for player in players {
        +try dbQueue.inTransaction { db in // or dbPool.writeInTransaction
        +    for player in players {
                 try player.insert(db)
             }
             return .commit
        @@ -9131,7 +9131,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         

        An UPDATE statement is costly: SQLite has to look for the updated row, update values, and write changes to disk.

        When the overwritten values are the same as the existing ones, it’s thus better to avoid performing the UPDATE statement:.

        -
        if player.hasDatabaseChanges {
        +
        if player.hasDatabaseChanges {
             try player.update(db)
         }
         
        @@ -9152,7 +9152,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

        The following code is inefficient. It is an example of the N+1 problem, because it performs one query to load the authors, and then N queries, as many as there are authors. This turns very inefficient as the number of authors grows:

        // SELECT * FROM author
         let authors = try Author.fetchAll(db)
        -for author in authors {
        +for author in authors {
             // SELECT COUNT(*) FROM book WHERE authorId = ...
             author.bookCount = try Book.filter(authorIdColumn == author.id).fetchCount(db)
         }
        @@ -9183,7 +9183,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         

        The String and Dictionary Swift types are better avoided when you look for the best performance.

        Now GRDB records, for your convenience, do use strings and dictionaries:

        -
        class Player : Record {
        +
        class Player : Record {
             var id: Int64?
             var name: String
             var email: String
        @@ -9217,20 +9217,20 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
             let id: Int64 = row[0]
             let name: String = row[1]
             let email: String = row[2]
        -    let player = Player(id: id, name: name, email: email)
        +    let player = Player(id: id, name: name, email: email)
             ...
         }
         

        When inserting values, use reusable prepared statements, and set statements values with an array:

        // Strings & dictionaries
        -for player in players {
        +for player in players {
             try player.insert(db)
         }
         
         // Prepared statement
         let insertStatement = db.prepareStatement("INSERT INTO player (name, email) VALUES (?, ?)")
        -for player in players {
        +for player in players {
             // Only use the unsafe arguments setter if you are sure that you provide
             // all statement arguments. A mistake can store unexpected values in
             // the database.
        @@ -9258,15 +9258,15 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
        let databaseURL = try FileManager.default
             .url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
             .appendingPathComponent("db.sqlite")
        -let dbQueue = try DatabaseQueue(path: databaseURL.path)
        +let dbQueue = try DatabaseQueue(path: databaseURL.path)
         

        How do I open a database stored as a resource of my application?

        If your application does not need to modify the database, open a read-only connection to your resource:

        -
        var configuration = Configuration()
        +
        var configuration = Configuration()
         configuration.readonly = true
         let dbPath = Bundle.main.path(forResource: "db", ofType: "sqlite")!
        -let dbQueue = try DatabaseQueue(path: dbPath, configuration: configuration)
        +let dbQueue = try DatabaseQueue(path: dbPath, configuration: configuration)
         

        If the application should modify the database, you need to copy it to a place where it can be modified. For example, in the Application Support directory. Only then, open a connection:

        @@ -9279,7 +9279,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared) let dbResourcePath = Bundle.main.path(forResource: "db", ofType: "sqlite")! try fileManager.copyItem(atPath: dbResourcePath, toPath: dbPath) } -let dbQueue = try DatabaseQueue(path: dbPath) +let dbQueue = try DatabaseQueue(path: dbPath)

        How do I close a database connection?

        @@ -9291,12 +9291,12 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

        When you want to debug a request that does not deliver the expected results, you may want to print the SQL that is actually executed.

        You can turn your request into a SQLRequest instance:

        -
        try dbQueue.read { db in
        +
        try dbQueue.read { db in
             let request = Wine
        -        .filter(Column("origin") == "Burgundy")
        -        .order(Column("price")
        +        .filter(Column("origin") == "Burgundy")
        +        .order(Column("price")
         
        -    let sqlRequest = try SQLRequest(db, request: request)
        +    let sqlRequest = try SQLRequest(db, request: request)
             print(sqlRequest.sql)
             // Prints SELECT * FROM wine WHERE origin = ? ORDER BY price
             print(sqlRequest.arguments)
        @@ -9305,14 +9305,14 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         

        Another option is to setup a tracing function that will print out all SQL requests executed by your application. You provide the trace function when you connect to the database:

        -
        var config = Configuration()
        +
        var config = Configuration()
         config.trace = { print($0) } // Prints all SQL statements
        -let dbQueue = try DatabaseQueue(path: dbPath, configuration: config)
        +let dbQueue = try DatabaseQueue(path: dbPath, configuration: config)
         
        -try dbQueue.read { db in
        +try dbQueue.read { db in
             let wines = Wine
        -        .filter(Column("origin") == "Burgundy")
        -        .order(Column("price")
        +        .filter(Column("origin") == "Burgundy")
        +        .order(Column("price")
                 .fetchAll(db)
             // Prints SELECT * FROM wine WHERE origin = 'Burgundy' ORDER BY price
         }
        @@ -9325,7 +9325,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        You may get this error when using the read and write methods of database queues and pools:

        // Generic parameter 'T' could not be inferred
        -let string = try dbQueue.read { db in
        +let string = try dbQueue.read { db in
             let result = try String.fetchOne(db, ...)
             return result
         }
        @@ -9335,7 +9335,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        The general workaround is to explicitly declare the type of the closure result:

        // General Workaround
        -let string = try dbQueue.read { db -> String? in
        +let string = try dbQueue.read { db -> String? in
             let result = try String.fetchOne(db, ...)
             return result
         }
        @@ -9343,7 +9343,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        You can also, when possible, write a single-line closure:

        // Single-line closure workaround:
        -let string = try dbQueue.read { db in
        +let string = try dbQueue.read { db in
             try String.fetchOne(db, ...)
         }
         
        @@ -9352,11 +9352,11 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

        Those errors may be the sign that SQLite can’t access the database due to data protection.

        When your application should be able to run in the background on a locked device, it has to catch this error, and, for example, wait for UIApplicationDelegate.applicationProtectedDataDidBecomeAvailable(_:) or UIApplicationProtectedDataDidBecomeAvailable notification and retry the failed database operation.

        -
        do {
        +
        do {
             try ...
         } catch let error as DatabaseError where
             error.resultCode == .SQLITE_IOERR ||
        -    error.resultCode == .SQLITE_AUTH
        +    error.resultCode == .SQLITE_AUTH
         {
             // Handle possible data protection error
         }
        @@ -9367,7 +9367,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
         
         

        You may get the error wrong number of statement arguments when executing a LIKE query similar to:

        let name = textField.text
        -let players = try dbQueue.read { db in
        +let players = try dbQueue.read { db in
             try Player.fetchAll(db, sql: "SELECT * FROM player WHERE name LIKE '%?%'", arguments: [name])
         }
         
        @@ -9378,7 +9378,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)

        To fix the error, you can feed the request with the pattern itself, instead of the name:

        let name = textField.text
        -let players: [Player] = try dbQueue.read { db in
        +let players: [Player] = try dbQueue.read { db in
             let pattern = "%\(name)%"
             return try Player.fetchAll(db, sql: "SELECT * FROM player WHERE name LIKE ?", arguments: [pattern])
         }
        @@ -9430,7 +9430,7 @@ dbQueue.setupMemoryManagement(in: UIApplication.shared)
                   
                 
                 
               
        diff --git a/index.html b/index.html
        index 3f6c7f94b..71fa98571 100644
        --- a/index.html
        +++ b/index.html
        @@ -23,7 +23,7 @@
             
             

        - Latest release: August 6, 2019 • version 4.2.0 • Release Notes + Latest release: August 13, 2019 • version 4.2.1 • Release Notes

        Requirements: iOS 9.0+ / OSX 10.9+ / watchOS 2.0+ • Swift 4.2+ / Xcode 10+