Subject Re: [IBO] Can't close Query when FB is down
Author Guido Klapperich
> Call stack does not help in this situation. What I am not sure of is
> exactly what you are trying to do.

When my app is running and it detects, that the connection is lost
(server is down or network failure, etc), then all datasets should be
closed. But this causes a lot of problems. Therefore I created this
simple test case, where I close only one query, when the FB-Server is down.

procedure TMainForm.ToolButton4Click(Sender: TObject);
begin
if not MainDataModule.Connection.VerifyConnection then
try
ContactsDataModule.CTQuery.Close;
except
end;
end;

When I close the query, I get an exception, that the connection is lost.
The first thing is, why do I get an exception, because I close the
query within a try-except-block, so I thought, this would prevent any
exception from being raised.

The second thing is, that's not clear to me, is that closing the query
causes IBO to reconnect. That's why I posted the call stack (you have to
read it from bottom to top). There you can see, that TIB_Statement
.SysClose calls TIB_Statement.GetColumnIsReadOnly, which calls
TIB_Statement.Prepare and then TIB_Connection.AllocateStmtHandle is called.
Any ideas?

Regards

Guido