Im creating an sqlite db in my air for android app inside the following function:
protected function createDatabase():void{
_sqlConnection = new SQLConnection();
_sqlConnection.addEventListener(SQLEvent.OPEN, openHandler);
_sqlConnection.addEventListener(SQLErrorEvent.ERROR, errorHandler);
var _sqlFolder:File = File.applicationStorageDirectory;
var _sqlFile:File = _sqlFolder.resolvePath("RouteLog.db");
_sqlConnection.open(_sqlFile);
}
i can successfully create tables, insert and select, but each time i re-publish the app from flash cs5.5 the database is overwritten and all data is lost. Totally stumped, any ideas welcome!
Cheers
[edit]
so, i'm publishing a debug release directly from flash pro via usb. When the app is initialised it calls the method above, on receiving the OPEN event it creates a table using the following SQL statement
var SQL:String =
"CREATE TABLE IF NOT EXISTS myRoutes (" +
"id INTEGER PRIMARY KEY AUTOINCREMENT, " +
"name STRING, " +
"created DATE, " +
"duration NUMBER, " +
"waypoints OBJECT, " +
"avgSpeed NUMBER, " +
"distance NUMBER, " +
"rating NUMBER" + ")";
I can then run some operations, insert, select etc and everything is as expected. If i exit and re-luanch the app, the previous data sets are intact, but when i re-publish from flash any data stored from the previous release has disappeared.
According to the documentation SQLConnection.open() will open a connection to the file supplied in the parameters and if it doesn't exist, it will create one...