The SQL Communications Area (SQLCA) is an area of memory that is used for communicating statistics and errors from the application to the database and back to the application. The SQLCA is used as a handle for the application-to-database communication link. It is passed explicitly to all database library functions that communicate with the database. It is implicitly passed in all embedded SQL statements.
UltraLite defines a SQLCA global variable for you in the generated code. The preprocessor generates an external reference for the global SQLCA variable. The external reference is named sqlca and is of type SQLCA. The actual global variable is declared in the imports library.
The SQLCA type is defined in the header file install-dir\SDK\Include\sqlca.h.
After declaring the SQLCA (
EXEC SQL INCLUDE SQLCA;), but before your application can carry out any operations on a database, you must initialize the communications area by
calling db_init and passing it the SQLCA:
db_init( &sqlca );
You reference the SQLCA to test for a particular error code. The sqlcode field contains an error code when a database request causes an error. Macros are defined for referencing the sqlcode field and some other fields in the sqlca.
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|