* Patch from Ludo Brands implementing TCustomBufdataset.lookup

Mantis #22099

git-svn-id: trunk@21364 -
This commit is contained in:
marco 2012-05-23 04:57:36 +00:00
parent c75486db89
commit 283b37139f

View File

@ -518,6 +518,7 @@ type
procedure CancelUpdates; virtual;
destructor Destroy; override;
function Locate(const keyfields: string; const keyvalues: Variant; options: TLocateOptions) : boolean; override;
function Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant; override;
function UpdateStatus: TUpdateStatus; override;
function CreateBlobStream(Field: TField; Mode: TBlobStreamMode): TStream; override;
procedure AddIndex(const AName, AFields : string; AOptions : TIndexOptions; const ADescFields: string = '';
@ -3139,6 +3140,27 @@ begin
end;
end;
function TCustomBufDataset.Lookup(const KeyFields: string;
const KeyValues: Variant; const ResultFields: string): Variant;
var
bm:TBookmark;
begin
result:=nil;
bm:=GetBookmark;
DisableControls;
try
if Locate(KeyFields,KeyValues,[]) then
begin
// CalculateFields(ActiveBuffer); // not needed, done by Locate more than once
result:=FieldValues[ResultFields];
end;
GotoBookmark(bm);
FreeBookmark(bm);
finally
EnableControls;
end;
end;
{ TArrayBufIndex }
function TArrayBufIndex.GetBookmarkSize: integer;