How to copy sqlite database from applicationDirectory to documentsDirectory
i having problems using ‘file’ function in adobe flex copy sqlite database read applicationdirectory users documentsdirectory. when use code below thing appears in user documentsdirectory 1k 4k file. actual file size of database around 350k.
am not giving file enough time copy over?
i developing on mac think remember duplicating error on pc well. bug has been keeping me launching app far long. ideas appreciated.
here code using:
public function copydb():void
{
var dbfile:file = file.applicationdirectory.resolvepath("db/mydatastorage.db");
var dbworkedfile:file = file.documentsdirectory.resolvepath("mydatastorage.db");
if(!dbworkedfile.exists){
trace("db not exist");
dbfile.copyto(dbworkedfile);
} else {
trace("db exists");
//the database has been installed. launch app.
}
dbconn = new sqlconnection();
dbconn.openasync(dbworkedfile);
}
i got above code adobe cookbook recipe:
http://cookbooks.adobe.com/post_include_existing_sqlite_database_in_an_air_applica-10483.h tml
thanks
have tried file.copytoasync() method? more suitable copying larger files such database.
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment