views:

4428

answers:

6

I'm developing for the iPhone and am looking for a good Cocoa/Objective-C library for working with SQLite. I don't want to use the standard procedural SQLite C API. I see options at sqlite.org under the Objective-C section, but am not sure which is the best in terms of library API design, stability, and functionality. I'd like to use something that's actively being developed and hopefully will be around for a while. Anyone have suggestions based on experience using one?

Thanks

+2  A: 

I personally use FMDB, and the last update to it was yesterday.

a link would be good :)
Toby Allen
+7  A: 

I'm also a fan of FMDatabase, although I've had to customize my own version of it. My apps use a layer around it I wrote called ArchDBObject that transparently converts objects to and from a database representation; I'm thinking about releasing it in some form, but I haven't really decided how yet.

In any case, FMDatabase can be had at http://code.google.com/p/flycode/source/browse/trunk/fmdb/.

Brent Royal-Gordon
+1 for giving a link
nevan
+1  A: 

We use sqlitepersistentobjects. It's very good at hiding all of the mechanics of interfacing with SQL away from your Objective-C code. There are some defects but it is under active development by Jeff Lamarche, the author of the excellent Beginning iPhone Development.

Google code hosts to source.

The downside would be that it is sometimes too clever and if you hit a problem, debugging/integrating is difficult.

Roger Nolan
+2  A: 

FMDB is nice because it's the lightest way to not have to deal with the C calls and type conversions, while still giving you full access to the SQL.

The thing I generally do not like about object-relational wrappers is that you get too distant from the SQL being generated and that's when performance can start to suffer.

Kendall Helmstetter Gelner
A: 

I have a simple ORM on top of FDBM here http://code.google.com/p/chibiorm/.

With it, you can use raw SQL when you wish, return any SQL as a dict list, or use the nice OO style.

mamcx
+2  A: 

I spent the last few hours looking at the options -- haven't been in production with any of these yet, so YMMV.

The lightest weight wrapper I found was here:

http://th30z.netsons.org/2008/11/objective-c-sqlite-wrapper/

I don't know if it has an official name. It's just 1 class, and it abstracts the nastiness of the SQLite api, while leaving the value of working directly with SQL. The learning curve is 5 minutes, assuming you know SQL already. Since it's so small, I can imagine it would be easy to fix anything that might go wrong with it.

Vineel Shah