![]() | Programming Guide | ![]() |
Contains an engine-independent error or status code
@dmretcodeis set to0before Panther executes a newDBMScommand. 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@dmretcodedescribing the failure.Usually a non-zero value in
@dmretcodeindicates 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
@dmretcodewhich are not errors:DM_NO_MORE_ROWSandDM_END_OF_PROC. When an engine indicates that it has returned all rows for a select set, Panther writes theDM_NO_MORE_ROWScode to@dmretcode. Since this is not considered an error, Panther does not call the default or installed error handler. You can test forDM_MORE_ROWSafter executing aSELECTor in an exit handler.Panther uses
DM_END_OF_PROCwith engines that support stored procedures. When an engine indicates that it has completed executing the stored procedure, Panther writes theDM_END_OF_PROCcode 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
@dmretcodeare 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
![]()
![]()
![]()
![]()