Mixing ODBC and embedded SQLcode

In order to allow mixed use of ODBC and ESQL constructs to access the ODBC handles has been added to the translator. The construct below allows to access either the statement handle or the connection handle of the specified data base name.

   <include_handle> ::= 
      'INCLUDE' 
           { 'STATEMENT' 'HANDLE' [ <cursor>] | 
             'CONNECTION' 'HANDLE' }
           'OF'  [ <dbname>]  
   

In case of the statement handle, the name of the cursor may be specified. If no cursor is given, the statement handle of the last query will be returned.

Example 14-5. Accessing ODBC handles

   
      H  : SQLHSTMT;
      C  : SQLHDBC ;        
      ...
      EXEC SQL AT DB01x
         SELECT LOCATION INTO :dep_location
            FROM DEPARTMENTS
            WHERE DEPTNO = :depno ;
      ......
 
      -- get the ODBC handles
      H := EXEC SQL INCLUDE STATEMENT HANDLE OF DB01x ;
      C := EXEC SQL INCLUDE CONNECTION HANDLE OF DB01x ;