Class TMidWareDataSet (unit MWDatSet)

Inherits from

TDataSet

:TMidWareDataSet is derived from TDataSet. It had only very few properties, methods and events. All inherited properties, methods and events are described in Delphi online help under the TDataSet topic.

Constructors


constructor Create(AOwner: TComponent);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Functions

destructor Destroy;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function AllocRecordBuffer: PChar;

Basic file reading and navigation

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure AppendData(Src : PChar);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function BookmarkValid(Bookmark: TBookmark): Boolean;

Bookmarks

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ClearCalcFields(Buffer: PChar);

Calculated fields

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function CompareBookmarks(Bookmark1, Bookmark2: TBookmark): Integer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure CopyFromCurrentRecord(Dst : PChar);

Internal things

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure CopyToCurrentRecord(Src : PChar);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function FindRecord(Restart, GoForward: Boolean): Boolean;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FreeRecordBuffer(var Buffer: PChar);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function GetBookmarkFlag(Buffer: PChar): TBookmarkFlag;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function GetCurrentRecord(Buffer: PChar): Boolean;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Get the data for the given field from the active buffer and stick it } { in the given buffer.

function GetRecNo: Integer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function GetRecordCount: Longint;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function GetRecordSize: Word;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InternalClose;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InternalDelete;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InternalEdit;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InternalFirst;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Position BEFORE the very first record (there will be a get next)

procedure InternalGotoBookmark(Bookmark: Pointer);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InternalInitFieldDefs;

Field component stuff

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalInitRecord(Buffer: PChar);

Basic file modification

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalLast;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Position AFTER the very last record (there will be a get prior)

procedure InternalOpen;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InternalPost;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InternalRefresh;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InternalSetToRecord(Buffer: PChar);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function IsCursorOpen: Boolean;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function IsSequenced: Boolean;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function Locate(const KeyFields: String; const KeyValues: Variant; Options: TLocateOptions): Boolean;

Data searching

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function Lookup(const KeyFields: String; const KeyValues: Variant; const ResultFields: String): Variant;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure SetRecNo(Value: Integer);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function TellText : String;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure TriggerDisplayInfo(const Msg: String);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Properties

property Data : TMWBuffer

:The data seen thru the component does'nt resides in the component.

property FieldCount : Integer

:The number of fields.

property FieldLayout : TFieldLayout

:TMWBuffer is organized in records made of fields.

property RecordSize : Word

:The record size property gives the size of the record.

Events

event OnDisplayInfo : TDisplayInfo

:Envent used to display internal info, for debugging purpose.

Variables

FBufferFromInternalSetToRecord : PChar;


FieldOffsets : TList;

Our own custom stuff

FBookmarkOffset : LongInt;


FCalcFieldsOffset : Word;

Offset to bookmark data in recbuf

FCursorOpen : Boolean;

Offset to extra rec info in recbuf

FData : TMWBuffer;

Total size of recbuf

FExtraRecInfoOffset : Word;

Offset to calculated fields data

FFieldCount : Integer;

FIELD1;LEN1;FIELD3;LEN2;.

FFieldLayout : TFieldLayout;

Where the data really resides

FInternalCurrent : TPosition;

True if cursor is open

FOnDisplayInfo : TDisplayInfo;

How many fields we have

FRecBufSize : Word;

Physical size of record

FRecSize : Word;

Record Pointer


Constructors


constructor Create(AOwner: TComponent);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Functions


destructor Destroy;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function AllocRecordBuffer: PChar;

Basic file reading and navigation

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure AppendData(Src : PChar);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function BookmarkValid(Bookmark: TBookmark): Boolean;

Bookmarks

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ClearCalcFields(Buffer: PChar);

Calculated fields

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function CompareBookmarks(Bookmark1, Bookmark2: TBookmark): Integer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure CopyFromCurrentRecord(Dst : PChar);

Internal things

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure CopyToCurrentRecord(Src : PChar);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function FindRecord(Restart, GoForward: Boolean): Boolean;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FreeRecordBuffer(var Buffer: PChar);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function GetBookmarkFlag(Buffer: PChar): TBookmarkFlag;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function GetCurrentRecord(Buffer: PChar): Boolean;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Get the data for the given field from the active buffer and stick it } { in the given buffer. Return False if the field value is null; otherwise } { return True. Buffer may be nil if TDataSet is checking for null only.


function GetRecNo: Integer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function GetRecordCount: Longint;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function GetRecordSize: Word;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalClose;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalDelete;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalEdit;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalFirst;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Position BEFORE the very first record (there will be a get next)


procedure InternalGotoBookmark(Bookmark: Pointer);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalInitFieldDefs;

Field component stuff

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalInitRecord(Buffer: PChar);

Basic file modification

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalLast;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Position AFTER the very last record (there will be a get prior)


procedure InternalOpen;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalPost;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalRefresh;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InternalSetToRecord(Buffer: PChar);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function IsCursorOpen: Boolean;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function IsSequenced: Boolean;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function Locate(const KeyFields: String; const KeyValues: Variant; Options: TLocateOptions): Boolean;

Data searching

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function Lookup(const KeyFields: String; const KeyValues: Variant; const ResultFields: String): Variant;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure SetRecNo(Value: Integer);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function TellText : String;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure TriggerDisplayInfo(const Msg: String);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Properties


property Data : TMWBuffer

:The data seen thru the component does'nt resides in the component. They are actually located in a TMWBuffer component.


property FieldCount : Integer

:The number of fields. Based on FieldLayout property.


property FieldLayout : TFieldLayout

:TMWBuffer is organized in records made of fields. There is nothing to gives field names, nor field sizes as TMWBuffer is a fully variable structure. The component needs something to give a name and a size to fields. This is the purpose of the FieldLayout property. This is simply a string structured a semicolon separated field names and field length like this: FIRSTNAME;20;LASTNAME;20;AGE;3;AMOUNT;8


property RecordSize : Word

:The record size property gives the size of the record. It is a readonly computedd value based on the FieldLayout property. Remember that the data comes from TMWBuffer component which does'nt have fixed record length as each TMWBuffer record can have a variable number of fields each one having a variable length.


Events


event OnDisplayInfo : TDisplayInfo

:Envent used to display internal info, for debugging purpose.


Variables


FBufferFromInternalSetToRecord : PChar;


FieldOffsets : TList;

Our own custom stuff


FBookmarkOffset : LongInt;


FCalcFieldsOffset : Word;

Offset to bookmark data in recbuf


FCursorOpen : Boolean;

Offset to extra rec info in recbuf


FData : TMWBuffer;

Total size of recbuf


FExtraRecInfoOffset : Word;

Offset to calculated fields data


FFieldCount : Integer;

FIELD1;LEN1;FIELD3;LEN2;...


FFieldLayout : TFieldLayout;

Where the data really resides


FInternalCurrent : TPosition;

True if cursor is open


FOnDisplayInfo : TDisplayInfo;

How many fields we have


FRecBufSize : Word;

Physical size of record


FRecSize : Word;

Record Pointer