mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
README.md
This commit is contained in:
1 parent
f3a2e5f243
commit
78c9577b6b
1 file changed
+3
-3
@@ -949,7 +949,7 @@ We think that this is the killer feature of GRDB.swift :bowtie:. For example:
|
||||
class PersonsViewController: UITableViewController {
|
||||
|
||||
// Private subclass of Person, with an extra `bookCount` property:
|
||||
private class PersonViewModel : Person {
|
||||
private class PersonWithBookCount : Person {
|
||||
var bookCount: Int!
|
||||
|
||||
override func updateFromRow(row: Row) {
|
||||
@@ -960,13 +960,13 @@ class PersonsViewController: UITableViewController {
|
||||
}
|
||||
}
|
||||
|
||||
var persons: [PersonViewModel]!
|
||||
var persons: [PersonWithBookCount]!
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
persons = dbQueue.inDatabase { db in
|
||||
PersonViewModel.fetchAll(db,
|
||||
PersonWithBookCount.fetchAll(db,
|
||||
"SELECT persons.*, COUNT(*) AS bookCount " +
|
||||
"FROM persons " +
|
||||
"JOIN books ON books.ownerID = persons.id " +
|
||||
|
||||
Reference in new issue
Block a user