Re: Database transactions with PEAR DB
| From: | Stig S. Bakken | Date: | Tue, 29 Jan 2002 13:37:21 +0000 |
| Subject: | Re: Database transactions with PEAR DB | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-748@lists.php.net to get a copy of this message | ||
On Tue, 2002-01-29 at 14:23, derek fong wrote:
> Hello,
>
> I have written a PHP application that may be used with either Oracle or
> MySQL. There is one section of it that would probably benefit from being
> within a database transaction. Although I've been able to find methods like
> autoCommit, rollback and commit, I can't seem to find the relevant function
> to actually start the transaction and finish it off, at least where Oracle
> is involved. Would it suffice to just set autocommit to false, issue my
> queries and commit/rollback when I'm done?
>
> Can someone shed some light on this? I've read about alternate DB classes I
> could use, but I would prefer to stick with the PEAR DB class since it's
> already been used exclusively for the project.
Hi,
Yes, you start a transaction simply by turning off autocommit (which is
always on by default), and complete it with a call to commit or
rollback.
- Stig