![]() | ![]() | Programming Guide |
Contains an engine-specific error code
@
dmengerrcodeis set to 0 before executing a DBMS command. If the database engine detects an error, Prolifics writes the engine's error code to this variable. In cases where the database engine generates multiple error codes for one statement, @dmengerrcodeis an array, and each error code is written to a different occurrence.A 0 (zero) value in this variable does not guarantee that the last statement executed without error. Some errors are detected by Prolifics's database driver before a request is made to the engine. For example, if an application attempts a
SELECTbefore declaring a connection, Prolifics detects the error. Use the global variable @dmretcodeto check for errors in Prolifics'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.If the default error handler is in use, Prolifics displays the statement which failed and an error message from either Prolifics'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)
else
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 == ...
...
else
msg emsg @dmengerrmsg
return
![]()
![]()
![]()
![]()