A SQLCA structure is used in conjunction with ct_diag to retrieve Client-Library and server error and informational messages.
A SQLCA structure is defined as follows:
/*
** SQLCA
** The SQL Communications Area structure.
*/
typedef struct _sqlca
{
char sqlcaid[8];
long sqlcabc;
long sqlcode;
struct
{
long sqlerrml;
char sqlerrmc[256];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
char sqlwarn[8];
char sqlext[8];
} SQLCA;
where:
sqlcaid is “SQLCA”.
sqlcabc is ignored.
sqlcode is the server or Client-Library message number. For information about how Client-Library maps message numbers to sqlcode, see “SQLCODE structure”.
sqlerrml is the length of the actual message text (not the length of the text placed in sqlerrmc).
sqlerrmc is the null-terminated text of the message. If the message is too long for the array, Client-Library truncates it before appending the null terminator.
sqlerrp is the null-terminated name of the stored procedure, if any, being executed at the time of the error. If the name is too long for the array, Client-Library truncates it before appending the null terminator.
sqlerrd[2] is the number of rows affected by the current command. This field is set only if the current message is a “number of rows affected” message. Otherwise, sqlerrd[2] has a value of CS_NO_COUNT.
sqlwarn is an array of warnings:
If sqlwarn[0] is blank, then all other sqlwarn variables are blank. If sqlwarn[0] is not blank, then at least one other sqlwarn variable is set to “W”.
If sqlwarn[1] is “W”, then Client-Library truncated at least one column’s value when copying it into a host variable.
If sqlwarn[2] is “W”, then at least one null value was eliminated from the argument set of a function.
If sqlwarn[3] is “W”, then some but not all items in a result set have been bound. This field is set only if the CS_ANSI_BINDS property is set to CS_TRUE (see “ANSI-style binds”).
If sqlwarn[4] is “W”, then a dynamic SQL update or delete statement did not include a where clause.
If sqlwarn[5] is “W”, then a server conversion or truncation error has occurred.
sqlext is ignored.