Using database over flat-files?

Discussion in 'iOS Programming' started by detz, Oct 5, 2008.

  1. detz macrumors 65816

    Joined:
    Jun 29, 2007
    #1
    I have yet to dive into the sql features on the iphone, usually when working on computer I would be the other way and opt to use a database over flat files but for some reason I just don't feel a phone is the appropriate place for a relational database. Anyone else feel the same way?

    I might feel a little more comfortable using it too if it was Objective C methods instead.
     
  2. dean1012 macrumors regular

    Joined:
    Jul 10, 2008
    #2
    hmm

    Hi there,

    I use a relational database in my desktop applications because they provide a quick and efficient means of organizing, entering, editing, deleting, and searching data (especially large amounts). The SQL query language is a powerful being.

    If I am making a simple app for the desktop with only a few lines of data, I will use a flat file because the benefits of SQL do not outweigh the overhead of SQL.

    I see no reason to look at it any differently on the iPhone (or any phone for that matter).

    If the phone in question contains support for SQL and can run it reasonably quickly and efficiently (which the iPhone can), then SQL can (and should, in my opinion) be used if the amount of data in question is large enough to warrant the overhead involved.

    As far as the methods not being in objective C, that is something you will run into a lot. I was writing a linux console based server in C++ a few years ago and I was using the MySQL library. I did not like it in C (I was using C++) so I found a C++ wrapper.

    It is quite possible you will find an sqlite wrapper in objective C already or soon.
     
  3. wizard macrumors 68040

    Joined:
    May 29, 2003
    #3
    It depends on your programs needs!

    Like the title says it depends. I know that sounds like no answer at all but I think after a bit you will find it to be true.

    Now I'm new to iPhone development so bias your reading properly but eye see two immediate options for data storage on iPhone. One being plists the other being sqlite. Now I'm only working on one app right now but have found that plists work well for static data storage. Frankly haven't even tried to update a plist programmically but have the sense that you will not want to use plist for user data that gets added or updated regurally.

    That is really what SQL was built for. Sqlite is a library that Apple supplies with a good rep so I'm not sure why you have a concern. More so it appears that many of Apples own apps on iPhone support or use sqlite. I really don't see SQL on iPhone as a huge issue, so I'm wondering why you think it is?

    Now you might want to say that Apple could have supported it better with libraries and such but that is another matter. The question you have to ask is this does SQL support the app I'm trying to write. That is is it the right tech for your data.


    Dave
     

Share This Page