Writing an API Application to Process SQL Statements

From InterBase
Jump to: navigation, search

Go Up to Working with Dynamic SQL


Writing an API application that processes SQL statements enables a developer to code directly to InterBase at a low level, while presenting end users a familiar SQL interface. API SQL applications are especially useful when any of the following are not known until runtime:

  • The text of the SQL statement
  • The number of host variables
  • The data types of host variables
  • References to database objects

Writing an API DSQL application is more complex than programming embedded SQL applications with regular SQL because for most DSQL operations, the application needs explicitly to allocate and process an extended SQL descriptor area (XSQLDA) data structure to pass data to and from the database.

To use the API to process a DSQL statement, follow these basic steps:

  1. Determine if API calls can process the SQL statement.
  2. Represent the SQL statement as a character string in the application.
  3. If necessary, allocate one or more XSQLDA for input parameters and return values.
  4. Use appropriate API programming methods to process the SQL ­statement.

Topics

Advance To: