Function call flows
The following diagrams illustrate the function call flow for each of the primary SQL commands that you might use in your SQL Connection program:
For information on example programs listed for these function call sequences, see SQL Connection sample programs.
The following illustrates a function call sequence for a simple query. For examples, see the example programs exam_fetch.dbl and exam_fetch_update.dbl (which includes %SSC_REBIND).
|
|
The following illustrates a function call sequence for a multirow query. For an example, see the example program exam_multirow_fetch.dbl.
|
|
The following illustrates a function call sequence for a simple atomic update. For an example, see the example program exam_fetch_update.dbl.
|
|
The following illustrates a function call sequence for a bulk update.
|
|
The following illustrates a function call sequence for an insert. For an example, see the example program exam_create_table.dbl.
|
|
The following illustrates a function call sequence for a stored procedure. For examples, see the following example programs: stp_mysql.dbl, stp_odbc.dbl, stp_ora.dbl, stp_sqlsrv1.dbl, stp_sqlsrv2.dbl. Note the following:
- To fetch data from a SQL Server result set, use a combination of %SSC_OPEN with %SSC_MOVE (rather than %SSC_EXECIO or %SSC_EXECUTE) as illustrated in Multirow query and the stp_sqlsrv1.dbl and stp_sqlsrv2.dbl example programs.
-
With stored procedures, transactions typically take place inside the stored procedure, not outside with %SSC_COMMIT.
- Initialize SQL Connection.
- Connect to database.
- Set up SQL statement.
- Open cursor with SSQL_NONSEL.
- Test for errors.
- Set up bound data (%SSC_EXECIO only).
- Execute stored procedure.
- Test for errors.
- Process any returned data (%SSC_EXECIO only).
- Loop until done.
- Close cursor.
- Release connection if no more operations.