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