When you say database, do you mean separate database connection, or separate named databases on the same connection?
Well, first of all, Firebird does not distinguish between databases and database connections. So connecting to several databases on the same host is basically the same thing as connecting to several databases which are on different hosts.
This goes for the multi-DB transactions as well. Every transaction uses 1 or several connections, regardless of which host they're on. Committing multi-DB transactions uses some kind of two-phase locking scheme to ensure atomicity and consistency between all the involved databases.
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 :)
Yeah I know, but the current code doesn't even allow multiple transactions against a single database on the same connection, does it ? This is something I'm sure other databases besides Firebird support as well.
Adding PDO_Transaction::start($db1[, $db2 ...]) for multiple databases would be nice too, but it's not as important. It's just that I think this might be something that other DBs might already support, or will support in the future.
Could you expand on what Firebird does here? Are there other DB's that support this too?
For completeness, I'll add some other features that I think have analogies in other DBs (Oracle, Postgres). [though I'm not saying they should all be supported by PDO]
- transaction flags (concurrency, read/write, etc), - executing SQL with placeholders directly, - preparing SQL with placeholders and executing it 1 or several times, - returning information on placeholders in a prepared statement (type), - naming resultsets and using them in 'WHERE CURRENT OF <name>' statements, - [b]lob API, - adding/removing users, stopping/restarting & other maintenance stuff.
I'm not saying we should try to squeeze everything into PDO, but we should at least make the API leave some room for it.
-- Ard
--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