I have a fairly simple (or so I thought) app that takes values, inserts them into SQLite when told to so so by the user. This app also displays the values when the app is loaded.
I have developed this in Aptana and everything works perfectly in the Aptana environment. However, when I make the whole thing into an .air file and install it, it doesn;t seem to be able to use the database. Here is my load function:
var file = air.File.applicationDirectory.resolvePath('pastOrders.db' );
db.addEventListener( air.SQLEvent.OPEN, doDbOpen );
db.open( file, air.SQLMode.UPDATE );
stmt.text = 'SELECT * FROM order_tbl ORDER BY order_id DESC LIMIT 3';
The file pastOrders.db is in the application root. I can also see it exists when the app is installed locally. My app doesn;t seem able to use the database however. I have no idea why. Any suggestions would be greatly appreciated
I ran into this issue as well, and I believe it's a security sandbox issue. You aren't supposed to write to files in the application directory, instead you are supposed to use the application storage directory. What I did with mine was to include a blank copy of the db in the application directory on install, then on initial load, I copy it to the applicationStorageDirectory.