sqlLite vs array

Discussion in 'iOS Programming' started by rompelstilchen, Dec 20, 2010.

  1. rompelstilchen macrumors newbie

    Dec 20, 2010
    Hi everybody,

    I've a (maybe dumb) question.

    I want to manage a list of elements (small photo, name and category).
    The user is able to manage (view, add, delete, edit) this list with a tableview.
    The tableview is grouped (categories sorted) and sorted by name inside each categories.
    The data come from a SQLlite DB.
    Should I initiate my app with db and after try to work with array and dictionaries, and only write my db when my user quit (a lot of array filter and others).
    Or can I work directly of the db for everything (populate my tableview, ...)

    Thanks for any advices.
  2. MicroApple macrumors regular

    Jul 26, 2010
    I would say go ahead and use the DB directly. Just make sure when populating a list you don't populate everything at once, (populate "pages" like the Mail app does.)
  3. rompelstilchen thread starter macrumors newbie

    Dec 20, 2010
    So it wont drain more battery (processing) using direct SQL Query against NSArray or NSDictionary.

    Thanks for your answer.

    If anybody has a counter opinion, feel free to share with reasons
  4. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
  5. rompelstilchen thread starter macrumors newbie

    Dec 20, 2010
    You're certainly right..
    I start writing my code before thinking, like an addict...
    Now I've write everything by loading up my SQLlite, doing my job with Arrays and Dictionaries and write the change when memory warning or quit.
    It start to be pretty annoying working with arrays for filtering and stuff like that.
    Before re-writing, I was checking if anybody have already did this (right) choice...

Share This Page