Contains an engine-specific error code
@dmengerrcodeis set to
0before executing a
DBMScommand. If the database engine detects an error, Panther writes the engine's error code to this variable. In cases where a database engine can generate multiple error codes for one statement,
@dmengerrcodeis an array, and each error code is written to a different occurrence.
0(zero) value in this variable does not guarantee that the last statement executed without error. Some errors are detected by Panther's database driver before a request is made to the engine. For example, if an application attempts a
SELECTbefore declaring a connection, Panther detects the error. Use the global variable
@dmretcodeto check for errors in Panther's database drivers.
Because the value of
@dmengerrcodeis engine-specific, it is strongly recommended that you install an error handler to test for these errors. In a multi-engine application, the error handler can call another function to do this depending on the engine.
If the default error 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. Refer to the Database Drivers for more information about the codes for a particular engine.
proc dbi_errhandle (stmt, engine, flag)
if @dmengerrcode == 0
msg emsg @dmretmsg
else if engine == "xyzdb"call xyzerror (@dmengerrcode)
else if engine == "oracle"
call oraerror (@dmengerrcode)
msg emsg "Unknown engine."
return 1proc xyzerror (error)
# Check for specific xyzdb error codes.
if error == 90931
msg emsg "Invalid user name."
else if error == ...
msg emsg @dmengerrmsg