Unit Fltcback

***************************************************************************** ** ** TFILTERCALLBACK Component. ** ** Author: Andy Strong e-mail: ANDREWS@NBAQSL.CO.UK ** CompuServe: 100716,3015 ** ** History ** ======= ** Vers Date Comments ** 2.00 10 Aug 97 Added Blob Filtering. ** Added limited Property Editor - About. ** Changed TFilterRecord name to TFilterObject - more sensible. ** Discovered Paradox Tables can hold TDate(LongInt) as separate ** to TDateTime(Double). Add fix to handle either correctly. ** 1.05 05 Aug 97 Added DbiFunction DbiGetExactRecordCount and ** FilteredRecordCount property. NOTE: DO NOT REFERENCE THIS ** property from within the CALLBACK METHOD - YOU WILL CRASH ** YOUR SYSTEM! ** 1.04 24 Jul 97 Penultimate hack to fix AsDate and AsDateTime functions. ** Added AsTime method. ** 1.03 10 Jun 97 Ensure FieldList is loaded every time Active set to True. ** Ensuring list always upto date. ** 1.02 06 Feb 97 Fixes for Date/Time handling of raw data, and boolean ** handling. ** 1.01 Not Rel. Minor Raw Data problems ** 1.00 10 Sep 96 First Public Release ** ** A component to be dropped on a form, to allow low-level BDE callback ** on a table independently of any other indexes, ranges set. ** Encapsulates the BDE callback in a standard Delphi event passing ** adequate information to allow selective filtering using Pascal code. ** ** Taken from an idea on the BDE Compuserve forum. ** ** This unit consists of three objects and one component. ** The component is used to encapsulate the usage of the BDE callback filter, ** and raw data handling. ** The TFilterCallback Component sets up the callback filter for the BDE; ** the TFilterObject object, is the object passed to the users Delphi callback ** routine to enable easy access to the raw data to work on; ** the TRaw object is an internal sanitiser of the raw BDE data for the Delphi ** users event handler. ** ** NOTE: The function DbiGetExactRecordcount works by iterating through all ** records and requesting a filter callback to see if the records are ** allowed in the set. This means that the DB is potentially parsed ** multiple times. ** Once for the Filter in the first place. ** Once for each time the DbiGetExcactRecordCount is called. ** This may have a dramatic performance effect if BLOB filtering is being ** used. **

Classes

TFilterBlobStream - Object which is used to hide all the nasty reading and seeking of the BDE blob data.
TFilterCallback - Actual component doing the work.
TFilterEditor - Little component editor to show an about box, and an About menu item on a right-click during design time.
TFilterObject - Object which is passed to the users Filter callback, giving access to the BDEs raw data for a record in a useable state.
TRawData - Object to handle the conversion of RAW data to a known Pascal type

Functions

Register - ** Standard Component Palette register procedure

Types

TBDEFieldType
TFilterEvent

Constants

MAXRAWSIZE
VERSNUM

Variables


Functions


procedure Register;

** Standard Component Palette register procedure

Types


TBDEFieldType = (ftUnknown, ftString, ftDate, ftBlob, ftBoolean, ftSmallint,
    ftInteger, ftFloat, ftBCD, ftBytes, ftTime, ftDateTime, ftWord);

TFilterEvent = procedure(FilterRec: TFilterObject; var Allow: boolean) of object
Function prototype for our sanitised Delphi filter event.

Constants

MAXRAWSIZE = SizeOf(String)

Remove this define if you want to compile without any dependancy upon the IDAPI01.DLL. This will remove the ability to find out how many Records are returned by the Filter. The FilteredRecordCount property calls an undocumanted BDE call. This iterates through the filter mechanism again, just counting the number of 'Allows' = True. Since this is the mechanism used, there can be a major performance impact, especially when filtering BLOB fields. The iteration is done EVERY time the DbiGetExactRecordCount is called, so if you are going to use it, minimise its use. {$define BDEFilterCount

VERSNUM = '2.00'

Max Pascal String size

Variables