Installs an exit handler
DBMS ONEXIT CALL
functionDBMS ONEXIT JPL
jplEntryPointDBMS ONEXIT STOP
- Name of prototyped C function.
- Name of JPL procedure.
- Remove any installed exit function.
DBMS ONEXITto install a function which Panther calls after executing a DBMS command from JPL or C. Use this function to process error and status codes after every command.
The exit handler is global to the application. Each execution of
DBMS ONEXIToverrides the previous exit handler.
The function is passed three arguments:
- The first 255 characters of the statement. If the statement was executed from JPL, this is the first 255 characters after the command word
- The name of the database engine for the statement.
- Context flag; for the exit handler its value is 1.
The function's return code is returned to the application. If an
ONEXITfunction and an
ONERRORfunction are both installed, the return code from the
ONERRORfunction takes precedence.
If an error occurred while executing a JPL statement with a DBMS command and there is no
- 0 returns control to the JPL procedure where the error occurred.
If the error occurred while executing a statement with the dm_dbms library function and there is an
ONEXITfunction, the function returns the exit handler's return code.
To use a C function as an exit handler, you must first install the function as a prototyped function. For more information, refer to "Prototyped Functions" in Application Development Guide.
//JPL procedure processes warnings from the database engine.proc entry
DBMS ONEXIT JPL dbi_warn
returnproc dbi_warn (stmt, engine, flag)
if @dmengerrcode == 0
msg emsg stmt "%N" "Error: " @dmretmsg
msg emsg stmt "%N" "Error: " @dmretmsg "%N" \
":engine error: " @dmengwarncode " " @dmengwarnmsg
ONERROR, Chapter 12, "DBMS Global Variables," Chapter 37, "Processing Application Errors," in Application Development Guide