Writing an API Application to Process SQL Statements
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:
- Determine if API calls can process the SQL statement.
- Represent the SQL statement as a character string in the application.
- If necessary, allocate one or more XSQLDA for input parameters and return values.
- Use appropriate API programming methods to process the SQL statement.
- Determining if API Calls Can Process a SQL Statement
- Representing a SQL Statement as a Character String
- Specifying Parameters in SQL Statement Strings