Arguments: |
The arguments are:
buHandle [required] |
The non-null handle to the backup returned from oosqlBackupInit .
|
count |
The whole number count of database pages to copy. If count is negative, all of the remaining pages are copied.
Ifcountis omitted it defaults to 5.
|
|
Return value: |
Ifcountpages are successfully copied, and there are still more pages to
be copied, then OK (.ooSQLite~OK) is returned. IfoosqlBackupStepsuccessfully
finishes copying all pages from source to destination, then DONE (.ooSQLite~DONE) is returned. Otherwise an error
code is returned. Some errors are fatal and some are not. The remarks section further discusses this.
|
Remarks: |
If the database engine can not obtain a required lock thenoosqlBackupStep
returns BUSY (.ooSQLite~BUSY.) If the source database connection is being used to write to the source database when
oosqlBackupStepis called, then LOCKED is returned. The return code can also be
NOMEM, READONLY, or one of the IO_ERR_XXX codes. After BUSY or LOCKED,oosqlBackupStepcan be tried again. But NOMEM, READONLY, and IO_ERR_XXX are considered
fatal. There is no point in retrying if any of those codes are returned. The application must accept that the
backup operation has failed and call oosqlBackupFinish to release associated
resources.
|
Details |
The functionality of theoosqlSteproutine is similar to that of the sqlite3_backup_step SQLite API.
|
Example: |
This example initializes a backup, copies everything in one step, checks for error, and cleans up:
... |
|
buObj = oosqlBackupInit(srcConn, dstConn) |
|
if oosqlIsHandleNull(buObj) then do |
-- handle error |
... |
end |
|
ret = oosqlBackupStep(buObj, -1) |
|
if ret \\== .ooSQLite~DONE then do |
-- back up failed, handle error |
ret = oosqlBackupFinish(buObj) |
... |
end |
|
-- Backup okay, we are done with the connections |
-- and the backup handle, close everything ... |
ret = oosqlBackupFinish(buObj) |
ret = oosqlClose(dstConn) |
ret = oosqlClose(srcConn) |
|
return 0
|
|