Scott McKenzie
Scott McKenzie

Reputation: 16242

What SQLite library do you recommend on the iPhone/iPad?

A few people have wrapped the SQLite library or provided alternatives. What are their relative merits?

Upvotes: 1

Views: 323

Answers (3)

Ziminji
Ziminji

Reputation: 1306

There is a third approach. This third approach allows you to build SQLite statements via a set of Objective-C classes. They will handle how your data is converted and sanitized. They will also ensure that your statements are correctly constructed. You can try https://github.com/ziminji/objective-c-sql-query-builder This particular library also offers Object Relational Mapping (ORM) that follows the Active Record design pattern.

Upvotes: 0

bbum
bbum

Reputation: 162712

Core Data

Yes, a bit of snarky answer.

There are three primary reasons to use SQLite directly or via a wrapper.

  • You are sharing databases across platforms and can't use Core Data's schema

  • You really do need raw SQLite performance and have the 17th level SQLite API Mastery required to actually achieve said performance advantage over SQLite.

  • You know SQLite inside and out, don't like learning new things, and want to re-invent the bits necessary to get between database and screen. (Slightly snarky again).

Core Data buys you a tremendous amount of functionality that is subtly very hard to do. That is, object graph management with full integrity and undo support.

Upvotes: 4

bbum gave the most succinct answer and you should ponder carefully not using Core Data.

But I thought you also deserved an answer to your actual question.

There are basically two wrapper approaches I know of:

FMDB uses an approach that simply makes a much easier to use Cocoa API overlay for SQLLite. This can be great if you know SQL and database design well and just want a simple database.

Other approaches are generally more object-relational mapping systems, that attempt to give you an object view of an underlying datastore, and hide some queries from you.

In both cases if you have a really simple data store they can make sense to use if you have a specific reason... but using Core Data gives you an awful lot for free (though I'll admit the learning curve can be steep).

Upvotes: 3

Related Questions