Programming Guide |
Contains an engine-independent error or status code
@dmretcode
is set to0
before Panther executes a newDBMS
command. If the command fails because of an error detected either by the engine or by Panther's database driver, Panther writes an error code to@dmretcode
describing the failure.Usually a non-zero value in
@dmretcode
indicates that an error occurred. The default or an installed error handler is called for an error. If the default handler is in use, Panther displays the statement which failed and an error message from either Panther's database driver or from the database engine. If the application has installed its own error handler, the installed function controls what messages are displayed.There are two non-zero codes for
@dmretcode
which are not errors:DM_NO_MORE_ROWS
andDM_END_OF_PROC
. When an engine indicates that it has returned all rows for a select set, Panther writes theDM_NO_MORE_ROWS
code to@dmretcode
. Since this is not considered an error, Panther does not call the default or installed error handler. You can test forDM_MORE_ROWS
after executing aSELECT
or in an exit handler.Panther uses
DM_END_OF_PROC
with engines that support stored procedures. When an engine indicates that it has completed executing the stored procedure, Panther writes theDM_END_OF_PROC
code to@dmretcode
. This is not an error. An application can test for this code in an exit procedure or after calling a stored procedure. Refer to the Database Drivers for information on stored procedures.The values for
@dmretcode
are listed alphabetically in Table 12-3 (in the source code, they reside indmerror.h
).
proc entry
DBMS ONERROR JPL dbi_errhandle
DBMS ONEXIT JPL dbi_exithandle
...
returnproc dbi_errhandle (stmt, engine, flag)
# Check for logon errors.
if @dmretcode == DM_ALREADY_ON
return 0else if @dmretcode == DM_LOGON_DENIED
msg emsg @dmretmsg "%N" @dmengerrmsg
....
return 1proc dbi_exithandle (stmt, engine, flag)
if @dmretcode == DM_NO_MORE_ROWS
msg emsg "All rows returned."
return 0