Success in SQLSTATE
When the database server executes an SQL statement successfully,
it sets SQLSTATE to "00000" (class = "00",
subclass = "000"). To check for successful execution,
your code needs to verify only the first two characters of SQLSTATE.
Tip: After a CONNECT, SET CONNECTION, DATABASE, CREATE DATABASE,
or START DATABASE statement, the SQLSTATE variable has a class
value of "01" and a subclass value, which is specific to HCL Informix®, to
provide information about the database and connection. For more information,
see Table 1.
The getdiag sample program in Guide to the getdiag.ec file uses the sqlstate_err() function to compare the first two characters of SQLSTATE with the string "00" to check for successful execution of an SQL statement. The sqlstate_exception() function shown in Figure 2 checks for a success in SQLSTATE with the system strncmp() function.