Page 1 of 1

SQLite BackupAPI

Posted: Sun Oct 26, 2014 12:13 pm
by GMKai
Hello,

I try to use the onlineBackupAPI to load and save my database.
But I fail with these functions:

Code: Select all

Function p_LoadGame()
    DebugPrint("p_LoadGame()")
    Local Dataset$ = FileRequest(c$[4],"hsgdb")
    If Dataset$ <> ""
       db:close_vm(false)
       db:close()
       db = sqlite3.open(Dataset$)
    EndIf()
EndFunction

Function p_SaveGame()
    DebugPrint("p_SaveGame()")
    Local Dataset$ = FileRequest(c$[10],"hsgdb")
    If Dataset$ <> ""
       Local backup  = sqlite3.open(Dataset$)
       Local pBackup = sqlite3.sqlite3_backup_init(backup, "main", db, "main");
       sqlite3:sqlite3_backup_step(pBackup, -1);
       sqlite3:sqlite3_backup_finish(pBackup);
    EndIf()
EndFunction         

First when saving the error is "tablefeld backup_init was not initialised...
any idea how to use the feature correctly?

Re: SQLite BackupAPI

Posted: Mon Oct 27, 2014 9:44 am
by airsoftsoftwair
Sounds like something for our SQL expert, Lazi? ;-)

Re: SQLite BackupAPI

Posted: Mon Oct 27, 2014 8:06 pm
by lazi
Sounds like something for our SQL expert, Lazi?
Thanks for the title :lol:

@GMKai:
I try to use the onlineBackupAPI to load and save my database.
You wanted to use something from the SQLite C interface. That is not available to the Hollywood SQLite3 plugin.
The LuaSQLite is our domain: http://lua.sqlite.org/index.cgi/doc/tip ... lite3.wiki

Let us see what you need, and I am sure there is a solution instead of the onlinebackupAPI.