From f2ae44384fae94c8be9381c6d99e34d6ac23bcf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 22 Apr 2018 18:13:47 +0200 Subject: [PATCH] Rename SQLColumnExpression to ColumnExpression --- GRDB.xcodeproj/project.pbxproj | 12 ++++----- GRDB/Core/Row.swift | 12 ++++----- GRDB/QueryInterface/Column.swift | 26 +++++++++++-------- .../FTS3+QueryInterfaceRequest.swift | 2 +- .../SQLExpression+QueryInterface.swift | 8 +++--- GRDB/Record/PersistableRecord.swift | 4 +-- GRDBCipher.xcodeproj/project.pbxproj | 20 +++++++------- GRDBCustom.xcodeproj/project.pbxproj | 12 ++++----- ...ests.swift => ColumnExpressionTests.swift} | 10 +++---- 9 files changed, 55 insertions(+), 51 deletions(-) rename Tests/GRDBTests/{SQLColumnExpressionTests.swift => ColumnExpressionTests.swift} (97%) diff --git a/GRDB.xcodeproj/project.pbxproj b/GRDB.xcodeproj/project.pbxproj index 0c685d5d7..571eaeeb5 100755 --- a/GRDB.xcodeproj/project.pbxproj +++ b/GRDB.xcodeproj/project.pbxproj @@ -426,8 +426,8 @@ 56B1C3CD201C8D0E001938DA /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B1C3CC201C8D0E001938DA /* Swift4.1.swift */; }; 56B1C3CE201C8D0E001938DA /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B1C3CC201C8D0E001938DA /* Swift4.1.swift */; }; 56B1C3CF201C8D0E001938DA /* Swift4.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B1C3CC201C8D0E001938DA /* Swift4.1.swift */; }; - 56B6EF56208CB4E3002F0ACB /* SQLColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF55208CB4E3002F0ACB /* SQLColumnExpressionTests.swift */; }; - 56B6EF57208CB4E3002F0ACB /* SQLColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF55208CB4E3002F0ACB /* SQLColumnExpressionTests.swift */; }; + 56B6EF56208CB4E3002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */; }; + 56B6EF57208CB4E3002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */; }; 56B7F42A1BE14A1900E39BBF /* CGFloatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */; }; 56B7F43A1BEB42D500E39BBF /* Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7F4391BEB42D500E39BBF /* Migration.swift */; }; 56B7F43B1BEB42D500E39BBF /* Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7F4391BEB42D500E39BBF /* Migration.swift */; }; @@ -949,7 +949,7 @@ 56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromDictionaryLiteralTests.swift; sourceTree = ""; }; 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchedRecordsControllerTests.swift; sourceTree = ""; }; 56B1C3CC201C8D0E001938DA /* Swift4.1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swift4.1.swift; sourceTree = ""; }; - 56B6EF55208CB4E3002F0ACB /* SQLColumnExpressionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLColumnExpressionTests.swift; sourceTree = ""; }; + 56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColumnExpressionTests.swift; sourceTree = ""; }; 56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGFloatTests.swift; sourceTree = ""; }; 56B7F4391BEB42D500E39BBF /* Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Migration.swift; sourceTree = ""; }; 56B8C2401CA1758F00510325 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Realm.framework; path = "Realm/build/osx/swift-4.1/Realm.framework"; sourceTree = ""; }; @@ -1268,12 +1268,12 @@ 56300B5C1C53C38F005A543B /* QueryInterface */ = { isa = PBXGroup; children = ( + 56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */, 56300B601C53C42C005A543B /* FetchableRecord+QueryInterfaceRequestTests.swift */, 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */, 5698AC021D9B9FCF0056AF8C /* QueryInterfaceExtensibilityTests.swift */, 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */, 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */, - 56B6EF55208CB4E3002F0ACB /* SQLColumnExpressionTests.swift */, 566AD8C51D531BE4002EC1A8 /* TableDefinitionTests.swift */, 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */, 5698AC7F1DA380A20056AF8C /* VirtualTableModuleTests.swift */, @@ -2456,7 +2456,7 @@ 5657AB6A1D108BA9006283EF /* FoundationURLTests.swift in Sources */, 56F3E74D1E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */, 56EB0AB31BCD787300A3DC55 /* DataMemoryTests.swift in Sources */, - 56B6EF57208CB4E3002F0ACB /* SQLColumnExpressionTests.swift in Sources */, + 56B6EF57208CB4E3002F0ACB /* ColumnExpressionTests.swift in Sources */, 56176C7F1EACCD2F000F3F2B /* EncryptionTests.swift in Sources */, 56741EAC1E66A8B3003E422D /* FetchRequestTests.swift in Sources */, 5672DE5C1CDB72520022BA81 /* DatabaseQueueBackupTests.swift in Sources */, @@ -2603,7 +2603,7 @@ 56D4968D1D81316E008276D7 /* DatabaseFunctionTests.swift in Sources */, 56D496661D813086008276D7 /* QueryInterfaceRequestTests.swift in Sources */, 56F3E7491E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */, - 56B6EF56208CB4E3002F0ACB /* SQLColumnExpressionTests.swift in Sources */, + 56B6EF56208CB4E3002F0ACB /* ColumnExpressionTests.swift in Sources */, 5698ACD71DA925420056AF8C /* RowTestCase.swift in Sources */, 56176C7D1EACCD2D000F3F2B /* EncryptionTests.swift in Sources */, 56741EA81E66A8B3003E422D /* FetchRequestTests.swift in Sources */, diff --git a/GRDB/Core/Row.swift b/GRDB/Core/Row.swift index ff28110e1..242637cd5 100644 --- a/GRDB/Core/Row.swift +++ b/GRDB/Core/Row.swift @@ -347,7 +347,7 @@ extension Row { /// the same name, the leftmost column is considered. /// /// The result is nil if the row does not contain the column. - public subscript(_ column: SQLColumnExpression) -> DatabaseValueConvertible? { + public subscript(_ column: ColumnExpression) -> DatabaseValueConvertible? { return self[column.name] } @@ -359,7 +359,7 @@ extension Row { /// If the column is missing or if the SQLite value is NULL, the result is /// nil. Otherwise the SQLite value is converted to the requested type /// `Value`. Should this conversion fail, a fatal error is raised. - public subscript(_ column: SQLColumnExpression) -> Value? { + public subscript(_ column: ColumnExpression) -> Value? { return self[column.name] } @@ -375,7 +375,7 @@ extension Row { /// This method exists as an optimization opportunity for types that adopt /// StatementColumnConvertible. It *may* trigger SQLite built-in conversions /// (see https://www.sqlite.org/datatype3.html). - public subscript(_ column: SQLColumnExpression) -> Value? { + public subscript(_ column: ColumnExpression) -> Value? { return self[column.name] } @@ -388,7 +388,7 @@ extension Row { /// /// This method crashes if the fetched SQLite value is NULL, or if the /// SQLite value can not be converted to `Value`. - public subscript(_ column: SQLColumnExpression) -> Value { + public subscript(_ column: ColumnExpression) -> Value { return self[column.name] } @@ -405,7 +405,7 @@ extension Row { /// This method exists as an optimization opportunity for types that adopt /// StatementColumnConvertible. It *may* trigger SQLite built-in conversions /// (see https://www.sqlite.org/datatype3.html). - public subscript(_ column: SQLColumnExpression) -> Value { + public subscript(_ column: ColumnExpression) -> Value { return self[column.name] } @@ -453,7 +453,7 @@ extension Row { /// /// The returned data does not owns its bytes: it must not be used longer /// than the row's lifetime. - public func dataNoCopy(_ column: SQLColumnExpression) -> Data? { + public func dataNoCopy(_ column: ColumnExpression) -> Data? { return dataNoCopy(named: column.name) } } diff --git a/GRDB/QueryInterface/Column.swift b/GRDB/QueryInterface/Column.swift index 56b0507bd..bdad2d1d8 100644 --- a/GRDB/QueryInterface/Column.swift +++ b/GRDB/QueryInterface/Column.swift @@ -1,9 +1,12 @@ /// The protocol for types that define database columns -public protocol SQLColumnExpression: SQLExpression { +public protocol ColumnExpression: SQLExpression { + /// The unqualified name of a database column. + /// + /// "score" is a valid unqualified name. "player.score" is not. var name: String { get } } -extension SQLColumnExpression { +extension ColumnExpression { /// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features) /// :nodoc: public func expressionSQL(_ arguments: inout StatementArguments?) -> String { @@ -20,7 +23,7 @@ extension SQLColumnExpression { /// A column in a database table /// /// See https://github.com/groue/GRDB.swift#the-query-interface -public struct Column: SQLColumnExpression { +public struct Column: ColumnExpression { /// The hidden rowID column public static let rowID = Column("rowid") @@ -34,7 +37,7 @@ public struct Column: SQLColumnExpression { } /// A qualified column in the database, as in `SELECT t.a FROM t` -struct QualifiedColumn: SQLColumnExpression { +struct QualifiedColumn: ColumnExpression { var name: String private let qualifier: SQLTableQualifier @@ -57,13 +60,14 @@ struct QualifiedColumn: SQLColumnExpression { } } -extension CodingKey where Self: SQLColumnExpression { - public var name: String { - return stringValue - } -} - -extension SQLColumnExpression where Self: RawRepresentable, Self.RawValue == String { +/// Support for column enums: +/// +/// struct Player { +/// enum Columns: ColumnExpression { +/// case id, name, score +/// } +/// } +extension ColumnExpression where Self: RawRepresentable, Self.RawValue == String { public var name: String { return rawValue } diff --git a/GRDB/QueryInterface/FTS3+QueryInterfaceRequest.swift b/GRDB/QueryInterface/FTS3+QueryInterfaceRequest.swift index 768f613f9..171b12868 100644 --- a/GRDB/QueryInterface/FTS3+QueryInterfaceRequest.swift +++ b/GRDB/QueryInterface/FTS3+QueryInterfaceRequest.swift @@ -42,7 +42,7 @@ extension TableRecord { } } -extension SQLColumnExpression { +extension ColumnExpression { /// A matching SQL expression with the `MATCH` SQL operator. /// /// // content MATCH '...' diff --git a/GRDB/QueryInterface/SQLExpression+QueryInterface.swift b/GRDB/QueryInterface/SQLExpression+QueryInterface.swift index b7ebe9512..a7a7f8dcc 100644 --- a/GRDB/QueryInterface/SQLExpression+QueryInterface.swift +++ b/GRDB/QueryInterface/SQLExpression+QueryInterface.swift @@ -289,7 +289,7 @@ public struct SQLExpressionBinary : SQLExpression { switch op { case .equal, .is: // Look for `id ==/IS 1`, `rowid ==/IS 1`, `1 ==/IS id`, `1 ==/IS rowid` - func matchedRowIds(column: SQLColumnExpression, dbValue: DatabaseValue) -> Set? { + func matchedRowIds(column: ColumnExpression, dbValue: DatabaseValue) -> Set? { var rowIdNames = [Column.rowID.name.lowercased()] if let rowIdName = rowIdName { rowIdNames.append(rowIdName.lowercased()) @@ -304,9 +304,9 @@ public struct SQLExpressionBinary : SQLExpression { } } switch (lhs, rhs) { - case (let column as SQLColumnExpression, let dbValue as DatabaseValue): + case (let column as ColumnExpression, let dbValue as DatabaseValue): return matchedRowIds(column: column, dbValue: dbValue) - case (let dbValue as DatabaseValue, let column as SQLColumnExpression): + case (let dbValue as DatabaseValue, let column as ColumnExpression): return matchedRowIds(column: column, dbValue: dbValue) default: return nil @@ -434,7 +434,7 @@ struct SQLExpressionContains : SQLExpression { func matchedRowIds(rowIdName: String?) -> Set? { // FIXME: this implementation ignores column qualifiers // Look for `id IN (1, 2, 3)` - guard let column = expression as? SQLColumnExpression, + guard let column = expression as? ColumnExpression, let array = collection as? SQLExpressionsArray else { return nil diff --git a/GRDB/Record/PersistableRecord.swift b/GRDB/Record/PersistableRecord.swift index a0c29e8a8..389035274 100644 --- a/GRDB/Record/PersistableRecord.swift +++ b/GRDB/Record/PersistableRecord.swift @@ -64,7 +64,7 @@ public struct PersistenceContainer { /// It is undefined behavior to set different values for the same column. /// Column names are case insensitive, so defining both "name" and "NAME" /// is considered undefined behavior. - public subscript(_ column: SQLColumnExpression) -> DatabaseValueConvertible? { + public subscript(_ column: ColumnExpression) -> DatabaseValueConvertible? { get { return self[column.name] } set { self[column.name] = newValue } } @@ -362,7 +362,7 @@ extension MutablePersistableRecord { /// - throws: A DatabaseError is thrown whenever an SQLite error occurs. /// PersistenceError.recordNotFound is thrown if the primary key does not /// match any row in the database. - public func update(_ db: Database, columns: Sequence) throws where Sequence.Element: SQLColumnExpression { + public func update(_ db: Database, columns: Sequence) throws where Sequence.Element: ColumnExpression { try update(db, columns: Set(columns.map { $0.name })) } diff --git a/GRDBCipher.xcodeproj/project.pbxproj b/GRDBCipher.xcodeproj/project.pbxproj index b97c9a5bc..1f5d77772 100755 --- a/GRDBCipher.xcodeproj/project.pbxproj +++ b/GRDBCipher.xcodeproj/project.pbxproj @@ -674,10 +674,10 @@ 56B14E851D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */; }; 56B15D0C1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */; }; 56B15D0D1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */; }; - 56B6EF64208CB762002F0ACB /* SQLColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF62208CB762002F0ACB /* SQLColumnExpressionTests.swift */; }; - 56B6EF65208CB762002F0ACB /* SQLColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF62208CB762002F0ACB /* SQLColumnExpressionTests.swift */; }; - 56B6EF66208CB762002F0ACB /* SQLColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF62208CB762002F0ACB /* SQLColumnExpressionTests.swift */; }; - 56B6EF67208CB762002F0ACB /* SQLColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF62208CB762002F0ACB /* SQLColumnExpressionTests.swift */; }; + 56B6EF64208CB762002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF62208CB762002F0ACB /* ColumnExpressionTests.swift */; }; + 56B6EF65208CB762002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF62208CB762002F0ACB /* ColumnExpressionTests.swift */; }; + 56B6EF66208CB762002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF62208CB762002F0ACB /* ColumnExpressionTests.swift */; }; + 56B6EF67208CB762002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF62208CB762002F0ACB /* ColumnExpressionTests.swift */; }; 56B9649E1DA51B4C0002DA19 /* FTS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B9649C1DA51B4C0002DA19 /* FTS5.swift */; }; 56B964A11DA51B4C0002DA19 /* FTS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B9649C1DA51B4C0002DA19 /* FTS5.swift */; }; 56B964B21DA51D010002DA19 /* FTS5TokenizerDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B964B01DA51D010002DA19 /* FTS5TokenizerDescriptor.swift */; }; @@ -1025,7 +1025,7 @@ 56B021C81D8C0D3900B239BB /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableRecordPersistenceConflictPolicyTests.swift; sourceTree = ""; }; 56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromDictionaryLiteralTests.swift; sourceTree = ""; }; 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchedRecordsControllerTests.swift; sourceTree = ""; }; - 56B6EF62208CB762002F0ACB /* SQLColumnExpressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLColumnExpressionTests.swift; sourceTree = ""; }; + 56B6EF62208CB762002F0ACB /* ColumnExpressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColumnExpressionTests.swift; sourceTree = ""; }; 56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGFloatTests.swift; sourceTree = ""; }; 56B7F4391BEB42D500E39BBF /* Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Migration.swift; sourceTree = ""; }; 56B8F49A1B4E2F3600C24296 /* GRDB.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDB.xcconfig; sourceTree = ""; }; @@ -1317,12 +1317,12 @@ 56300B5C1C53C38F005A543B /* QueryInterface */ = { isa = PBXGroup; children = ( + 56B6EF62208CB762002F0ACB /* ColumnExpressionTests.swift */, 56300B601C53C42C005A543B /* FetchableRecord+QueryInterfaceRequestTests.swift */, 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */, 5698AC021D9B9FCF0056AF8C /* QueryInterfaceExtensibilityTests.swift */, 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */, 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */, - 56B6EF62208CB762002F0ACB /* SQLColumnExpressionTests.swift */, 566AD8C51D531BE4002EC1A8 /* TableDefinitionTests.swift */, 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */, 5698AC7F1DA380A20056AF8C /* VirtualTableModuleTests.swift */, @@ -2148,7 +2148,7 @@ 560FC57D1CB00B880014AA8E /* RecordInitializersTests.swift in Sources */, 56176C5F1EACCCC7000F3F2B /* FTS5CustomTokenizerTests.swift in Sources */, 565F03C31CE5D3AA00DE108F /* RowAdapterTests.swift in Sources */, - 56B6EF64208CB762002F0ACB /* SQLColumnExpressionTests.swift in Sources */, + 56B6EF64208CB762002F0ACB /* ColumnExpressionTests.swift in Sources */, 5657AB3F1D108BA9006283EF /* FoundationNSDataTests.swift in Sources */, 560FC57E1CB00B880014AA8E /* MutablePersistableRecordTests.swift in Sources */, 5657AB5F1D108BA9006283EF /* FoundationNSURLTests.swift in Sources */, @@ -2295,7 +2295,7 @@ 5671563B1CB16729007DC145 /* RecordInitializersTests.swift in Sources */, 56176C651EACCCC8000F3F2B /* FTS5CustomTokenizerTests.swift in Sources */, 5657AB681D108BA9006283EF /* FoundationURLTests.swift in Sources */, - 56B6EF65208CB762002F0ACB /* SQLColumnExpressionTests.swift in Sources */, + 56B6EF65208CB762002F0ACB /* ColumnExpressionTests.swift in Sources */, 5671563C1CB16729007DC145 /* MutablePersistableRecordTests.swift in Sources */, 5671563D1CB16729007DC145 /* FetchableRecord+QueryInterfaceRequestTests.swift in Sources */, 567E55F31D2BDDFE00CC6F79 /* EncryptionTests.swift in Sources */, @@ -2543,7 +2543,7 @@ 5657AB6B1D108BA9006283EF /* FoundationURLTests.swift in Sources */, 56AFCA4F1CB1AA9900F48B96 /* DataMemoryTests.swift in Sources */, 56176C711EACCCCA000F3F2B /* FTS5CustomTokenizerTests.swift in Sources */, - 56B6EF66208CB762002F0ACB /* SQLColumnExpressionTests.swift in Sources */, + 56B6EF66208CB762002F0ACB /* ColumnExpressionTests.swift in Sources */, 5672DE5D1CDB72520022BA81 /* DatabaseQueueBackupTests.swift in Sources */, 56AFCA501CB1AA9900F48B96 /* RecordCopyTests.swift in Sources */, 56FF45451D2C23BA00F21EF9 /* MutablePersistableRecordDeleteTests.swift in Sources */, @@ -2690,7 +2690,7 @@ 56AFCAA51CB1ABC800F48B96 /* FetchableRecord+QueryInterfaceRequestTests.swift in Sources */, 56AFCAA61CB1ABC800F48B96 /* DatabasePoolReadOnlyTests.swift in Sources */, 56176C771EACCCCB000F3F2B /* FTS5CustomTokenizerTests.swift in Sources */, - 56B6EF67208CB762002F0ACB /* SQLColumnExpressionTests.swift in Sources */, + 56B6EF67208CB762002F0ACB /* ColumnExpressionTests.swift in Sources */, 5657AB6C1D108BA9006283EF /* FoundationURLTests.swift in Sources */, 56AFCAA81CB1ABC800F48B96 /* DataMemoryTests.swift in Sources */, 56AFCAA91CB1ABC800F48B96 /* RecordCopyTests.swift in Sources */, diff --git a/GRDBCustom.xcodeproj/project.pbxproj b/GRDBCustom.xcodeproj/project.pbxproj index 0f5bc591b..ecf88c2b8 100755 --- a/GRDBCustom.xcodeproj/project.pbxproj +++ b/GRDBCustom.xcodeproj/project.pbxproj @@ -209,8 +209,8 @@ 56B021D01D8C0D3900B239BB /* MutablePersistableRecordPersistenceConflictPolicyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B021C81D8C0D3900B239BB /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */; }; 56B14E821D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */; }; 56B14E861D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */; }; - 56B6EF60208CB746002F0ACB /* SQLColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF5E208CB746002F0ACB /* SQLColumnExpressionTests.swift */; }; - 56B6EF61208CB746002F0ACB /* SQLColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF5E208CB746002F0ACB /* SQLColumnExpressionTests.swift */; }; + 56B6EF60208CB746002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF5E208CB746002F0ACB /* ColumnExpressionTests.swift */; }; + 56B6EF61208CB746002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF5E208CB746002F0ACB /* ColumnExpressionTests.swift */; }; 56B9649F1DA51B4C0002DA19 /* FTS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B9649C1DA51B4C0002DA19 /* FTS5.swift */; }; 56B964A21DA51B4C0002DA19 /* FTS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B9649C1DA51B4C0002DA19 /* FTS5.swift */; }; 56B964B31DA51D010002DA19 /* FTS5TokenizerDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B964B01DA51D010002DA19 /* FTS5TokenizerDescriptor.swift */; }; @@ -717,7 +717,7 @@ 56B021C81D8C0D3900B239BB /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableRecordPersistenceConflictPolicyTests.swift; sourceTree = ""; }; 56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromDictionaryLiteralTests.swift; sourceTree = ""; }; 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchedRecordsControllerTests.swift; sourceTree = ""; }; - 56B6EF5E208CB746002F0ACB /* SQLColumnExpressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLColumnExpressionTests.swift; sourceTree = ""; }; + 56B6EF5E208CB746002F0ACB /* ColumnExpressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColumnExpressionTests.swift; sourceTree = ""; }; 56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGFloatTests.swift; sourceTree = ""; }; 56B7F4391BEB42D500E39BBF /* Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Migration.swift; sourceTree = ""; }; 56B8F49A1B4E2F3600C24296 /* GRDB.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDB.xcconfig; sourceTree = ""; }; @@ -991,12 +991,12 @@ 56300B5C1C53C38F005A543B /* QueryInterface */ = { isa = PBXGroup; children = ( + 56B6EF5E208CB746002F0ACB /* ColumnExpressionTests.swift */, 56300B601C53C42C005A543B /* FetchableRecord+QueryInterfaceRequestTests.swift */, 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */, 5698AC021D9B9FCF0056AF8C /* QueryInterfaceExtensibilityTests.swift */, 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */, 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */, - 56B6EF5E208CB746002F0ACB /* SQLColumnExpressionTests.swift */, 566AD8C51D531BE4002EC1A8 /* TableDefinitionTests.swift */, 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */, 5698AC7F1DA380A20056AF8C /* VirtualTableModuleTests.swift */, @@ -1851,7 +1851,7 @@ 5698ACBD1DA6285E0056AF8C /* FTS3TokenizerTests.swift in Sources */, 5623931F1DECC02000A6B01F /* RowFetchTests.swift in Sources */, 562393701DEE0CD200A6B01F /* FlattenCursorTests.swift in Sources */, - 56B6EF61208CB746002F0ACB /* SQLColumnExpressionTests.swift in Sources */, + 56B6EF61208CB746002F0ACB /* ColumnExpressionTests.swift in Sources */, F3BA81121CFB3059003DC1BA /* DatabaseMigratorTests.swift in Sources */, 56176C801EACCD31000F3F2B /* EncryptionTests.swift in Sources */, F3BA80EB1CFB3016003DC1BA /* FetchableRecordTests.swift in Sources */, @@ -2099,7 +2099,7 @@ 5657AB411D108BA9006283EF /* FoundationNSDataTests.swift in Sources */, 56B964C61DA521450002DA19 /* FTS5PatternTests.swift in Sources */, 562205FA1E420E49005860AC /* DatabasePoolReleaseMemoryTests.swift in Sources */, - 56B6EF60208CB746002F0ACB /* SQLColumnExpressionTests.swift in Sources */, + 56B6EF60208CB746002F0ACB /* ColumnExpressionTests.swift in Sources */, 562205FD1E420EA2005860AC /* DatabasePoolBackupTests.swift in Sources */, 562206091E420EB2005860AC /* DatabaseQueueConcurrencyTests.swift in Sources */, 56176C7E1EACCD2F000F3F2B /* EncryptionTests.swift in Sources */, diff --git a/Tests/GRDBTests/SQLColumnExpressionTests.swift b/Tests/GRDBTests/ColumnExpressionTests.swift similarity index 97% rename from Tests/GRDBTests/SQLColumnExpressionTests.swift rename to Tests/GRDBTests/ColumnExpressionTests.swift index 5442dd129..410dc7aef 100644 --- a/Tests/GRDBTests/SQLColumnExpressionTests.swift +++ b/Tests/GRDBTests/ColumnExpressionTests.swift @@ -7,15 +7,15 @@ import XCTest import GRDB #endif -class SQLColumnExpressionTests: GRDBTestCase { +class ColumnExpressionTests: GRDBTestCase { - func testRawSQLColumnExpression() throws { + func testRawColumnExpression() throws { struct Player: TableRecord, FetchableRecord, PersistableRecord { var id: Int64 var name: String var score: Int - struct Column: SQLColumnExpression { + struct Column: ColumnExpression { var name: String } @@ -82,7 +82,7 @@ class SQLColumnExpressionTests: GRDBTestCase { var name: String var score: Int - enum Columns: String, SQLColumnExpression { + enum Columns: String, ColumnExpression { case id, name, score } @@ -143,7 +143,7 @@ class SQLColumnExpressionTests: GRDBTestCase { var name: String var score: Int - enum CodingKeys: CodingKey, SQLColumnExpression { + enum CodingKeys: CodingKey, ColumnExpression { case id, name, score }