busyHandler



Installs a user defined busy handler.

Arguments: The arguments are:
callBackObj [required] An instantiated object with a method that might be invoked whenever an attempt is made to open a database table that another thread or process has locked. However, this argument can also be .nil to indicate that any installed busy handler is to be removed. When no busy handler is installed then BUSY or IOERR_BLOCKED is returned immediately upon encountering the lock.
mthName [optional] The method name that will be invoked during a call back. By default, the method invoked will bebusyCallBack(). However, the user can specify an alternative method if desired. This argument is ignored when thecallbackObjargument is .nil.
userData [optional] This can be any Rexx object the user desires. The object will be sent as the second argument to the busy callback method when it is invoked. This argument is ignored when the callbackObj argument is .nil.
Return value: Returns a SQLite result Result Code Constants .
Remarks: By default, there is no busy handler installed. There can only be one busy handler installed. Setting a new busy handler automatically clears any previously installed handler. Note that invoking busyTimeOut can also set or clear the busy handler. The busy handler should not take any actions which modify the database connection that invoked the busy handler. Any such actions result in undefined behavior. A busy handler must not close the database connection or prepared statement that invoked the busy handler.
Details: The functionality of thebusyHandlermethod is similar to that of the SQLite sqlite3_busy_handler API.
Example: This example installs a busy handler with aonTimeOutmethod that is to be invoked. It passes the busy handler object itself as theuserDataargument:
helper = .MyHelperClass~new
db = .ooSQLiteConnection~new('phoneBook.rdbx')
if db~initCode &gt.&lt. 0 then return db~lastErrCode
db~busyHandler(helper, onTimeOut, helper)
...
::class 'MyHelperClass
::method onTimeOut unguarded
use arg count, helperObj
if helperObj~query(count) == "ABANDON_TIMEOUT" then return 0
else return 1
::method query private unguarded
use strict arg count
{ code that determines what to return }
...