_sqp_trace

sql

function _sqp_trace(IN situation INTEGER, IN username CHAR(31), IN objectname CHAR(63), IN logname CHAR(31), IN kontext_extent INTEGER) RETURNS BOOLEAN;

Parameters

situation number of the situation whose logging is to be affected
username name of the user whose actions are to be logged; if empty, then all users' actions will be logged
objectname name of the table in the logging request
logname name of the log being written; if empty, standard log will be used
kontext_extent specifies the log information extent, or disables logging

Since version

7.0

Description

This function sets a new request for logging a certain situation or modifies or deletes a valid logging request.

The situation parameter numbers are designated with constants described here.

The objectname parameter specifies the name of the table involved in the logging request for situations concerned with manipulating table data. The name may be prefixed with the scheme name. If the prefix is not specified, the currently selected scheme is taken. The involved table must exist.

If the logname parameter is nonempty, it must specify an already existing log (i.e. created by a previous call to the _sqp_define_log function).

The username parameter must designated an existing user name. You may not use the name of the user that will be created later.

The kontext_extent parameter values specify the extent of information displayed in the context of the situation occurrence. There are three levels of context:

Context higher than 1 is used mainly for logging user errors, SQL commands and table manipulations. Setting context to 0 disables logging.

The setting can be done only by the database configuration administrator, tracing requests for data reading and writing may be sent only by the security administrator - see Administering the SQL server.

Request persistance

Only the requests for basic log (without a user name link or table name) are valid after the server is shut down and run again.

Function value

This function returns TRUE if successful, FALSE if an error occurs. The error may be cause by specifying a non-existing user or object.

Example:

You may set the detailed tracing for application development into a separate log (accessible only by an administrator) in the _ON_SERVER_START procedure, and setup the basic log like this:

PROCEDURE _ON_SERVER_START();
BEGIN
  CALL Log_write("debuglog setting");

  CALL _sqp_define_log('debuglog','c:\aux\debuglog.log','%d %t %s %a %u %m');
  CALL _sqp_trace(TRACE_SERVER_FAILURE, '', '', 'debuglog', 3);
  CALL _sqp_trace(TRACE_START_STOP,     '', '', 'debuglog', 3);
  CALL _sqp_trace(TRACE_LOGIN,          '', '', 'debuglog', 3);
  CALL _sqp_trace(TRACE_SERVER_INFO,    '', '', 'debuglog', 3);
  CALL _sqp_trace(TRACE_USER_ERROR,     '', '', 'debuglog', 3);
  CALL _sqp_trace(TRACE_SQL,            '', '', 'debuglog', 3);
  CALL _sqp_trace(TRACE_CURSOR,         '', '', 'debuglog', 3);
  CALL _sqp_trace(TRACE_LOG_WRITE,      '', '', 'debuglog', 3);
  CALL _sqp_trace(TRACE_PROCEDURE_CALL, '', '', 'debuglog', 3);
  CALL _sqp_trace(TRACE_TRIGGER_EXEC,   '', '', 'debuglog', 3);

  CALL Log_write("basic log setting");
  CALL _sqp_trace(TRACE_SERVER_FAILURE, '', '', '', 1);
  CALL _sqp_trace(TRACE_START_STOP,     '', '', '', 1);
  CALL _sqp_trace(TRACE_USER_ERROR,     '', '', '', 1);
  CALL _sqp_trace(TRACE_LOG_WRITE,      '', '', '', 1);
  CALL _sqp_trace(TRACE_REPLICATION,    '', '', '', 0);
  CALL _sqp_trace(TRACE_DIRECT_IP,      '', '', '', 0);
  CALL _sqp_trace(TRACE_REPLIC_MAIL,    '', '', '', 0);
  CALL _sqp_trace(TRACE_REPLIC_COPY,    '', '', '', 0);
  CALL _sqp_trace(TRACE_REPL_CONFLICT,  '', '', '', 0);
END

See