diff --git a/CHANGELOG.md b/CHANGELOG.md index baf4b730a..5d68eeadf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ Release Notes - Performance improvements. - You can extract non-optional values from Row and DatabaseValue. -- Types that adopt MetalType on top of the DatabaseValueConvertible protocol are granted with faster database access. +- Types that adopt SQLiteStatementConvertible on top of the DatabaseValueConvertible protocol are granted with faster database access. **Breaking Changes** diff --git a/GRDB Tests/Public/Core/MetalType/MetalTypeTests.swift b/GRDB Tests/Public/Core/SQLiteStatementConvertible/SQLiteStatementConvertibleTests.swift similarity index 99% rename from GRDB Tests/Public/Core/MetalType/MetalTypeTests.swift rename to GRDB Tests/Public/Core/SQLiteStatementConvertible/SQLiteStatementConvertibleTests.swift index 91479611f..43024eca1 100644 --- a/GRDB Tests/Public/Core/MetalType/MetalTypeTests.swift +++ b/GRDB Tests/Public/Core/SQLiteStatementConvertible/SQLiteStatementConvertibleTests.swift @@ -1,7 +1,7 @@ import XCTest import GRDB -class MetalTypeTests : GRDBTestCase { +class SQLiteStatementConvertibleTests : GRDBTestCase { // Datatypes In SQLite Version 3: https://www.sqlite.org/datatype3.html diff --git a/GRDB.xcodeproj/project.pbxproj b/GRDB.xcodeproj/project.pbxproj index 4cc739f8f..88e3784b6 100644 --- a/GRDB.xcodeproj/project.pbxproj +++ b/GRDB.xcodeproj/project.pbxproj @@ -7,8 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 5614DEF01BA9DA15003163B3 /* MetalType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5614DEEF1BA9DA15003163B3 /* MetalType.swift */; settings = {ASSET_TAGS = (); }; }; - 5614DEF11BA9DA15003163B3 /* MetalType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5614DEEF1BA9DA15003163B3 /* MetalType.swift */; settings = {ASSET_TAGS = (); }; }; + 5614DEF01BA9DA15003163B3 /* SQLiteStatementConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5614DEEF1BA9DA15003163B3 /* SQLiteStatementConvertible.swift */; settings = {ASSET_TAGS = (); }; }; + 5614DEF11BA9DA15003163B3 /* SQLiteStatementConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5614DEEF1BA9DA15003163B3 /* SQLiteStatementConvertible.swift */; settings = {ASSET_TAGS = (); }; }; 5614DEF81BAA1B43003163B3 /* DatabaseValueConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A2381B1B9C74A90082EB20 /* DatabaseValueConvertibleTests.swift */; settings = {ASSET_TAGS = (); }; }; 5683C2691B4D445E00296494 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5683C2681B4D445E00296494 /* libsqlite3.dylib */; }; 56997A8E1B5390D4005EBEED /* DatabaseErrorFromStatementCreationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56997A8D1B5390D4005EBEED /* DatabaseErrorFromStatementCreationTests.swift */; }; @@ -146,8 +146,8 @@ 56E5D8181B4D435D00430942 /* GRDBTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5623E0901B4AFACC00B20B7F /* GRDBTestCase.swift */; }; 56E5D82C1B4D437600430942 /* GRDB.h in Headers */ = {isa = PBXBuildFile; fileRef = DC3773F819C8CBB3004FCF85 /* GRDB.h */; settings = {ATTRIBUTES = (Public, ); }; }; 56E5D82D1B4D438800430942 /* GRDB-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = DC2393C61ABE35F8003FF113 /* GRDB-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 56EE573D1BB317B7007A6A95 /* MetalTypeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* MetalTypeTests.swift */; settings = {ASSET_TAGS = (); }; }; - 56EE573E1BB317B7007A6A95 /* MetalTypeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* MetalTypeTests.swift */; settings = {ASSET_TAGS = (); }; }; + 56EE573D1BB317B7007A6A95 /* SQLiteStatementConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* SQLiteStatementConvertibleTests.swift */; settings = {ASSET_TAGS = (); }; }; + 56EE573E1BB317B7007A6A95 /* SQLiteStatementConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* SQLiteStatementConvertibleTests.swift */; settings = {ASSET_TAGS = (); }; }; 56EE573F1BB31DBA007A6A95 /* FetchPerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BB86121BA9886D001F9168 /* FetchPerformanceTests.swift */; settings = {ASSET_TAGS = (); }; }; 56EE57401BB31DBA007A6A95 /* FetchPerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BB86121BA9886D001F9168 /* FetchPerformanceTests.swift */; settings = {ASSET_TAGS = (); }; }; 56F0B98F1B6001C600A2F135 /* NSDateComponentsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F0B98D1B6001C600A2F135 /* NSDateComponentsTests.swift */; }; @@ -179,7 +179,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 5614DEEF1BA9DA15003163B3 /* MetalType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalType.swift; sourceTree = ""; }; + 5614DEEF1BA9DA15003163B3 /* SQLiteStatementConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteStatementConvertible.swift; sourceTree = ""; }; 5623E0901B4AFACC00B20B7F /* GRDBTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GRDBTestCase.swift; sourceTree = ""; }; 5683C2681B4D445E00296494 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/usr/lib/libsqlite3.dylib; sourceTree = DEVELOPER_DIR; }; 56997A8D1B5390D4005EBEED /* DatabaseErrorFromStatementCreationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseErrorFromStatementCreationTests.swift; sourceTree = ""; }; @@ -263,7 +263,7 @@ 56E5D7CA1B4D3FED00430942 /* GRDB.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GRDB.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 56E5D7D31B4D3FEE00430942 /* GRDBTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56E5D7F91B4D422D00430942 /* GRDBTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 56EE573C1BB317B7007A6A95 /* MetalTypeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalTypeTests.swift; sourceTree = ""; }; + 56EE573C1BB317B7007A6A95 /* SQLiteStatementConvertibleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteStatementConvertibleTests.swift; sourceTree = ""; }; 56F0B98D1B6001C600A2F135 /* NSDateComponentsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDateComponentsTests.swift; sourceTree = ""; }; 56F0B98E1B6001C600A2F135 /* NSDateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDateTests.swift; sourceTree = ""; }; 56FDECE11BB32DFD009AD709 /* MetalRowTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalRowTests.swift; sourceTree = ""; }; @@ -383,8 +383,8 @@ 56A238151B9C74A90082EB20 /* DatabaseError */, 56A238171B9C74A90082EB20 /* DatabaseValue */, 56A238191B9C74A90082EB20 /* DatabaseValueConvertible */, - 56EE573B1BB317B7007A6A95 /* MetalType */, 56A2381D1B9C74A90082EB20 /* Row */, + 56EE573B1BB317B7007A6A95 /* SQLiteStatementConvertible */, 56A238201B9C74A90082EB20 /* Statement */, ); path = Core; @@ -516,8 +516,8 @@ children = ( 56A238961B9C752B0082EB20 /* DatabaseTableMapping.swift */, 56A238971B9C752B0082EB20 /* DatabaseValueConvertible.swift */, - 5614DEEF1BA9DA15003163B3 /* MetalType.swift */, 56A238981B9C752B0082EB20 /* RowConvertible.swift */, + 5614DEEF1BA9DA15003163B3 /* SQLiteStatementConvertible.swift */, ); path = Protocols; sourceTree = ""; @@ -584,12 +584,12 @@ path = GRDBOSX; sourceTree = ""; }; - 56EE573B1BB317B7007A6A95 /* MetalType */ = { + 56EE573B1BB317B7007A6A95 /* SQLiteStatementConvertible */ = { isa = PBXGroup; children = ( - 56EE573C1BB317B7007A6A95 /* MetalTypeTests.swift */, + 56EE573C1BB317B7007A6A95 /* SQLiteStatementConvertibleTests.swift */, ); - path = MetalType; + path = SQLiteStatementConvertible; sourceTree = ""; }; 56F0B98C1B6001C600A2F135 /* Foundation */ = { @@ -858,7 +858,7 @@ 56A238901B9C75030082EB20 /* UpdateStatement.swift in Sources */, 56A2388E1B9C75030082EB20 /* StatementArguments.swift in Sources */, 56A2380A1B9C6DD20082EB20 /* StandardLibraryTypes.swift in Sources */, - 5614DEF11BA9DA15003163B3 /* MetalType.swift in Sources */, + 5614DEF11BA9DA15003163B3 /* SQLiteStatementConvertible.swift in Sources */, 56A2387E1B9C75030082EB20 /* Database.swift in Sources */, 56A238941B9C750B0082EB20 /* DatabaseMigrator.swift in Sources */, 56A238AB1B9C7E540082EB20 /* StatementArgumentsFoundationInitializers.swift in Sources */, @@ -903,7 +903,7 @@ 56A238641B9C74A90082EB20 /* RecordAwakeFromFetchTests.swift in Sources */, 56A2385A1B9C74A90082EB20 /* PrimaryKeySingleTests.swift in Sources */, 56A238661B9C74A90082EB20 /* RecordFetchTests.swift in Sources */, - 56EE573E1BB317B7007A6A95 /* MetalTypeTests.swift in Sources */, + 56EE573E1BB317B7007A6A95 /* SQLiteStatementConvertibleTests.swift in Sources */, 56A238481B9C74A90082EB20 /* DetachedRowTests.swift in Sources */, 56BB862C1BA988F2001F9168 /* FMResultSet.m in Sources */, 56A2386E1B9C74A90082EB20 /* RecordUpdateFromRowTests.swift in Sources */, @@ -952,7 +952,7 @@ 56A2384D1B9C74A90082EB20 /* DatabaseMigratorTests.swift in Sources */, 56A238631B9C74A90082EB20 /* RecordAwakeFromFetchTests.swift in Sources */, 56A238591B9C74A90082EB20 /* PrimaryKeySingleTests.swift in Sources */, - 56EE573D1BB317B7007A6A95 /* MetalTypeTests.swift in Sources */, + 56EE573D1BB317B7007A6A95 /* SQLiteStatementConvertibleTests.swift in Sources */, 56A238651B9C74A90082EB20 /* RecordFetchTests.swift in Sources */, 56A238471B9C74A90082EB20 /* DetachedRowTests.swift in Sources */, 56BB862B1BA988F2001F9168 /* FMResultSet.m in Sources */, @@ -991,7 +991,7 @@ 56A238AD1B9C90090082EB20 /* NSNull.swift in Sources */, 56A2389D1B9C752B0082EB20 /* RowConvertible.swift in Sources */, 56A2388D1B9C75030082EB20 /* StatementArguments.swift in Sources */, - 5614DEF01BA9DA15003163B3 /* MetalType.swift in Sources */, + 5614DEF01BA9DA15003163B3 /* SQLiteStatementConvertible.swift in Sources */, 56A238051B9C6D670082EB20 /* NSDate.swift in Sources */, 56A2387B1B9C75030082EB20 /* Configuration.swift in Sources */, 56A2389B1B9C752B0082EB20 /* DatabaseValueConvertible.swift in Sources */, diff --git a/GRDB/Core/Blob.swift b/GRDB/Core/Blob.swift index f80cd1541..8dd7d2b42 100644 --- a/GRDB/Core/Blob.swift +++ b/GRDB/Core/Blob.swift @@ -68,8 +68,8 @@ public final class Blob : Equatable { // MARK: - DatabaseValueConvertible -/// Blob adopts DatabaseValueConvertible and MetalType. -extension Blob : DatabaseValueConvertible, MetalType { +/// Blob adopts DatabaseValueConvertible and SQLiteStatementConvertible. +extension Blob : DatabaseValueConvertible, SQLiteStatementConvertible { /** Returns an instance initialized from a raw SQLite statement pointer. diff --git a/GRDB/Core/Protocols/DatabaseValueConvertible.swift b/GRDB/Core/Protocols/DatabaseValueConvertible.swift index 58fba800a..b2b4175bc 100644 --- a/GRDB/Core/Protocols/DatabaseValueConvertible.swift +++ b/GRDB/Core/Protocols/DatabaseValueConvertible.swift @@ -174,16 +174,16 @@ public extension DatabaseValueConvertible { } -// MARK: - Fetching DatabaseValueConvertible + MetalType +// MARK: - Fetching DatabaseValueConvertible + SQLiteStatementConvertible -public extension DatabaseValueConvertible where Self: MetalType { +public extension DatabaseValueConvertible where Self: SQLiteStatementConvertible { // MARK: - Fetching From SelectStatement /** This method is an optimized specialization of DatabaseValueConvertible.fetch(_,arguments:) for types that adopt both - DatabaseValueConvertible and MetalType protocols. + DatabaseValueConvertible and SQLiteStatementConvertible protocols. let statement = db.selectStatement("SELECT name FROM ...") let names = String.fetch(statement) // DatabaseSequence @@ -209,7 +209,7 @@ public extension DatabaseValueConvertible where Self: MetalType { /** This method is an optimized specialization of DatabaseValueConvertible.fetchAll(_,arguments:) for types that adopt both - DatabaseValueConvertible and MetalType protocols. + DatabaseValueConvertible and SQLiteStatementConvertible protocols. let statement = db.selectStatement("SELECT name FROM ...") let names = String.fetchAll(statement) // [String?] @@ -228,7 +228,7 @@ public extension DatabaseValueConvertible where Self: MetalType { /** This method is an optimized specialization of DatabaseValueConvertible.fetchOne(_,arguments:) for types that adopt both - DatabaseValueConvertible and MetalType protocols. + DatabaseValueConvertible and SQLiteStatementConvertible protocols. let statement = db.selectStatement("SELECT name FROM ...") let name = String.fetchOne(statement) // String? @@ -253,7 +253,7 @@ public extension DatabaseValueConvertible where Self: MetalType { /** This method is an optimized specialization of DatabaseValueConvertible.fetch(_,sql:,arguments:) for types that adopt both - DatabaseValueConvertible and MetalType protocols. + DatabaseValueConvertible and SQLiteStatementConvertible protocols. let names = String.fetch(db, "SELECT name FROM ...") // DatabaseSequence @@ -272,7 +272,7 @@ public extension DatabaseValueConvertible where Self: MetalType { /** This method is an optimized specialization of DatabaseValueConvertible.fetchAll(_,sql:,arguments:) for types that adopt - both DatabaseValueConvertible and MetalType protocols. + both DatabaseValueConvertible and SQLiteStatementConvertible protocols. let names = String.fetchAll(db, "SELECT name FROM ...") // [String?] @@ -291,7 +291,7 @@ public extension DatabaseValueConvertible where Self: MetalType { /** This method is an optimized specialization of DatabaseValueConvertible.fetchOne(_,sql:,arguments:) for types that adopt - both DatabaseValueConvertible and MetalType protocols. + both DatabaseValueConvertible and SQLiteStatementConvertible protocols. let name = String.fetchOne(db, "SELECT name FROM ...") // String? diff --git a/GRDB/Core/Protocols/MetalType.swift b/GRDB/Core/Protocols/SQLiteStatementConvertible.swift similarity index 71% rename from GRDB/Core/Protocols/MetalType.swift rename to GRDB/Core/Protocols/SQLiteStatementConvertible.swift index 5e82ac863..d5fbbf686 100644 --- a/GRDB/Core/Protocols/MetalType.swift +++ b/GRDB/Core/Protocols/SQLiteStatementConvertible.swift @@ -1,15 +1,15 @@ /** -When a type adopts both DatabaseValueConvertible and MetalType, it is granted +When a type adopts both DatabaseValueConvertible and SQLiteStatementConvertible, it is granted with faster access to the SQLite database values. */ -public protocol MetalType { +public protocol SQLiteStatementConvertible { /** Returns an instance initialized from a raw SQLite statement pointer. - As an example, here is the how Int64 adopts MetalType: + As an example, here is the how Int64 adopts SQLiteStatementConvertible: - extension Int64: MetalType { + extension Int64: SQLiteStatementConvertible { public init(sqliteStatement: SQLiteStatement, index: Int32) { self = sqlite3_column_int64(sqliteStatement, index) } diff --git a/GRDB/Core/Row.swift b/GRDB/Core/Row.swift index 97a7238d7..adba39697 100644 --- a/GRDB/Core/Row.swift +++ b/GRDB/Core/Row.swift @@ -102,7 +102,8 @@ public class Row: CollectionType { /** This method is an optimized specialization of Row.value(atIndex:) for types - that adopt both DatabaseValueConvertible and MetalType protocols. + that adopt both DatabaseValueConvertible and SQLiteStatementConvertible + protocols. let value: Bool? = row.value(atIndex: 0) let value: Int? = row.value(atIndex: 0) @@ -113,7 +114,7 @@ public class Row: CollectionType { - parameter index: The index of a column. - returns: An optional *Value*. */ - public func value>(atIndex index: Int) -> Value? { + public func value>(atIndex index: Int) -> Value? { let sqliteStatement = self.sqliteStatement if sqliteStatement != nil { // Metal row @@ -158,7 +159,8 @@ public class Row: CollectionType { /** This method is an optimized specialization of Row.value(atIndex:) for types - that adopt both DatabaseValueConvertible and MetalType protocols. + that adopt both DatabaseValueConvertible and SQLiteStatementConvertible + protocols. let value: Bool = row.value(atIndex: 0) let value: Int = row.value(atIndex: 0) @@ -169,7 +171,7 @@ public class Row: CollectionType { - parameter index: The index of a column. - returns: An optional *Value*. */ - public func value>(atIndex index: Int) -> Value { + public func value>(atIndex index: Int) -> Value { let sqliteStatement = self.sqliteStatement if sqliteStatement != nil { // Metal row @@ -235,7 +237,8 @@ public class Row: CollectionType { /** This method is an optimized specialization of Row.value(named:) for types - that adopt both DatabaseValueConvertible and MetalType protocols. + that adopt both DatabaseValueConvertible and SQLiteStatementConvertible + protocols. let value: Bool? = row.value(named: "count") let value: Int? = row.value(named: "count") @@ -246,7 +249,7 @@ public class Row: CollectionType { - parameter name: A column name. - returns: An optional *Value*. */ - public func value>(named columnName: String) -> Value? { + public func value>(named columnName: String) -> Value? { let index = impl.indexForColumn(named: columnName)! return value(atIndex: index) } @@ -281,7 +284,8 @@ public class Row: CollectionType { /** This method is an optimized specialization of Row.value(named:) for types - that adopt both DatabaseValueConvertible and MetalType protocols. + that adopt both DatabaseValueConvertible and SQLiteStatementConvertible + protocols. let value: Bool = row.value(named: "count") let value: Int = row.value(named: "count") @@ -292,7 +296,7 @@ public class Row: CollectionType { - parameter name: A column name. - returns: An optional *Value*. */ - public func value>(named columnName: String) -> Value { + public func value>(named columnName: String) -> Value { let index = impl.indexForColumn(named: columnName)! return value(atIndex: index) } @@ -531,7 +535,7 @@ public class Row: CollectionType { /// Only metal rows have a SQLiteStatement. /// /// Making sqliteStatement a property of Row instead of a property of RowImpl - /// makes the extraction of MetalType values faster. + /// makes the extraction of SQLiteStatementConvertible values faster. let sqliteStatement: SQLiteStatement /** diff --git a/GRDB/Swift/StandardLibraryTypes.swift b/GRDB/Swift/StandardLibraryTypes.swift index 3f36f3ac5..a6a1156a4 100644 --- a/GRDB/Swift/StandardLibraryTypes.swift +++ b/GRDB/Swift/StandardLibraryTypes.swift @@ -1,5 +1,5 @@ -/// Bool adopts DatabaseValueConvertible and MetalType. -extension Bool: DatabaseValueConvertible, MetalType { +/// Bool adopts DatabaseValueConvertible and SQLiteStatementConvertible. +extension Bool: DatabaseValueConvertible, SQLiteStatementConvertible { /** Returns an instance initialized from a raw SQLite statement pointer. @@ -90,8 +90,8 @@ extension Bool: DatabaseValueConvertible, MetalType { } } -/// Int adopts DatabaseValueConvertible and MetalType. -extension Int: DatabaseValueConvertible, MetalType { +/// Int adopts DatabaseValueConvertible and SQLiteStatementConvertible. +extension Int: DatabaseValueConvertible, SQLiteStatementConvertible { /** Returns an instance initialized from a raw SQLite statement pointer. @@ -126,8 +126,8 @@ extension Int: DatabaseValueConvertible, MetalType { } } -/// Int32 adopts DatabaseValueConvertible and MetalType. -extension Int32: DatabaseValueConvertible, MetalType { +/// Int32 adopts DatabaseValueConvertible and SQLiteStatementConvertible. +extension Int32: DatabaseValueConvertible, SQLiteStatementConvertible { /** Returns an instance initialized from a raw SQLite statement pointer. @@ -162,8 +162,8 @@ extension Int32: DatabaseValueConvertible, MetalType { } } -/// Int64 adopts DatabaseValueConvertible and MetalType. -extension Int64: DatabaseValueConvertible, MetalType { +/// Int64 adopts DatabaseValueConvertible and SQLiteStatementConvertible. +extension Int64: DatabaseValueConvertible, SQLiteStatementConvertible { /** Returns an instance initialized from a raw SQLite statement pointer. @@ -198,8 +198,8 @@ extension Int64: DatabaseValueConvertible, MetalType { } } -/// Double adopts DatabaseValueConvertible and MetalType. -extension Double: DatabaseValueConvertible, MetalType { +/// Double adopts DatabaseValueConvertible and SQLiteStatementConvertible. +extension Double: DatabaseValueConvertible, SQLiteStatementConvertible { /** Returns an instance initialized from a raw SQLite statement pointer. @@ -234,8 +234,8 @@ extension Double: DatabaseValueConvertible, MetalType { } } -/// String adopts DatabaseValueConvertible and MetalType. -extension String: DatabaseValueConvertible, MetalType { +/// String adopts DatabaseValueConvertible and SQLiteStatementConvertible. +extension String: DatabaseValueConvertible, SQLiteStatementConvertible { /** Returns an instance initialized from a raw SQLite statement pointer. diff --git a/TODO.md b/TODO.md index 5b6869ea4..16ef6685e 100644 --- a/TODO.md +++ b/TODO.md @@ -8,7 +8,6 @@ - [ ] Write test for how a fetched sequence should behave. It should contains the expected values. It can be restarted. Some of those are already written. - [ ] Update documentation (README.md and inline doc) when they metal rows are exposed, so that user is encouraged copying them. - [ ] Metal: How does the code look like when one iterates metal row and extracts NSData without copy? -- [ ] Turn DatabaseIntRepresentable and DatabaseStringRepresentable into MetalType when Swift allows for it. +- [ ] Turn DatabaseIntRepresentable and DatabaseStringRepresentable into SQLiteStatementConvertible when Swift allows for it. - [ ] Update or delete the "Value Extraction in Details" paragraph in README.md -- [ ] Talk about MetalType. Maybe in a special "Performance" section. -- [ ] Find a better name for MetalType (there may be some vocabulary in https://www.sqlite.org/c3ref/column_blob.html) +- [ ] Talk about SQLiteStatementConvertible. Maybe in a special "Performance" section.