Re: A question about DB abstraction

From: Date: Fri, 19 Jan 2007 10:12:01 +0000
Subject: Re: A question about DB abstraction
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26374@lists.php.net to get a copy of this message
Le 19 janv. 07 à 09:43, David Sanders a écrit :
m.php wrote:
Hi! I'm writing to you because I'd like to know whether your Pear Db Package contains an abstraction class - or classes - that makes it possible to pass from a given db (say: mysql or oracle) to another (say: sql server or any other db) in a so to speak "painless" way.
PEAR::DB *is* the abstraction class. Also look at MDB2... some of the developers on here can probably explain the beneficial differences better than me.
I would say that PEAR DB is just a wrapper around existing native php database functions like _connect(), _query(), etc. Thus, it makes you more productive since it provides a common API for every kind of databases that is supported. But it is not an abstraction layer in the strict sense because SQL for Oracle is different from MySQL SQL when you need advanced features (limits, procedures, sequences, triggers, transactions...). PDO also belongs to this kind of software but should be faster than DB since it's implemented in C. MDB2 as far as I know provides a better abstraction. But complete abstraction is impossible to achieve in my opinion. If you really need portable code, you could also create your own library which performs specialized tasks and implement one variant for each database you need. It all depends on the complexity of your queries. -- Bertrand Mansion Mamasam Work : http://www.mamasam.com Blog : http://golgote.freeflux.net

« previous php.pear.general (#26374) next »