FMDB: Easy SQLite database wrapper

One of the difficulties in iPhone is that it lacks Core Data, thus requiring developers to handle the database directly. While the system has SQLite built in (in libsqlite3.0.dylib ), the functions just beg to be wrapped up into something more usable.

The creator of Flying Meat software has created such a wrapper called FMDB. It is MIT licensed.

Using it is easy enough. Just import the source files, import the libsqlite3.0.dylib framework, and then after that it is fairly straightforward.

Initializing the Database

First get the path to the database (make sure this is outside of your application bundle or it will get overwritten on every upgrade), then just call:

FMDatabase *database = [[FMDatabase alloc] initWithPath:path];

The database is now initialized and ready to use. We’ll cover more advanced usage of the database, along with DAO patterns, at a later date.

This entry was posted in Uncategorized. Bookmark the permalink.

Error: The ad management script is not properly configured for this user

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>