Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi IBX TIBSQL.ExecQuery是否有奇怪的事务要求(FStreamedActive factor)?_Delphi_Firebird - Fatal编程技术网

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

Delphi IBX TIBSQL.ExecQuery是否有奇怪的事务要求(FStreamedActive factor)?,delphi,firebird,Delphi,Firebird,我将Delphi(2009,没关系)与IBX一起使用,并尝试执行简单的代码: TestSQL.ExecQuery; 在这段代码之前,我已经检查过(也可以在调试器监视中看到)TestSQL.Transaction.InTransaction是否为True。然而,提出了例外情况: EIBInterBaseError with message 'invalid transaction handle (expecting explicit transaction start)' EIBClientE

我将Delphi(2009,没关系)与IBX一起使用,并尝试执行简单的代码:

TestSQL.ExecQuery;
在这段代码之前,我已经检查过(也可以在调试器监视中看到)TestSQL.Transaction.InTransaction
是否为
True
。然而,提出了例外情况:

EIBInterBaseError with message 'invalid transaction handle (expecting explicit transaction start)'
EIBClientError with message 'Transaction is active'
因此,除了执行代码之外,没有其他解决方案:

TestSQL.Transaction.StartTransaction;
TestSQL.ExecQuery;
现在提出了另一个例外:

EIBInterBaseError with message 'invalid transaction handle (expecting explicit transaction start)'
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
?解决办法是什么?我的测试代码是较长代码的一部分,但我想知道如何分解事务状态的内部状态?

我发现解决方案-
TestSQL.Database
无意中与
TestSQL.transaction.DefaultDatabase
不同。这表现在一个奇怪的错误信息中。很奇怪,IBX允许所有这些数据库都不同。

您使用的是Firebird还是InterBase?Firebird,但我设法找到了解决方案。现在一切都如期进行。德尔福2009?希望您不要使用泛型…Interbase/Firebird有那种使用2数据库事务的模式,而不是其他模式。我还怀疑IBX术语数据库==连接。在Interbase/Firebird实践中,有一种打开两个数据库连接的模式,一个用于读取,一个用于写入。FIB+支撑着它。它们与IBX有着相同的祖先。也许您可以从Lazarus向后移植较新的IBX,或者甚至尝试beta IBX2。也许使用包装器将有助于避免手动(繁琐且容易出错)事务和数据库链接。我几乎可以肯定我做过类似的事情。