Merge pull request #1605 from groue/dev/GRDB7-DatabaseCursor-primary-associated-type

GRDB 7: DatabaseCursor has a primary associated type
This commit is contained in:
Gwendal Roué authored and GitHub committed 2024-08-25 13:40:41 +02:00
commit 5025ecc314
3 files changed
+11 -2

No files matched your search

+1 -1
View File
@@ -719,7 +719,7 @@ extension Statement {
/// [`sqlite3_reset`](https://www.sqlite.org/c3ref/reset.html) when the cursor
/// is created, and when it is deallocated. Don't share the same prepared
/// statement between two cursors!
public protocol DatabaseCursor: Cursor {
public protocol DatabaseCursor<Element>: Cursor {
/// Must be initialized to false.
var _isDone: Bool { get set }
+1 -1
View File
@@ -128,7 +128,7 @@
- [ ] GRDB7: Sendable: SQL (ac33856f)
- [ ] GRDB7: Split Row.swift (2ce8a619)
- [ ] GRDB7: Cleanup ValueReducer (6c73b1c5)
- [ ] GRDB7: DatabaseCursor has a primary associated type (b11c5dd2)
- [X] GRDB7: DatabaseCursor has a primary associated type (b11c5dd2)
- [ ] GRDB7: Enable Strict Concurrency Checks (6aa43ded)
- [ ] GRDB7: Sendable: OrderedDictionary (e022c35b)
- [ ] GRDB7: Rename ReadWriteBox to ReadWriteLock (7f5205ef)
@@ -213,6 +213,15 @@ class DatabaseCursorTests: GRDBTestCase {
// }
}
// This test passes if it compiles
func testAssociatedType() throws {
func accept(_ cursor: some DatabaseCursor<String>) { }
func useCursor(_ db: Database) throws {
let cursor = try String.fetchCursor(db, sql: "SELECT 'foo'")
accept(cursor)
}
}
// For profiling tests
let profilingSQL = """
WITH RECURSIVE