fcl-db: mssql: in case of network failure infinite loop can occurs in Fetch method. Bug #32524

git-svn-id: trunk@37537 -
This commit is contained in:
lacak 2017-10-31 08:45:50 +00:00
parent 49a96af874
commit 05cddddf7c

View File

@ -607,7 +607,9 @@ begin
if not c.FSelectable then //Sybase stored proc.
begin
repeat until dbnextrow(FDBProc) = NO_MORE_ROWS;
repeat
Fstatus := dbnextrow(FDBProc);
until (Fstatus = NO_MORE_ROWS) or (Fstatus = FAIL);
res := CheckError( dbresults(FDBProc) );
// stored procedure information (return status and output parameters)
// are available only after normal results are processed
@ -742,12 +744,18 @@ begin
// Compute rows resulting from the COMPUTE clause are not processed
repeat
Fstatus := dbnextrow(FDBProc);
// In case of network failure FAIL is returned
// Use dbsettime() to specify query timeout, else on Windows TCP KeepAliveTime is used, which defaults to 2 hours
Result := Fstatus=REG_ROW;
until Result or (Fstatus = NO_MORE_ROWS);
until Result or (Fstatus = NO_MORE_ROWS) or (Fstatus = FAIL);
if Fstatus = NO_MORE_ROWS then
while dbresults(FDBProc) <> NO_MORE_RESULTS do // process remaining results if there are any
repeat until dbnextrow(FDBProc) = NO_MORE_ROWS;
repeat
Fstatus := dbnextrow(FDBProc);
until (Fstatus = NO_MORE_ROWS) or (Fstatus = FAIL);
if Fstatus = FAIL then CheckError(FAIL);
end;
function TMSSQLConnection.LoadField(cursor: TSQLCursor; FieldDef: TFieldDef;