Wednesday, April 14, 2010

iPhone: Core Data or SQLite3?

I've been studying SQLite access from Objective C in one of these days. As you may know already, there are two native ways to access SQLite database.
Let's see their advantages and drawbacks:
  1. SQLite native commands
    • ANSI C functions to direct access the database
    • dev should write it's own data access module and DAOs
    • SQL scripts can be ported from the Android project
    • queries can be hand optimized
    • have to learn the nitpicks too (for example there may be query timeouts, in this case the request should be resent), mid learning difficulty
    • reinvent the wheel by reimplementing Model and DAOs
    • available on all iPhone OS versions
    • there are 3rd party frameworks available, but they're overkill for a small application
  2. Core Data framework, provided by Apple
    • native Obj C objects, but without direct access to the database, instead it has graphic data designer and it's pretty well optimized
    • has high level managed objects, you can work directly with them when using your data
    • whole database has to be recreated from a scratch
    • fast for small applications, small queries
    • easy to learn
    • available in iPhone OS 3.0 and above
The access modes cannot be mixed.

We have chosen Core Data for our application, because it's all we need, it has steep learning curve.
Which would you choose for your application?

No comments:

Post a Comment