Chapter 2

The iOS Database: SQLite

WHAT’S IN THIS CHAPTER?

  • Creating an SQLite database
  • Connecting your application to a database and displaying its data
  • Running SQL statements against an SQLite database to insert and select data
  • Building a database and an iOS application to view master-detail relationships

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

The wrox.com code downloads for this chapter are found at www.wrox.com/remtitle.cgi?isbn=1118391845 on the Download Code tab. The code is in the Chapter 2 download and individually named according to the names throughout the chapter.

As an application developer, you have several options when it comes to storing the data used by your iOS application. You could use plist files, XML, or plaintext. Although any of these solutions is acceptable in certain situations, not all provide the best efficiency for your application. None of these formats allows you to query for specific data quickly, nor does any provide an efficient way to sort your data. If you have designed your application to work with a large data set and you would like to be able to query and sort it, you should consider using SQLite.

In the previous chapter, you learned how to display a small dataset that was stored in a simple array. As you move on to build more complicated applications, chances are that your data set will grow. Hard-coded arrays will probably not meet the demanding requirements of a more complicated application. You will find as you progress with your iOS ...

Get Professional iOS Database Application Programming, 2nd Edition 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.