Object | Data Type | Comment |
---|---|---|
dbmserror | integer | The number of the error caused by the last query. This number corresponds to the value of sqlerrd(1), the first element of the sqlerrd array in the SQLCA. You can specify whether a local or generic error is returned using SET_SQL(errortype). |
endquery | integer | If the previous FETCH statement was issued after the last row of the cursor, endquery returns the value “1.” If the last FETCH statement returns a valid row, the value returned is “0.” This is identical to the NOT FOUND condition (value 100) of the SQLCA variable sqlcode, which can be checked after a fetch statement is issued. Like the NOT FOUND condition, when endquery returns “1,” the variables assigned values from the fetch remain unchanged. |
errorno | integer | A positive integer, representing the error number of the last query. The error number is cleared before each embedded OpenSQL statement, so that this object is only valid immediately after the statement in question. This error number is the same as the positive value of the SQLCA variable sqlcode, except in two cases: A single query generates multiple different errors, in which case the sqlcode identifies the first error number, and the errorno object identifies the last error. After switching sessions. In this case, sqlcode reflects the results of the last statement executed before switching sessions, while errorno will reflect the results of the last statement executed in the current session. If a statement executes with no errors or sqlcode is set to a positive number (for example, +100 to indicate no rows affected), then the error number is set to 0. |
errortext | character | The error text of the last query. The error text is only valid immediately after the database statement in question. The text that is returned is the complete error message of the last error. This message may have been truncated when it was deposited into the SQLCA variable sqlerm. A character string result variable of size 512 should be sufficient to retrieve all OpenSQL error messages. If the result variable is shorter than the error message, the message is truncated. If there is no error message, a blank message is returned. |
errortype | character | Returns genericerror if OpenSQL returns generic error numbers to errorno and sqlcode, or dbmserror if OpenSQL returns local DBMS error numbers to errorno and sqlcode. For information about generic and local errors, see “Chapter 7: OpenSQL Features.” |
programquit | integer | Returns 1 if applications quit: • After issuing a query when not connected to a database. • If the Enterprise Access product or server fails. • If communications services fail. Returns 0 if applications continue after encountering such errors. |
querytext | character | Returns the text of the last query issued. Valid only if this feature is enabled. To enable or disable the saving of query text, use set_sql(savequery). A maximum of 1024 characters is returned. If the query is longer, it is truncated to 1024 characters. If the receiving variable is smaller than the query text being returned, the text is truncated to fit. If a null indicator variable is specified together with the receiving host language variable, the indicator variable is set to ‑1 if query text cannot be returned, 0 if query text is returned successfully. Query text cannot be returned if (1) savequery is disabled, (2) no query has been issued in the current session, or (3) the inquire_sql statement is issued outside of a connected session. |
rowcount | integer | The number of rows affected by the last query. “Affected” means subject to any of the following statements: insert, delete, update, select, fetch, create index, or create table as select. If any of these statements run successfully, the value of rowcount is the same as the value of the SQLCA variable sqlerrd(3). If these statements generate errors, or if statements other than these are run, then the value of rowcount is negative and the value of sqlerrd(3) is 0. |
savequery | integer | Returns 1 if query text saving is enabled, 0 if disabled. |
session | integer | Returns the session identifier of the current database session. If the application is not using multiple sessions or there is no current session, 0 is returned. |
transaction | integer | Returns a value of 1 if there is a transaction open. Returns 0 if no transaction is open. |