New in version 6.1.0: See the new features.

Create an audit transaction

audit_transaction()

Create an audit transaction

The audit transaction can be used to associate all the keyed file operations relevant to one business action. If a simple insertion or modification in the business logic means many insertions or modifications in several keyed files, all this audit information can be related by a transaction.

A new audit transaction must be defined prior any keyed file operation that must be audited insde the transaction. Optionally the transaction may contain custom values (CustomValue[1-4]) that may provide some useful information to the application developer (Like business user, role, programs,…)


SYNTAX

  • sage/srep:

    audit_transaction(server, CustomValue1, CustomValue2, CustomValue3, CustomValue4)
    audit_transaction(server, CustomValue1, CustomValue2, CustomValue3)
    audit_transaction(server, CustomValue1, CustomValue2)
    audit_transaction(server, CustomValue1)
    audit_transaction(server)

    Note: server can be a server name string, an opened !file on the server or an opened database on the server.


  • KfLib* (DNet, Java and Cpp):

    Server.auditTransaction(CustomValue1, CustomValue2, CustomValue3, CustomValue4)
    Server.auditTransaction(CustomValue1, CustomValue2, CustomValue3)
    Server.auditTransaction(CustomValue1, CustomValue2)
    Server.auditTransaction(CustomValue1)
    Server.auditTransaction()

  • SQL Engine (sql command and ScODBC):

    AUDIT TRANSACTIONCustomValue1’ ‘CustomValue2’ ‘CustomValue3’ ‘CustomValue4
    AUDIT TRANSACTIONCustomValue1’ ‘CustomValue2’ ‘CustomValue3
    AUDIT TRANSACTIONCustomValue1’ ‘CustomValue2
    AUDIT TRANSACTIONCustomValue1
    AUDIT TRANSACTION

Functionality

  • The method sets the custom values in the transaction record (if specified).

  • Used to trigger the creation of a new transaction when an audit record must be created.

  • If no audit record is created no transaction is created (no need to have empty transactions).

The return value is 0 (K_OK) if successful or a keyed file error code otherwise


EXAMPLE

Creating a new transaction with custom value “USER1”:

tmp.kfStatus = audit_transaction("localhost", "USER1")

RELATED TOPICS

Audit service

Audit functions