views:

37

answers:

1

I have a rather large db (as in many records). I'd rather let the client download a pre-built db instead of forcing them to load a bunch of text, then insert all the records before being able to use the db.

The closest thing to a spec I can find is this: http://developer.apple.com/safari/library/documentation/iphone/conceptual/safarijsdatabaseguide/usingthejavascriptdatabase/usingthejavascriptdatabase.html

It doesn't mention anything about being able to download a database, but I thought someone on SO might have a solution.

A: 

Just make up the DB on the simulator or via some GUI... Then make the DB available on the web via a link to the DB file on your webserver. Then in the app check a flag that you make up to see if it has downloaded the DB yet, if it hasn't then just download the DB just like any other file over HTTP and store it in your documents directory. Then set your flag so you know you have downloaded the DB and that the app doesn't need to do this again. Then when you need to access the DB just point sqlite to the DB file you placed in the Documents directory.

jamone
So you are suggesting I prompt the user to download the db and save it to specific location? That is definitely out of the question.
jckdnk111
No, I think he's suggesting your app check whether it's been downloaded, and if not, the app would download and save it, all in the background. The only thing the user would presumably see is a loading screen.
chrispix
But this is a Webkit app - it is not possible to download something without the user knowing.
jckdnk111
Oh, I saw the sqlite tag and thought it was a native app and that the webkit part didn't really fit. I didn't realize sqlite is accessible to nonnative apps.
jamone