Chapter 11. Working with Databases

This chapter covers the basics of the SQLite database engine that is available to you using the iPhone SDK. SQLite is different from the other databases that you may be familiar with. Databases such as Oracle and Sybase are server-based databases. In server-based databases, a server runs the database engine and serves the queries of clients running on other machines. SQLite is an embedded database in the sense that there is no server running, and the database engine is linked to your application. SQLite is 100% free to use.

This chapter is not an introduction to databases and it assumes that you know the basics of the Structured Query Language (SQL). You should know that a database is composed of a set of tables and each table has a name that uniquely identifies that table in the database. Each table consists of one or more columns and each column has a name that uniquely identifies it within that table. A row is a vector of values for each column in a given table. A row is often referred to as a record.

This chapter is organized as follows. Section 11.1 describes basic SQL statements and their implementation using SQLite function calls. In Section 11.2, we discuss the handling of result sets generated by SQL statements. In Section 11.3, we address the topic of prepared statements. In Section 11.4, we talk about extensions to the SQLite API through the use of user-defined functions. In Sections 11.5 and 11.6 we present, respectively, a detailed example ...

Get iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch 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.