AnyDAC
ContentsIndexHome
PreviousUpNext
TADFetchOptions.CursorKind Property

Specifies type of cursor an AnyDAC command or dataset uses.

Group
Links

Set CursorKind to indicate the type of cursor the AnyDAC command or dataset uses for the result set when it is opening. CursorKind must be set prior to preparing command or dataset. To change CursorKind for already used dataset, application may call Disconnect method first. 

CursorKind affects on the:

  • time to return the first record or open the result set;
  • time to return all result set records;
  • ability to use multiple open cursors;
  • cursor stability;
  • used DBMS resources;
  • TADTable mode.
Option 
Description 
ckAutomatic 
A driver will automatically choose cursor kind, depending on the other fetch options and result set structure. 
ckDefault 
A driver will use a default client side cursor. A default cursor produces the records snapshot, as they was at query execution time. May give maximum fetch performance. But requires more time to return first record, because all result set records will be sent to the client at Open call. Some DBMS support only single active default cursor per connection. 
ckDynamic 
A driver will use a dynamic server side cursor. Dynamic cursor rows may be affected by the updates to the query tables, while the cursor is active. May require less time to return first record. And more time to return all records. 
ckStatic 
A driver will use a static server side cursor. Static cursor produces the records snapshot, as they was at query execution time. The fetch performance may be similar to dynamic cursor. 
ckForwardOnly 
A driver will use a forward only server side cursor. For AnyDAC forward only cursors are similar to dynamic or static cursors. To control AnyDAC dataset scrolling abilities use the Unidirectional property. 

The default value is ckAutomatic. 

Most of AnyDAC drivers support only some cursor kinds or even does not use this option at all. Please, consult to the DBMS documentation for details. AnyDAC chooses actual cursor kind, when CursorKind = ckAutomatic, as the following:

DBMS 
Conditions 
Actual cursor kind 
Microsoft SQL Server 
  • if server version is 2005 or higher;
  • or FetchOptions.Mode is fmExactRecsMax or fmAll;
  • or ResourceOptions.DirectExecute is True.
 
Default cursor. 
 
Otherwise. 
Static cursor. 
IBM DB2 
-- 
Forward only cursor. 
Sybase SQL Anywhere,
Microsoft Access 
If result set has BLOB fields. 
Dynamic cursor. 
 
Otherwise. 
Default cursor. 
PostgreSQL 
If FetchOptions.Mode is fmExactRecsMax or fmAll. 
Default cursor. 
 
Otherwise 
Static cursor. 
Others 
-- 
Default cursor. 

For TADTable ckAutomatic enables live data window, when a table has unique identifying fields. ckDynamic enables live data window unconditionally, and an exception will be raised if DB table does not have unique key. Other cursor kinds disable live data window mode and sets TADTable to standard mode, when it acts like the TADQuery.

property CursorKind: TADCursorKind;
What do you think about this topic? Send feedback!