Subject Re: [IBO] Can't close Query when FB is down
Author Aage Johansen
Guido Klapperich wrote:
> ...
> 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.

Are you running this from within the IDE?

> 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?

Maybe Jason (after a feature request?) has been trying to recover from a
"connection lost" situation.
Could you - when this happens - try just to disconnect any
TIB_Connection. This would/should? close all queries. (You can safely
assume that I haven't tried this).

Aage J.