oosqlBackupFinish



Called to release all resources associated with the backup operation. This function is part of the Online Backup Feature for the online backup feature of SQLite.

Arguments: The arguments are:
buHandle [required] The non-null handle to the backup returned from oosqlBackupInit .
Return value: Returns .ooSQLite~OK if no errors occurred during a call to oosqlBackupStep , whether or not the backup operation completed. If an out-of-memory condition or IO error occurred during any prior call ofoosqlBackupStepusing thebuHandleargument, then oosqlBackupFinishreturns the corresponding Result Code Constants code.
Remarks: There should be exactly one call tooosqlBackupFinishfor each successful call of oosqlBackupInit . OnceoosqlBackupFinishhas been called,buHandleis no longer valid and must not be used in any other call to a function.
Details The functionality of theoosqlBackupFinishroutine is similar to that of the SQLite API
Example: This example shows part of the code that performs an online backup of a very large database which is concurrently in heavy use. If the backup does not finish in four hours, the application abandons the backup and reschedules it to a different time:
-- This function will return DONE if completed and BUSY if abandoned. Any other
-- return would be a fatal error.
::routine backupWithTimeLimit
use strict arg buHandle, limit
count = 0
do while .true
ret = oosqlBackupStep(buHandle, 2)
if ret == .ooSQLite~DONE then do
say 'Backup finished with no error.'
outcome = .ooSQLite~DONE
leave
end
if ret &gt.&lt. .ooSQLite~OK, ret &gt.&lt. .ooSQLite~BUSY, ret &gt.&lt. .ooSQLite~LOCKED then do
say 'Fatal error during back up.'
outcome = ret
leave
end
if count * 2 > limit then do
say
say "Backup has not completed within the time limit, going to abandon the operation."
say
outcome = .ooSQLite~BUSY
leave
end
j = SysSleep(.5)
count += 1
end
ret = oosqlBackupFinish(buHandle)
return outcome