更改了 php-interbase 默认事务行为

发布于 2024-10-26 12:10:27 字数 501 浏览 13 评论 0原文

我有一些运行很长时间(24 小时以上)的 PHP CLI 脚本,尽管它们定期“提交”,但我在孤立事务方面遇到了一些问题 - 可能是由脚本崩溃引起的。

我的解决方案是创建事务如下 - 一年前我研究了这个,不太记得这些设置的确切原因,但它似乎解决了数据库的一些问题。

$dbh = ibase_connect($dbhost, $dbuser, $dbpass); $trans = ibase_trans(IBASE_WRITE+IBASE_COMMITTED+IBASE_REC_VERSION+IBASE_WAIT,$dbh);

现在已升级到 php 5.3.5,发现 ibase_trans 行导致分段错误。 php ibase_trans 页面上有一条注释:

“该函数的行为在 PHP 5.0.0 中已更改。第一次调用 ibase_trans() 将不会返回连接的默认事务。”

所以我的问题是我是否可以为默认交易设置交易参数...第二个问题,我是否完全错过了尝试这样做的要点!

谢谢

I have some PHP CLI scripts that run for a long time (24 hours plus) and although they do regular 'commit's I had some problems with orphaned transactions - possibly caused by scripts crashing out.

My solution was to create the transaction as follows - it was a year ago that I researched this and can't quite remember the precise reasons for these settings but it seemed to solve some problems with the database.

$dbh = ibase_connect($dbhost, $dbuser, $dbpass);
$trans = ibase_trans(IBASE_WRITE+IBASE_COMMITTED+IBASE_REC_VERSION+IBASE_WAIT,$dbh);

Have now upgraded to php 5.3.5 and found that the ibase_trans line causes a segmentation fault. On the php ibase_trans page there is a note:

"The behaviour of this function has been changed in PHP 5.0.0. The first call to ibase_trans() will not return the default transaction of a connection."

So my question is whether I can set the transaction arguments for the default transaction... Secondary question, whether I am entirely missing the point in trying to do this anyway!

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感情废物 2024-11-02 12:10:27

您不应该使用默认事务。

定义您的事务如下:

$T = ibase_trans($params, $database);

运行查询后:

 ibase_query($T, $SQL, $Params)

或者您可以使用 ibase_prepare & ibase_execute。

之后,请致电

ibase_commit_ret($T); // this mentain transaction active

ibase_commit($T) // this commit work close transaction

You should not work with default transaction.

Define your transaction as folows:

$T = ibase_trans($params, $database);

After run your query:

 ibase_query($T, $SQL, $Params)

or you may use ibase_prepare & ibase_execute.

After it, call

ibase_commit_ret($T); // this mentain transaction active

or

ibase_commit($T) // this commit work close transaction
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文