TDBQuery.GetWhereClause uses an empty string on a not yet fetched, inserted row. So a numerical cell which is part of a primary/unique key gets into the WHERE clause without any value. Fix that by using "0" as a default if it's an empty string. Avoid usage of UnformatNumber(), which I removed in r4047. Fixes issue #2867.

This commit is contained in:
Ansgar Becker
2012-06-12 19:50:48 +00:00
parent 3ead3f8ef6
commit 8af6d3c900

View File

@ -4469,9 +4469,14 @@ begin
dtcInteger, dtcReal: begin
if DataType(j).Index = dtBit then
Result := Result + '=b' + Connection.EscapeString(ColVal)
else
else begin
// Guess (!) the default value silently inserted by the server. This is likely
// to be incomplete in cases where a UNIQUE key allows NULL here
if ColVal='' then
ColVal := '0';
Result := Result + '=' + ColVal;
end;
end;
dtcBinary:
Result := Result + '=' + HexValue(ColVal);
else