From 1368508685086459f3c93bde7c308fca8bf8cc3c Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Mon, 10 May 2010 23:34:36 +0000 Subject: [PATCH] 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. --- source/mysql_connection.pas | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/mysql_connection.pas b/source/mysql_connection.pas index c56dac99..e5fc7dc2 100644 --- a/source/mysql_connection.pas +++ b/source/mysql_connection.pas @@ -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;