Programming Guide



@dmengsqlstate

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 a five-character string which can be set for warning or error conditions. In Prolifics, warning conditions from SQLSTATE are written to @dmwarnsqlstate; error conditions are written to @dmengsqlstate.

If the database engine does not support SQLSTATE, the value of @dmengsqlstate will be 0, the value which represents success.

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 SELECT before declaring a connection, Prolifics detects the error. Use the global variable @dmretcode to check for errors in Prolifics's database drivers.

Because the value of @dmengsqlstate 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 process ing.@dmengsqlstate, like all @dm variables, is set to 0 before each DBMS statement. If you need its value for further processing, it should be copied to another variable.