PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → How to do a backup of HFSQL database for an android application ?
How to do a backup of HFSQL database for an android application ?
Iniciado por ayman.ke3, 18,abr. 2020 16:10 - 1 respuesta
Publicado el 18,abril 2020 - 16:10
hi, i have developed an andoird application using hfsql database and i can't find a way to backup my database and restore it in android.
Any one can help plz ?
Miembro registrado
23 mensajes
Publicado el 20,abril 2020 - 09:32
What I have done for my own purposes is to add a couple of menu items. One for "Export Database", the other "Import Database". The code is:
// For Export -
<COMPILE IF Configuration <> "iOS application">
IF YesNo("Do you want to export the database?") = Yes THEN
sSource is string = fDataDir() + "/*.*"
sDestination is string = SysDirExternalStorage(1, ssePublicDownload)
Info(sSource +" to "+ sDestination)
IF fCopyFile(sSource,sDestination,frConfirm) = False THEN
Error(ErrorInfo())
ELSE
Info("Successfully copied")
END
END
<END>

// For Import -
<COMPILE IF Configuration <> "iOS application">
IF YesNo("Do you want to import a backed up database from the internal Downloads folder?") = Yes THEN
sSource is string = SysDirExternalStorage(1, ssePublicDownload) + "/bplog.fic"
sDestination is string = fDataDir()
IF fFileExist(sSource) = True THEN
IF fCopyFile(sSource,sDestination,frConfirm) = False THEN
Error(ErrorInfo())
ELSE
Info("bplog.fic Successfully copied")
END
sSource = SysDirExternalStorage(1, ssePublicDownload) + "/bplog.ndx"
IF fCopyFile(sSource,sDestination,frConfirm) = False THEN
Error(ErrorInfo())
ELSE
Info("bplog.ndx Successfully copied")
END
ELSE
Info("Files not found. Check they are stored in correct folder.")
END
END
<END>

Just change this to suit your situation.

Best Regards,

Geoff