Cursor

Cursor. A cursor is a data structure that stores the results of a query. The type of cursor determines the functionality available. Some cursors allow you to move forward through the results of your query, others allow you to move forward and backward. Streaming database connector supports both the forward-only and static (i.e., random access, see below) cursors. You can also specify database connections that permit writing of information back to the database (e.g., of predicted values or classifications via the Rapid Deployment of Models options). See the description of the Query Options dialog box for additional information.

Forward-Only Cursor. The simplest type of cursor, it allows moving only forward through the results of your query. After you move beyond a record, it is no longer available in the cursor. This type of cursor provides fast access to the data and places the least stress on the database system. In the context of database streaming, if a user or analysis must make multiple passes through or needs random access to the data, then the query must be re-run to return to a previous record. If records were modified, added to, or removed from the database in the meantime, this re-query can result in different data or a different number of records. If a particular analysis or usage of database streaming requires a single forward pass through the data, this type of cursor will most likely be the fastest.

Static Cursor. A static cursor supports scrolling forward and backward through the data, thus allowing random access to the data. This cursor type provides a "snapshot" of the result of your query - records modified, added to, or removed from the database after the cursor is populated will not be visible. A server-side static cursor can place considerable strain on the database system. A client-side cursor is always static. If an analysis or other usage of database streaming requires random access or multiple passes through the data, this type of cursor may be needed.

Keyset Cursor. A keyset cursor is a server side cursor that allows you to update data (when using an appropriate Lock Type; see the description of the Query Options dialog box for details) and to see changes made by other users. It allows random access to records and multiple passes through the data. In contrast to a static cursor, which the query processor will completely populate when you submit your query, the keyset cursor is initially populated with only the data required to locate the records in the tables that satisfy the query. Generally this data corresponds to the primary key in your tables and is referred to as the keyset.

Dynamic Cursor. The dynamic cursor behaves a lot like the keyset cursor. Initially, the query processor retrieves the key field information for the records that satisfy your query and returns a particular number of records (specified in the Cache Size property of the Query Options dialog box) to the local machine. With the dynamic cursor, however, the query processor rebuilds the keyset information each time the cache is refreshed. Thus, records added by other users will become available in this cursor as you navigate through the records.

Note that the keyset and dynamic cursor types are significantly more complicated than forward only and static cursors, and therefore they are typically much slower, and place a greater strain on the remote database system. In addition, unexpected or misleading results can be obtained if the number or content of records in the database streaming connection changes while an analysis is in progress.

Server-side Cursor. The cursor is maintained on the database server. The number of records specified by the cache size (see Query Options) will be copied to the user's local machine, while the rest are stored on the server. Whenever a record not in the local cache is requested, a new set of records will be copied from the server to the client machine. This type of cursor can place considerable strain on the database system, as it must store the results of all such queries.

Client-side Cursor. The cursor is maintained on the client (user's) machine, with the Microsoft ActiveX Data Objects (ADO) Cursor Engine. This means that all records returned from the query are copied to the user's local machine. A client side cursor is a static cursor.  

See also, Streaming of Data on Remote Servers and Streaming Database Connector Technology (Technical Overview).