finish



Releases all resources associated with the backup operation.

Arguments: There are no arguments to this method
Return value: Returns .ooSQLite~OK if no errors occurred during a step invocation, whether or not the backup operation completed. If an out-of-memory condition or IO error occurred during any prior invocation ofstepon this ooSQLiteBackupobject, thenfinishreturns the corresponding Result Code Constants code.
Remarks: There should be exactly one invocation offinishfor each successful invocation of new (Class method) . Note that during step , if the backup finishes successfuly, or a fatal error occurs,finishis invoked automatically by ooSQLite. Thus, the programmer should only invoke finishto abandon (halt) the backup before it is finished.
Details The functionality of thefinishmethod is similar to that of the SQLite sqlite3_backup_finish API.
Example: This example shows a online backup in progress. The source database is in use in a busy application. The backup operation is expected to complete in less than 4 hours. If it does not, the operation is abandoned and the application reschedules the backup for another time:
count = 0
do while .true
ret = bu~step(2)
if ret == bu~DONE then leave
if ret &gt.&lt. bu~OK, ret &gt.&lt. bu~BUSY, ret &gt.&lt. bu~LOCKED then do
say 'Fatal error during back up:' bu~lastErrCode bu~lastErrMsg
leave
end
j = SysSleep(.5)
count += 1
if count > (count * 2 * 60 * 60 * 4) then do
say "Backup has not completed in 4 hours, going to abandon the operation."
bu~finish
leave
end
end