January 2012
Beginner
655 pages
16h 35m
English
This chapter provided a brief introduction to the SQLite3 database used in the iPhone. With SQLite3, you can now store all your structured data in an efficient manner and perform complex aggregations on your data. To learn more about SQLite, visit its official page at www.sqlite.org.
EXERCISES
Answers to the exercises can be found in Appendix D.
WHAT YOU LEARNED IN THIS CHAPTER
| TOPIC | KEY CONCEPTS |
| Using a SQLite3 database in your application | Add a reference to the libsqlite3.dylib library to your project. |
| Obtaining a C-style string from an NSString object | Use the UTF8String method of the NSString class. |
| Creating and opening a SQLite3 database | Use the sqlite3_open() C function. |
| Executing a SQL query | Use the sqlite3_exec() C function. |
| Closing a database connection | Use the sqlite3_close() C function. |
| Using bind variables | Create a sqlite3_stmt object.
Use the sqlite3_prepare_v2() C function to prepare the statement. Use the sqlite3_bind_text() (or sqlite3_bind_int(), and so on) C function to insert the values into the statement. Use the sqlite3_step() C function to execute the statement. Use the ... |