Delphi IBX TIBSQL.ExecQuery是否有奇怪的事务要求(FStreamedActive factor)?

问题描述 投票:3回答:1

我正在使用Delphi(2009年,没关系)与IBX,我正在尝试执行简单的代码:

TestSQL.ExecQuery;

在此代码之前,我已经检查过(并且可以在调试器手表中看到)TestSQL.Transaction.InTransactionTrue。然而,提出了例外:

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

因此,除了执行代码之外没有其他解决方案:

TestSQL.Transaction.StartTransaction;
TestSQL.ExecQuery;

现在提出了另一个例外:

EIBClientError with message 'Transaction is active'

完全死路一条? Delphi有代码:

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

这意味着交易要求不仅由InTransaction决定,而且由私人变量FStreamedActive决定。那么 - 事务控制是否更复杂?我怎么能影响FStreamedActive?解决办法是什么?我的测试代码是较长代码的一部分,但我想知道如何分解事务状态的内部状态?

delphi firebird
1个回答
2
投票

我找到了解决方案 - TestSQL.Database无意中与TestSQL.Transaction.DefaultDatabase不同。而这表现在如此奇怪的错误信息中。非常奇怪的是,IBX允许所有这些数据库不同。

© www.soinside.com 2019 - 2024. All rights reserved.