Skip to content

TBufIndex

Defines the interface used to implement indexes in TBufDataset.

Declaration

Source position: bufdataset.pas line 153

type

  TBufIndex = class(TObject)
  public
    DBCompareStruct: Array of TDBCompareRec = record
  CompareFunc : TCompareFunc;
  Off : PtrInt;
  NullBOff : PtrInt;
  FieldInd : LongInt;
  Size : Integer;
  Options : TLocateOptions;
  Desc : Boolean;
end
;
    Name: string;
    FieldsName: string;
    CaseinsFields: string;
    DescFields: string;
    Options: TIndexOptions = Set of TIndexOption = (ixPrimary,ixUnique,ixDescending,ixCaseInsensitive,
                ixExpression,ixNonMaintained);
    IndNr: Integer;
    constructor Create;
    function ScrollBackward : TGetResult;
    function ScrollForward : TGetResult;
    function GetCurrent : TGetResult;
    function ScrollFirst : TGetResult;
    procedure ScrollLast;
    function GetRecord : TGetResult;
    procedure SetToFirstRecord;
    procedure SetToLastRecord;
    procedure StoreCurrentRecord;
    procedure RestoreCurrentRecord;
    function CanScrollForward : Boolean;
    procedure DoScrollForward;
    procedure StoreCurrentRecIntoBookmark;
    procedure StoreSpareRecIntoBookmark;
    procedure GotoBookmark;
    function BookmarkValid : Boolean;
    function CompareBookmarks : Integer;
    function SameBookmarks : Boolean;
    procedure InitialiseIndex;
    procedure InitialiseSpareRecord;
    procedure ReleaseSpareRecord;
    procedure BeginUpdate;
    procedure AddRecord;
    procedure InsertRecordBeforeCurrentRecord;
    procedure RemoveRecordFromIndex;
    procedure OrderCurrentRecord;
    procedure EndUpdate;
    property SpareRecord: TRecordBuffer; {r}
    property SpareBuffer: TRecordBuffer; {r}
    property CurrentRecord: TRecordBuffer; {r}
    property CurrentBuffer: Pointer; {r}
    property IsInitialized: Boolean; {r}
    property BookmarkSize: Integer; {r}
    property RecNo: LongInt; {rw}
  end;

Inheritance

Description

TBufIndex is a TObject descendant which defines the interface used to implement indexes in TBufDataset. TBufIndex provides access to the Dataset with field values for the index, and methods to perform record navigation and index maintenance.

TBufIndex contains many virtual and abstract methods that should be implemented in a descendent class which provides a specific index implementation, such as: TDoubleLinkedBufIndex, TUniDirectionalBufIndex, and TArrayBufIndex.

TBufIndex is the type used for the TBufDataset.BufferIndex property.

Properties

Member Visibility Description
BookmarkSize read only public Size (number of bytes) needed for Bookmarks in the index.
CurrentBuffer read only public Current record buffer in the index.
CurrentRecord read only public Current record in the index.
IsInitialized read only public Indicates if the index has been initialized.
RecNo public Active record number in the index.
SpareBuffer read only public Spare record buffer for the index.
SpareRecord read only public Spare record for the index.
See all Properties

Methods

Member Visibility Description
AddRecord public Adds a record to the index.
BeginUpdate public
BookmarkValid public Indicates the specified Bookmark is valid.
CanScrollForward public Indicates if the index can be scrolled forward.
CompareBookmarks public Gets the relative order for the specified Bookmarks.
Create public Constructor for the class instance.
DoScrollForward public Implements actions need to scroll forward in the index.
EndUpdate public
GetCurrent public Gets the record buffer for the current record in the dataset.
GetRecord public Gets prior/next record relative to the specified bookmark.
GotoBookmark public Moves the index position to the specified Bookmark.
InitialiseIndex public Initializes the index.
InitialiseSpareRecord public Initializes values in the spare record for the index.
InsertRecordBeforeCurrentRecord public Inserts a record before the current record in the index order.
OrderCurrentRecord public
ReleaseSpareRecord public Releases resources allocated to the spare record for the index.
RemoveRecordFromIndex public Remove the record at the specified bookmark from the index.
RestoreCurrentRecord public Restores the stored record buiffer to the current record.
SameBookmarks public Indicates if the specified Bookmarks are for the same record.
ScrollBackward public Moves to the prior record in the index.
ScrollFirst public Moves to the first record in the index.
ScrollForward public Moves to the next record in the index.
ScrollLast public Moves to the last record in the index.
SetToFirstRecord public Sets the index to the first record in the index order.
SetToLastRecord public Sets the index to the last record in the index order.
StoreCurrentRecIntoBookmark public
StoreCurrentRecord public Stores the record buffer for the current record.
StoreSpareRecIntoBookmark public
See all Methods

Fieldss

Member Visibility Description
CaseinsFields public Case-insensitive field names in the index.
DBCompareStruct public Structure used when comparing record/field values in the index.
DescFields public Descending fields in the index.
FieldsName public Field names included in the index.
IndNr public Ordinal position for the index in the list of indexes.
Name public Name of the index.
Options public Options for the index.
See all Fieldss

See also

Name Description
TDoubleLinkedBufIndex Implements an index using a doubly-linked list.
TUniDirectionalBufIndex Implements a uni-directional index.
TArrayBufIndex Implements an index using an array of record buffers.