Estimates: I need to back up my SQLite database from my mobile app (app) to an external memory or to the cloud.
Can someone tell me how I can do that?
I have been reading documentation for many days to achieve this and I did not succeed.
Thank you very much.
The best way to do this is to convert the database to a string. You can then transfer it:
Sub butStoreDatabase_onclick() Dim DB
DB = SqlOpenDatabase("Northwind.db")
DBjson = SQLExport(DB, "NorthwindNew.db", exportComplete)
End Sub
Sub exportComplete()
console.log(JSON.stringify(DBjson))
End Sub
To import the database back, do this:
Sub getDatabase
data = ' the string that you exported earlier
SQLImport(data, DBnew, importComplete, NSB.overwriteAlmays)
End Sub
Sub importComplete()
console.log("import complete")
DBnew = SqlOpenDatabase("NorthwindNew.db")
s = Array(["Select * from Customers;", newQueryComplete])
Sql(DBnew, s)
End Sub