I have produced a phonegap application for iOS using jQuery &lifier JQTouch. Info is drawn from the test database and shown on the web page around the apple iphone simulator. However to get this work, I pre-made/populated the database and by hand replicated it across towards the correct folder and so i could connect with it during my code.

When placed on my apple iphone for testing I have to produce the database and populate it in code on first run (ultimately this process should allow it to be suitable for android instead of attempting to copy the database by hand in Objective C as with this situation: http://groups.google.com/group/phonegap/browse_thread/thread/ca6c85f7d6c3976c/017cdbf51c70585a). My idea would be to pull the data from the flat CSV file or JSON object (incorporated within the package) right into a local array, then produce the database table, and iterate with the array placing the data in to the database.

Is a smart approach? I am trying to choose minimal complexity! It appears simpler to produce and keep a CSV file of my questions as opposed to a JSON file (which appears like adding extra complexity with regard to it) - any ideas? Finally, does anybody know of methods to extract the data from the CSV file? I discovered this JQuery library (http://code.google.com/p/js-tables/wiki/CSV) which looks promising - it is possible to better method?

Thank you for any help, I'd rather not begin prior to getting top tips! Nick

First, consider how big your database file. Test in simulator as well as on your desktop browser won't be nearly that which you encounter around the products. I discovered that the 5meg text file was intolerable on older products.

Second, I'd advocate to make use of json always as it is much simpler to make use of in JS and you don't need to make use of exterior libraries.

One approach you may consider would be to store your "db records" in files that will get bundled up to your application package. Then when you really need to "record" you are able to grab the file with ajax, see clearly, store it in local DB if you would like later, etc.

          url: asset_path + "/" + filename,
          success : function(data) {
                // data is your json object
          error : function(request,error) {
                // file not found
          async: false,
          dataType: "json"

You can find some overhead using the quality should you generate json files as in comparison to CSV with the string handling and brackets etc.

If this sounds like starting a Phonegap package or just being put in a application package, these files is going to be compressed to assist alleviate size this way.