Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Advanced Programming

SQL Server 2000

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

Advanced programming topics include:

  • Data type mappings from Transact-SQL to C, and vice versa

  • The SQLDA data structure for data input and output

  • The contents of the SQLCA data structure

  • The EXEC statement and how to use it to selectively bypass the creation of an access plan

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:

   SELECT au_lname
   FROM   authors
   SELECT au_fname
   FROM   authors

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

See Also

Embedded SQL Programming

© 2015 Microsoft