Issue #1169: prefer OpenOrExecute over Open, in TInterbaseConnection.Query, and destroy unused FdQuery object. Fixes exception with "[FireDAC][Phys]-308" with non-result queries.

This commit is contained in:
Ansgar Becker
2021-11-03 09:13:24 +01:00
parent b6d221b3e3
commit 00625b8f09

View File

@ -3698,17 +3698,19 @@ begin
try
FdQuery.ResourceOptions.CmdExecTimeout := Parameters.QueryTimeout;
if DoStoreResult then begin
FdQuery.Open(SQL);
FRowsFound := FdQuery.RecordCount;
FdQuery.SQL.Text := SQL;
if FdQuery.OpenOrExecute then begin
FRowsFound := FdQuery.RecordCount;
SetLength(FLastRawResults, Length(FLastRawResults)+1);
FLastRawResults[Length(FLastRawResults)-1] := FdQuery;
end;
end else begin
FdQuery.ExecSQL(SQL);
FRowsFound := 0;
FRowsAffected := FdQuery.RowsAffected;
FdQuery.Free;
end;
FRowsAffected := FdQuery.RowsAffected;
FLastQueryDuration := GetTickCount - TimerStart;
FLastQueryNetworkDuration := 0;
SetLength(FLastRawResults, Length(FLastRawResults)+1);
FLastRawResults[Length(FLastRawResults)-1] := FdQuery;
except
on E:EFDDBEngineException do begin
SetLength(FLastRawResults, 0);
@ -7969,7 +7971,7 @@ begin
TypeIndex := dbdtBinary;
ftVarBytes:
TypeIndex := dbdtVarbinary;
ftFloat:
ftFloat, ftSingle:
TypeIndex := dbdtFloat;
ftDate:
TypeIndex := dbdtDate;