Do not display grid cells as modified if new value is effectively the same as the old one. Especially minimizes INSERTs for "Duplicate row" feature.

This commit is contained in:
Ansgar Becker
2010-05-10 23:34:36 +00:00
parent 6355102eb0
commit 1368508685

View File

@ -1926,11 +1926,16 @@ begin
CreateUpdateRow;
EnsureFullRow;
end;
FCurrentUpdateRow[Column].NewText := NewText;
if DataType(Column).Category in [dtcInteger, dtcReal] then
FCurrentUpdateRow[Column].NewText := UnformatNumber(FCurrentUpdateRow[Column].NewText);
FCurrentUpdateRow[Column].NewIsNull := Null;
FCurrentUpdateRow[Column].Modified := True;
if Null then
FCurrentUpdateRow[Column].NewText := ''
else begin
FCurrentUpdateRow[Column].NewText := NewText;
if DataType(Column).Category in [dtcInteger, dtcReal] then
FCurrentUpdateRow[Column].NewText := UnformatNumber(FCurrentUpdateRow[Column].NewText);
end;
FCurrentUpdateRow[Column].Modified := (FCurrentUpdateRow[Column].NewText <> FCurrentUpdateRow[Column].OldText) or
(FCurrentUpdateRow[Column].NewIsNull <> FCurrentUpdateRow[Column].OldIsNull);
end;