skip to main content
Overview : Overview of the Third-party SQL Engine API : Developing an IP Using C/C++
 

Developing an IP Using C/C++

The following table describes the API functions that must be implemented by each IP developed in C or C++ for use with a third-party SQL engine. Some functions may not apply to your data source. In this case, implement the functions as stubs that return success when called.
See IP API Reference for C/C++ for more information.
 
Table 1: API for an IP Developed in C/C++ 
Method
Description
OASQLIP_alloc_connect
Called when a client wants to establish a connection with a data source served by the IP. Sets up a handle to be used for this connection.
OASQLIP_alloc_stmt
Allocates a statement handle to be used for executing statements.
OASQLIP_cancel
Cancel the specified statement.
OASQLIP_close_cursor
Closes the cursor and clears the result table. Frees any resources used to hold the results of this cursor.
OASQLIP_close_stmt
Frees any resources allocated for the execution of a statement on this statement handle. If a cursor is open, the IP should close it.
OASQLIP_commit
Commits the changes on the specified connection handle and starts a new transaction.
OASQLIP_connect
Called when a client wants to establish a connection with a data source served by the IP. Authentication information such as the user name and password are passed in. The IP attempts to connect to the database at this time.
OASQLIP_disconnect
Closes the connection and frees all resources used to serve this connection.
OASQLIP_error
Returns the error that occurred during the last operation on either the connection or the statement handle. Once the error is returned, clears the error list.
OASQLIP_execute_direct_stmt
Execute a statement that has not been prepared. For example, a ODBC client call SQLExecDirect will result in a call to this function.
OASQLIP_execute_stmt
Execute the prepared statement. Save the result table and place the cursor before the first row in the table. Return the number of rows selected.
OASQLIP_exit
Called when the OpenAccess SDK Server (in client/server configuration) or the client DLL (in local configuration) is shutting down. The IP should free all resources and close any open connections.
OASQLIP_fetch_row
Advances the cursor to the next row of the result table. On reaching End of the Table, the IP should return SQLDRV_EOS.
OASQLIP_free_connect
Frees the connection handle. The IP should close any files or other connections established on behalf of this connection.
OASQLIP_free_stmt
Frees a statement handle that was allocated by the OASQLIP_alloc_connect function.
OASQLIP_get_colattr
Called to obtain column attributes such as base table name and base column name.
OASQLIP_get_colspec
Returns the description about the column.
OASQLIP_get_colval
Returns the column value in the same format as the type of the column. For example, if the column is defined as XO_TYPE_CHAR, then the data is a character string.
OASQLIP_get_connect_info
Called to query the IP for connection level information.
OASQLIP_get_ds_info
Called to query the IP for data source level settings.
OASQLIP_get_numcols
Returns the number of columns in the result set.
For a Insert, Update, Delete statement (a DML statement), the method returns 0.
For a Select statement, the method returns the number of columns.
OASQLIP_get_numparams
Returns the number of parameter markers in the prepared statement. If the statement does not have any parameters, returns 0.
OASQLIP_get_paramspec
Describes the parameters in a parameterized query that has been prepared.
OASQLIP_get_stmt_info
Called to query the IP for statement level information.
OASQLIP_init
Called at startup to initialize the IP. The IP performs all the required startup processing.
OASQLIP_init_param
Initializes the parameter with the specified value.
OASQLIP_open_next_cursor
Open the next cursor that may be available. Applies to stored procedure calls and statements that can return more than one result set. After this call the OASQLIP_get_colspec function should be prepared to return the definition of this new result set.
OASQLIP_open_output_cursor
Position the cursor to return the result code and output parameters from a stored procedure call.
OASQLIP_prepare_stmt
Parse the given statement and generate plan for executing the statement. The IP should collect information about any parameters in the statement and also description about result columns (if the statement is of type Select). All statements are always executed using PREPARE/OPEN_CURSOR sequence, regardless of how the client API submits the request.
OASQLIP_rollback
Rollback all operations performed on this connection since the last COMMIT and start a new transaction.
OASQLIP_set_connect_info
Called to set connection level information.
OASQLIP_set_stmt_info
Called to set statement level information.
OASQLIP_start_transaction
Called to initiate a new transaction. The IP can use this entry point to perform transaction management for each connection. It is assumed that after a commit or rollback a new transaction is initiated. This method is called only if a nested transaction is initiated.