Using Cursor Library

Usually, an ODBC driver does not support all cursor types (see the section Choosing Cursor Type and Concurrency Mode). The reasons for that may lie in ODBC driver architecture as well as in restrictions of DBMS for which the driver is intended. There are data sources (the combination of DBMS and an ODBC driver) that support forward-only cursors (constant gdbExtDBCursorForwardOnly in the "Cursor types" table). Such a data source cannot satisfy the needs of many applications because it does not support arbitrary moving in a recordset.

To solve the problem for data sources that support forward-only cursors, the cursor library is used. The cursor library is a dynamic-link library (DLL) that resides between an application and an ODBC driver. If the ODBC cursor library is loaded, the ODBC Driver Manager routes all cursor-related commands to the cursor library instead of the driver (i.e., the cursor library appears as a driver to an application). The cursor library is used to implement cursors different from forward-only cursors on a driver that normally does not support them. The cursor library gives an opportunity to use a static cursor (only a static one) (see constant gdbExtDBCursorStatic in the "Cursor types" table).

To implement a static cursor providing arbitrary moving in a recordset, the cursor library caches the data it has retrieved in memory and, if necessary, in disk files on a user computer. When a static cursor moves forward, the cursor library using the driver cursor fills the cache and returns the requested record. When a static cursor moves backward, the cursor library uses the cache filled earlier and returns the requested record from the cache.

Taking into account the implementation of a static cursor in the cursor library, it is worth to note that large-sized recordsets demand more memory and disk space. Besides, the performance (access speed to a certain record) of static cursor provided by the cursor library decreases when the size of recordset increases.

One of the connection attributes used to connect to a data source is an option for the cursor library that can be set by the ExternalDatabase::CursorLibrary property. You can use the following options for the cursor library in the GIS kernel:

The cursor library is always used (constant gdbExtDBCurUseODBC in the "Options Used for Cursor Library" table). Only the cursor types supported by the cursor library can be used in the GIS kernel regardless of cursor types supported by a data source. This mode can increase concurrency and general performance in the case of small-sized recordsets. This is the default mode.

The cursor library is used if needed (constant gdbExtDBCurUseIfNeeded in the "Options Used for Cursor Library" table). The GIS kernel will use the cursor library only if a data source does not support scrollable cursors (just forward-only cursors).

The cursor library is never used (constant gdbExtDBCurUseDriver in the "Options Used for Cursor Library" table). The GIS kernel will not use the cursor library regardless of cursor types supported by a data source. In this case, the work with data sources supporting forward-only cursors is impossible.