mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-24 12:01:39 +02:00
* Patch from Ludo Brands implementing TCustomBufdataset.lookup
Mantis #22099 git-svn-id: trunk@21364 -
This commit is contained in:
parent
c75486db89
commit
283b37139f
@ -518,6 +518,7 @@ type
|
|||||||
procedure CancelUpdates; virtual;
|
procedure CancelUpdates; virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function Locate(const keyfields: string; const keyvalues: Variant; options: TLocateOptions) : boolean; 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 UpdateStatus: TUpdateStatus; override;
|
||||||
function CreateBlobStream(Field: TField; Mode: TBlobStreamMode): TStream; override;
|
function CreateBlobStream(Field: TField; Mode: TBlobStreamMode): TStream; override;
|
||||||
procedure AddIndex(const AName, AFields : string; AOptions : TIndexOptions; const ADescFields: string = '';
|
procedure AddIndex(const AName, AFields : string; AOptions : TIndexOptions; const ADescFields: string = '';
|
||||||
@ -3139,6 +3140,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
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 }
|
{ TArrayBufIndex }
|
||||||
|
|
||||||
function TArrayBufIndex.GetBookmarkSize: integer;
|
function TArrayBufIndex.GetBookmarkSize: integer;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user