Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
FahimF committed Jul 21, 2014
1 parent 4c52d77 commit 5a1798c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ In the above, `db` is a reference to the shared SQLite database instance and `SQ
db.execute("DELETE * FROM customers WHERE last_name='Smith'")
```

* You can also create SQL statements with variable/dynamic values quite easily using Swift's string manipulation functionality. (And you do not need to use the SQLite bind API calls.)
```swift
let name = "Smith"
db.execute("DELETE * FROM customers WHERE last_name='\(name)'")
```

* If your variable values contain quotes, remember to use the `esc` method to quote and escape the special characters in your input data. Otherwise, you will get a runtime error when trying to execute your SQL statements. (Note that the `esc` method encloses your data in quotes - so you don't have to enclose the final value in quotes when building your SQL statement.)
```swift
let db = SQLiteDB.sharedInstance()
let name = db.esc("John's Name")
let sql = "SELECT * FROM clients WHERE name=\(name)"
```

Questions?
---
* FAQ: [FAQs](https://github.com/FahimF/SQLiteDB/wiki/FAQs)
Expand Down

0 comments on commit 5a1798c

Please sign in to comment.