Audit trigger extension points

Triggers source code extension point

This feature allows the user to extend the trigger's source code, for some advanced special cases where custom (but systematic) logic is needed.

To enable this feature, the user must create a procedure named: 'AuditPlusAppendTriggerExtension'

The procedure must define the following parm:

Parm(in:&TableName, in:&TriggerOperation, in:&TriggerSection, out:&SourceCode);

Where all parameters must be character or varchar.

WorkWithPlus for Audit will then insert calls to the procedure in the middle of the trigger source code generation process.

AuditPlusAppendTriggerExtensio

Extension points locations

Extension points depend on the DBMS, as the trigger's source code may have different structure, and not all extension points are available in every DBMS, but, generally speaking, the following extension points are used:

  • "beforeattcheck": Before comparing the record values (old value vs new value), to decide if modification is to be considered.
  • "afterattcheck": After comparing the record values (only in case it fulfills the condition)
  • "beforeauditrecord": Before creating the new "AuditRecord", which includes the audit "header" information (user, date, transacition info, etc.).
  • "afterauditrecord":  After creating the "AuditRecord" header.
  • "beforeauditrecordatts": Before inserting "AuditRecord" sublevel, which stores each of the transaction's attribute changes (old and new values of each attribute).
  • "afterauditrecordatts": After all "AuditRecord" sublevel are inserted.

Availability

This feature is available for the following DBMS:

  • SQLServer
  • MySQL
  • PostgreSQL