skip to main content
Designing and coding the IP : Typical call sequence into the IP
 

Typical call sequence into the IP

This section shows the sequence of operations that the IP must perform to handle the execution of a query from an ODBC-compliant client application. The sequence shown here is representative of what happens for a single table query. The sequence is different when joins, scalar functions, stored procedures, and pushdown operations are performed.
A typical sequence of calls to a C/C++ IP to an OpenAccess SDK ODBC driver for a client/server configuration that is loaded from Microsoft Excel is:
1. OpenAccess SDK Server is started: The IP is called to perform an INIT operation. At this time, the IP should perform any global initialization that may be required. For a local implementation this happens when the driver is loaded.
2. Client application connects to a DSN: The IP is called to perform CONNECT to process a user’s request to log in to the selected ODBC DSN. User name, password, and custom properties are passed to CONNECT. The CONNECT function initiates a connection to the backend data source.
3. List of tables requests: If using the built-in static schema database, then the IP does not get a call. The OpenAccess SDK SQL engine directly accesses the schema tables and returns the list of configured tables. If the IP is implementing the schema (dynamic schema), then the SCHEMA function is called to return table objects.
4. Columns for selected table: If using the built-in static schema database, then the IP does not get a call. The OpenAccess SDK SQL engine directly accesses the schema tables and returns the list of columns for the selected table. If the IP is implementing the schema, then the SCHEMA function is called to return column objects with a filter containing the table name.
5. Query execution: The user builds a SELECT query and submits it for execution. The OpenAccess SDK SQL engine receives the query and first validates it for correctness. To do this, it must access the schema definition for the table(s) in the query. If the IP is handling the schema then the SCHEMA operation for TABLE lookup is requested for each table referenced in the query. For each table a COLUMNS lookup is requested. This is followed by a call for PRIMARY keys information and INDEX information for each table. If multiple tables are referenced in the query, then SCHEMA is called again to retrieve foreign keys.
If the query syntax is correct and the objects referenced in it are in the schema, then the OpenAccess SDK SQL engine calls IP EXECUTE to perform a DAM_SELECT operation. At this time the IP builds the rows for the specified table and then returns. At this point it is finished processing the query for the specified table.
6. Results are sent back to the client: The OpenAccess SDK SQL engine sends the results to the OpenAccess SDK Client, from which the ODBC application fetches the data using the SQLFetch ODBC call.
7. Client disconnects: The OpenAccess SDK SQL engine calls IP DISCONNECT to close the connection with the data source. At this time, the IP releases any resources.
8. The OpenAccess SDK Server is shut down: The IP is called to perform the EXIT operation.
Note: In the Java and .NET methods, the IP interface does not have the INIT and EXIT operations.