> Yeah I know, but the current code doesn't even allow multiple 
> transactions against a single database on the same 
> connection, does it ? 

> 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.
 
PDO tries (a bit) to keep things portable: if it's a method of the PDO or
PDOStatement classes, then you can be reasonably sure it's supported for a
given driver.  That doesn't mean that I want to exclude all non-portable
behaviour, I just want to make sure that we don't overload the API too much
and make things harder in the future for when those databases grow and add new
features.

The current transactional behaviour of PDO is this, FYI, a fairly standard
semantic:

- new connections start in auto-commit mode (ala ODBC)
- in auto-commit mode, there is an implicit commit after each query
- if you begin a txn in auto-commit mode, auto-commit is disabled until you
rollback or commit.
- it is an error to begin a new transaction while inside a transaction, since
nested transactions are not portable
- if a driver does not support transactions, an exception is raised
(regardless of your choice of error handling settings) when you attempt to
begin a transaction or disable auto-commit mode

The PDO philosophy on driver specific behaviour can be generally summed up as:
if you can't do it portably, use a driver/db specific API or query.

Right now, I think I would prefer to defer making a decision on
multi-connection transactions, with a view to implementing it as a separate
API (pdo_multi_txn_begin() or something like that) so that it is clear that it
operates on separate connections.  If it does appear that only firebird
supports this, then I would prefer to have that function in the pdo_firebird
extension only, at least until other databases appear and we can see how their
API operates and find some common ground.

Does this cause a big problem for using firebird in PHP? (How often do you
open separate connections to separate databases?)

> - transaction flags (concurrency, read/write, etc),
> - naming resultsets and using them in 'WHERE CURRENT OF <name>'
>    statements,
> - [b]lob API,

Already planned, along with cursors (and positioned updates using named result
sets).

> - executing SQL with placeholders directly,
> - preparing SQL with placeholders and executing it 1 or several times,

This is already implemented, although one-shot with placeholders is not yet.

> - returning information on placeholders in a prepared 
> statement (type),

Just wondering, how often do you need to query the types of placeholders?
PDO works in the opposite sense: you tell the database the type you are
setting and intending to receive.

> - adding/removing users, stopping/restarting & other 
> maintenance stuff.

These can (perhaps should) be extension level functions and not methods of the
PDO class, unless they happen to be uniform API's across the majority of APIs.
 
--Wez.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to