User Tools

Site Tools


proptransactionhook.htm
Navigation:  Language Reference > App C - PROP: Runtime Properties > Complete Property List >PROP:TransactionHook Previous pageReturn to chapter overviewNext page

You can trap calls to the transaction handling functions LOGOUT, COMMIT, and ROLLBACK without having to attach a file callback to every file.

To do this you use SYSTEM{PROP:TransactionHook}.  You set this property to the address of a function that has the prototype:

myFUNCTION(SIGNED opCode, LONG state, *FILE file, *LONG stop, *CSTRING FileErrCode, *CSTRING FielErrMsg),LONG

The callback function will be called at least 3 times for each operation.

once at the start of the operation (in this case state = TRANSTATE:STARTING),

once for each file in the transaction (in this case state = TRANSTATE:HAVEFILE)

once at the end of the operation (in this case state = TRANSTATE:ENDING)

the opCode parameter can be set to DriverOp:LOGOUT, DriverOp:COMMIT, or DriverOp:ROLLBACK

the file parameter is assigned to one of the files in the transaction if state parameter = TRANSTATE:HAVEFILE.

Setting the stop parameter to TRUE causes the RTL to stop execution of normal transaction handling code after this function exits

Setting FileErrorCode and FileError parameters sets the values for FILEERRORCODE() and FILEERROR() respectively

The return value is the ERROR() that the operation should set.  This function must return 0 if no error is to be reported.

proptransactionhook.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1