You've already forked lazarus-ccr
TRxMemoryData - Increased speed of calculation properties AsXXXXXX
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3485 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -4223,6 +4223,7 @@ var
|
|||||||
P: TBookmark;
|
P: TBookmark;
|
||||||
i, cnt, K: integer;
|
i, cnt, K: integer;
|
||||||
APresent: boolean;
|
APresent: boolean;
|
||||||
|
BB:Double;
|
||||||
|
|
||||||
DHL:THackDataLink;
|
DHL:THackDataLink;
|
||||||
DHS:THackDataSet;
|
DHS:THackDataSet;
|
||||||
@@ -4319,7 +4320,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
RCol:=TRxColumn(FCList[i]);
|
RCol:=TRxColumn(FCList[i]);
|
||||||
if RCol.FFooter.FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
if RCol.FFooter.FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
||||||
RCol.FFooter.UpdateTestValueFromVar( RCol.FFooter.FField.AsFloat)
|
RCol.FFooter.UpdateTestValueFromVar( RCol.FFooter.FField.AsVariant)
|
||||||
|
// BB:=RCol.FFooter.FField.AsFloat;
|
||||||
|
// RCol.FFooter.UpdateTestValueFromVar( RCol.FFooter.FField.AsFloat)
|
||||||
end;
|
end;
|
||||||
inc(cnt);
|
inc(cnt);
|
||||||
DHS.Next;
|
DHS.Next;
|
||||||
@@ -5488,7 +5491,7 @@ begin
|
|||||||
FTestValue := 0;
|
FTestValue := 0;
|
||||||
FCountRec:=0;
|
FCountRec:=0;
|
||||||
|
|
||||||
if (ValueType = fvtMin) and (TRxDBGrid(
|
if (ValueType in [fvtMin, fvtMax]) and (TRxDBGrid(
|
||||||
FOwner.Grid).DataSource.DataSet.RecordCount <> 0) then
|
FOwner.Grid).DataSource.DataSet.RecordCount <> 0) then
|
||||||
begin
|
begin
|
||||||
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FieldByName(FFieldName);
|
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FieldByName(FFieldName);
|
||||||
|
@@ -91,8 +91,8 @@ type
|
|||||||
procedure SetOnFilterRecordEx(const AValue: TFilterRecordEvent);
|
procedure SetOnFilterRecordEx(const AValue: TFilterRecordEvent);
|
||||||
procedure Sort;
|
procedure Sort;
|
||||||
function CalcRecordSize: Integer;
|
function CalcRecordSize: Integer;
|
||||||
function FindFieldData(Buffer: Pointer; Field: TField): Pointer;overload;
|
// function FindFieldData(Buffer: Pointer; Field: TField): Pointer;overload;
|
||||||
function FindFieldData(Buffer: Pointer; FieldNo:Integer): Pointer;overload;
|
function FindFieldData(Buffer: Pointer; FieldNo:Integer): Pointer; //overload;
|
||||||
function GetMemoryRecord(Index: Integer): TMemoryRecord;
|
function GetMemoryRecord(Index: Integer): TMemoryRecord;
|
||||||
function GetCapacity: Integer;
|
function GetCapacity: Integer;
|
||||||
function RecordFilter: Boolean;
|
function RecordFilter: Boolean;
|
||||||
@@ -612,14 +612,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{
|
||||||
function TRxMemoryData.FindFieldData(Buffer: Pointer; Field: TField): Pointer;
|
function TRxMemoryData.FindFieldData(Buffer: Pointer; Field: TField): Pointer;
|
||||||
var
|
var
|
||||||
Index: Integer;
|
Index: Integer;
|
||||||
begin
|
begin
|
||||||
Index := FieldDefs.IndexOf(Field.FieldName);
|
Index := FieldDefs.IndexOf(Field.FieldName);
|
||||||
|
if Index <> Field.FieldNo - 1 then
|
||||||
|
raise exception.Create('Index <> Field.FieldNo - 1');
|
||||||
Result:=FindFieldData(Buffer, Index);
|
Result:=FindFieldData(Buffer, Index);
|
||||||
end;
|
end;
|
||||||
|
}
|
||||||
function TRxMemoryData.FindFieldData(Buffer: Pointer; FieldNo: Integer): Pointer;
|
function TRxMemoryData.FindFieldData(Buffer: Pointer; FieldNo: Integer): Pointer;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
@@ -873,7 +876,8 @@ begin
|
|||||||
if Field.FieldNo > 0 then
|
if Field.FieldNo > 0 then
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
Data := FindFieldData(RecBuf, Field);
|
Data := FindFieldData(RecBuf, Field.FieldNo-1);
|
||||||
|
// Data := FindFieldData(RecBuf, Field);
|
||||||
if Data <> nil then begin
|
if Data <> nil then begin
|
||||||
Result := Boolean(Data[0]);
|
Result := Boolean(Data[0]);
|
||||||
Inc(Data);
|
Inc(Data);
|
||||||
@@ -888,6 +892,7 @@ begin
|
|||||||
else
|
else
|
||||||
Move(Data^, Buffer^, CalcFieldLen(Field.DataType, Field.Size));
|
Move(Data^, Buffer^, CalcFieldLen(Field.DataType, Field.Size));
|
||||||
end;
|
end;
|
||||||
|
Result := true;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@@ -923,7 +928,8 @@ begin
|
|||||||
Validate(Buffer);
|
Validate(Buffer);
|
||||||
if FieldKind <> fkInternalCalc then
|
if FieldKind <> fkInternalCalc then
|
||||||
begin
|
begin
|
||||||
Data := FindFieldData(RecBuf, Field);
|
// Data := FindFieldData(RecBuf, Field);
|
||||||
|
Data := FindFieldData(RecBuf, Field.FieldNo-1);
|
||||||
if Data <> nil then
|
if Data <> nil then
|
||||||
begin
|
begin
|
||||||
if DataType = ftVariant then
|
if DataType = ftVariant then
|
||||||
@@ -1188,7 +1194,8 @@ begin
|
|||||||
if (Fields[I].FieldKind in fkStoredFields) and
|
if (Fields[I].FieldKind in fkStoredFields) and
|
||||||
(Fields[I].DataType = ftAutoInc) then
|
(Fields[I].DataType = ftAutoInc) then
|
||||||
begin
|
begin
|
||||||
Data := FindFieldData(Buffer, Fields[I]);
|
// Data := FindFieldData(Buffer, Fields[I]);
|
||||||
|
Data := FindFieldData(Buffer, Fields[I].FieldNo-1);
|
||||||
if Data <> nil then begin
|
if Data <> nil then begin
|
||||||
Boolean(Data[0]) := True;
|
Boolean(Data[0]) := True;
|
||||||
Inc(Data);
|
Inc(Data);
|
||||||
@@ -1332,7 +1339,8 @@ var
|
|||||||
Item:TMemoryRecord;
|
Item:TMemoryRecord;
|
||||||
begin
|
begin
|
||||||
Item:=Records[SrcRecNo];
|
Item:=Records[SrcRecNo];
|
||||||
Data1 := FindFieldData(Item.Data, AField);
|
// Data1 := FindFieldData(Item.Data, AField);
|
||||||
|
Data1 := FindFieldData(Item.Data, AField.FieldNo-1);
|
||||||
Inc(Data1); //Skip null flag
|
Inc(Data1); //Skip null flag
|
||||||
|
|
||||||
case AField.DataType of
|
case AField.DataType of
|
||||||
@@ -1731,14 +1739,21 @@ var
|
|||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if FIndexList <> nil then begin
|
if FIndexList <> nil then
|
||||||
for I := 0 to FIndexList.Count - 1 do begin
|
begin
|
||||||
|
for I := 0 to FIndexList.Count - 1 do
|
||||||
|
begin
|
||||||
F := TField(FIndexList[I]);
|
F := TField(FIndexList[I]);
|
||||||
Data1 := FindFieldData(Item1.Data, F);
|
// Data1 := FindFieldData(Item1.Data, F);
|
||||||
if Data1 <> nil then begin
|
Data1 := FindFieldData(Item1.Data, F.FieldNo-1);
|
||||||
Data2 := FindFieldData(Item2.Data, F);
|
if Data1 <> nil then
|
||||||
if Data2 <> nil then begin
|
begin
|
||||||
if Boolean(Data1[0]) and Boolean(Data2[0]) then begin
|
// Data2 := FindFieldData(Item2.Data, F);
|
||||||
|
Data2 := FindFieldData(Item2.Data, F.FieldNo-1);
|
||||||
|
if Data2 <> nil then
|
||||||
|
begin
|
||||||
|
if Boolean(Data1[0]) and Boolean(Data2[0]) then
|
||||||
|
begin
|
||||||
Inc(Data1);
|
Inc(Data1);
|
||||||
Inc(Data2);
|
Inc(Data2);
|
||||||
Result := CompareFields(Data1, Data2, F.DataType,
|
Result := CompareFields(Data1, Data2, F.DataType,
|
||||||
|
Reference in New Issue
Block a user