Programming Guide



ONENTRY

Installs an entry function

Synopsis

DBMS ONENTRY CALL function
DBMS ONENTRY JPL jplEntryPoint

Arguments

function
Name of prototyped function.

jplEntryPoint
Name of JPL procedure.

Use DBMS ONENTRY to install a function or JPL procedure which Prolifics calls before it executes a DBMS statement.

This function is for informational purposes only. For instance, you can log statements to a text file before executing them. You can use this function with an exit handler to track the start and complete time for a query or any other database operation.

The function is passed three arguments:

  1. A copy of the first 255 characters of the statement; if the statement is executed from JPL, this is the first 255 characters after the command word DBMS SQL or DBMS.
  2. The name of the database engine for the statement.
  3. Context flag; for the entry handler its value is 0.

The function's return code is not used.

Example

The following sample function logs the current statement in a text file.

/* This function is installed as a prototyped function.*/
/* It writes the current time, name of the current */
/* engine, and the command which Prolifics will execute */
/* to a file called dbi.log. */
/* dbms ONENTRY CALL dbientry  */
#include "smdefs.h"

int
dbientry (stmt, engine, flag)
char *stmt;
char *engine;
int flag;
{
FILE *fp;
time_t timeval;

fp = fopen ("dbi.log", "a");
timeval = time(NULL)
fprintf (fp, "%s\n%s\n%s\n\n",
ctime(&timeval), engine, stmt);
fclose (fp);
return 0;
}

This sample function displays a message before performing any database operations.

// dbms ONENTRY JPL entrymsg

proc entrymsg
msg setbkstat "Processing. Please be patient..."
flush
return 0

See Also

DBMS ONEXIT, Chapter 12, "DBMS Global Variables," Chapter 37, "Processing Application Errors," in Application Development Guide