Chapter 12. Database Storage Using SQLite3
WHAT YOU WILL LEARN IN THIS CHAPTER
How to use the SQLite3 database in your Xcode project
How to create and open a SQLite3 database
How to use the various SQLite3 functions to execute SQL strings
How to use bind variables to insert values into a SQL string
In the previous chapter, you learned about data persistence using files. For simple applications, you can write the data you want to persist to a simple text file. For more structured data, you can use a property list. For large and complex data, it is more efficient to store them using a database. The iPhone comes with the SQLite3 database library, which you can use to store your data. With your data stored in a database, your application can populate a Table view or store a large amount of data in a structured manner.
This chapter shows you how to use the embedded SQLite3 database in your applications.
USING SQLITE3
To use a SQLite3 database in your application, you first need to add the libsqlite3.dylib
library to your Xcode project. Use the following Try It Out to find out how. You will need to download the code files indicated for this and the rest of the Try It Out features in this chapter.
Get Beginning iPhone® SDK Programming with Objective-C® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.