SQLite is a public domaindatabase library that offers file and memory based relational databasefunctionality from a single C library. The iPhone / iPod Touch has theSQLite library included and ready to roll and Apple expects the SQLitelibrary to form the backbone of most applications’ data storagerequirements.
We’ve collected together some of the best SQLite related tutorials,and libraries in order to help you on your way with this essentialiPhone programming technology:
iPhone SQLite Database Basics by Lee Falinis a comprehensive introduction to using SQLite in respect to iPhoneapplication development. He covers SQLite database creation and iPhonespecific database design considerations well. Lee’s tutorial has lotsof screenshots and he takes a step-by-step approach that’s easy tofollow. He walks through creating an SQLite database from scratch (onthe desktop to start with) and then imports that into an XCode project.Bear in mind, however, that Lee’s tutorial is not about the actual coding necessary to use SQLite on the iPhone itself.
Reading data from a SQLite Database by Dean Collinsis a wonderful “start to finish” tutorial that covers creating anSQLite database, creating an XCode project, and then all the codenecessary to use that database within an iPhone app. There’s even alink to an archive of the code used in the tutorial so you can morequickly try it out for yourself.
SQLite Tutorial 1: Selecting Data by Jai Kirdattis the first in five SQLite focused tutorials from the aforementionedauthor. This one covers creating an SQLite database and, like Dean’stutorial above, using that database from Objective C. There’s more codeand less screenshots than in the aforementioned tutorials, so thistutorial is worth coming to once you’re totally confident with thebasics. Source code is available to download at the bottom of the post.
SQLite Tutorial 2: Deleting Data by Jai Kirdatt follows on nicely from the previous tutorial and quickly demonstrates how to delete rows of data from an SQLite database.
SQLite Tutorial 3: Adding Data by Jai Kirdatt demonstrates how to add data to an SQLite database from Objective C.
SQLite Tutorial 4: Loading Data As Required by Jai Kirdatt shows how to select rows in a database to then display in a detail view. Data is only loaded when it is required.
SQLite Tutorial 5: Updating Data by Jai Kirdatt shows you how to update the database when fields on a form are edited and the application is then terminated.
EntropyDBis an embedded object database for OS X 10.5 and iPhone OS written inObjective C that’s built on top of SQLite. It provides a nicer API thanthat offered by SQLite directly. You don’t need to use SQL at all, butinstead just work with Objective C objects!
SQLitePersistentObjectsallows you to call “save” on your objects and trust that they will besaved properly and can be easily reloaded in future. No SQL required.
FMDB is a library that acts as a wrapper around SQLite – inspired by JDBC. fmdb-migration-manager (originally by last week’s podcast interviewee – Dr Nic Williams) allows you to easily roll out database migrations using fmdb.
iPhone SQLite Persistence for Objectsis an open source project that lets you add “object persistence” toyour applications. The object persistence uses SQLite, and the libraryworks on both the iPhone and iPod Touch.