From acb7432610a3af240ee394aeef84b2e92fc79858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 5 May 2019 20:06:55 +0200 Subject: [PATCH] TODO --- GRDB/Core/Row.swift | 4 ++++ GRDB/QueryInterface/QueryInterfaceRequest.swift | 9 +++++++++ Tests/GRDBTests/AssociationPrefetchingTests.swift | 1 + 3 files changed, 14 insertions(+) diff --git a/GRDB/Core/Row.swift b/GRDB/Core/Row.swift index 6809bd78e..2e6399f7b 100644 --- a/GRDB/Core/Row.swift +++ b/GRDB/Core/Row.swift @@ -74,6 +74,7 @@ public final class Row : Equatable, Hashable, RandomAccessCollection, Expressibl /// the iteration of a query: make sure to make a copy of it whenever you /// want to keep a specific one: `row.copy()`. public func copy() -> Row { + // TODO: copy prefetches return impl.copiedRow(self) } @@ -608,6 +609,7 @@ extension Row { /// // Success: /// XCTAssertEqual(row.unscoped, ["id": 1, "name": "foo"]) public var unscoped: Row { + // TODO: copy prefetches return impl.unscopedRow(self) } @@ -616,6 +618,7 @@ extension Row { /// This property can turn out useful when you debug the consumption of /// adapted rows, such as rows fetched from joined requests. public var unadapted: Row { + // TODO: copy prefetches return impl.unadaptedRow(self) } } @@ -1032,6 +1035,7 @@ extension Row { } } + // TODO: compare prefetches return true } } diff --git a/GRDB/QueryInterface/QueryInterfaceRequest.swift b/GRDB/QueryInterface/QueryInterfaceRequest.swift index 05b19e4e4..b3c50c652 100644 --- a/GRDB/QueryInterface/QueryInterfaceRequest.swift +++ b/GRDB/QueryInterface/QueryInterfaceRequest.swift @@ -179,6 +179,15 @@ extension QueryInterfaceRequest : DerivableRequest, AggregatingRequest { /// .select([Column("id"), Column("email")]) /// .annotated(with: [Column("name")]) public func annotated(with selection: [SQLSelectable]) -> QueryInterfaceRequest { + // TODO: test consumption of + // + // let author = TableAlias() + // let request = Book + // .annotated(with: [author[Column("name")]]) + // .joining(requireed: Book.author) + // + // The problem is the "author.name" column. Can we consume it as "name"? + // From raw rows? From copied rows? return mapQuery { $0.annotated(with: selection) } } diff --git a/Tests/GRDBTests/AssociationPrefetchingTests.swift b/Tests/GRDBTests/AssociationPrefetchingTests.swift index 277e3744b..811a27c15 100644 --- a/Tests/GRDBTests/AssociationPrefetchingTests.swift +++ b/Tests/GRDBTests/AssociationPrefetchingTests.swift @@ -113,6 +113,7 @@ class AssociationPrefetchingTests: GRDBTestCase { // prefetchTree do { + // TODO: test fetchOne and fetchCursor let rows = try Row.fetchAll(db, request) XCTAssertEqual(rows.count, 3)