Re: RE: MDB $this->in_transaction

From: Date: Fri, 31 Oct 2003 10:56:22 +0000
Subject: Re: RE: MDB $this->in_transaction
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-23160@lists.php.net to get a copy of this message
Lukas Smith wrote:
From: Lukas Smith [mailto:smith@backendmedia.com] Sent: Friday, October 31, 2003 10:12 AM
From: Jeroen Houben [mailto:jeroen@terena.nl] Sent: Friday, October 31, 2003 10:08 AM
     
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. Yeah makes sense.
Pondering it again it doesnt make that much sense after all :-) Basically when you set auto commit to false MDB automatically keeps a transaction open. Notice there is no "begin transaction" in MDB. So basically you are always in a transaction when auto_commit is FALSE. Now the obvious question is what the hell is $in_transaction for? Answer: I am not sure :-) It seems its just the opposite of $auto_commit Okay well which variable is used is not that important, but it is important that users can find out if a transaction is open. I would suggest adding a public method called inTransaction() which returns a boolean. That way the internal variable used does not matter anymore (to the user anyways :-)
I think inTransction() is a nice name. e.g. if ($mdb->inTransaction()) { // do stuff } Jeroen

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