Progress
Embedded SQL-92
Guide and Reference


The SQLCA Structure

The complete SQLCA structure is in the sql_lib.h file, in the include directory of your installation. This is an excerpt from the SQLCA structure:

struct sqlca {
    char   sqlcaid[8] ;
    long   sqlcabc ;
    long   sqlcode ;
    unsigned long sqlerrml ;
    char   sqlerrm[512] ;
    char   sqlerrp[8] ;
    unsigned long sqlerrd[8] ;
    char   sqlwarn[8] ;
    char   sqlext[8] ;
        .
        .
        .
    long   number ;
    char   more[1] ;
    char   command_function[128] ;
    char   dynamic_function[128] ;
    long   condition_number ;
    char   returned_sqlstate[6] ;
    char   class_origin[128] ;
    char   subclass_origin[250] ;
    char   table_name[128] ;
    char   column_name[128] ;
} ; 

Descriptions of the fields in the SQLCA structure follow:

SQLCAID

Contains the string 'SQLCA'.

SQLCABC

Contains the size of the SQLCA structure.

SQLCODE

Gives the result of an SQL statement execution. The SQLCODE can have the following values:

SQLERRML

Contains the length of the error message in SQLERRM.

SQLERRM

Is a NULL terminated character string that is the error text corresponding to the code returned in the component SQLCODE.

SQLERRP

Currently not used.

SQLERRD

Is an array of six elements where each element is a long integer.

SQLERRD[2]

Indicates the number of rows processed after a successful execution of INSERT UPDATE and DELETE statements. SQLERRD[2] is set to the cumulative number of rows for a FETCH call associated with a cursor.

SQLERRD[3]

Is set to the number of rows fetched by the last FETCH call.

SQLWARN

A character array of size eight where each character value can either be a blank or a 'W'. A character 'W' in any of the character positions of the array indicates a warning during the execution of an SQL statement. Currently, only elements 0, 1, 2, 3, 4, and 6 of the array are used.

SQLWARN[0]

Set to 'W', then one or more of the other SQLWARN components have been set. If this component is blank no warning has been set.

SQLWARN[1]

Set to 'W' to indicate that one or more of the strings returned by the previous FETCH call have been truncated. Use the indicator variables to determine which of the strings were truncated.

SQLWARN[2]

Set to 'W' when one or more NULL values were ignored in the computation of an aggregate function.

SQLWARN[3]

Set to 'W' to indicate that the number of items in the SELECT list does not equal the number of host variables in the INTO clause; the query returns all the elements it can, which is the lesser of the two counts.

SQLWARN[4]

Set to 'W' after a successful execution of an UPDATE or a DELETE statement without a WHERE clause; it is more useful to check for this component while working with dynamic statements.

SQLWARN[6]

Set to 'W' if the transaction is implicitly marked for ROLLBACK. The application must roll back the current transaction before executing the next SQL statement.

SQLEXT

Currently not used.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095