Re: [PDO] Re: [PHP-DEV] [PATCH] New PDO methods for PostgreSQL driver
[email protected] (Oskar Eisemuth) Tue, 25 May 2010 14:25:50 +0200
| Newsgroups | php.pdo |
|---|---|
| Message-ID | <[email protected]> |
Lester Caine schrieb: > From one of the other examples ... >> Or the same as transaction object... >> >> $tobj = new PDOCrossTransaction(); >> $tobj->attach($dbh1); >> $tobj->attach($dbh2); >> $tobj->beginTransaction($options); >> >> + Can change the function declaration for transaction options > Provided that $dbh1 and $dbh2 can be used within the transaction to > identify the connection required. Firebird/Interbase normally has both > the connection AND transaction passed to any activity so that 'query' > for instance knows which transaction is active. So > $dbh1->beginTransaction() would need to know that there is a > PDOCrossTransaction active already. > Yes, you have to hijack the beginTransaction and commit calls of all child PDO objects and manipulate the internal state. So you can't have two separate transaction running at the same time or do other tricks. The other way would be to clone the PDO objects and let them use the newly created transaction_handle/id and disable beginTransaction/commit/rollback for these. This would mean you get a PDO Object bound to a specific transaction. As soon as the Transaction Object will do the final commit the cloned objects will be invalid.