Permalink
Browse files

Issue #496: fix potentially undefined result of TAdoDBQuery.IsNull

  • Loading branch information...
ansgarbecker committed Feb 10, 2019
1 parent 074f61c commit 25394f423fae344e96a05c929657908ebfa02053
Showing with 12 additions and 11 deletions.
  1. +12 −11 source/dbconnection.pas
@@ -6463,18 +6463,19 @@ function TDBQuery.IsNull(Column: String): Boolean;

function TAdoDBQuery.IsNull(Column: Integer): Boolean;
begin
Result := False;
// Catch broken connection
if not FConnection.Active then
Result := False
else if FEditingPrepared and Assigned(FCurrentUpdateRow) then
Result := FCurrentUpdateRow[Column].NewIsNull
else begin
try
Result := FCurrentResults.Fields[Column].IsNull;
except
// Silence error: "Multiple-step operation generated errors. Check each status value."
// @see #496
on E:EOleException do;
if FConnection.Active then begin
if FEditingPrepared and Assigned(FCurrentUpdateRow) then
Result := FCurrentUpdateRow[Column].NewIsNull
else begin
try
Result := FCurrentResults.Fields[Column].IsNull;
except
// Silence error: "Multiple-step operation generated errors. Check each status value."
// @see #496
on E:EOleException do;
end;
end;
end;
end;

0 comments on commit 25394f4

Please sign in to comment.