I have a Palm Pre app that has a large(ish) database. I would like to transfer the database directly to the phone rather than having the app create the database.
What I tried is to create a sqlite file on the PC using a simple python script, then have the app create an empty extended db in the media/internal folders, then copy the PC file over the one created on the phone. However I get an error when trying to read the file: “database disk image is malformed”.
Has anyone succeeded in doing something like this?
Edit: Now that my original idea is actually not possible my question becomes: what is the best way to initialize an application DB with a lot of data without duplicating it (now I have an array with info and the first time the app is run it creates and fills the database). The solution to use a hybrid application is too much for me now, I need a simple and quick solution.
The alternative would probably be to connect to a ‘web service’ and download the data to the application.
You can’t access a preloaded SQLite database directly from your JavaScript code — while WebKit is using SQLite internally, it needs to associate the database with its own data structures and manage some constraints.
You could write a hybrid application where your C/C++ code just acted as a server for accessing the included data file. You can use that static version of SQLite in your hybrid app to get access to that data and send it over the IPC system to JS. That model is similar to how Quickfoffice on the device uses a hybrid to parse MS Word documents and send their representation to their JS app that shows them using WebKit’s rendering engine.