Programming Guide |
Installs an exit handler
DBMS ONEXIT CALLfunction
DBMS ONEXIT JPLjplEntryPoint
DBMS ONEXIT STOP
- CALL
function
- Name of prototyped C function.
- JPL
jplEntryPoint
- Name of JPL procedure.
STOP
- Remove any installed exit function.
Use
DBMS ONEXIT
to 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 ONEXIT
overrides 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
DBMS
orDBMS SQL
.- 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
ONEXIT
function and anONERROR
function are both installed, the return code from theONERROR
function takes precedence.If an error occurred while executing a JPL statement with a DBMS command and there is no
ONEXIT
function, then
- 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
ONEXIT
function, 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
else
msg emsg stmt "%N" "Error: " @dmretmsg "%N" \
":engine error: " @dmengwarncode " " @dmengwarnmsg
return
ONENTRY
,ONERROR
, Chapter 12, "DBMS Global Variables," Chapter 37, "Processing Application Errors," in Application Development Guide