SQLite Help

Discussion in 'Mac Programming' started by zcarter, Mar 21, 2008.

  1. zcarter macrumors member

    Apr 21, 2007
    If i have the table 'info' in a database with just the values of a primary key and 'data'

    How in the iPhone SDK could I read in from the database and loop through all of the rows in the table?

    I guess my problem would be initializing the database, and then figuring out how to read in. I am very familiar with basic SQL syntax, just not the importing part of it.


  2. admanimal macrumors 68040

    Apr 22, 2005
    There is an SQLite example program now available on the iPhone SDK website, you might want to check that out.

    The way it usually works is that you issue a query to the database using a function that takes the query string as its argument. Then you provide a callback function that processes each row in the results. A callback function is just a fancy name for a function that will automatically be called for each row in the results, and the data for that row will be provided as the argument to the function so that you can process and/or store it how you want.

Share This Page