diff --git a/CHANGELOG.md b/CHANGELOG.md index bef30f951..9790f2751 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,6 +97,7 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception: - **Breaking**: Swift 5.7+ and Xcode 14+ are required. - **Breaking**: iOS 11.0+ / macOS 10.13+ / tvOS 11.0+ / watchOS 4.0+ are required. +- **Breaking**: Removed deprecated methods ## 5.26.0 diff --git a/GRDB.xcodeproj/project.pbxproj b/GRDB.xcodeproj/project.pbxproj index 9db71ef11..ad0bfc95d 100755 --- a/GRDB.xcodeproj/project.pbxproj +++ b/GRDB.xcodeproj/project.pbxproj @@ -490,6 +490,10 @@ 566BE71F2342542F00A8254B /* LockedBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566BE7172342542F00A8254B /* LockedBox.swift */; }; 566BE7202342542F00A8254B /* LockedBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566BE7172342542F00A8254B /* LockedBox.swift */; }; 566BE7212342542F00A8254B /* LockedBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566BE7172342542F00A8254B /* LockedBox.swift */; }; + 566DDE0D288D763C0000DCFB /* Fixits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566DDE0C288D763C0000DCFB /* Fixits.swift */; }; + 566DDE0E288D763C0000DCFB /* Fixits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566DDE0C288D763C0000DCFB /* Fixits.swift */; }; + 566DDE0F288D763C0000DCFB /* Fixits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566DDE0C288D763C0000DCFB /* Fixits.swift */; }; + 566DDE10288D763C0000DCFB /* Fixits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566DDE0C288D763C0000DCFB /* Fixits.swift */; }; 56703297212B5450007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56703290212B544F007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; }; 56703298212B5450007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56703290212B544F007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; }; 56713FDD2691F409006153C3 /* JSONRequiredEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56713FDC2691F409006153C3 /* JSONRequiredEncoder.swift */; }; @@ -549,9 +553,6 @@ 567DAF221EAB61ED00FC0928 /* grdb_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 567DAF141EAB61ED00FC0928 /* grdb_config.h */; settings = {ATTRIBUTES = (Private, ); }; }; 567DAF351EAB789800FC0928 /* DatabaseLogErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567DAF341EAB789800FC0928 /* DatabaseLogErrorTests.swift */; }; 567DAF391EAB789800FC0928 /* DatabaseLogErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567DAF341EAB789800FC0928 /* DatabaseLogErrorTests.swift */; }; - 567ECE4F2222E431009245CA /* GRDB-5.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567ECE4E2222E431009245CA /* GRDB-5.0.swift */; }; - 567ECE502222E431009245CA /* GRDB-5.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567ECE4E2222E431009245CA /* GRDB-5.0.swift */; }; - 567ECE512222E431009245CA /* GRDB-5.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567ECE4E2222E431009245CA /* GRDB-5.0.swift */; }; 567F45A81F888B2600030B59 /* TruncateOptimizationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567F45A71F888B2600030B59 /* TruncateOptimizationTests.swift */; }; 567F45AC1F888B2600030B59 /* TruncateOptimizationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567F45A71F888B2600030B59 /* TruncateOptimizationTests.swift */; }; 568068311EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 568068301EBBA26100EFB8AA /* SQLRequestTests.swift */; }; @@ -1025,7 +1026,6 @@ AAA4DCD0230F1E0600C74B15 /* SQLInterpolation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569D6DDD220EF9E100A058A9 /* SQLInterpolation.swift */; }; AAA4DCD1230F1E0600C74B15 /* DatabaseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238731B9C75030082EB20 /* DatabaseError.swift */; }; AAA4DCD2230F1E0600C74B15 /* HasManyAssociation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAFB20944C7B00F46237 /* HasManyAssociation.swift */; }; - AAA4DCD3230F1E0600C74B15 /* GRDB-5.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567ECE4E2222E431009245CA /* GRDB-5.0.swift */; }; AAA4DCD4230F1E0600C74B15 /* TableDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566AD8B11D5318F4002EC1A8 /* TableDefinition.swift */; }; AAA4DCD5230F1E0600C74B15 /* FTS5WrapperTokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5698AD201DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift */; }; AAA4DCD6230F1E0600C74B15 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED82210731A00945324 /* SQLRequest.swift */; }; @@ -1470,6 +1470,7 @@ 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionObserver.swift; sourceTree = ""; }; 566B9C1F25C6CC24004542CF /* RowDecodingError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RowDecodingError.swift; sourceTree = ""; }; 566BE7172342542F00A8254B /* LockedBox.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockedBox.swift; sourceTree = ""; }; + 566DDE0C288D763C0000DCFB /* Fixits.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fixits.swift; sourceTree = ""; }; 56703290212B544F007D270F /* DatabaseUUIDEncodingStrategyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseUUIDEncodingStrategyTests.swift; sourceTree = ""; }; 56713FDC2691F409006153C3 /* JSONRequiredEncoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONRequiredEncoder.swift; sourceTree = ""; }; 567156151CB142AA007DC145 /* DatabaseQueueReadOnlyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseQueueReadOnlyTests.swift; sourceTree = ""; }; @@ -1495,7 +1496,6 @@ 567A80521D41350C00C7DCEC /* IndexInfoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IndexInfoTests.swift; sourceTree = ""; }; 567DAF141EAB61ED00FC0928 /* grdb_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = grdb_config.h; sourceTree = ""; }; 567DAF341EAB789800FC0928 /* DatabaseLogErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseLogErrorTests.swift; sourceTree = ""; }; - 567ECE4E2222E431009245CA /* GRDB-5.0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "GRDB-5.0.swift"; sourceTree = ""; }; 567F45A71F888B2600030B59 /* TruncateOptimizationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TruncateOptimizationTests.swift; sourceTree = ""; }; 568068301EBBA26100EFB8AA /* SQLRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLRequestTests.swift; sourceTree = ""; }; 5682D71A239582AA004B58C4 /* DatabaseSuspensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseSuspensionTests.swift; sourceTree = ""; }; @@ -2423,14 +2423,6 @@ path = ValueReducer; sourceTree = ""; }; - 56D7E449221595FE0052464B /* Fixit */ = { - isa = PBXGroup; - children = ( - 567ECE4E2222E431009245CA /* GRDB-5.0.swift */, - ); - path = Fixit; - sourceTree = ""; - }; 56DAA2C41DE99D8D006E10C8 /* Cursor */ = { isa = PBXGroup; children = ( @@ -2526,8 +2518,8 @@ isa = PBXGroup; children = ( 56A2FA3524424D2A00E97D23 /* Export.swift */, + 566DDE0C288D763C0000DCFB /* Fixits.swift */, 56A2386F1B9C75030082EB20 /* Core */, - 56D7E449221595FE0052464B /* Fixit */, 5698AC291D9E5A480056AF8C /* FTS */, 56A238911B9C750B0082EB20 /* Migration */, 56300B6D1C53F592005A543B /* QueryInterface */, @@ -2960,6 +2952,7 @@ 5613ED4621A95B2C00DC7A68 /* ValueReducer.swift in Sources */, 5698AD1C1DAAD17F0056AF8C /* FTS5Tokenizer.swift in Sources */, 56CEB5171EAA324B00BFAF62 /* FTS3+QueryInterface.swift in Sources */, + 566DDE0F288D763C0000DCFB /* Fixits.swift in Sources */, 5656A8B22295BFD7001FF3FF /* TableRecord+QueryInterfaceRequest.swift in Sources */, 56B964B71DA51D010002DA19 /* FTS5TokenizerDescriptor.swift in Sources */, 5653EB0B20944C7C00F46237 /* Association.swift in Sources */, @@ -2997,7 +2990,6 @@ 563EF45D2163309F007DAACD /* Inflections.swift in Sources */, 569D6DE0220EF9E100A058A9 /* SQLInterpolation.swift in Sources */, 5611620A25757583007AAF99 /* JoinAssociation.swift in Sources */, - 567ECE512222E431009245CA /* GRDB-5.0.swift in Sources */, 565490BF1D5AE236005622CB /* DatabaseValueConvertible.swift in Sources */, 566B91191FA4C3F50012D5B0 /* DatabaseCollation.swift in Sources */, 560233C62724234F00529DF3 /* SharedValueObservation.swift in Sources */, @@ -3108,6 +3100,7 @@ 563B8FC624A1D3B9007A48C9 /* OnDemandFuture.swift in Sources */, 56300B791C53F592005A543B /* QueryInterfaceRequest.swift in Sources */, 5656A8B12295BFD7001FF3FF /* TableRecord+QueryInterfaceRequest.swift in Sources */, + 566DDE0E288D763C0000DCFB /* Fixits.swift in Sources */, 56CEB5561EAA359A00BFAF62 /* SQLExpression.swift in Sources */, 5674A6F91F307F600095F066 /* EncodableRecord+Encodable.swift in Sources */, 566475D61D981D5E00FF74B8 /* SQLOperators.swift in Sources */, @@ -3199,7 +3192,6 @@ 569D6DDF220EF9E100A058A9 /* SQLInterpolation.swift in Sources */, 56A238821B9C75030082EB20 /* DatabaseError.swift in Sources */, 5653EB0D20944C7C00F46237 /* HasManyAssociation.swift in Sources */, - 567ECE502222E431009245CA /* GRDB-5.0.swift in Sources */, 566AD8B51D5318F4002EC1A8 /* TableDefinition.swift in Sources */, 5698AD241DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift in Sources */, 568ECB1925D9161600B71526 /* SQLSubquery.swift in Sources */, @@ -3717,6 +3709,7 @@ 563B8FC824A1D3B9007A48C9 /* OnDemandFuture.swift in Sources */, AAA4DC7A230F1E0600C74B15 /* QueryInterfaceRequest.swift in Sources */, AAA4DC7B230F1E0600C74B15 /* TableRecord+QueryInterfaceRequest.swift in Sources */, + 566DDE10288D763C0000DCFB /* Fixits.swift in Sources */, AAA4DC7C230F1E0600C74B15 /* SQLExpression.swift in Sources */, AAA4DC7D230F1E0600C74B15 /* EncodableRecord+Encodable.swift in Sources */, AAA4DC7F230F1E0600C74B15 /* SQLOperators.swift in Sources */, @@ -3808,7 +3801,6 @@ AAA4DCD0230F1E0600C74B15 /* SQLInterpolation.swift in Sources */, AAA4DCD1230F1E0600C74B15 /* DatabaseError.swift in Sources */, AAA4DCD2230F1E0600C74B15 /* HasManyAssociation.swift in Sources */, - AAA4DCD3230F1E0600C74B15 /* GRDB-5.0.swift in Sources */, AAA4DCD4230F1E0600C74B15 /* TableDefinition.swift in Sources */, AAA4DCD5230F1E0600C74B15 /* FTS5WrapperTokenizer.swift in Sources */, 568ECB1B25D9161600B71526 /* SQLSubquery.swift in Sources */, @@ -4090,6 +4082,7 @@ 5656A8B02295BFD7001FF3FF /* TableRecord+QueryInterfaceRequest.swift in Sources */, 5613ED4421A95B2C00DC7A68 /* ValueReducer.swift in Sources */, 5636E9BC1D22574100B9B05F /* FetchRequest.swift in Sources */, + 566DDE0D288D763C0000DCFB /* Fixits.swift in Sources */, 56BB6EA91D3009B100A1CA52 /* SchedulingWatchdog.swift in Sources */, 563EF44A2161F179007DAACD /* Inflections.swift in Sources */, 566B91091FA4C3970012D5B0 /* Database+Statements.swift in Sources */, @@ -4176,7 +4169,6 @@ 569D6DDE220EF9E100A058A9 /* SQLInterpolation.swift in Sources */, 568D131F2207213E00674B58 /* SQLQueryGenerator.swift in Sources */, 5605F15D1C672E4000235C62 /* DatabaseDateComponents.swift in Sources */, - 567ECE4F2222E431009245CA /* GRDB-5.0.swift in Sources */, 56894FB72606589700268F4D /* Decimal.swift in Sources */, 56B964B91DA51D0A0002DA19 /* FTS5Pattern.swift in Sources */, 56FBFEDA2210731A00945324 /* SQLRequest.swift in Sources */, diff --git a/GRDB/Core/Database+Schema.swift b/GRDB/Core/Database+Schema.swift index a3d242c3e..2bcfb0a7e 100644 --- a/GRDB/Core/Database+Schema.swift +++ b/GRDB/Core/Database+Schema.swift @@ -126,17 +126,7 @@ extension Database { // > "sqlite_". tableName.starts(with: "sqlite_") || tableName.starts(with: "pragma_") } - - /// Returns whether a table is an internal SQLite table. - /// - /// Those are tables whose name begins with `sqlite_` and `pragma_`. - /// - /// For more information, see - @available(*, deprecated, message: "Use Database.isSQLiteInternalTable(_:) static method instead.") - public func isSQLiteInternalTable(_ tableName: String) -> Bool { - Self.isSQLiteInternalTable(tableName) - } - + /// Returns whether a table is an internal GRDB table. /// /// Those are tables whose name begins with "grdb_". @@ -144,14 +134,6 @@ extension Database { tableName.starts(with: "grdb_") } - /// Returns whether a table is an internal GRDB table. - /// - /// Those are tables whose name begins with "grdb_". - @available(*, deprecated, message: "Use Database.isGRDBInternalTable(_:) static method instead.") - public func isGRDBInternalTable(_ tableName: String) -> Bool { - Self.isGRDBInternalTable(tableName) - } - /// Returns whether a view exists in the main or temp schema. public func viewExists(_ name: String) throws -> Bool { try schemaIdentifiers().contains { diff --git a/GRDB/Core/Database+Statements.swift b/GRDB/Core/Database+Statements.swift index c91d7fe3d..46e135555 100644 --- a/GRDB/Core/Database+Statements.swift +++ b/GRDB/Core/Database+Statements.swift @@ -60,46 +60,6 @@ extension Database { return statement } - /// Returns a new prepared statement that can be reused. - /// - /// let statement = try db.makeSelectStatement(sql: "SELECT * FROM player WHERE id = ?") - /// let player1 = try Player.fetchOne(statement, arguments: [1])! - /// let player2 = try Player.fetchOne(statement, arguments: [2])! - /// - /// - parameter sql: An SQL query. - /// - returns: A Statement. - /// - throws: A DatabaseError whenever SQLite could not parse the sql query. - @available(*, deprecated, renamed: "makeStatement(sql:)") - public func makeSelectStatement(sql: String) throws -> Statement { - try makeStatement(sql: sql) - } - - /// Returns a new prepared statement that can be reused. - /// - /// - parameter sqlLiteral: An `SQL` literal. - /// - returns: A Statement. - /// - throws: A DatabaseError whenever SQLite could not parse the sql query. - /// - precondition: No argument must be set, or all arguments must be set. - /// An error is raised otherwise. - /// - /// // OK - /// try makeSelectStatement(literal: """ - /// SELECT COUNT(*) FROM player WHERE score > ? - /// """) - /// try makeSelectStatement(literal: """ - /// SELECT COUNT(*) FROM player WHERE score > \(1000) - /// """) - /// - /// // NOT OK - /// try makeSelectStatement(literal: """ - /// SELECT COUNT(*) FROM player - /// WHERE color = ? AND score > \(1000) - /// """) - @available(*, deprecated, renamed: "makeStatement(literal:)") - public func makeSelectStatement(literal sqlLiteral: SQL) throws -> Statement { - try makeStatement(literal: sqlLiteral) - } - /// Returns a new prepared statement that can be reused. /// /// let statement = try db.makeStatement(sql: "SELECT COUNT(*) FROM player WHERE score > ?", prepFlags: 0) @@ -202,138 +162,11 @@ extension Database { return statement } - /// Returns a prepared statement that can be reused. - /// - /// let statement = try db.cachedSelectStatement(sql: "SELECT COUNT(*) FROM player WHERE score > ?") - /// let moreThanTwentyCount = try Int.fetchOne(statement, arguments: [20])! - /// let moreThanThirtyCount = try Int.fetchOne(statement, arguments: [30])! - /// - /// The returned statement may have already been used: it may or may not - /// contain values for its eventual arguments. - /// - /// - parameter sql: An SQL query. - /// - returns: A Statement. - /// - throws: A DatabaseError whenever SQLite could not parse the sql query. - @available(*, deprecated, renamed: "cachedStatement(sql:)") - public func cachedSelectStatement(sql: String) throws -> Statement { - try cachedStatement(sql: sql) - } - - /// Returns a prepared statement that can be reused. - /// - /// let statement = try db.cachedSelectStatement(literal: "SELECT COUNT(*) FROM player WHERE score > \(20)") - /// let moreThanTwentyCount = try Int.fetchOne(statement)! - /// - /// - parameter sqlLiteral: An `SQL` literal. - /// - returns: A Statement. - /// - throws: A DatabaseError whenever SQLite could not parse the sql query. - /// - precondition: No argument must be set, or all arguments must be set. - /// An error is raised otherwise. - /// - /// // OK - /// try cachedSelectStatement(literal: """ - /// SELECT COUNT(*) FROM player WHERE score > ? - /// """) - /// try cachedSelectStatement(literal: """ - /// SELECT COUNT(*) FROM player WHERE score > \(1000) - /// """) - /// - /// // NOT OK - /// try cachedSelectStatement(literal: """ - /// SELECT COUNT(*) FROM player - /// WHERE color = ? AND score > \(1000) - /// """) - @available(*, deprecated, renamed: "cachedStatement(literal:)") - public func cachedSelectStatement(literal sqlLiteral: SQL) throws -> Statement { - try cachedStatement(literal: sqlLiteral) - } - /// Returns a cached statement that does not conflict with user's cached statements. func internalCachedStatement(sql: String) throws -> Statement { try internalStatementCache.statement(sql) } - /// Returns a new prepared statement that can be reused. - /// - /// let statement = try db.makeUpdateStatement(sql: "INSERT INTO player (name) VALUES (?)") - /// try statement.execute(arguments: ["Arthur"]) - /// try statement.execute(arguments: ["Barbara"]) - /// - /// - parameter sql: An SQL query. - /// - returns: An UpdateStatement. - /// - throws: A DatabaseError whenever SQLite could not parse the sql query. - @available(*, deprecated, renamed: "makeStatement(sql:)") - public func makeUpdateStatement(sql: String) throws -> Statement { - try makeStatement(sql: sql) - } - - /// Returns a new prepared statement that can be reused. - /// - /// - parameter sqlLiteral: An `SQL` literal. - /// - returns: A Statement. - /// - throws: A DatabaseError whenever SQLite could not parse the sql query. - /// - precondition: No argument must be set, or all arguments must be set. - /// An error is raised otherwise. - /// - /// // OK - /// try makeUpdateStatement(literal: """ - /// UPDATE player SET name = ? - /// """) - /// try makeUpdateStatement(literal: """ - /// UPDATE player SET name = \("O'Brien") - /// """) - /// - /// // NOT OK - /// try makeUpdateStatement(literal: """ - /// UPDATE player SET name = ?, score = \(10) - /// """) - @available(*, deprecated, renamed: "makeStatement(literal:)") - public func makeUpdateStatement(literal sqlLiteral: SQL) throws -> Statement { - try makeStatement(literal: sqlLiteral) - } - - /// Returns a prepared statement that can be reused. - /// - /// let statement = try db.cachedUpdateStatement(sql: "INSERT INTO player (name) VALUES (?)") - /// try statement.execute(arguments: ["Arthur"]) - /// try statement.execute(arguments: ["Barbara"]) - /// - /// The returned statement may have already been used: it may or may not - /// contain values for its eventual arguments. - /// - /// - parameter sql: An SQL query. - /// - returns: A Statement. - /// - throws: A DatabaseError whenever SQLite could not parse the sql query. - @available(*, deprecated, renamed: "cachedStatement(sql:)") - public func cachedUpdateStatement(sql: String) throws -> Statement { - try cachedStatement(sql: sql) - } - - /// Returns a new prepared statement that can be reused. - /// - /// - parameter sqlLiteral: An `SQL` literal. - /// - returns: A Statement. - /// - throws: A DatabaseError whenever SQLite could not parse the sql query. - /// - precondition: No argument must be set, or all arguments must be set. - /// An error is raised otherwise. - /// - /// // OK - /// try cachedUpdateStatement(literal: """ - /// UPDATE player SET name = ? - /// """) - /// try cachedUpdateStatement(literal: """ - /// UPDATE player SET name = \("O'Brien") - /// """) - /// - /// // NOT OK - /// try cachedUpdateStatement(literal: """ - /// UPDATE player SET name = ?, score = \(10) - /// """) - @available(*, deprecated, renamed: "cachedStatement(sql:)") - public func cachedUpdateStatement(literal sqlLiteral: SQL) throws -> Statement { - try cachedStatement(literal: sqlLiteral) - } - /// Returns a cursor of all SQL statements separated by semi-colons. /// /// let statements = try db.allStatements(sql: """ diff --git a/GRDB/Core/DatabaseRegion.swift b/GRDB/Core/DatabaseRegion.swift index 0f134c4ce..cadb45156 100644 --- a/GRDB/Core/DatabaseRegion.swift +++ b/GRDB/Core/DatabaseRegion.swift @@ -55,14 +55,6 @@ public struct DatabaseRegion: CustomStringConvertible, Equatable { /// from all tables. public static let fullDatabase = DatabaseRegion(tableRegions: nil) - // TODO: rename to init(table:) when this initializer is no longer public - /// The region that covers a full database table: all columns and all rows - /// from this table. - static func fullTable(_ table: String) -> DatabaseRegion { - let table = CaseInsensitiveIdentifier(rawValue: table) - return DatabaseRegion(tableRegions: [table: TableRegion(columns: nil, rowIds: nil)]) - } - /// Creates an empty database region. public init() { self.init(tableRegions: [:]) @@ -71,9 +63,9 @@ public struct DatabaseRegion: CustomStringConvertible, Equatable { /// Creates a region that spans all rows and columns of a database table. /// /// - parameter table: A table name. - @available(*, deprecated, message: "In order to specify a table region, prefer `Table(tableName)`") - public init(table: String) { - self = .fullTable(table) + init(table: String) { + let table = CaseInsensitiveIdentifier(rawValue: table) + self.init(tableRegions: [table: TableRegion(columns: nil, rowIds: nil)]) } /// Full columns in a table: (some columns in a table) × (all rows) diff --git a/GRDB/Core/Statement.swift b/GRDB/Core/Statement.swift index a994296a1..c6120e06f 100644 --- a/GRDB/Core/Statement.swift +++ b/GRDB/Core/Statement.swift @@ -358,12 +358,6 @@ public final class Statement { } } -@available(*, deprecated, renamed: "Statement") -public typealias SelectStatement = Statement - -@available(*, deprecated, renamed: "Statement") -public typealias UpdateStatement = Statement - extension Statement: CustomStringConvertible { public var description: String { SchedulingWatchdog.allows(database) ? sql : "Statement" diff --git a/GRDB/Core/StatementAuthorizer.swift b/GRDB/Core/StatementAuthorizer.swift index 8f3cbbf00..255dc0a56 100644 --- a/GRDB/Core/StatementAuthorizer.swift +++ b/GRDB/Core/StatementAuthorizer.swift @@ -74,7 +74,7 @@ final class StatementAuthorizer { guard let columnName = cString2.map(String.init) else { return SQLITE_OK } if columnName.isEmpty { // SELECT COUNT(*) FROM table - selectedRegion.formUnion(DatabaseRegion.fullTable(tableName)) + selectedRegion.formUnion(DatabaseRegion(table: tableName)) } else { // SELECT column FROM table selectedRegion.formUnion(DatabaseRegion(table: tableName, columns: [columnName])) diff --git a/GRDB/Core/TransactionObserver.swift b/GRDB/Core/TransactionObserver.swift index ffdd7cf02..be77b89db 100644 --- a/GRDB/Core/TransactionObserver.swift +++ b/GRDB/Core/TransactionObserver.swift @@ -901,9 +901,9 @@ public enum DatabaseEventKind { var modifiedRegion: DatabaseRegion { switch self { case let .delete(tableName): - return DatabaseRegion.fullTable(tableName) + return DatabaseRegion(table: tableName) case let .insert(tableName): - return DatabaseRegion.fullTable(tableName) + return DatabaseRegion(table: tableName) case let .update(tableName, updatedColumnNames): return DatabaseRegion(table: tableName, columns: updatedColumnNames) } diff --git a/GRDB/FTS/FTS3.swift b/GRDB/FTS/FTS3.swift index 3dd31a534..f36a73f63 100644 --- a/GRDB/FTS/FTS3.swift +++ b/GRDB/FTS/FTS3.swift @@ -79,14 +79,6 @@ public struct FTS3: VirtualTableModule { /// The virtual table module name public let moduleName = "fts3" - // TODO: remove when `makeTableDefinition()` is no longer a requirement - /// Reserved; part of the VirtualTableModule protocol. - /// - /// See Database.create(virtualTable:using:) - public func makeTableDefinition() -> FTS3TableDefinition { - preconditionFailure() - } - /// Reserved; part of the VirtualTableModule protocol. /// /// See Database.create(virtualTable:using:) diff --git a/GRDB/FTS/FTS4.swift b/GRDB/FTS/FTS4.swift index 6166bfad5..726e4c442 100644 --- a/GRDB/FTS/FTS4.swift +++ b/GRDB/FTS/FTS4.swift @@ -25,14 +25,6 @@ public struct FTS4: VirtualTableModule { /// The virtual table module name public let moduleName = "fts4" - // TODO: remove when `makeTableDefinition()` is no longer a requirement - /// Reserved; part of the VirtualTableModule protocol. - /// - /// See Database.create(virtualTable:using:) - public func makeTableDefinition() -> FTS4TableDefinition { - preconditionFailure() - } - /// Reserved; part of the VirtualTableModule protocol. /// /// See Database.create(virtualTable:using:) diff --git a/GRDB/FTS/FTS5.swift b/GRDB/FTS/FTS5.swift index 3669a52d4..90b3c47a2 100644 --- a/GRDB/FTS/FTS5.swift +++ b/GRDB/FTS/FTS5.swift @@ -76,14 +76,6 @@ public struct FTS5: VirtualTableModule { /// The virtual table module name public let moduleName = "fts5" - // TODO: remove when `makeTableDefinition()` is no longer a requirement - /// Reserved; part of the VirtualTableModule protocol. - /// - /// See Database.create(virtualTable:using:) - public func makeTableDefinition() -> FTS5TableDefinition { - preconditionFailure() - } - /// Reserved; part of the VirtualTableModule protocol. /// /// See Database.create(virtualTable:using:) diff --git a/GRDB/Fixit/GRDB-5.0.swift b/GRDB/Fixit/GRDB-5.0.swift deleted file mode 100644 index e8f8f36ce..000000000 --- a/GRDB/Fixit/GRDB-5.0.swift +++ /dev/null @@ -1,542 +0,0 @@ -// Fixits for changes introduced by GRDB 5.0.0 -// swiftlint:disable all - -import Dispatch -#if os(iOS) -import UIKit -#endif - -extension AnyFetchRequest { - @available(*, unavailable, renamed: "RowDecoder") - typealias T = RowDecoder - - @available(*, unavailable, message: "Use AnyFetchRequest(request).asRequest(of: SomeType.self) instead.") - public init(_ request: Request) - { preconditionFailure() } - - @available(*, unavailable, message: "Define your own FetchRequest type instead.") - public init(_ prepare: @escaping (Database, _ singleResult: Bool) throws -> (Statement, RowAdapter?)) - { preconditionFailure() } -} - -@available(*, unavailable, message: "Custom reducers are no longer supported. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") -public struct AnyValueReducer: ValueReducer { - public init(fetch: @escaping (Database) throws -> Fetched, value: @escaping (Fetched) -> Value?) - { preconditionFailure() } - - public init(_ reducer: Base) where Base.Fetched == Fetched, Base.Value == Value - { preconditionFailure() } - - public func _fetch(_ db: Database) throws -> Fetched - { preconditionFailure() } - - public func _value(_ fetched: Fetched) -> Value? - { preconditionFailure() } -} - -extension AssociationAggregate { - @available(*, unavailable, renamed: "forKey(_:)") - public func aliased(_ name: String) -> AssociationAggregate - { preconditionFailure() } - - @available(*, unavailable, renamed: "forKey(_:)") - public func aliased(_ key: CodingKey) -> AssociationAggregate - { preconditionFailure() } -} - -extension Configuration { - @available(*, unavailable, message: "Replace the assignment with a method call: prepareDatabase { db in ... }") - public var prepareDatabase: ((Database) throws -> Void)? { - get { preconditionFailure() } - set { preconditionFailure() } - } - - @available(*, unavailable, message: "Use Database.trace(options:_:) in Configuration.prepareDatabase instead.") - public var trace: TraceFunction? { - get { preconditionFailure() } - set { preconditionFailure() } - } -} - -extension DatabaseFunction { - @available(*, unavailable, renamed: "callAsFunction(_:)") - public func apply(_ arguments: SQLExpressible...) -> SQLExpression - { preconditionFailure() } -} - -extension DatabaseMigrator { - @available(*, unavailable, renamed: "registerMigration(_:migrate:)") - public mutating func registerMigrationWithDeferredForeignKeyCheck( - _ identifier: String, - migrate: @escaping (Database) throws -> Void) - { preconditionFailure() } - - @available(*, unavailable, message: "Wrap this method: reader.read(migrator.appliedMigrations) }") - public func appliedMigrations(in reader: DatabaseReader) throws -> Set - { preconditionFailure() } - - @available(*, unavailable, message: "Wrap this method: reader.read(migrator.hasCompletedMigrations) }") - public func hasCompletedMigrations(in reader: DatabaseReader) throws -> Bool - { preconditionFailure() } - - @available(*, unavailable, message: "Prefer reader.read(migrator.completedMigrations).contains(targetIdentifier)") - public func hasCompletedMigrations(in reader: DatabaseReader, through targetIdentifier: String) throws -> Bool - { preconditionFailure() } - - @available(*, unavailable, message: "Prefer reader.read(migrator.completedMigrations).last") - public func lastCompletedMigration(in reader: DatabaseReader) throws -> String? - { preconditionFailure() } -} - -extension DatabasePool { - @available(*, unavailable, message: "Use pool.writeWithoutTransaction { $0.checkpoint() } instead") - public func checkpoint(_ kind: Database.CheckpointMode = .passive) throws { preconditionFailure() } - - #if os(iOS) - @available(*, unavailable, message: "Memory management is now enabled by default. This method does nothing.") - public func setupMemoryManagement(in application: UIApplication) { preconditionFailure() } - #endif -} - -extension DatabaseQueue { - #if os(iOS) - @available(*, unavailable, message: "Memory management is now enabled by default. This method does nothing.") - public func setupMemoryManagement(in application: UIApplication) { preconditionFailure() } - #endif -} - -extension DatabaseReader { - @available(*, unavailable, message: "Use Database.add(collation:) in Configuration.prepareDatabase instead.") - public func add(collation: DatabaseCollation) { preconditionFailure() } - - @available(*, unavailable) - public func remove(collation: DatabaseCollation) { preconditionFailure() } - - @available(*, unavailable, message: "Use Database.add(function:) in Configuration.prepareDatabase instead.") - public func add(function: DatabaseFunction) { preconditionFailure() } - - @available(*, unavailable) - public func remove(function: DatabaseFunction) { preconditionFailure() } - - #if SQLITE_ENABLE_FTS5 - @available(*, unavailable, message: "Use Database.add(tokenizer:) in Configuration.prepareDatabase instead.") - public func add(tokenizer: Tokenizer.Type) { preconditionFailure() } - #endif -} - -extension FetchRequest { - @available(*, unavailable, message: "Use makePreparedRequest(_:forSingleResult:) instead.") - func prepare(_ db: Database, forSingleResult singleResult: Bool) throws -> (Statement, RowAdapter?) - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(request.fetchCount) instead") - public func observationForCount() -> ValueObservation> - { preconditionFailure() } -} - -extension FetchRequest where RowDecoder: DatabaseValueConvertible { - @available(*, unavailable, message: "Use ValueObservation.tracking(request.fetchAll) instead") - public func observationForAll() -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(request.fetchOne) instead") - public func observationForFirst() -> ValueObservation> - { preconditionFailure() } -} - -extension FetchRequest where RowDecoder: FetchableRecord { - @available(*, unavailable, message: "Use ValueObservation.tracking(request.fetchAll) instead") - public func observationForAll() -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(request.fetchOne) instead") - public func observationForFirst() -> ValueObservation> - { preconditionFailure() } -} - -extension FetchRequest where RowDecoder: _OptionalProtocol, RowDecoder.Wrapped: DatabaseValueConvertible { - @available(*, unavailable, message: "Use ValueObservation.tracking(request.fetchAll) instead") - public func observationForAll() -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(request.fetchOne) instead") - public func observationForFirst() -> ValueObservation> - { preconditionFailure() } -} - -extension FetchRequest where RowDecoder == Row { - @available(*, unavailable, message: "Use ValueObservation.tracking(request.fetchAll) instead") - public func observationForAll() -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(request.fetchOne) instead") - public func observationForFirst() -> ValueObservation> - { preconditionFailure() } -} - -extension QueryInterfaceRequest { - @available(*, unavailable, renamed: "RowDecoder") - typealias T = RowDecoder -} - -extension SQLExpression { - @available(*, unavailable, message: "Use SQL initializer instead") - public var sqlLiteral: SQL - { preconditionFailure() } -} - -extension FilteredRequest { - @available(*, unavailable, message: "The expectingSingleResult() hint is no longer available.") - func expectingSingleResult() -> Self - { preconditionFailure() } -} - -@available(*, deprecated, renamed: "SQL") -public typealias SQLLiteral = SQL - -/// :nodoc: -@available(*, unavailable, message: "Build literal expressions with SQL.sqlExpression instead.") -struct SQLExpressionLiteral: SQLSpecificExpressible { - var sqlExpression: SQLExpression { preconditionFailure() } - - @available(*, unavailable, message: "Build literal expressions with SQL.sqlExpression instead.") - public var sql: String { preconditionFailure() } - - @available(*, unavailable, message: "Build literal expressions with SQL.sqlExpression instead.") - public var arguments: StatementArguments { preconditionFailure() } - - @available(*, unavailable, message: "Build literal expressions with SQL.sqlExpression instead.") - public init(sql: String, arguments: StatementArguments = StatementArguments()) - { preconditionFailure() } - - @available(*, unavailable, message: "Build literal expressions with SQL.sqlExpression instead.") - public init(literal sqlLiteral: SQL) - { preconditionFailure() } -} - -@available(*, deprecated, renamed: "SQL") -public typealias SQLiteral = SQL - -extension SQL { - @available(*, unavailable, message: "Use SQL interpolation instead.") - public func mapSQL(_ transform: @escaping (String) -> String) -> SQL - { preconditionFailure() } - - @available(*, unavailable, message: "Use the build(_:) method instead.") - public var sql: String { preconditionFailure() } - - @available(*, unavailable, message: "Use the build(_:) method instead.") - public var arguments: StatementArguments { preconditionFailure() } -} - -@available(*, unavailable, renamed: "SQLExpression.AssociativeBinaryOperator") -typealias SQLLogicalBinaryOperator = SQLExpression.AssociativeBinaryOperator - -@available(*, deprecated, renamed: "SQLExpression") -typealias SQLCollatedExpression = SQLExpression - -extension SQLRequest { - @available(*, unavailable, renamed: "RowDecoder") - typealias T = RowDecoder - - @available(*, unavailable, message: "Turning a request into SQLRequest is no longer supported.") - public init( - _ db: Database, - request: Request, - cached: Bool = false) - throws - where Request: FetchRequest, Request.RowDecoder == RowDecoder - { preconditionFailure() } - - @available(*, unavailable, message: "Use makePreparedRequest(db).statement.sql instead") - public var sql: String { preconditionFailure() } - - @available(*, unavailable, message: "Use makePreparedRequest(db).statement.arguments instead") - public var arguments: StatementArguments { preconditionFailure() } -} - -extension SQLSpecificExpressible { - @available(*, unavailable, renamed: "forKey(_:)") - public func aliased(_ name: String) -> SQLSelectable - { preconditionFailure() } - - @available(*, unavailable, renamed: "forKey(_:)") - public func aliased(_ key: CodingKey) -> SQLSelectable - { preconditionFailure() } -} - -extension Statement { - @available(*, unavailable, renamed: "setUncheckedArguments(_:)") - public func unsafeSetArguments(_ arguments: StatementArguments) - { preconditionFailure() } - - @available(*, unavailable, renamed: "validateArguments(_:)") - public func validate(arguments: StatementArguments) throws - { preconditionFailure() } -} - -extension TableRecord { - @available(*, unavailable, message: "Use ValueObservation.tracking(MyRecord.fetchCount) instead") - public static func observationForCount() -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use SQL interpolation instead") - public static func selectionSQL(alias: String? = nil) -> String - { preconditionFailure() } -} - -extension TableRecord where Self: FetchableRecord { - @available(*, unavailable, message: "Use ValueObservation.tracking(MyRecord.fetchAll) instead") - public static func observationForAll() -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(MyRecord.fetchOne) instead") - public static func observationForFirst() -> ValueObservation> - { preconditionFailure() } -} - -@available(*, unavailable) -public typealias TraceFunction = (String) -> Void - -extension ValueObservation { - @available(*, unavailable, message: "ValueObservation now schedules its values asynchronously on the main queue by default. See ValueObservation.start() for possible configuration") - var scheduling: ValueScheduling { - get { preconditionFailure() } - set { preconditionFailure() } - } - - @available(*, unavailable, message: "Custom reducers are no longer supported. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public static func tracking(_ regions: DatabaseRegionConvertible..., reducer: @escaping (Database) throws -> Reducer) -> ValueObservation - { preconditionFailure() } - - @available(*, unavailable, message: "Custom reducers are no longer supported. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public static func tracking(_ regions: [DatabaseRegionConvertible], reducer: @escaping (Database) throws -> Reducer) -> ValueObservation - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public func combine( - _ other: ValueObservation, - _ transform: @escaping (Reducer.Value, R1.Value) -> Combined) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public func combine( - _ observation1: ValueObservation, - _ observation2: ValueObservation, - _ transform: @escaping (Reducer.Value, R1.Value, R2.Value) -> Combined) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public func combine( - _ observation1: ValueObservation, - _ observation2: ValueObservation, - _ observation3: ValueObservation, - _ transform: @escaping (Reducer.Value, R1.Value, R2.Value, R3.Value) -> Combined) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public func combine( - _ observation1: ValueObservation, - _ observation2: ValueObservation, - _ observation3: ValueObservation, - _ observation4: ValueObservation, - _ transform: @escaping (Reducer.Value, R1.Value, R2.Value, R3.Value, R4.Value) -> Combined) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "compactMap is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public func compactMap(_ transform: @escaping (Reducer.Value) -> T?) -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use start(in:onError:onChange:) instead.") - public func start( - in reader: DatabaseReader, - onChange: @escaping (Reducer.Value) -> Void) throws -> TransactionObserver - { preconditionFailure() } -} - -extension ValueObservation where Reducer == ValueReducers.Auto { - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public static func combine( - _ o1: ValueObservation, - _ o2: ValueObservation) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public static func combine( - _ o1: ValueObservation, - _ o2: ValueObservation, - _ o3: ValueObservation) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public static func combine( - _ o1: ValueObservation, - _ o2: ValueObservation, - _ o3: ValueObservation, - _ o4: ValueObservation) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public static func combine( - _ o1: ValueObservation, - _ o2: ValueObservation, - _ o3: ValueObservation, - _ o4: ValueObservation, - _ o5: ValueObservation) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public static func combine( - _ o1: ValueObservation, - _ o2: ValueObservation, - _ o3: ValueObservation, - _ o4: ValueObservation, - _ o5: ValueObservation, - _ o6: ValueObservation) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public static func combine( - _ o1: ValueObservation, - _ o2: ValueObservation, - _ o3: ValueObservation, - _ o4: ValueObservation, - _ o5: ValueObservation, - _ o6: ValueObservation, - _ o7: ValueObservation) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.") - public static func combine( - _ o1: ValueObservation, - _ o2: ValueObservation, - _ o3: ValueObservation, - _ o4: ValueObservation, - _ o5: ValueObservation, - _ o6: ValueObservation, - _ o7: ValueObservation, - _ o8: ValueObservation) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func trackingCount(_ request: Request) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func trackingAll(_ request: Request) - -> ValueObservation> - where Request.RowDecoder: DatabaseValueConvertible - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func trackingOne(_ request: Request) - -> ValueObservation> - where Request.RowDecoder: DatabaseValueConvertible - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func trackingAll(_ request: Request) - -> ValueObservation> - where Request.RowDecoder: _OptionalProtocol, - Request.RowDecoder.Wrapped: DatabaseValueConvertible - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func trackingAll(_ request: Request) - -> ValueObservation> - where Request.RowDecoder: FetchableRecord - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func trackingOne(_ request: Request) -> - ValueObservation> - where Request.RowDecoder: FetchableRecord - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func trackingAll(_ request: Request) - -> ValueObservation> - where Request.RowDecoder == Row - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func trackingOne(_ request: Request) - -> ValueObservation> - where Request.RowDecoder == Row - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func tracking( - _ regions: DatabaseRegionConvertible..., - fetch: @escaping (Database) throws -> Value) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, message: "Use ValueObservation.tracking(_:) instead") - public static func tracking( - _ regions: [DatabaseRegionConvertible], - fetch: @escaping (Database) throws -> Value) - -> ValueObservation> - { preconditionFailure() } - - @available(*, unavailable, renamed: "tracking(_:)") - public static func tracking( - value: @escaping (Database) throws -> Value) - -> ValueObservation> - { preconditionFailure() } -} - -extension ValueObservation where Reducer.Value: Equatable { - @available(*, unavailable, renamed: "removeDuplicates") - public func distinctUntilChanged() -> ValueObservation> - { preconditionFailure() } -} - -extension ValueReducers { - @available(*, unavailable) - public enum Unavailable: ValueReducer { - public func _fetch(_ db: Database) throws -> Never - { preconditionFailure() } - - public mutating func _value(_ fetched: Never) -> T? { } - } -} - -@available(*, unavailable, message: "ValueObservation now schedules its values asynchronously on the main queue by default. See ValueObservation.start() for possible configuration") -enum ValueScheduling { - case mainQueue - case async(onQueue: DispatchQueue, startImmediately: Bool) - case unsafe(startImmediately: Bool) -} - -#if SQLITE_HAS_CODEC -extension Configuration { - @available(*, unavailable, message: "Use Database.usePassphrase(_:) in Configuration.prepareDatabase instead.") - public var passphrase: String? { - get { preconditionFailure() } - set { preconditionFailure() } - } -} - -extension DatabasePool { - @available(*, unavailable, message: "Use Database.changePassphrase(_:) instead") - public func change(passphrase: String) throws { preconditionFailure() } -} - -extension DatabaseQueue { - @available(*, unavailable, message: "Use Database.changePassphrase(_:) instead") - public func change(passphrase: String) throws { preconditionFailure() } -} -#endif diff --git a/GRDB/Fixits.swift b/GRDB/Fixits.swift new file mode 100644 index 000000000..333bbb559 --- /dev/null +++ b/GRDB/Fixits.swift @@ -0,0 +1,57 @@ +// Fixits for changes introduced by GRDB 6.0.0 +// swiftlint:disable all + +extension Database { + @available(*, unavailable, renamed: "cachedStatement(sql:)") + public func cachedSelectStatement(sql: String) throws -> Statement { preconditionFailure() } + + @available(*, unavailable, renamed: "cachedStatement(literal:)") + public func cachedSelectStatement(literal sqlLiteral: SQL) throws -> Statement { preconditionFailure() } + + @available(*, unavailable, renamed: "cachedStatement(sql:)") + public func cachedUpdateStatement(sql: String) throws -> Statement { preconditionFailure() } + + @available(*, unavailable, renamed: "cachedStatement(sql:)") + public func cachedUpdateStatement(literal sqlLiteral: SQL) throws -> Statement { preconditionFailure() } + + @available(*, unavailable, message: "Use Database.isSQLiteInternalTable(_:) static method instead.") + public func isSQLiteInternalTable(_ tableName: String) -> Bool { preconditionFailure() } + + @available(*, unavailable, message: "Use Database.isGRDBInternalTable(_:) static method instead.") + public func isGRDBInternalTable(_ tableName: String) -> Bool { preconditionFailure() } + + @available(*, unavailable, renamed: "makeStatement(sql:)") + public func makeSelectStatement(sql: String) throws -> Statement { preconditionFailure() } + + @available(*, unavailable, renamed: "makeStatement(literal:)") + public func makeSelectStatement(literal sqlLiteral: SQL) throws -> Statement { preconditionFailure() } + + @available(*, unavailable, renamed: "makeStatement(sql:)") + public func makeUpdateStatement(sql: String) throws -> Statement { preconditionFailure() } + + @available(*, unavailable, renamed: "makeStatement(literal:)") + public func makeUpdateStatement(literal sqlLiteral: SQL) throws -> Statement { preconditionFailure() } +} + +extension DatabaseUUIDEncodingStrategy { + @available(*, unavailable, renamed: "uppercaseString") + public static var string: Self { preconditionFailure() } +} + +@available(*, unavailable, renamed: "Statement") +public typealias SelectStatement = Statement + +@available(*, unavailable, renamed: "SQLExpression.AssociativeBinaryOperator") +public typealias SQLAssociativeBinaryOperator = SQLExpression.AssociativeBinaryOperator + +@available(*, unavailable, renamed: "Statement") +public typealias UpdateStatement = Statement + +extension ValueObservation where Reducer == ValueReducers.Auto { + @available(*, unavailable, renamed: "tracking(_:)") + public static func trackingVaryingRegion( + _ fetch: @escaping (Database) throws -> Value) + -> ValueObservation> + { preconditionFailure() } +} + diff --git a/GRDB/QueryInterface/Request/Association/AssociationAggregate.swift b/GRDB/QueryInterface/Request/Association/AssociationAggregate.swift index b442506ae..135c0bc8f 100644 --- a/GRDB/QueryInterface/Request/Association/AssociationAggregate.swift +++ b/GRDB/QueryInterface/Request/Association/AssociationAggregate.swift @@ -45,34 +45,6 @@ extension AssociationToMany { .forKey("hasNo\(key.singularizedName.uppercasingFirstCharacter)") } - /// Creates an aggregate which evaluate to the average value of the given - /// expression in associated records. - /// - /// When the averaged expression is a column, the aggregate has a default - /// name which is "average[Key][Column]", where key is the key of the - /// association. For example: - /// - /// For example: - /// - /// struct TeamInfo: FetchableRecord, Decodable { - /// var team: Team - /// var averagePlayerScore: Double - /// } - /// 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) - @available(*, deprecated, message: "Did you mean average(Column(...))? If not, prefer average(value.databaseValue) instead.") // swiftlint:disable:this line_length - public func average(_ expression: SQLExpressible) -> AssociationAggregate { - let aggregate = makeAggregate(.aggregate("AVG", [expression.sqlExpression])) - if let column = expression as? ColumnExpression { - let name = key.singularizedName - return aggregate.forKey("average\(name.uppercasingFirstCharacter)\(column.name.uppercasingFirstCharacter)") - } else { - return aggregate - } - } - /// Creates an aggregate which evaluate to the average value of the given /// expression in associated records. /// @@ -100,34 +72,6 @@ extension AssociationToMany { } } - /// Creates an aggregate which evaluate to the maximum value of the given - /// expression in associated records. - /// - /// When the maximized expression is a column, the aggregate has a default - /// name which is "maximum[Key][Column]", where key is the key of the - /// association. For example: - /// - /// For example: - /// - /// struct TeamInfo: FetchableRecord, Decodable { - /// var team: Team - /// var maxPlayerScore: Double - /// } - /// 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) - @available(*, deprecated, message: "Did you mean max(Column(...))? If not, prefer max(value.databaseValue) instead.") // swiftlint:disable:this line_length - public func max(_ expression: SQLExpressible) -> AssociationAggregate { - let aggregate = makeAggregate(.aggregate("MAX", [expression.sqlExpression])) - if let column = expression as? ColumnExpression { - let name = key.singularizedName - return aggregate.forKey("max\(name.uppercasingFirstCharacter)\(column.name.uppercasingFirstCharacter)") - } else { - return aggregate - } - } - /// Creates an aggregate which evaluate to the maximum value of the given /// expression in associated records. /// @@ -155,34 +99,6 @@ extension AssociationToMany { } } - /// Creates an aggregate which evaluate to the minimum value of the given - /// expression in associated records. - /// - /// When the minimized expression is a column, the aggregate has a default - /// name which is "minimum[Key][Column]", where key is the key of the - /// association. For example: - /// - /// For example: - /// - /// struct TeamInfo: FetchableRecord, Decodable { - /// var team: Team - /// var minPlayerScore: Double - /// } - /// 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) - @available(*, deprecated, message: "Did you mean min(Column(...))? If not, prefer min(value.databaseValue) instead.") // swiftlint:disable:this line_length - public func min(_ expression: SQLExpressible) -> AssociationAggregate { - let aggregate = makeAggregate(.aggregate("MIN", [expression.sqlExpression])) - if let column = expression as? ColumnExpression { - let name = key.singularizedName - return aggregate.forKey("min\(name.uppercasingFirstCharacter)\(column.name.uppercasingFirstCharacter)") - } else { - return aggregate - } - } - /// Creates an aggregate which evaluate to the minimum value of the given /// expression in associated records. /// @@ -210,37 +126,6 @@ extension AssociationToMany { } } - /// Creates an aggregate which evaluate to the sum of the given expression - /// in associated records. - /// - /// When the summed expression is a column, the aggregate has a default - /// name which is "[key][Column]Sum", where key is the key of the - /// association. For example: - /// - /// For example: - /// - /// struct TeamInfo: FetchableRecord, Decodable { - /// var team: Team - /// var playerScoreSum: Double - /// } - /// 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) - /// - /// This aggregate invokes the `SUM` SQL function. See also `total(_:)`, and - /// . - @available(*, deprecated, message: "Did you mean sum(Column(...))? If not, prefer sum(value.databaseValue) instead.") // swiftlint:disable:this line_length - public func sum(_ expression: SQLExpressible) -> AssociationAggregate { - let aggregate = makeAggregate(.aggregate("SUM", [expression.sqlExpression])) - if let column = expression as? ColumnExpression { - let name = key.singularizedName - return aggregate.forKey("\(name)\(column.name.uppercasingFirstCharacter)Sum") - } else { - return aggregate - } - } - /// Creates an aggregate which evaluate to the sum of the given expression /// in associated records. /// diff --git a/GRDB/QueryInterface/Request/RequestProtocols.swift b/GRDB/QueryInterface/Request/RequestProtocols.swift index 90ef03457..782ac2109 100644 --- a/GRDB/QueryInterface/Request/RequestProtocols.swift +++ b/GRDB/QueryInterface/Request/RequestProtocols.swift @@ -150,17 +150,6 @@ public protocol FilteredRequest { } extension FilteredRequest { - /// Creates a request with the provided *predicate* added to the - /// eventual set of already applied predicates. - /// - /// // SELECT * FROM player WHERE 0 - /// var request = Player.all() - /// request = request.filter(false) - @available(*, deprecated, message: "Did you mean filter(id:) or filter(key:)? If not, prefer filter(value.databaseValue) instead. See also none().") // swiftlint:disable:this line_length - public func filter(_ predicate: SQLExpressible) -> Self { - filter { _ in predicate } - } - // Accept SQLSpecificExpressible instead of SQLExpressible, so that we // prevent the `Player.filter(42)` misuse. // See https://github.com/groue/GRDB.swift/pull/864 diff --git a/GRDB/QueryInterface/SQL/SQLExpression.swift b/GRDB/QueryInterface/SQL/SQLExpression.swift index d65258e86..72696c126 100644 --- a/GRDB/QueryInterface/SQL/SQLExpression.swift +++ b/GRDB/QueryInterface/SQL/SQLExpression.swift @@ -370,9 +370,6 @@ public struct SQLExpression { } } -@available(*, deprecated, renamed: "SQLExpression.AssociativeBinaryOperator") -public typealias SQLAssociativeBinaryOperator = SQLExpression.AssociativeBinaryOperator - // MARK: - Creating Expressions extension SQLExpression { diff --git a/GRDB/QueryInterface/SQL/SQLFunctions.swift b/GRDB/QueryInterface/SQL/SQLFunctions.swift index d491eabfb..d2acfc445 100644 --- a/GRDB/QueryInterface/SQL/SQLFunctions.swift +++ b/GRDB/QueryInterface/SQL/SQLFunctions.swift @@ -22,17 +22,6 @@ public func average(_ value: SQLSpecificExpressible) -> SQLExpression { // MARK: - COUNT(...) -/// Returns an expression that evaluates the `COUNT` SQL function. -/// -/// // COUNT(email) -/// count(Column("email")) -/// -/// :nodoc: -@available(*, deprecated) -public func count(_ counted: SQLSelectable) -> SQLExpression { - counted.sqlSelection.countExpression -} - /// Returns an expression that evaluates the `COUNT` SQL function. /// /// // COUNT(email) diff --git a/GRDB/QueryInterface/SQL/SQLSelection.swift b/GRDB/QueryInterface/SQL/SQLSelection.swift index cd6655582..e37707cb1 100644 --- a/GRDB/QueryInterface/SQL/SQLSelection.swift +++ b/GRDB/QueryInterface/SQL/SQLSelection.swift @@ -74,25 +74,6 @@ extension SQLSelection { } } - /// TODO: remove when `count(_ counted: SQLSelectable)` is removed. - var countExpression: SQLExpression { - switch impl { - case .allColumns: - return .countAll - - case .qualifiedAllColumns: - // COUNT(player.*) is not valid SQL - fatalError("Uncountable selection") - - case let .expression(expression), - let .aliasedExpression(expression, _): - return .count(expression) - - case let .literal(sqlLiteral): - return .count(sqlLiteral.sqlExpression) - } - } - /// If the selection can be counted, return how to count it. func count(distinct: Bool) -> SQLCount? { switch impl { diff --git a/GRDB/QueryInterface/SQL/Table.swift b/GRDB/QueryInterface/SQL/Table.swift index b17dcdfd4..722937b6a 100644 --- a/GRDB/QueryInterface/SQL/Table.swift +++ b/GRDB/QueryInterface/SQL/Table.swift @@ -35,7 +35,7 @@ extension Table where RowDecoder == Row { extension Table: DatabaseRegionConvertible { public func databaseRegion(_ db: Database) throws -> DatabaseRegion { - DatabaseRegion.fullTable(tableName) + DatabaseRegion(table: tableName) } } diff --git a/GRDB/QueryInterface/Schema/VirtualTableModule.swift b/GRDB/QueryInterface/Schema/VirtualTableModule.swift index cb6c53f90..3b34dc29d 100644 --- a/GRDB/QueryInterface/Schema/VirtualTableModule.swift +++ b/GRDB/QueryInterface/Schema/VirtualTableModule.swift @@ -21,18 +21,6 @@ public protocol VirtualTableModule { /// The name of the module. var moduleName: String { get } - // TODO: remove this requirement - /// Returns a table definition that is passed as the closure argument in the - /// `Database.create(virtualTable:using:)` method: - /// - /// try db.create(virtualTable: "item", using: module) { t in - /// // t is the result of makeTableDefinition() - /// } - /// - /// - warning: This method is DEPRECATED. Define - /// `makeTableDefinition(configuration:)` instead. - func makeTableDefinition() -> TableDefinition - /// Returns a table definition that is passed as the closure argument in the /// `Database.create(virtualTable:using:)` method: /// @@ -49,14 +37,6 @@ public protocol VirtualTableModule { func database(_ db: Database, didCreate tableName: String, using definition: TableDefinition) throws } -extension VirtualTableModule { - // Support for VirtualTableModule types defined by users - // TODO: remove when `makeTableDefinition()` is no longer a requirement - public func makeTableDefinition(configuration: VirtualTableConfiguration) -> TableDefinition { - makeTableDefinition() - } -} - public struct VirtualTableConfiguration { /// If true, existing objects must not be replaced, or generate any error /// (even if they do not match the objects that would be created otherwise.) diff --git a/GRDB/QueryInterface/TableRecord+QueryInterfaceRequest.swift b/GRDB/QueryInterface/TableRecord+QueryInterfaceRequest.swift index 78ce4f920..5fdf6e7f1 100644 --- a/GRDB/QueryInterface/TableRecord+QueryInterfaceRequest.swift +++ b/GRDB/QueryInterface/TableRecord+QueryInterfaceRequest.swift @@ -150,15 +150,6 @@ extension TableRecord { all().annotated(with: selection) } - /// Creates a request with the provided *predicate*. - /// - /// // SELECT * FROM player WHERE email = 'arthur@example.com' - /// let request = Player.filter(Column("email") == "arthur@example.com") - @available(*, deprecated, message: "Did you mean filter(id:) or filter(key:)? If not, prefer filter(value.databaseValue) instead. See also none().") // swiftlint:disable:this line_length - public static func filter(_ predicate: SQLExpressible) -> QueryInterfaceRequest { - all().filter(predicate.sqlExpression) - } - // Accept SQLSpecificExpressible instead of SQLExpressible, so that we // prevent the `Player.filter(42)` misuse. // See https://github.com/groue/GRDB.swift/pull/864 diff --git a/GRDB/Record/EncodableRecord.swift b/GRDB/Record/EncodableRecord.swift index 1d5a4b685..9ced8258e 100644 --- a/GRDB/Record/EncodableRecord.swift +++ b/GRDB/Record/EncodableRecord.swift @@ -425,10 +425,6 @@ public enum DatabaseUUIDEncodingStrategy { /// Encodes UUIDs as lowercased strings such as "e621e1f8-c36c-495a-93fc-0c247a3e6e5f" case lowercaseString - /// Encodes UUIDs as uppercased strings such as "E621E1F8-C36C-495A-93FC-0C247A3E6E5F" - @available(*, deprecated, renamed: "uppercaseString") - public static var string: Self { .uppercaseString } - func encode(_ uuid: UUID) -> DatabaseValueConvertible { switch self { case .deferredToUUID: diff --git a/GRDB/ValueObservation/ValueObservation.swift b/GRDB/ValueObservation/ValueObservation.swift index 58a469288..33c11b930 100644 --- a/GRDB/ValueObservation/ValueObservation.swift +++ b/GRDB/ValueObservation/ValueObservation.swift @@ -747,30 +747,4 @@ extension ValueObservation where Reducer == ValueReducers.Auto { trackingMode: .nonConstantRegionRecordedFromSelection, makeReducer: { ValueReducers.Fetch(fetch: fetch) }) } - - /// Creates a `ValueObservation` that notifies the values returned by the - /// `fetch` function whenever a database transaction changes them. - /// - /// For example: - /// - /// let observation = ValueObservation.tracking { db in - /// try Player.fetchAll(db) - /// } - /// - /// let cancellable = try observation.start( - /// in: dbQueue, - /// onError: { error in ... }, - /// onChange: { players: [Player] in - /// print("Players have changed") - /// }) - /// - /// - parameter fetch: A function that fetches the observed value from - /// the database. - @available(*, deprecated, renamed: "tracking(_:)") - public static func trackingVaryingRegion( - _ fetch: @escaping (Database) throws -> Value) - -> ValueObservation> - { - tracking(fetch) - } } diff --git a/GRDBCustom.xcodeproj/project.pbxproj b/GRDBCustom.xcodeproj/project.pbxproj index a47819af8..2dbf1478f 100755 --- a/GRDBCustom.xcodeproj/project.pbxproj +++ b/GRDBCustom.xcodeproj/project.pbxproj @@ -35,8 +35,6 @@ 5611626C2576BF9D007AAF99 /* JoinAssociation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561162692576BF9C007AAF99 /* JoinAssociation.swift */; }; 5613ED6121A95E6100DC7A68 /* ValueObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5613ED5921A95E6100DC7A68 /* ValueObservation.swift */; }; 5613ED6221A95E6100DC7A68 /* ValueObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5613ED5921A95E6100DC7A68 /* ValueObservation.swift */; }; - 561408A0221596A100DAD589 /* GRDB-5.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5614089E221596A100DAD589 /* GRDB-5.0.swift */; }; - 561408A1221596A100DAD589 /* GRDB-5.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5614089E221596A100DAD589 /* GRDB-5.0.swift */; }; 5615B258222AE19100061C1C /* AssociationHasOneThroughSQLDerivationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5615B256222AE19100061C1C /* AssociationHasOneThroughSQLDerivationTests.swift */; }; 5615B259222AE19100061C1C /* AssociationHasOneThroughSQLDerivationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5615B256222AE19100061C1C /* AssociationHasOneThroughSQLDerivationTests.swift */; }; 5615B26D222AFEB300061C1C /* AssociationHasOneThroughRowScopeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5615B26C222AFEB300061C1C /* AssociationHasOneThroughRowScopeTests.swift */; }; @@ -330,6 +328,8 @@ 566B91381FA4D3810012D5B0 /* TransactionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */; }; 566BE7152342541F00A8254B /* LockedBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566BE7132342541F00A8254B /* LockedBox.swift */; }; 566BE7162342541F00A8254B /* LockedBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566BE7132342541F00A8254B /* LockedBox.swift */; }; + 566DDE12288D76400000DCFB /* Fixits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566DDE11288D76400000DCFB /* Fixits.swift */; }; + 566DDE13288D76400000DCFB /* Fixits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566DDE11288D76400000DCFB /* Fixits.swift */; }; 5670329B212B5462007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56703299212B5461007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; }; 5670329C212B5462007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56703299212B5461007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; }; 567071F4208A00BE006AD95A /* SQLiteDateParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567071F2208A00BE006AD95A /* SQLiteDateParser.swift */; }; @@ -814,7 +814,6 @@ 560D92461C672C4B00F4F92B /* TableRecord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRecord.swift; sourceTree = ""; }; 561162692576BF9C007AAF99 /* JoinAssociation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JoinAssociation.swift; sourceTree = ""; }; 5613ED5921A95E6100DC7A68 /* ValueObservation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueObservation.swift; sourceTree = ""; }; - 5614089E221596A100DAD589 /* GRDB-5.0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "GRDB-5.0.swift"; sourceTree = ""; }; 5615B256222AE19100061C1C /* AssociationHasOneThroughSQLDerivationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationHasOneThroughSQLDerivationTests.swift; sourceTree = ""; }; 5615B26C222AFEB300061C1C /* AssociationHasOneThroughRowScopeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationHasOneThroughRowScopeTests.swift; sourceTree = ""; }; 5615B277222B109500061C1C /* AssociationHasOneThroughFetchableRecordTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationHasOneThroughFetchableRecordTests.swift; sourceTree = ""; }; @@ -977,6 +976,7 @@ 566B912A1FA4D0CC0012D5B0 /* StatementAuthorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatementAuthorizer.swift; sourceTree = ""; }; 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionObserver.swift; sourceTree = ""; }; 566BE7132342541F00A8254B /* LockedBox.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockedBox.swift; sourceTree = ""; }; + 566DDE11288D76400000DCFB /* Fixits.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fixits.swift; sourceTree = ""; }; 56703299212B5461007D270F /* DatabaseUUIDEncodingStrategyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseUUIDEncodingStrategyTests.swift; sourceTree = ""; }; 567071F2208A00BE006AD95A /* SQLiteDateParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteDateParser.swift; sourceTree = ""; }; 56713FE12691F487006153C3 /* JSONRequiredEncoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONRequiredEncoder.swift; sourceTree = ""; }; @@ -1303,14 +1303,6 @@ path = ValueObservation; sourceTree = ""; }; - 5614089D221596A100DAD589 /* Fixit */ = { - isa = PBXGroup; - children = ( - 5614089E221596A100DAD589 /* GRDB-5.0.swift */, - ); - path = Fixit; - sourceTree = ""; - }; 5614DEEE1BA9D6F9003163B3 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -1966,8 +1958,8 @@ isa = PBXGroup; children = ( 56A2FA3724424F4200E97D23 /* Export.swift */, + 566DDE11288D76400000DCFB /* Fixits.swift */, 56A2386F1B9C75030082EB20 /* Core */, - 5614089D221596A100DAD589 /* Fixit */, 5698AC291D9E5A480056AF8C /* FTS */, 56A238911B9C750B0082EB20 /* Migration */, 5656A8252295BD56001FF3FF /* QueryInterface */, @@ -2320,6 +2312,7 @@ 563B8FBE24A1D388007A48C9 /* OnDemandFuture.swift in Sources */, 5656A85E2295BD56001FF3FF /* VirtualTableModule.swift in Sources */, 5656A8882295BD56001FF3FF /* SQLOperators.swift in Sources */, + 566DDE13288D76400000DCFB /* Fixits.swift in Sources */, 563EF44E2161F196007DAACD /* Inflections.swift in Sources */, 566B910E1FA4C3970012D5B0 /* Database+Statements.swift in Sources */, 5656A8682295BD56001FF3FF /* HasOneAssociation.swift in Sources */, @@ -2416,7 +2409,6 @@ F3BA80331CFB28A4003DC1BA /* PersistableRecord.swift in Sources */, 5656A8802295BD56001FF3FF /* SQLForeignKeyRequest.swift in Sources */, 56B964BE1DA51D0A0002DA19 /* FTS5Pattern.swift in Sources */, - 561408A1221596A100DAD589 /* GRDB-5.0.swift in Sources */, F3BA80211CFB288C003DC1BA /* NSNull.swift in Sources */, 56FBFED72210731100945324 /* SQLRequest.swift in Sources */, 564CE43D21AA955B00652B19 /* ValueConcurrentObserver.swift in Sources */, @@ -2692,6 +2684,7 @@ 563B8FBD24A1D388007A48C9 /* OnDemandFuture.swift in Sources */, 5656A85D2295BD56001FF3FF /* VirtualTableModule.swift in Sources */, 5656A8872295BD56001FF3FF /* SQLOperators.swift in Sources */, + 566DDE12288D76400000DCFB /* Fixits.swift in Sources */, 563EF44D2161F196007DAACD /* Inflections.swift in Sources */, 566B910B1FA4C3970012D5B0 /* Database+Statements.swift in Sources */, 5656A8672295BD56001FF3FF /* HasOneAssociation.swift in Sources */, @@ -2788,7 +2781,6 @@ F3BA808F1CFB2E7A003DC1BA /* PersistableRecord.swift in Sources */, 5656A87F2295BD56001FF3FF /* SQLForeignKeyRequest.swift in Sources */, 56B964BB1DA51D0A0002DA19 /* FTS5Pattern.swift in Sources */, - 561408A0221596A100DAD589 /* GRDB-5.0.swift in Sources */, F3BA807D1CFB2E61003DC1BA /* NSNull.swift in Sources */, 56FBFED62210731100945324 /* SQLRequest.swift in Sources */, 564CE43C21AA955B00652B19 /* ValueConcurrentObserver.swift in Sources */, diff --git a/Tests/GRDBTests/CompilationProtocolTests.swift b/Tests/GRDBTests/CompilationProtocolTests.swift index b0bd21231..1c4f259f5 100644 --- a/Tests/GRDBTests/CompilationProtocolTests.swift +++ b/Tests/GRDBTests/CompilationProtocolTests.swift @@ -153,7 +153,7 @@ private class UserTransactionObserver : TransactionObserver { private struct UserVirtualTableModule1 : VirtualTableModule { struct CustomTableDefinition { } let moduleName = "UserVirtualTableModule1" - func makeTableDefinition() -> CustomTableDefinition { preconditionFailure() } + func makeTableDefinition(configuration: VirtualTableConfiguration) -> CustomTableDefinition { preconditionFailure() } func moduleArguments(for definition: CustomTableDefinition, in db: Database) throws -> [String] { preconditionFailure() } func database(_ db: Database, didCreate tableName: String, using definition: CustomTableDefinition) throws { } } @@ -161,7 +161,7 @@ private struct UserVirtualTableModule1 : VirtualTableModule { private class UserVirtualTableModule2 : VirtualTableModule { struct CustomTableDefinition { } let moduleName = "UserVirtualTableModule2" - func makeTableDefinition() -> CustomTableDefinition { preconditionFailure() } + func makeTableDefinition(configuration: VirtualTableConfiguration) -> CustomTableDefinition { preconditionFailure() } func moduleArguments(for definition: CustomTableDefinition, in db: Database) throws -> [String] { preconditionFailure() } func database(_ db: Database, didCreate tableName: String, using definition: CustomTableDefinition) throws { } } diff --git a/Tests/GRDBTests/DatabaseRegionTests.swift b/Tests/GRDBTests/DatabaseRegionTests.swift index 853368f79..64ad3955f 100644 --- a/Tests/GRDBTests/DatabaseRegionTests.swift +++ b/Tests/GRDBTests/DatabaseRegionTests.swift @@ -8,12 +8,12 @@ class DatabaseRegionTests : GRDBTestCase { let regions = [ DatabaseRegion.fullDatabase, DatabaseRegion(), - DatabaseRegion.fullTable("foo"), + DatabaseRegion(table: "foo"), DatabaseRegion(table: "foo", columns: ["a", "b"]), DatabaseRegion(table: "foo", columns: ["b", "c"]), DatabaseRegion(table: "foo", rowIds: [1, 2]), DatabaseRegion(table: "foo", rowIds: [2, 3]), - DatabaseRegion.fullTable("bar")] + DatabaseRegion(table: "bar")] for (i1, s1) in regions.enumerated() { for (i2, s2) in regions.enumerated() { @@ -27,8 +27,8 @@ class DatabaseRegionTests : GRDBTestCase { // Case insensitivity XCTAssertEqual( - DatabaseRegion.fullTable("foo"), - DatabaseRegion.fullTable("FOO")) + DatabaseRegion(table: "foo"), + DatabaseRegion(table: "FOO")) XCTAssertEqual( DatabaseRegion(table: "foo", columns: ["a", "b"]), DatabaseRegion(table: "FOO", columns: ["A", "B"])) @@ -38,12 +38,12 @@ class DatabaseRegionTests : GRDBTestCase { let regions = [ DatabaseRegion.fullDatabase, DatabaseRegion(), - DatabaseRegion.fullTable("foo"), + DatabaseRegion(table: "foo"), DatabaseRegion(table: "foo", columns: ["a", "b"]), DatabaseRegion(table: "foo", columns: ["b", "c"]), DatabaseRegion(table: "foo", rowIds: [1, 2]), DatabaseRegion(table: "foo", rowIds: [2, 3]), - DatabaseRegion.fullTable("bar")] + DatabaseRegion(table: "bar")] var unions: [DatabaseRegion] = [] for s1 in regions { @@ -146,12 +146,12 @@ class DatabaseRegionTests : GRDBTestCase { let regions = [ DatabaseRegion.fullDatabase, DatabaseRegion(), - DatabaseRegion.fullTable("foo"), + DatabaseRegion(table: "foo"), DatabaseRegion(table: "foo", columns: ["a", "b"]), DatabaseRegion(table: "foo", columns: ["b", "c"]), DatabaseRegion(table: "foo", rowIds: [1, 2]), DatabaseRegion(table: "foo", rowIds: [2, 3]), - DatabaseRegion.fullTable("bar")] + DatabaseRegion(table: "bar")] var intersection: [DatabaseRegion] = [] for s1 in regions { @@ -258,13 +258,13 @@ class DatabaseRegionTests : GRDBTestCase { do { // Select the rowid let statement = try db.makeStatement(sql: "SELECT id FROM foo") - let expectedRegion = DatabaseRegion.fullTable("foo") + let expectedRegion = DatabaseRegion(table: "foo") XCTAssertEqual(statement.databaseRegion, expectedRegion) XCTAssertEqual(statement.databaseRegion.description, "foo(*)") } do { let statement = try db.makeStatement(sql: "SELECT ID FROM FOO") - let expectedRegion = DatabaseRegion.fullTable("foo") + let expectedRegion = DatabaseRegion(table: "foo") XCTAssertEqual(statement.databaseRegion, expectedRegion) XCTAssertEqual(statement.databaseRegion.description, "foo(*)") } @@ -310,7 +310,7 @@ class DatabaseRegionTests : GRDBTestCase { XCTAssertEqual(statement.databaseRegion, expectedRegion) XCTAssertEqual(statement.databaseRegion.description, "full database") } else { - let expectedRegion = DatabaseRegion.fullTable("foo") + let expectedRegion = DatabaseRegion(table: "foo") XCTAssertEqual(statement.databaseRegion, expectedRegion) XCTAssertEqual(statement.databaseRegion.description, "foo(*)") } @@ -322,7 +322,7 @@ class DatabaseRegionTests : GRDBTestCase { XCTAssertEqual(statement.databaseRegion, expectedRegion) XCTAssertEqual(statement.databaseRegion.description, "full database") } else { - let expectedRegion = DatabaseRegion.fullTable("foo") + let expectedRegion = DatabaseRegion(table: "foo") XCTAssertEqual(statement.databaseRegion, expectedRegion) XCTAssertEqual(statement.databaseRegion.description, "FOO(*)") } @@ -747,7 +747,7 @@ class DatabaseRegionTests : GRDBTestCase { do { // Complex selection - let region = DatabaseRegion.fullTable("foo") + let region = DatabaseRegion(table: "foo") .union(DatabaseRegion(table: "bar", columns: ["a"]) .intersection(DatabaseRegion(table: "bar", rowIds: [1]))) XCTAssertEqual(region.description, "bar(a)[1],foo(*)") diff --git a/Tests/GRDBTests/ValueObservationRegionRecordingTests.swift b/Tests/GRDBTests/ValueObservationRegionRecordingTests.swift index 30a10f22b..90bd8beb8 100644 --- a/Tests/GRDBTests/ValueObservationRegionRecordingTests.swift +++ b/Tests/GRDBTests/ValueObservationRegionRecordingTests.swift @@ -23,7 +23,7 @@ class ValueObservationRegionRecordingTests: GRDBTestCase { } do { - var region = DatabaseRegion.fullTable("player") + var region = DatabaseRegion(table: "player") db.recordingSelection(®ion) { } XCTAssertEqual(region.description, "player(*)") } @@ -45,7 +45,7 @@ class ValueObservationRegionRecordingTests: GRDBTestCase { } do { - var region = DatabaseRegion.fullTable("player") + var region = DatabaseRegion(table: "player") _ = try db.recordingSelection(®ion) { _ = try Row.fetchAll(db, sql: "SELECT * FROM team") } diff --git a/Tests/GRDBTests/VirtualTableModuleTests.swift b/Tests/GRDBTests/VirtualTableModuleTests.swift index 6cd05f26a..b13848acd 100644 --- a/Tests/GRDBTests/VirtualTableModuleTests.swift +++ b/Tests/GRDBTests/VirtualTableModuleTests.swift @@ -4,7 +4,7 @@ import GRDB private struct FTS3TokenizeModule : VirtualTableModule { let moduleName = "fts3tokenize" - func makeTableDefinition() -> FTS3TokenizeTableDefinition { + func makeTableDefinition(configuration: VirtualTableConfiguration) -> FTS3TokenizeTableDefinition { FTS3TokenizeTableDefinition() } @@ -22,7 +22,7 @@ private struct FTS3TokenizeModule : VirtualTableModule { private struct ThrowingFTS3TokenizeModule : VirtualTableModule { let moduleName = "fts3tokenize" - func makeTableDefinition() -> FTS3TokenizeTableDefinition { + func makeTableDefinition(configuration: VirtualTableConfiguration) -> FTS3TokenizeTableDefinition { FTS3TokenizeTableDefinition() }