README.md

This commit is contained in:
Gwendal Roué committed 2015-09-29 10:40:15 +02:00
1 parent c20b195ae4
commit d8bb994629
1 file changed
+11 -1
+11 -1
View File
@@ -243,6 +243,8 @@ The last two methods are the only ones that don't take a custom SQL query as an
- [RowConvertible Protocol](#rowconvertible-protocol)
#### Fetching Rows
Fetch **sequences** of rows, **arrays**, or a **single** row:
```swift
@@ -263,7 +265,13 @@ Row.fetch(db, "SELECT * FROM persons WHERE name = :name", arguments: ["name": "A
Do use those arguments: they prevent nasty users from injecting [nasty SQL snippets](https://en.wikipedia.org/wiki/SQL_injection) into your SQL queries.
**Row sequences grant the fastest and the most memory-efficient access to SQLite**, much more than row arrays that hold copies of the database rows.
**Row sequences grant the fastest and the most memory-efficient access to SQLite**, much more than row arrays that hold copies of the database rows:
```swift
for row in Row.fetch(db, "SELECT ...") {
// Can't be closer to SQLite
}
```
> **Note**: this performance advantage comes with extra precautions when using row sequences:
>
@@ -307,6 +315,8 @@ let dateString: String = row.value(named: "date") // "2015-09-11 18:14:15.
let date: NSDate = row.value(named: "date") // NSDate
```
Don't miss the [NSData](#nsdata-and-memory-savings) paragraph if you target memory efficiency.
You can also use the `as` type casting operator:
```swift