Storing data in a database - SQL or PLIST

Discussion in 'iOS Programming' started by Brendan.Porter, Sep 6, 2008.

  1. Brendan.Porter macrumors member

    Joined:
    May 19, 2007
    Location:
    Between tourists, corn, and windmills.
    #1
    I'm just getting started on an App that I plan to use as a large data catch-all. The functionality I want is startlingly similar to the Contacts App, with the ability to add items to a list of items, and be able to dig into each item and quantify details similar to the details of a Contact.

    My problem is this- I don't have any idea what direction to take this. Do I need to research using SQL such as the "SQLite Books" example code so that I have a full-function database, or can I go the route of the "Editable Detail View" code example? The latter seems like the functionality Apple uses in Contacts.

    I want to be able to add items to a list, add details to an item, change the template details, add custom fields to the details, and hopefully create some sort of reports from the information or export it via email. Even better would be interaction with a web-based database.

    I don't want to use an insufficient database method. If for instance the "Editable Detail View" method, which uses a PLIST to store the list entries, is too fragile or incapable of storing thousands of entries efficiently, then I want to steer clear of that immediately.

    I appreciate any input.
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Use SQLite. Property lists are not suitable for large sets of data.
     
  3. Brendan.Porter thread starter macrumors member

    Joined:
    May 19, 2007
    Location:
    Between tourists, corn, and windmills.
    #3
    I was afraid of that.

    Anybody know any good jumping point for learning to use and implement SQLite on iPhone?
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
  5. lucasgladding macrumors 6502

    Joined:
    Feb 16, 2007
    Location:
    Waterloo, Ontario
    #5
    I'm using the standard keyed archiver for Ledger and have no complaints. The implementation is about as simple as you can get. If you have Cocoa Programming for Mac OS X, that example should tell you everything you need.

    Best of luck with whichever method you pursue

    Luke Gladding
     
  6. mekopolis macrumors regular

    Joined:
    Feb 10, 2008
    #6
    i have also been developing a similar data structured app like you mention, similar to the contacts app

    and after a few days playing with each option, sqlite3 is the way to go

    but i am still working out all the kinks

    from looking at the sqlite books sample and the table search sample found on the app dev. page

    and a few tutorials on iphoneiphonedevsdk.com and the icodeblog
    its got me started in the right direction

    but alas there is no real good sample/tutorial on how to link and read from a sqlite3 database, at least not one that i have found, we should all work together to just do a generic tutorial on this...i know i have spent a good week on it and have hit a wall on trying to read from an established sqlite3 database that was built externally and not internally with the terminal
     
  7. springframework macrumors member

    Joined:
    Mar 31, 2008
    #7
    the SQLiteBooks example is really good. it shows u how to create a database, and then read/write an int or text to the database. what more abilities are there to do to a database?

    How would u be more generic then that?

    objective-c is not a very nice language, it takes a lot of code to do most stuff.
     
  8. dougdawson macrumors member

    Joined:
    Aug 24, 2008
    Location:
    Austin, TX
    #8
    Objective-C is balls-to-the-wall great. Where are you coming from?

    But back to the topic, there should be more online examples of what SQLite3 is capable of. The ones I'm familiar with are incomplete to the point of being misleading. If all you want to do is store files, they are probably sufficient.

    Doug
     
  9. springframework macrumors member

    Joined:
    Mar 31, 2008
    #9
    im coming from actionscript 3.0, so objective-c definitely licks balls in my opinion.

    what kind of example do you want?

    it seems to me like u just create a sqlite query string and it executes, and u can get a while loop for select statements.

    I have run into problems where the sqlite query doesn't perform how it should. I don't know why this is, possibly the program im using to create my sqlite file in the first place produced my file incorrectly.


    This is the query i was having problems with today. It would just delete everything in the MyTable table

    PHP:
    DELETE FROM MyTable WHERE Id NOT IN (SELECT Id FROM MyTable ORDER BY Id DESC Limit 2)

    how ever when i did this query inside of the program i used to create the sqlite file (SQLite Maestro) it worked perfect.


    if anyone knows a better program for sqlite database creation/modification please let me know.
     

Share This Page