Advanced Programming

Most of the features used in writing Embedded SQL code are discussed in Embedded SQL Programming.

Advanced programming topics include:

Embedded SQL for C is not thread-safe. If you are using ESQL/C in a threaded application, use only ESQL/C calls from a single thread of execution. It is best if you use the main thread.

If you place the ESQL/C calls in a thread other than the main thread, the thread can be started only one time. The thread must then remain available for all subsequent ESQL/C needs. Therefore, if you place the ESQL/C calls in a thread, and then start and stop that thread multiple times to accomplish database tasks, you may experience unexpected behavior. To implement a thread that handles all ESQL/C activity, set up the thread with an event-triggering mechanism.

In ESQL/C, statements that return only one result set can be executed.  For example:

CREATE PROCEDURE spTest

AS

    SELECT au_lname

    FROM    authors

    SELECT au_fname

    FROM    authors

GO

Execution of spTest stored procedure produces two result sets from Microsoft® SQL Server™. But ESQL/C application will see only the first result set.

See Also

Embedded SQL Programming

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.