QUEL Reference Guide > QUEL Reference Guide > QUEL and EQUEL Statements > INQUIRE_INGRES--Get Diagnostic Information
Was this helpful?
INQUIRE_INGRES--Get Diagnostic Information
Valid in: EQUEL
Returns diagnostic information about the program's interaction with the database.
This statement has the following format:
## inquire_ingres (variable object {, variable = object})
The inquire_ingres statement returns diagnostic information about the last database statement that was executed. Inquire_ingres and inquire_equel are synonymous.
Inquire_ingres must be issued immediately following the database statement in question, because the next EQUEL statement resets this diagnostic information.
Valid values for object are listed in the following Inquire_ingres Statement Parameters table:
Object
Data Type
Description
connection_target
character
Returns the node and database to which the current session is connected; for example, "bignode::mydatabase".
dbmserror
integer
Returns the number of the error caused by the last query.
endquery
integer
Returns 1 if the previous fetch statement was issued after the last row of the cursor, 0 if the last fetch statement returned a valid row. If endquery returns 1, the variables assigned values from the fetch are left unchanged.
errorno
integer
Returns the error number of the last query as a positive integer. The error number is cleared before each embedded QUEL statement; errorno is meaningful only immediately after the statement in question.
errortext
character
Returns the error text of the last query. The error text is only valid immediately after the database statement in question. The error text that is returned is the complete error message of the last error. A character string result variable of size 256 is sufficient to retrieve all 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 the DBMS Server returns generic error numbers to errorno, or "dbmserror" if it returns local DBMS error numbers to errorno. For information about generic and local errors, see the SQL Reference Guide.
prefetchrows
integer
Returns the number of rows the DBMS Server buffers when fetching data using readonly cursors. This value is reset every time a readonly cursor is opened; if your application is using this feature, be sure to set the value after opening a readonly cursor.
programquit
integer
Returns 1 if the programquit option is enabled. If programquit is enabled, the following errors cause EQUEL applications to abort:
Issuing a query when not connected to a database
Failure of the DBMS Server
Failure of communications services
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 the set_ingres(savequery) statement.
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 you specify a null indicator variable in conjunction with the receiving host 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_ingres statement is issued outside of a connected session.
rowcount
integer
Returns the number of rows affected by the last query. The following statements affect rows: append, delete, replace, retrieve, fetch, modify, index, and copy. If these statements generate errors, or if statements other than these are run, the value of rowcount is negative. Exception: for modify to truncated, inquire_ingres(rowcount) always returns 0. The value returned for rowcount is determined by the set update_rowcount option. For details, see Update_rowcount Option.
savequery
integer
Returns 1 if query text saving is enabled, 0 if disabled.
transaction
integer
Returns a value of 1 if there is a transaction open.
Last modified date: 04/03/2024