Home | Previous Page | Next Page   Database Access > Executing SQL Statements >

Processing Statement Results

Once a DataBlade API statement-execution function (see Table 53) executes, the SQL statement that it sent to the database server is the most recent SQL statement on the connection. This most recent SQL statement is called the current statement. Information about the current statement is associated with a connection. Only one statement is current at a time.

After you send the current statement to the database server for execution, your DataBlade API module must process the statement results by:

Retrieving the results of an SQL statement is a multiphase process that involves several levels of nested iteration, as the following table shows.

Statement-Processing Loop Description More Information
mi_get_result( ) loop Outermost loop of the row-retrieval code iterates through each current statement. Executing the mi_get_result( ) Loop
mi_next_row( ) loop Middle loop of the row-retrieval code iterates through each row that the current statement has retrieved. Executing the mi_next_row( ) Loop
Column-value loop Innermost loop of the row-retrieval code iterates through each column value of a query row. This loop uses the mi_value( ) or mi_value_by_name( ) function to obtain the column values. Executing the Column-Value Loop

The first step in processing statement results is to determine the status of the current statement with the mi_get_result( ) function, as follows:

For a sample function that shows one way to use mi_get_result( ) to process statement results, see Example: The get_data( ) Function.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]