rollbackHookCallBack



The rollbackHookCallBack method is an example of a user callback method for the rollbackHook method. Here the method name of rollbackHookCallBack is used, because it is the default method name if the programmer does not specify his own name in the rollbackHook method. Any method name can be used by specifying it as the second argument to the rollbackHook method.

Note: there is no rollbackHookCallBack method in any ooSQLite class. This method is just used to illustrate how to define a user callback method to be used with the rollback hook.

Arguments: The single argument sent to the callback method is:
userData [required] The user data object specified by the programmer as the third argument to therollbackHookmethod. If the programmer did not specify a user data argument, this will be the .nilobject.
Return value: The programmer must return a whole number value from the callback. However, the actual value returned makes no difference to the SQLite database engine. Typically, the programmer would just return 0.
Remarks: The callback method must not do anything that will modify the database connection that invoked the callback. Any actions to modify the database connection must be deferred until after the completion of the step invocation that triggered the rollback hook to begin with. Running any other SQL statements, including SELECT statements, or merely instantiating a new new (Class method) object, or executing anotherstepmethod will modify the database connection. For the purposes of this method, a transaction is said to have been rolled back if an explicit ROLLBACK statement is executed, or an error or constraint causes an implicit rollback to occur. However, the callback is not invoked if a transaction is automatically rolled back because the database connection is closed.
Details: The implementation of arollback hookmethod is is discussed on the SQLite sqlite3_rollback_hook page.