PDA

View Full Version : SQLite Help




zcarter
Mar 21, 2008, 03:10 PM
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.

Thanks,

Zac



admanimal
Mar 21, 2008, 03:27 PM
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.