mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 08:09:18 +02:00
* Fix memleak in comparer, improve date recognition
git-svn-id: trunk@43663 -
This commit is contained in:
parent
04a51a622d
commit
4ded1eb698
@ -179,6 +179,7 @@ type
|
||||
Function Compare(aRowindex : integer) : Integer;
|
||||
Public
|
||||
Constructor Create(aDataset : TBaseJSONDataset; aFields : String; aValues : Variant; aOptions : TLocateOptions);
|
||||
Destructor Destroy; override;
|
||||
Property Dataset : TBaseJSONDataset Read FDataset;
|
||||
property Items [Index : Integer] : TFieldComparer Read GetFieldComparer;
|
||||
Property Options : TLocateOptions Read FOptions Write FOptions;
|
||||
@ -408,6 +409,9 @@ var
|
||||
|
||||
begin
|
||||
S1:=GetFieldValue(Rowindex).AsString;
|
||||
if varIsNull(aValue) then
|
||||
S2:=''
|
||||
else
|
||||
S2:=String(aValue);
|
||||
if loPartialKey in Options then
|
||||
S1:=Copy(S1,1,Length(S2));
|
||||
@ -543,6 +547,18 @@ begin
|
||||
ConstructItems(aFields);
|
||||
end;
|
||||
|
||||
destructor TRecordComparer.Destroy;
|
||||
|
||||
Var
|
||||
F : TFieldComparer;
|
||||
|
||||
begin
|
||||
For F in Fitems do
|
||||
F.Free;
|
||||
FItems:=Nil;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{ TDefaultJSONIndex }
|
||||
|
||||
|
||||
@ -1049,7 +1065,7 @@ begin
|
||||
end;
|
||||
If (Ptrn='') then
|
||||
Case F.DataType of
|
||||
ftDate : Result:=StrToDate(S,'y/m/d');
|
||||
ftDate : Result:=StrToDate(S,'y/m/d','-');
|
||||
ftTime : Result:=StrToTime(S);
|
||||
ftDateTime : Result:=StrToDateTime(S);
|
||||
end
|
||||
@ -1077,7 +1093,7 @@ begin
|
||||
end;
|
||||
If (Ptrn='') then
|
||||
Case F.DataType of
|
||||
ftDate : Result:=DateToStr(DT);
|
||||
ftDate : Result:=FormatDateTime('yyyy/mm/dd',DT);
|
||||
ftTime : Result:=TimeToStr(DT);
|
||||
ftDateTime : Result:=DateTimeToStr(DT);
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user