[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'BufDataset' (#fcl)

# TCustomBufDataset

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Dataset connected to a database.

## Declaration

Source position: bufdataset.pas line 445

`type TCustomBufDataset = class(TDBDataset)`
`public`
`constructor Create(); override;` |  | Constructor for the class instance
`function GetFieldData();` |  | Get the data for a field
`procedure SetFieldData();` |  | Store the data for a field
`procedure ApplyUpdates();` |  | Applies pending updates to the dataset
`procedure MergeChangeLog;` |  | Frees update buffers and Blob update buffer allocated for the dataset
`procedure RevertRecord;` |  | Reverts the current record to its original (un-edited) values
`procedure CancelUpdates; virtual;` |  | Cancels pending updates in the dataset
`destructor Destroy; override;` |  | Free a TDataset instance
`function Locate(); override;` |  | Locate a record based on some key values
`function Lookup(); override;` |  | Search for a record and return matching values.
`function UpdateStatus; override;` |  | Get the update status for the current record
`function CreateBlobStream(); override;` |  | Create blob stream
`procedure AddIndex(); virtual;` |  | Adds an index definition to the dataset
`procedure ClearIndexes;` |  | Clears index storage in the dataset
`procedure SetDatasetPacket();` |  | Retrieves and applies the data packet with the content for the dataset
`procedure GetDatasetPacket();` |  | Builds a data packet representing the content in the buffered dataset
`procedure LoadFromStream();` |  | Loads the dataset from the specified stream using the given data format
`procedure SaveToStream();` |  | Saves the dataset to the specified stream using the given data format
`procedure LoadFromFile();` |  | Loads the dataset from the specified file using the given format
`procedure SaveToFile();` |  | Saves the dataset to the specified file using the given data format
`procedure CreateDataset;` |  | Creates the dataset using its field definitions or bound fields
`procedure Clear;` |  | Clears the content in the dataset
`function BookmarkValid(); override;` |  | Determines if the specified Bookmark is valid for the dataset
`function CompareBookmarks(); override;` |  | Gets the relative sort order for the specified Bookmarks
`procedure CopyFromDataset();` |  | Loads field definitions and optional data from another dataset
`property ChangeCount: Integer; [r]` |  | Number of pending changes for the dataset
`property MaxIndexesCount: Integer; [rw]` |  | Maximum number of indexes available in the dataset
`property ReadOnly: Boolean; [rw]` |  | Indicates if records can be added, deleted, or modified in the dataset
`property ManualMergeChangeLog: Boolean; [rw]` |  | Indicates if the update change log can be manually merged
`published`
`property FileName: TFileName; [rw]` |  | File name on the local file system used to load or store the dataset
`property PacketRecords: Integer; [rw]` |  | Number of records allowed in a data packet handled by the packet reader
`property OnUpdateError: TResolverErrorEvent; [rw]` |  | Event handler signalled when an error occurs while updating records
`property IndexDefs: TIndexDefs; [r]` |  | Index definitions for the dataset
`property IndexName: string; [rw]` |  | Name of the selected index for the dataset
`property IndexFieldNames: string; [rw]` |  | Field names included in the custom index
`property UniDirectional: Boolean; [rw]` |  | Indicates if the dataset is for uni-directional navigation only
`end;`

## Inheritance

`TCustomBufDataset` |  | Dataset connected to a database.
`TDBDataset` |  | Dataset connected to a database.
`TDataSet` |  | Base class for records-based data-access
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent,IFPObserved`
`TObject`

## Description

TCustomBufDataset is a TDBDataset descendant that implements the ancestor class for a database-aware buffered dataset. TCustomBufDataset is an in-memory dataset that can be used as a local stand-alone dataset, or it can be used as a local buffer for updates applied to a remote dataset. TCustomBufDataset implements many features similar to those in TClientDataset in Delphi. However, it is not meant to be code or function compatible with TClientDataset. It is designed to provide management of the buffers used to access record data, and is used as the ancestor for classes like TSQLQuery and TRESTBufDataset.

As a TDBDataset descendant, it offers access to many of the database features supported in the FCL DB package. As a TDataset descendant, it also offers access to familiar navigation and data handling methods in the ancestor class. TCustomBufDataset has features that allow local storage and retrieval of field definitions and record data. In addition, facilities are provided that allow local indexing of record data in the dataset. There is a comprehensive parser/expression evaluator available that allows complete support for Filters in the dataset.

Do not create instances of TCustomBufDataset. Use the TBufDataset descendant instead.

Additional information about using TBufDataset can be found on the Lazarus Wiki at: How to write in-memory database applications in Lazarus/FPC (TBufDataset).

## See also

TBufDataset |  | Implements a database-aware buffered dataset
TDBDataset |  | Dataset connected to a database.
TDataset |  | Base class for records-based data-access