Chapter 10. Working with Databases

In this chapter, we will cover 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 are 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. In Section 10.1, we will describe basic SQL statements and their implementation using SQLite function calls. In Section 10.2, we discuss the handling of result sets generated by SQL statements. In Section 10.3, we address the topic of prepared statements. In Section 10.4, we talk about extensions to the SQLite API through the use of user-defined functions. In Sections 10.6 and 10.5 we present, respectively, ...

Get iPhone SDK Programming: Developing Mobile Applications 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.