oosqlBackupInit



Called once to initialize an online backup. This function is part of the Online Backup Feature for the online backup feature of SQLite.

Arguments: The arguments are:
dstConn [required] An open database oosqlOpen . This database is used as the destination of the backup.
srcConn [required] An open database oosqlOpen . This database is used as the source of the backup.
dstName [optional] The name of the destination backup. This is not the file name but rather themain,temp, or attached as name. If omitted, mainis used.
srcName [optional] The name of the source backup. Again, this is not the file name but rather themain,temp, or attached as name. If omitted, mainis used.
Return value: Returns a Handle that is used in the calls to other functions that are part of the online backup feature. This handle may be null if an error ocurred. See the remarks for a discussion on this.
Remarks: If an error occurs within the call tooosqlBackupInit, then the handle returned will be null. Use the oosqlIsHandleNull routine to check for this. On error, an error code and error message are stored in the destination database connection. This error code and message can be retrieved using the oosqlErrCode and oosqlErrMsg functions A successful call tooosqlBackupInitreturns a non-null handle. The handle may be used with the oosqlBackupStep and oosqlBackupFinish , functions to perform the specified backup operation. The non-null handle is also used in the oosqlBackupPageCount and oosqlBackupRemaining functions.
Details The functionality of theoosqlBackupInitroutine is similar to that of the sqlite3_backup_init SQLite API
Example: This example initializes a backup and checks for error:
buHandle = oosqlBackupInit(destDB, srcDB)
if oosqlIsHandleNull(buHandle) then do
say 'Error initializing backup. Error code:' oosqlErrCode(destDB) oosqlErrMsg(destDB)
r = oosqlClose(srcDB)
r = oosqlClose(destDB)
return 99.
end