SQLCA

Embedded SQL for C and SQL Server

Embedded SQL for C and SQL Server

SQLCA

Here are fields and data types for the SQLCA data structure.

Field C data type Contains
sqlcaid unsigned char Text string SQLCA.
sqlabc long Length of the SQLCA data structure.
sqlcode long Status code for the last-run SQL statement:

0    The statement ran without error.
1    The statement ran, but an exception was generated.
100    A FETCH statement was issued, but no more rows satisfy the SELECT statement criteria used to define the cursor. No rows were processed.
< 0 (negative)    The statement did not run due to an application, database, system, or network error.

sqlerrm   Error messages that consist of two parts.
sqlerrml Length of the error message in sqlerrmc (0 to 70).
short
sqlerrmc Text of the error message. Error messages longer than 70 bytes are truncated.
unsigned char Reserved (diagnostic information).
sqlerrp unsigned char
sqlerrd long Array of six integer status codes (codes not in the fields listed later are reserved).
sqlerrd[1] Microsoft® SQL Server™ 2000 error number.
sqlerrd[2] SQL Server severity level.
sqlerrd[3] Number of rows affected.
sqlwarn Eight warning flags, each containing a blank or W (flags not in the fields listed later are reserved).
sqlwarn[0] unsigned char Summary of all warning fields. Blank indicates no warnings.
sqlwarn[1] unsigned char W indicates a character string was truncated during output binding
sqlwarn[2] unsigned char Not used.
sqlwarn[3] unsigned char W indicates that the number of columns does not match the number of host variables.
sqlext unsigned char Reserved.
sqlstate unsigned char SQLSTATE run-time error codes.

Warning  If the number of host variables and parameter markers does not match, SQLWARN3 is set to W. This condition is considered an exception (SQLCODE is set to +1). Exceeding the number of host variables or SQLDA data structure entries is fatal (SQLCODE = -19313). During a FETCH statement or a singleton SELECT statement, SQLWARN3 is set if the number of columns is not equal to the number of host variables (or SQLDA data structure entries). The lower of the two is the number of items actually processed. For more information about SQLCA, see Using the SQLCA Data Structure.