Sample embedded SQL programs are included with the SQL Anywhere installation. They are placed in the samples-dir\SQLAnywhere\C directory. For Windows Mobile, an additional example is located in the samples-dir\SQLAnywhere\CE\esql_sample directory.
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:
WSQLEX_Init Connects to the database and opens the cursor.
WSQLEX_Process_Command Processes commands from the user, manipulating the cursor as necessary.
WSQLEX_Finish Closes the cursor and disconnects from the database.
The function of the mainline is to:
Connecting to the database is accomplished 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 SQL Anywhere that demonstrate features available for particular platforms.
Building the sample programs
Running the sample programs
Static cursor sample
Dynamic cursor sample
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |