Does Delphi IBX TIBSQL.ExecQuery has strange transaction requirements (FStreamedActive factor)?

Viewed 303

I am using Delphi (2009, never mind) with IBX and I am trying to execute simple code:

TestSQL.ExecQuery;

Before this code I have checked (and it can be seen in debugger watches as well) that TestSQL.Transaction.InTransaction is True. Nevertheless the exception is raised:

EIBInterBaseError with message 'invalid transaction handle (expecting explicit transaction start)'

So, there is no another solution than to execute the code:

TestSQL.Transaction.StartTransaction;
TestSQL.ExecQuery;

Now the other exception is raised:

EIBClientError with message 'Transaction is active'

Complete dead end? Delphi has code:

procedure TIBTransaction.CheckInTransaction;
begin
  if FStreamedActive and (not InTransaction) then
    Loaded;
  if (FHandle = nil) then
    IBError(ibxeNotInTransaction, [nil]);
end;

and it means that the transaction requirement is determined not only by InTransaction but by private variable FStreamedActive as well. So - the transaction control is way more complex? How can I impact FStreamedActive? What is the solution? My test code is part to lengthier code but I wonder how I can break down the inner status of transaction state?

1 Answers

I found the solution - TestSQL.Database was unintentionally different from TestSQL.Transaction.DefaultDatabase. And that manifested in such a strange error message. It is quite strange that IBX allow at all those databases to be different.

Related