User Tools

Site Tools


prop_transactionhook.htm

Documented in Readme of Clarion 11.13371 Feb 6, 2019.

FEATURE: You can now 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:

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

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

  1. Once at the start of the operation (in this case state = TRANSTATE:STARTING),
  2. Once for each file in the transaction (in this case state = TRANSTATE:HAVEFILE), and
  3. Once at the end of the operation (in this case state = TRANSTATE:ENDING)

The opCode (SIGNED opCode) can be set to DriverOp:LOGOUT, DriverOp:COMMIT, or DriverOp:ROLLBACK

The file parameter (*FILE file) will be assigned to one of the files in the transaction if state = TRANSTATE:HAVEFILE.

Setting stop to TRUE (*LONG stop) will cause the RTL to stop execution of normal transaction handling code after this function exits

Setting FileErrorCode and FileError (*CSTRING FileErrCode and *CSTRING FielErrMsg) will set FILEERRORCODE() and FILEERROR() respectively.

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

prop_transactionhook.htm.txt · Last modified: 2021/04/14 01:10 by carlbarnes