使用sqlite.swift在数据库中搜索特定行

Mot*_*oxX 4 database sqlite.swift

我读了数据库中的特定行.我使用过滤查询,但我得到的是以下内容:

Table(clauses: SQLite.QueryClauses(select: (false, [SQLite.Expression<()>(template: "*", bindings: [])]), from: ("users", nil, nil), join: [], filters: Optional(SQLite.Expression<Swift.Optional<Swift.Bool>>(template: "(\"id\" = ?)", bindings: [Optional(6523)])), group: nil, order: [], limit: nil))
Run Code Online (Sandbox Code Playgroud)

这是我的查询:

let query = users.filter(id == 6523)
print(query)
Run Code Online (Sandbox Code Playgroud)

我的错误在哪里?

Mot*_*oxX 7

好的,我自己整理了这个问题.我用了prepare函数.见下面的代码

let query = users.filter(id == 6523)
for user in try db.prepare(query) { 
   print("id: \(user[name])") 
}
Run Code Online (Sandbox Code Playgroud)