commitHookCallBack



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

Note: there is no commitHookCallBack method in any ooSQLite class. This method is just used to illustrate how to define a user callback method to be used with the commit 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 thecommitHookmethod. If the programmer did not specify a user data argument, this will be the .nilobject.
Return value: The programmer must return a value from the callback. If the method returns 0, then the commit is allowed to continue normally. If the callback returns non-zero, then the COMMIT is converted into a ROLLBACK. If a rollbackHook hook has been installed, it is invoked just as it would be for any other rollback.
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 commit 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.
Details: The implementation of acommit hookmethod is is discussed on the SQLite sqlite3_commit_hook page.