RE: [PEAR] [MDB] transaction syntax (just to be sure..)
| From: | Lukas Smith | Date: | Mon, 08 Sep 2003 09:44:53 +0000 |
| Subject: | RE: [PEAR] [MDB] transaction syntax (just to be sure..) | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7633@lists.php.net to get a copy of this message | ||
> From: Thierry Bothorel [mailto:thierry.bo@netcourrier.com]
> Sent: Sunday, September 07, 2003 4:21 AM
> as it is not very clear reading the API manual, is this the correct
> syntax
> to run a **manual** tansaction ? :
>
> $mdb->autoCommit(FALSE);
>
> (some code)
>
> $mdb->commit();
Looks to be correct.
You can also look at the MDB_usage_testcase.php in the tests directory.
There you will find a testcase for transaction support.
> Also, I don't well understand the meaning of "Therefore, a new
transaction
> is implicitly started after committing the pending changes" (excerpt
from
> commit()). I just want to run a transaction at some place in my code,
I
> don't want to run a new one just after $mdb->commit() !
Usually you have to explicitly begin a transactions in most RDBMS.
Following Metabases's example you don't have to do this in MDB. A
transaction is implicitly started when you set autocommit to false and
whenever you commit or rollback.
regards,
Lukas