[patch_done] Patch in ZConnection.pas
Posted: 10.03.2009, 10:50
I'm doing some test with detecting connection problems while being connected to a FireBird database. I noticed the following in ZConnection.pas, which might be an issue:
FConnect := nil; comes after FConnection.Close;
If your network connection is gone, and you try to close the connection to reconnect later, calling FConnection.Close will raise an exception (in ZDbcInterbase6Utils.CheckInterbase6Error), which causes FConnection never to be changed to nil.
As long as FConnection is assigned, you can't reconnect. My suggestion is to change above code to:
Every feedback is welcome!
Code: Select all
procedure TZConnection.Disconnect;
begin
if FConnection <> nil then
begin
DoBeforeDisconnect;
ShowSqlHourGlass;
try
CloseAllDataSets;
// Modified by cipto 8/2/2007 10:11:02 AM
CloseAllSequences;
FConnection.Close;
FConnection := nil;
finally
HideSqlHourGlass;
end;
DoAfterDisconnect;
end;
end;
If your network connection is gone, and you try to close the connection to reconnect later, calling FConnection.Close will raise an exception (in ZDbcInterbase6Utils.CheckInterbase6Error), which causes FConnection never to be changed to nil.
As long as FConnection is assigned, you can't reconnect. My suggestion is to change above code to:
Code: Select all
procedure TZConnection.Disconnect;
begin
if FConnection <> nil then
begin
DoBeforeDisconnect;
ShowSqlHourGlass;
try
CloseAllDataSets;
// Modified by cipto 8/2/2007 10:11:02 AM
CloseAllSequences;
FConnection.Close;
finally
FConnection := nil;
HideSqlHourGlass;
end;
DoAfterDisconnect;
end;
end;