Sample embedded SQL programs are included with the SAP Sybase IQ installation. They are placed in the %ALLUSERSPROFILE%\SybaseIQ\samples\SQLAnywhere\C directory.
The static cursor embedded SQL example, cur.sqc, demonstrates the use of static SQL statements.
The dynamic cursor embedded SQL example, dcur.sqc, demonstrates the use of dynamic SQL statements.
To reduce the amount of code that is duplicated by the sample programs, the mainlines and the data printing functions have been placed into a separate file. This is mainch.c for character mode systems and mainwin.c for windowing environments.
The sample programs each supply the following three routines, which are called from the mainlines:
The function of the mainline is to:
Call the WSQLEX_Init routine.
Loop, getting commands from the user and calling WSQL_Process_Command until the user quits.
Call the WSQLEX_Finish routine.
Connecting to the database is done with the embedded SQL CONNECT statement supplying the appropriate user ID and password.
In addition to these samples, you may find other programs and source files as part of SAP Sybase IQ that demonstrate features available for particular platforms.