Andi
At 09:12 AM 5/23/2004 +0800, Alan Knowles wrote:
Just a thought - feel free to ignore...
In dataobjects rather than implement extra methods for transactions, I just hooked into query
..
eg. $do->query('BEGIN') - turned off autocommit, and ran begin.
$do->query('ROLLBACK') or $do->('COMMIT'); - ranit , then turned autocommit back on
It seemed far more sensible than fattening up the API.
Regards Alan
Wez Furlong wrote:
Hey Ard,
When you say database, do you mean separate database connection, or separate named databases on the same connection?
PDO::beginTransaction() initiates a transaction for a given connection ($dbh) in a more or less portable way. You're not always guaranteed to be able to do that; extending it for multiple database handles seems a bit optimistic :)
Could you expand on what Firebird does here? Are there other DB's that support this too?
--Wez.
-----Original Message-----
From: Ard Biesheuvel [mailto:[EMAIL PROTECTED] Sent: 22 May 2004 16:39
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: pdo design
Guys,
I saw the alpha of PDO on pecl. I was wondering if we could discuss the design of it a bit more before putting too much work into it.
In particular, the way transactions are represented is not very practical. Generally, databases that support transactions will support multiple concurrent transactions against the same database. Firebird also supports transactions against multiple databases. [which does *not* mean you can join tables from different DBs, it just means ACID over multiple DBs]
This means that in some cases you must specify both the connection and the transaction when generating a statement. [I'm not sure if others RDBMSs support this, but it might be something we will see more in the future.]
In short:
In addition to $db->startTransaction(), maybe we could add PDO::startTransaction($db1 [,$db2 [,$db3]]).
In addition to $db->prepare(), maybe we could add a Transaction interface whose instances would allow being called as
$trans->prepare($query)
and maybe even
$trans->prepare($db, $query)
Your thoughts please ?
-- Ard
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php