Unit 'memds' Package
[Overview][Constants][Classes][Index] [#fcl]

TMemDataset

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

Base class for records-based data-access.

Declaration

Source position: memds.pp line 58

type TMemDataset = class(TDataSet)

public

  constructor Create(); override;

  

Create a new TDataset instance.

  destructor Destroy; override;

  

Free a TDataset instance.

  function BookmarkValid(); override;

  

Test whether ABookMark is a valid bookmark.

  function CompareBookmarks(); override;

  

Compare two bookmarks.

  function CreateBlobStream(); override;

  

Create blob stream.

  function Locate(); override;

  

Locate a record based on some key values.

  function Lookup(); override;

  

Search for a record and return matching values.

  procedure CreateTable;

  

Creates the internal storage for records in the in-memory dataset.

  function DataSize;

  

Size of the internal TMemoryStream used in the in-memory dataset.

  procedure Clear();

  

Clears the content in the in-memory dataset.

  procedure SaveToFile();

  

Saves field definitions and optional record data to the specified file name.

  procedure SaveToStream();

  

Saves field definitions and optional record data to the specified stream.

  procedure LoadFromStream();

  

Loads the content for the dataset from the specified stream.

  procedure LoadFromFile();

  

Loads the content for the dataset from the specified file name.

  procedure CopyFromDataset();

  

Loads field definitions and optional data from the specified TDataset.

  property FileModified: Boolean; [r]

  

Indicates if the in-memory dataset has been modified.

  property Filter: string; unimplemented ;

  

Filter to apply to the data in memory.

published

  property FileName: string; [rw]

  

File name used to read or write field definitions and optional data.

  property Filtered: Boolean;

  

Is the filter active or not.

  property Active: Boolean;

  

Is the dataset open or closed.

  property FieldDefs: TFieldDefs;

  

Definitions of available fields in the underlying database.

  property BeforeOpen: TDataSetNotifyEvent;

  

Event triggered before the dataset is opened.

  property AfterOpen: TDataSetNotifyEvent;

  

Event triggered after the dataset is opened.

  property BeforeClose: TDataSetNotifyEvent;

  

Event triggered before the dataset is closed.

  property AfterClose: TDataSetNotifyEvent;

  

Event triggered after the dataset is closed.

  property BeforeInsert: TDataSetNotifyEvent;

  

Event triggered before the dataset is put in insert mode.

  property AfterInsert: TDataSetNotifyEvent;

  

Event triggered after the dataset is put in insert mode.

  property BeforeEdit: TDataSetNotifyEvent;

  

Event triggered before the dataset is put in edit mode.

  property AfterEdit: TDataSetNotifyEvent;

  

Event triggered after the dataset is put in edit mode.

  property BeforePost: TDataSetNotifyEvent;

  

Event called before changes are posted to the underlying database.

  property AfterPost: TDataSetNotifyEvent;

  

Event called after changes have been posted to the underlying database.

  property BeforeCancel: TDataSetNotifyEvent;

  

Event triggered before a Cancel operation.

  property AfterCancel: TDataSetNotifyEvent;

  

Event triggered after a Cancel operation.

  property BeforeDelete: TDataSetNotifyEvent;

  

Event triggered before a Delete operation.

  property AfterDelete: TDataSetNotifyEvent;

  

Event triggered after a successful Delete operation.

  property BeforeScroll: TDataSetNotifyEvent;

  

Event triggered before the cursor changes position.

  property AfterScroll: TDataSetNotifyEvent;

  

Event triggered after the cursor has changed position.

  property OnDeleteError: TDataSetErrorEvent;

  

Event triggered when a delete operation fails.

  property OnEditError: TDataSetErrorEvent;

  

Event triggered when an edit operation fails.

  property OnNewRecord: TDataSetNotifyEvent;

  

Event triggered when a new record is created.

  property OnPostError: TDataSetErrorEvent;

  

Event triggered when a post operation fails.

  property OnFilterRecord: TFilterRecordEvent;

  

Event triggered to filter records.

end;

Inheritance

TMemDataset

  

Base class for records-based data-access.

|

TDataSet

  

Base class for records-based data-access.

|

TComponent

|

TPersistent,IInterfaceComponentReference

|

TObject,IFPObserved

Description

TMemDataset is a TDataset descendant which implements an in-memory dataset. TMemDataset is a performant, single user dataset for non-mission critical use cases that do not require transactions. All record and field processing is done in memory; no data is read from or written to disk unless explicitly requested.

TMemDataset implements common facilities defined in the TDataset ancestor class. This includes using the FieldDefs property to define the structure for the dataset. Most (but not all) field types are supported in TMemDataset, including:

TMemDataset implements common data manipulation methods such as: Append, AppendRecord, Insert, InsertRecord, Delete, Clear, and Refresh. TMemDataset implements Bookmarks and common navigation methods like: First, Next, Prior, Last, Locate, BOF, and EOF. Methods are provided that allow loading and saving both structure and data from a file, a stream, or another TDataset descendent.

TMemDataset provides methods to filter records, but they are implemented in a different manner than in TDataset. The Filter property is ignored; use the OnFilterRecord method and the Filtered property for this functionality.

One notable missing feature is Indexes. Index definitions are not implemented in TMemDataset.

TMemDataset uses ideas taken from the THKMemTab component by Harri Kasulke. (Hamburg/Germany)

See also

TDataset

  

Base class for records-based data-access.


Documentation generated on: Nov 22 2024