Contents IndexSET OPTION statement SIGNAL statement

User's Guide
   Part VI. SQL Anywhere Reference
     Chapter 43. Watcom-SQL Statements
      SET SQLCA statement

Function

To tell the SQL preprocessor to use a SQLCA other than the default global sqlca.

Syntax

     SET SQLCA sqlca

Parameters

     sqlca:    identifier or string

Usage

Embedded SQL.

Permissions

None.

Side effects

None.

See also

Description

The SET SQLCA statement tells the SQL preprocessor to use a SQLCA other than the default global sqlca. The sqlca must be an identifier or string that is a C language reference to a SQLCA pointer. The current SQLCA pointer is implicitly passed to the database interface library on every Embedded SQL statement. All Embedded SQL statements that follow this statement in the C source file will use the new SQLCA. This statement is only necessary when you are writing code that is reentrant (see "Multi-Threaded or Reentrant Code"). The sqlca should reference a local variable. Any global or module static variable is subject to being modified by another thread.

Example

The following function could be found in a Windows DLL. Each application that uses the DLL has its own SQLCA.

     an_sql_code FAR PASCAL ExecuteSQL( an_application *app, char *com )
     {
     EXEC SQL BEGIN DECLARE SECTION;
     char *sqlcommand;
     EXEC SQL END DECLARE SECTION;
     EXEC SQL SET SQLCA "&app->.sqlca";
     sqlcommand = com;
     EXEC SQL WHENEVER SQLERROR CONTINUE;
     EXEC SQL EXECUTE IMMEDIATE :sqlcommand;
     return( SQLCODE );
     }

Contents IndexSET OPTION statement SIGNAL statement