Changed php-interbase default transaction behaviour
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
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
精彩评论