Fields of the sqlca structure

The sqlca structure is defined in the sqlca.h header file. The Informix® ESQL/C preprocessor automatically includes the sqlca.h header file in the Informix® ESQL/C program.

The following table illustrates the fields of the sqlca structure.

Table 1. Fields of the sqlca structure
Field Type Value Value description
sqlcode int4 0 Indicates success.
>=0, < 100 After a DESCRIBE statement, represents the type of SQL statement that is described.
100 After a successful query that returns no rows, indicates the NOT FOUND condition. NOT FOUND can also occur in an ANSI-compliant database after an INSERT INTO/SELECT, UPDATE, DELETE, or SELECT... INTO TEMP statement fails to access any rows. For more information, see NOT FOUND in SQLSTATE.
<0 Error code.
sqlerrm character (72) or character (600) When working with Informix® database servers this field is 72 characters long and contains the error message parameter. This parameter is used to replace a %s token in the actual error message. If an error message requires no parameter, this field is blank.
sqlerrp character (8) Internal use only.
sqlerrd array of 6 int4s [0] After a successful PREPARE statement for a SELECT, UPDATE, INSERT, or DELETE statement, or after a select cursor is opened, this field contains the estimated number of rows affected.
[1] When SQLCODE contains an error code, this field contains either zero or an additional error code, called the ISAM error code, that explains the cause of the main error.

After a successful insert operation of a single row, this field contains the value of any SERIAL value generated for that row.

[2] After a successful multirow insert, update, or delete operation, this field contains the number of rows that were processed.

After a multirow insert, update, or delete operation that ends with an error, this field contains the number of rows that were successfully processed before the error was detected.

[3] After a successful PREPARE statement for a SELECT, UPDATE, INSERT, or DELETE statement, or after a select cursor was opened, this field contains the estimated weighted sum of disk accesses and total rows processed.
[4] After a syntax error in a PREPARE, EXECUTE IMMEDIATE, DECLARE, or static SQL statement, this field contains the offset in the statement text where the error was detected.
[5] After a successful fetch of a selected row, or a successful insert, update, or delete operation, this field contains the rowid (physical address) of the last row that was processed. Whether this rowid value corresponds to a row that the database server returns to the user depends on how the database server processes a query, particularly for SELECT statements.
Table 2. Fields of the sqlca structure when opening a database
Field Type Value Value description
sqlwarn array of 8 characters sqlwarn0 Set to W when any other warning field is set to W. If blank, others do not need to be checked.
sqlwarn1 Set to W when the database now open uses a transaction log.
sqlwarn2 Set to W when the database now open is ANSI compliant.
sqlwarn3 Set to W.
sqlwarn4 Set to W when the database server stores the FLOAT data type in DECIMAL form (done when the host system lacks support for FLOAT data types).
sqlwarn5 Reserved.
sqlwarn6 Set to W when the application is connected to a database server that is running in secondary mode. The database server is a secondary server in a data-replication pair (the database server is available only for read operations).
sqlwarn7 Set to W when client DB_LOCALE does not match the database locale. For more information, see the chapter on Informix® ESQL/C in the Informix® GLS User's Guide.
Table 3. Fields of the sqlca structure for all other operations:
Field Type Value Value description
sqlwarn array of 8 characters sqlwarn0 Set to W when any other warning field is set to W. If blank, other fields in sqlwarn do not need to be checked.
sqlwarn1 Set to W if a column value is truncated when it is fetched into a host variable with a FETCH or a SELECT...INTO statement. On a REVOKE ALL statement, set to W when not all seven table-level privileges are revoked.
sqlwarn2 Set to W when a FETCH or SELECT statement returns an aggregate function (SUM, AVG, MIN, MAX) value that is null.
sqlwarn3 On a SELECT...INTO, FETCH...INTO, or EXECUTE...INTO statement, set to W when the number of items in the select list is not the same as the number of host variables given in the INTO clause to receive them. On a GRANT ALL statement, set to W when not all seven table-level privileges are granted.
sqlwarn4 Set to W after a DESCRIBE statement if the prepared statement contains a DELETE statement or an UPDATE statement without a WHERE clause.
sqlwarn5 Set to W following execution of a statement that does not use ANSI-standard SQL syntax (provided the DBANSIWARN environment variable is set).
sqlwarn6 Set to W when a data fragment (a dbspace) has been skipped during query processing (when the DATASKIP feature is on).
sqlwarn7 Reserved.