Archive for March, 2009


by Philippe Hausler on Mar.31, 2009, under Database, MacOS X, Objective-C, SQLite

Wouldn’t it be great to be able to access SQLite databases with just Objective-C calls?
Now you can with SQLite.framework. This framework supports NSFastEnumeration on SQLiteResults as well as per result enumeration. Additionally the database connections provide update callbacks into the database delegate object.

Here is some example usage.

SQLiteDatabase *db = [SQLiteDatabase databaseNamed:@"mydatabase.db"];
if([db executeQuery:@"CREATE TABLE foo (bar TEXT, baz NUMERIC, car INTEGER, caz BLOB);"])
    [db executeQuery:@"INSERT INTO foo VALUES('500.0', '500.0', '500.0', '500.0');"];
for(NSDictionary *row in [db executeQuery:@"SELECT * FROM foo"])
    NSString *bar = [row objectForKey:@"bar"];
    NSNumber *baz = [row objectForKey:@"baz"];
    NSNumber *car = [row objectForKey:@"car"];
    NSData *caz = [row objectForKey:@"caz"];

Download SQLite.framework

Note: This framework is still fairly un-tested and a bit on the alpha side, however future releases may add features like query building and detailed table/row/record information. Additionally I am creating a SequelPro-like client app to demonstrate the framework and provide an easy tool to manipulate SQLite databases.

Comments Off more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...