mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
README.md
This commit is contained in:
1 parent
a7b2a1ed70
commit
390bc93e54
1 file changed
+5
-1
@@ -1774,12 +1774,16 @@ For an efficient algorithm which synchronizes the content of a database table wi
|
||||
**The query interface lets you write pure Swift instead of SQL:**
|
||||
|
||||
```swift
|
||||
let redWineCount = Wine.filter(color == .Red).fetchCount(db)
|
||||
let wines = Wine.filter(origin == "Burgundy").order(price).fetchAll(db)
|
||||
```
|
||||
|
||||
Please bear in mind that the query interface can not generate all possible SQL queries. You may also *prefer* writing SQL:
|
||||
Please bear in mind that the query interface can not generate all possible SQL queries. You may also *prefer* writing SQL, and this is just OK:
|
||||
|
||||
```swift
|
||||
let redWineCount = Int.fetchOne(db,
|
||||
"SELECT COUNT(*) FROM wines WHERE color = ?",
|
||||
arguments [Color.Red])!
|
||||
let wines = Wine.fetchAll(db,
|
||||
"SELECT * FROM wines WHERE origin = ? ORDER BY price",
|
||||
arguments: ["Burgundy"])
|
||||
|
||||
Reference in new issue
Block a user