Using Core Data to fetch record from SQLite database.

Discussion in 'iOS Programming' started by kimbebot, Jun 27, 2012.

  1. kimbebot macrumors newbie

    Joined:
    Jun 26, 2012
    #1
    Hi, I am new to iOS app development. I have my sqlite database and I want to fetch records from it using Core Data. How is it possible? Can you provide me a simple tutorial? Thanks for your help!
     
  2. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #2
    You probably already know this (but just in case), Core Data is based on SQLite.

    My understanding is that Core Data is a wrapper over SQLite, so it shouldn't be a problem except for data type conversions. I would guess that SQLite supports more types than are native to Core Data.

    So I'm wondering, why use Core Data instead of SQLite?

    I'm learning SQLite right now and have been useing this:
    http://shop.oreilly.com/product/9780596521196.do
     
  3. forum user macrumors regular

    Joined:
    Aug 28, 2008
    #3
    You don't use CoreData to "fetch data from a sqlite database". If you need to "fetch data from a sqlite database" you use FMDB or similar. :)

    Using CoreData but thinking in SQL language only creates confusion. If you intent to use CoreData then better ignore the fact that CoreData is using a sqlite db as persistent storage and forget everything you know about sql language.

    CoreData is an Object Graph framework not a database interface. It happens to store data to a sqlite db as default but from a programmer point of view the usage is in terms of objects not in terms of rows and tables.
     
  4. Saladinos macrumors 68000

    Saladinos

    Joined:
    Feb 26, 2008
    #4
    Listen to this guy - when you use CoreData, you have to forget about the underlying DB (which may or may not be SQLite - XML and in-memory stores are also available).

    CoreData allows you to have millions of objects and to persist and query the object space.

    If you want to interact with a SQLite DB directly, use SQLite.
     

Share This Page