mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
TableMapping.selectsRowID + passing tests for FTS3Record
This commit is contained in:
1 parent
a1f3d42fd0
commit
2d6abc088f
12 files changed
+634
-47
No files matched your search
@@ -236,7 +236,13 @@ extension TableMapping {
|
||||
|
||||
/// Returns a QueryInterfaceRequest which fetches all rows in the table.
|
||||
public static func all() -> QueryInterfaceRequest<Self> {
|
||||
return QueryInterfaceRequest(tableName: databaseTableName)
|
||||
let selection: [SQLSelectable]
|
||||
if selectsRowID {
|
||||
selection = [star, Column.rowID]
|
||||
} else {
|
||||
selection = [star]
|
||||
}
|
||||
return QueryInterfaceRequest(query: QueryInterfaceSelectQueryDefinition(select: selection, from: .table(name: databaseTableName, alias: nil)))
|
||||
}
|
||||
|
||||
/// Returns a QueryInterfaceRequest which selects *selection*.
|
||||
|
||||
@@ -71,10 +71,10 @@ struct QueryInterfaceSelectQueryDefinition {
|
||||
// > always refers the explicitly declared column and cannot be
|
||||
// > used to retrieve the integer rowid value.
|
||||
//
|
||||
// Here we assume that _rowid_ is not a custom column.
|
||||
// TODO: support for user-defined _rowid_ column.
|
||||
// Here we assume that rowid is not a custom column.
|
||||
// TODO: support for user-defined rowid column.
|
||||
// TODO: support for WITHOUT ROWID tables.
|
||||
orderings = [Column("_rowid_").desc]
|
||||
orderings = [Column.rowID.desc]
|
||||
} else {
|
||||
orderings = orderings.map { $0.reversed }
|
||||
}
|
||||
|
||||
@@ -188,6 +188,11 @@ extension Column : SQLExpression {
|
||||
}
|
||||
}
|
||||
|
||||
extension Column {
|
||||
/// The hidden rowID column
|
||||
public static let rowID = Column("rowid")
|
||||
}
|
||||
|
||||
|
||||
// MARK: - DatabaseValue
|
||||
|
||||
|
||||
Reference in new issue
Block a user