Cursor types supported by SQL Server.
Unit
MSClasses
Syntax
TMSCursorType = (ctDefaultResultSet, ctStatic, ctKeyset, ctDynamic, ctBaseTable);
Values
Value | Meaning |
ctBaseTable |
Base table cursor. This cursor is used for working with Compact Edition.
This cursor is the fastest of the SQL server cursors and the only cursor that interacts directly with the storage engine. This allows to increase the speed of data access several times. Data modifications, deletions, and insertions by other users are visible.
If UniDirectional=False, the cursor is used only when fetching data, and Data updates are reflected on database by SQL statements execution.
In order to use the cursor also for data modification it is necessary to set the UniDirectional property to True. But in this case the cursor does not support bookmarks and cannot be represented in multiline controls such as DBGrid.
|
ctDefaultResultSet |
By the old SQL Server terminology is the Firehose cursor. It serves for the fastest data fetch from server to the client side. Allows to run batches. Data updates are reflected in the database only by SQL statements execution. The default value. |
ctDynamic |
Dynamic cursor. Used when data is not cached at the server and fetch is performed row by row as required. Doesn't support bookmarks and cannot be represented in multiline controls such as DBGrid. Data modifications, deletions, and insertions by other users are visible. Data updates are reflected on database both by SQL statements execution and server cursors means. |
ctKeyset |
Allows to cache only keyfields at the server. Fetching is performed row by row when a data-aware component or a program requests it. Records added by other users are not visible, and records deleted by other users are inaccessible. Data updates are reflected in the database both by SQL statements execution and server cursors means. |
ctStatic |
Static copying of records. Query execution results are cashed at the server. Fetch is performed row by row when a data-aware component or a program requests it. When a cursor is opened, all newly added updates are invisible. Used mostly for reporting. |
Remarks
ctStatic, ctKeyset, and ctDynamic cursors are server cursors. So the TCustomDADataSet.FetchRows, TCustomMSDataSet.FetchAll, TMemDataSet.CachedUpdates properties don't have any influence on such cursors and only the Options.CursorUpdate option does.
The default value is ctDefaultResultSet.