Re: DB, MDB2, PDO - Future of DB-Abstraction in PEAR

From: Date: Thu, 04 Aug 2005 00:07:49 +0000
Subject: Re: DB, MDB2, PDO - Future of DB-Abstraction in PEAR
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-39189@lists.php.net to get a copy of this message
Andreas Korthaus wrote:
Lukas Smith wrote:
Well limit is slightly more tricky, but atleast nextID() can best be handled inside the schema, this way you can get any popular database to produce auto increment like behaviour. This is exactly what the lastInsertId() method in PDO tries to facilitate.
do you think about this one: http://troels.arvin.dk/db/rdbms/#mix-identity ?
Thats more or less what I am talking about. Use auto increment / identity where it exist and emulate where not (look up the SERIAL datatype of PostGreSQL as an example of how to emulate via triggers/sequences).
I'm not 100% sure how to implement it with PDO::lastInsertId(). An application should not know which database is used and which features are supported. Do all PDO-Drivers support:
http://de.php.net/manual/en/function.pdo-lastinsertid.php Notice that you can optionally pass in a string. If you do pass in a string on an RDBMS that does not natively support last insert id it will actually try to get the current ID from a sequence with that name. this is currently only implemented in the PostGreSQL driver and effectively means you can use a SERIAL column just like an auto increment column in MySQL. regards, Lukas

« previous php.pear.dev (#39189) next »