Programming Guide



@dmerrsqlstate

Contains an engine-specific status code for error conditions

Description

Some database engines support a SQLSTATE status code which is updated after each SQL statement. SQLSTATE is currently supported by Panther's ODBC, Informix and DB2 drivers.

SQLSTATE is a five-character string which can be set for warning or error conditions. In Panther, warning conditions from SQLSTATE are written to @dmwarnsqlstate; error conditions are written to @dmerrsqlstate.

If the database engine does not support SQLSTATE, the value of @dmerrsqlstate will be "00000", the value that represents success.

A "00000" (five zeros) 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 SELECT before declaring a connection, Panther detects the error. Use the global variable @dmretcode to check for errors in Panther's database drivers.

Because the value of @dmerrsqlstate is engine-specific, it is strongly recommended that you install an error handler to test for these errors.

If the application accesses multiple database engines, the database driver for each engine must support SQLSTATE in order to use its values for application processing. @dmerrsqlstate is set to "00000" before each DBMS statement. If you need its value for later processing, it should be copied to another variable.