ASA Programming Guide
Embedded SQL Programming
EXEC SQLALL embedded SQL statements must be preceded with EXEC SQL and end with a semicolon (;). |
There are two groups of embedded SQL commands. Standard SQL commands are used by simply placing them in a C program enclosed with EXEC SQL and a semi-colon (;). CONNECT, DELETE, SELECT, SET, and UPDATE have additional formats only available in embedded SQL. The additional formats fall into the second category of embedded SQL specific commands.
For descriptions of the standard SQL commands, see SQL Statements.
Several SQL commands are specific to embedded SQL and can only be used in a C program.
For more information about these embedded SQL commands, see SQL Language Elements.
Standard data manipulation and data definition statements can be used from embedded SQL applications. In addition the following statements are specifically for embedded SQL programming:
ALLOCATE DESCRIPTOR allocate memory for a descriptor
CLOSE close a cursor
CONNECT connect to the database
DEALLOCATE DESCRIPTOR reclaim memory for a descriptor
Declaration Section declare host variables for database communication
DECLARE CURSOR declare a cursor
DELETE (positioned) delete the row at the current position in a cursor
DESCRIBE describe the host variables for a particular SQL statement
DISCONNECT disconnect from database server
DROP STATEMENT free resources used by a prepared statement
EXECUTE execute a particular SQL statement
EXPLAIN explain the optimization strategy for a particular cursor
FETCH fetch a row from a cursor
GET DATA fetch long values from a cursor
GET DESCRIPTOR retrieve information about a variable in a SQLDA.
GET OPTION get the setting for a particular database option
INCLUDE include a file for SQL preprocessing
OPEN open a cursor
PREPARE prepare a particular SQL statement
PUT insert a row into a cursor
SET CONNECTION change active connection
SET DESCRIPTOR describe the variables in a SQLDA and place data into the SQLDA
SET SQLCA use an SQLCA other than the default global one
UPDATE (positioned) update the row at the current location of a cursor
WHENEVER specify actions to occur on errors in SQL statements