Class TBinaryDataSet (unit bindata)

Inherits from

TDataSet

Constructors


constructor Create(AOwner:tComponent);

____________________________________________________________________________ tBinaryDataSet.


Functions

procedure CreateTable;

____________________________________________________________________________ tBinaryDataSet.

Procedure PackTable;

____________________________________________________________________________ tBinaryDataSet.

Procedure SortTable(SortFields : Array of String);

____________________________________________________________________________ tBinaryDataSet.

Procedure UnsortTable;

____________________________________________________________________________ tBinaryDataSet.

function AllocRecordBuffer: PChar;

TDataSet virtual abstract method

____________________________________________________________________________ tBinaryDataSet.


procedure FreeRecordBuffer(var Buffer: PChar);

____________________________________________________________________________ tBinaryDataSet.

procedure GetBookmarkData(Buffer: PChar; Data: Pointer);

____________________________________________________________________________ tBinaryDataSet.

function GetBookmarkFlag(Buffer: PChar): TBookmarkFlag;

____________________________________________________________________________ tBinaryDataSet.

function GetFieldData(Field: TField; Buffer: Pointer): Boolean;

____________________________________________________________________________ tBinaryDataSet.

function GetRecNo: Integer;

____________________________________________________________________________ tBinaryDataSet.

function GetRecord(Buffer: PChar; GetMode: TGetMode; DoCheck: Boolean): TGetResult;

____________________________________________________________________________ tBinaryDataSet.

function GetRecordCount: Integer;

TDataSet virtual method (optional

____________________________________________________________________________ tBinaryDataSet.


function GetRecordSize: Word;

//////////////////////////////////////// //// Part III: //// Record buffers and field management //////////////////////////////////////// ____________________________________________________________________________ tBinaryDataSet.

procedure InternalAddRecord(Buffer: Pointer; Append: Boolean);

____________________________________________________________________________ tBinaryDataSet.

procedure InternalClose;

____________________________________________________________________________ tBinaryDataSet.

procedure InternalDelete;

____________________________________________________________________________ tBinaryDataSet.

procedure InternalFirst;

____________________________________________________________________________ tBinaryDataSet.

procedure InternalGotoBookmark( Bookmark: Pointer);

////////////////////////////////////// //// Part II: //// Bookmarks management and movement ////////////////////////////////////// ____________________________________________________________________________ tBinaryDataSet.

procedure InternalHandleException;

____________________________________________________________________________ tBinaryDataSet.

procedure InternalInitFieldDefs;

____________________________________________________________________________ tBinaryDataSet.

procedure InternalInitRecord(Buffer: PChar);

____________________________________________________________________________ tBinaryDataSet.

procedure InternalLast;

____________________________________________________________________________ tBinaryDataSet.

procedure InternalOpen;

/////////////////////////////////////////////// //// Part I: //// Initialization, opening, and closing /////////////////////////////////////////////// ____________________________________________________________________________ tBinaryDataSet.

procedure InternalPost;

____________________________________________________________________________ tBinaryDataSet.

procedure InternalSetToRecord(Buffer: PChar);

____________________________________________________________________________ tBinaryDataSet.

function IsCursorOpen: Boolean;

____________________________________________________________________________ tBinaryDataSet.

procedure SetBookmarkData(Buffer: PChar; Data: Pointer);

____________________________________________________________________________ tBinaryDataSet.

procedure SetBookmarkFlag(Buffer: PChar; Value: TBookmarkFlag);

____________________________________________________________________________ tBinaryDataSet.

procedure SetFieldData(Field: TField; Buffer: Pointer);

____________________________________________________________________________ tBinaryDataSet.

procedure SetRecNo(Value: Integer);

____________________________________________________________________________ tBinaryDataSet.

Procedure WriteHeader;

____________________________________________________________________________ tBinaryDataSet.

Procedure _AppendRecord(Buffer:PChar);

____________________________________________________________________________ tBinaryDataSet.

Function _CompareRecords(SortFields:Array of String;Rec1,Rec2:Integer):Integer;

____________________________________________________________________________ tBinaryDataSet.

Procedure _ReadRecord(Buffer:PChar;IntRecNum:Integer);

**************************************************************************** Low Level Routines for accessing an internal record ____________________________________________________________________________ tBinaryDataSet.

Procedure _SwapRecords(Rec1,REc2:Integer);

____________________________________________________________________________ tBinaryDataSet.

Procedure _WriteRecord(Buffer:PChar;IntRecNum:Integer);

____________________________________________________________________________ tBinaryDataSet.

Properties

property Active :

redeclared data set properties

property AfterCancel :


property AfterClose :


property AfterDelete :


property AfterEdit :


property AfterInsert :


property AfterOpen :


property AfterPost :


property AfterScroll :


property BeforeCancel :


property BeforeClose :


property BeforeDelete :


property BeforeEdit :


property BeforeInsert :


property BeforeOpen :


property BeforePost :


property BeforeScroll :


property DataFileHeader : tDataFileHeader


property Filtered :


property ReadOnly : Boolean


property TableName : string


Events

event OnCalcFields :


event OnDeleteError :


event OnEditError :


event OnFilterRecord :


event OnNewRecord :


event OnPostError :


Variables

BofCrack : Integer;

current record (0 to FRecordCount - 1

EofCrack : Integer;

before the first record (crack

FCurrentRecord : Integer;

offset of RecInfo in record buffer

fDataFileHeader : tDataFileHeader;

table path and file name

FDataFileHeaderSize : Integer;

after the last record (crack) file header size

FFieldOffset : TList;

field offsets in record

FIsTableOpen : Boolean;

status

fReadOnly : Boolean;

Enhancements

FRecordBufferSize : Integer;

the size of the actual data

FRecordCount : Integer;

The size of the record header

fRecordHeaderSize : Integer;

record data

FRecordInfoOffset : Integer;

data + housekeeping (TRecInfo

FRecordSize : Integer;

current number of record

FStream : TStream;


FTableName : string;

the physical table


Constructors


constructor Create(AOwner:tComponent);

____________________________________________________________________________ tBinaryDataSet.Create


Functions


procedure CreateTable;

____________________________________________________________________________ tBinaryDataSet.CreateTable I: Create a new table/file


Procedure PackTable;

____________________________________________________________________________ tBinaryDataSet.PackTable Enhancement: Remove all deleted items from the table.


Procedure SortTable(SortFields : Array of String);

____________________________________________________________________________ tBinaryDataSet.SortTable Enhancement: Sort the table by the fields passed.


Procedure UnsortTable;

____________________________________________________________________________ tBinaryDataSet.UnsortTable Used to help test the sort routine. Attempts to generate a random dispersment of the records in the dataset.


function AllocRecordBuffer: PChar;

TDataSet virtual abstract method

____________________________________________________________________________ tBinaryDataSet.AllocRecordBuffer / III: Allocate a buffer for the record


procedure FreeRecordBuffer(var Buffer: PChar);

____________________________________________________________________________ tBinaryDataSet.FreeRecordBuffer III: Free the buffer


procedure GetBookmarkData(Buffer: PChar; Data: Pointer);

____________________________________________________________________________ tBinaryDataSet.GetBookmarkData II: read the bookmark data from record buffer


function GetBookmarkFlag(Buffer: PChar): TBookmarkFlag;

____________________________________________________________________________ tBinaryDataSet.GetBookmarkFlag II: retrieve bookmarks flags from buffer


function GetFieldData(Field: TField; Buffer: Pointer): Boolean;

____________________________________________________________________________ tBinaryDataSet.GetFieldData III: Move data from record buffer to field


function GetRecNo: Integer;

____________________________________________________________________________ tBinaryDataSet.GetRecNo II (optional): Get the number of the current record


function GetRecord(Buffer: PChar; GetMode: TGetMode; DoCheck: Boolean): TGetResult;

____________________________________________________________________________ tBinaryDataSet.GetRecord III: Retrieve data for current, previous, or next record (eventually moving to it) and return the status


function GetRecordCount: Integer;

TDataSet virtual method (optional

____________________________________________________________________________ tBinaryDataSet.GetRecordCount II (optional): Record count


function GetRecordSize: Word;

//////////////////////////////////////// //// Part III: //// Record buffers and field management //////////////////////////////////////// ____________________________________________________________________________ tBinaryDataSet.GetRecordSize / III: Determine the size of each record buffer in memory


procedure InternalAddRecord(Buffer: Pointer; Append: Boolean);

____________________________________________________________________________ tBinaryDataSet.InternalAddRecord III: Add the current data to the file


procedure InternalClose;

____________________________________________________________________________ tBinaryDataSet.InternalClose I: close the table/file


procedure InternalDelete;

____________________________________________________________________________ tBinaryDataSet.InternalDelete III: Delete the current record


procedure InternalFirst;

____________________________________________________________________________ tBinaryDataSet.InternalFirst II: Go to a special position before the first record


procedure InternalGotoBookmark( Bookmark: Pointer);

////////////////////////////////////// //// Part II: //// Bookmarks management and movement ////////////////////////////////////// ____________________________________________________________________________ tBinaryDataSet.InternalGotoBookmark II: set the requested bookmark as current record


procedure InternalHandleException;

____________________________________________________________________________ tBinaryDataSet.InternalHandleException default exception handling


procedure InternalInitFieldDefs;

____________________________________________________________________________ tBinaryDataSet.InternalInitFieldDefs I: define the fields


procedure InternalInitRecord(Buffer: PChar);

____________________________________________________________________________ tBinaryDataSet.InternalInitRecord III: Initialize the record (set to zero


procedure InternalLast;

____________________________________________________________________________ tBinaryDataSet.InternalLast II: Go to a special position after the last record


procedure InternalOpen;

/////////////////////////////////////////////// //// Part I: //// Initialization, opening, and closing /////////////////////////////////////////////// ____________________________________________________________________________ tBinaryDataSet.InternalOpen I: open the table/file


procedure InternalPost;

____________________________________________________________________________ tBinaryDataSet.InternalPost III: Write the current data to the file


procedure InternalSetToRecord(Buffer: PChar);

____________________________________________________________________________ tBinaryDataSet.InternalSetToRecord II: same as above (but passes a buffer


function IsCursorOpen: Boolean;

____________________________________________________________________________ tBinaryDataSet.IsCursorOpen I: is table open


procedure SetBookmarkData(Buffer: PChar; Data: Pointer);

____________________________________________________________________________ tBinaryDataSet.SetBookmarkData II: set the bookmark data in the buffer


procedure SetBookmarkFlag(Buffer: PChar; Value: TBookmarkFlag);

____________________________________________________________________________ tBinaryDataSet.SetBookmarkFlag II: change the bookmark flags in the buffer


procedure SetFieldData(Field: TField; Buffer: Pointer);

____________________________________________________________________________ tBinaryDataSet.SetFieldData III: Move data from field to record buffer


procedure SetRecNo(Value: Integer);

____________________________________________________________________________ tBinaryDataSet.SetRecNo II (optional): Move to the given record number


Procedure WriteHeader;

____________________________________________________________________________ tBinaryDataSet.WriteHeader


Procedure _AppendRecord(Buffer:PChar);

____________________________________________________________________________ tBinaryDataSet._AppendRecord


Function _CompareRecords(SortFields:Array of String;Rec1,Rec2:Integer):Integer;

____________________________________________________________________________ tBinaryDataSet._CompareRecords Compare two records. Returns -1 if REC1 < REC2, 0 if REC1 = REC2, or 1 if REC1 > REC2.


Procedure _ReadRecord(Buffer:PChar;IntRecNum:Integer);

**************************************************************************** Low Level Routines for accessing an internal record ____________________________________________________________________________ tBinaryDataSet._ReadRecord


Procedure _SwapRecords(Rec1,REc2:Integer);

____________________________________________________________________________ tBinaryDataSet._SwapRecords Enhancement: Quick swap of two records. Used primarily for sorting.


Procedure _WriteRecord(Buffer:PChar;IntRecNum:Integer);

____________________________________________________________________________ tBinaryDataSet._WriteRecord


Properties


property Active :

redeclared data set properties


property AfterCancel :


property AfterClose :


property AfterDelete :


property AfterEdit :


property AfterInsert :


property AfterOpen :


property AfterPost :


property AfterScroll :


property BeforeCancel :


property BeforeClose :


property BeforeDelete :


property BeforeEdit :


property BeforeInsert :


property BeforeOpen :


property BeforePost :


property BeforeScroll :


property DataFileHeader : tDataFileHeader


property Filtered :


property ReadOnly : Boolean


property TableName : string


Events


event OnCalcFields :


event OnDeleteError :


event OnEditError :


event OnFilterRecord :


event OnNewRecord :


event OnPostError :


Variables


BofCrack : Integer;

current record (0 to FRecordCount - 1


EofCrack : Integer;

before the first record (crack


FCurrentRecord : Integer;

offset of RecInfo in record buffer


fDataFileHeader : tDataFileHeader;

table path and file name


FDataFileHeaderSize : Integer;

after the last record (crack) file header size


FFieldOffset : TList;

field offsets in record


FIsTableOpen : Boolean;

status


fReadOnly : Boolean;

Enhancements


FRecordBufferSize : Integer;

the size of the actual data


FRecordCount : Integer;

The size of the record header


fRecordHeaderSize : Integer;

record data


FRecordInfoOffset : Integer;

data + housekeeping (TRecInfo


FRecordSize : Integer;

current number of record


FStream : TStream;


FTableName : string;

the physical table