views:

107

answers:

1

perhaps I'm missing something, but I need a client side database pre-populated with a load of data.

To test whether client side databases were up to the task, I created a few dummy tables with dummy data using the transaction.executeSql() method. But from what I can gather, it requires an executeSQL call for every single CREATE TABLE and INSERT INTO query. I'm lazy, and that seems like too much work to me.

I'm wondering...: I can create an SQLite table fairly quickly using an SQLite GUI. I've tried exporting an SQL file and running it all in one executeSQL statement but that just processes the first 'CREATE TABLE' bit none of the inserts.

Is there some special method of the transaction object that I'm not aware of for running multiple queries at once?

This is for Mobile Safari buy the way, which according to Apple uses an SQLite Database to power their client side database stuff.

A: 

i put all the sql code into a file with one command per line then used ajax to pull file and loop over each line executing the sql

tip: use the if not exists so you can call it every time to init your database

Carter Cole