This content has been marked as final. Show 4 replies
SQLite databases in AIR are always stored as database files on the file system.
Thanks. To clarify, if I create the database in memory by dbConn.openAsync(null), I just am trying to find the most efficient way to save it to a true db file if the user decides to save it. I was wondering if one could take an in-memory DB and save it to file or if I have to always create a dummy file-based DB to switch to file-based at the end of the session.
John, please disregard my previous reply. AIR does indeed support in-memory databases.
I think your best solution would be to base the database off of a temporary file (such as File.createTempFile() or File.applicationStorageDirectory.resolvePath(tempData.db)), and then either (a) delete the file if you don't need to save it (perhaps upon application shut-down), or (b) save the file as needed.
You *could* recreate an in-memory database by recreating all the tables, views, triggers, and indexes in a file-based database. Which is perhaps a bit tedious, but possible.
I'll go with your first method, thanks.