gpt4 book ai didi

delphi - Delphi IBX TIBSQL.ExecQuery 是否有奇怪的事务要求(FStreamedActive 因素)?

转载 作者:行者123 更新时间:2023-12-03 15:55:43 25 4
gpt4 key购买 nike

我正在使用 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 决定,还由私有(private)变量 FStreamedActive 决定。那么——事务控制要复杂得多吗?我如何影响 FStreamedActive?解决办法是什么?我的测试代码是较长代码的一部分,但我想知道如何分解事务状态的内部状态?

最佳答案

我找到了解决方案 - TestSQL.Database 无意中与 TestSQL.Transaction.DefaultDatabase 不同。这体现在这样一个奇怪的错误消息中。很奇怪的是,IBX 允许所有这些数据库不同。

关于delphi - Delphi IBX TIBSQL.ExecQuery 是否有奇怪的事务要求(FStreamedActive 因素)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52114373/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com