To execute an SQL statement, a DataBlade API module must send the SQL statement to the database server, where the statement is actually executed. The DataBlade API provides the following statement-execution functions for use in a DataBlade API module:
All of these functions perform the same basic task: they send a string representation of an SQL statement to the database server, which executes it and returns statement results. The mi_exec( ) function is the simplest way to execute an SQL statement.
A C user-defined routine (UDR) that executes SQL statements must be registered as a variant function; that is, its CREATE FUNCTION statement must either include the VARIANT routine modifier or omit both the NOT VARIANT and VARIANT routine modifiers (VARIANT is the default).
This section provides a summary of factors to consider when choosing the DataBlade API statement-execution function to use. It then describes the two methods for statement execution.
Method of Statement Execution | More Information |
---|---|
Parse, optimize, and execute the statement in one step | Executing Basic SQL Statements |
Parse and optimize the statement to create a prepared statement Execute the prepared statement | Executing Prepared SQL Statements |