# pdo design

- Thread: https://externals.io/message/10028
- Original archive: https://news-web.php.net/php.internals/10028
- Started by Ard Biesheuvel on 2004-05-22T15:38:40+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #10028 — Ard Biesheuvel — 2004-05-22T15:38:40+00:00

URL: https://externals.io/message/10028#10028

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

---

## #10027 — Wez Furlong — 2004-05-22T15:50:52+00:00

URL: https://externals.io/message/10028#10027 · In reply to: #10028

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:a.k.biesheuvel@ewi.tudelft.nl] 
> Sent: 22 May 2004 16:39
> To: internals@lists.php.net
> Cc: helly@php.net; ilia@prohost.org; wez@thebrainroom.net; 
> george@omniti.com
> 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
