Re: RE: MDB $this->in_transaction

From: Date: Fri, 31 Oct 2003 09:07:58 +0000
Subject: Re: RE: MDB $this->in_transaction
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-23156@lists.php.net to get a copy of this message
Lukas Smith wrote:
From: Jeroen Houben [mailto:jeroen@terena.nl] Sent: Thursday, October 30, 2003 4:11 PM
In version 1.3 of MDB I encountered the following: /** * @var boolean * @access private */ var $in_transaction = 0; Most of the times this won't cause any problems but the following will (I think!):
Yeah it is a bit unclean. I will fix that.
if ($mdb->in_transaction === true) { $mdb->rollback(); }
Did you see this anywhere in the code? Not in the MDB code. However users may use it in *their* code. For instance in an error handler functoin you could use:
function err_handler($err) { global $mdb; if ($mdb->in_transaction === true) {
      $mdb->rollback();
} var_dump($err); }
While I'm on the topic. The inline docs (see above) say this method is private put it's not prefixed with an _underscore. I would like to have public access to the variable, either directly or through an isIntransaction() method perhaps. Can I just keep accessing it directly or will it become a private var in future versions?
Hmm not sure. I am just not sure if it contains meaningful values in all drivers. I could investigate that. I think it's important that MDB users can find out if a transaction is open. There has to be public some method/variabale to find that out IMHO.
Jeroen

« previous php.pear.dev (#23156) next »