SQLite BackupAPI

Discuss about plugins that don't have a dedicated forum
Post Reply
GMKai
Posts: 140
Joined: Mon Feb 15, 2010 10:58 am

SQLite BackupAPI

Post 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?
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: SQLite BackupAPI

Post by airsoftsoftwair »

Sounds like something for our SQL expert, Lazi? ;-)
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: SQLite BackupAPI

Post 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.
Post Reply