For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > January 2007 > Re: [PEAR] A question about DB abstraction









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] A question about DB abstraction
David Sanders

2007-01-19, 4:01 am

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 "pa

inless" 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.


--
David Sanders
Bertrand Mansion

2007-01-19, 8:01 am


Le 19 janv. 07 =E0 09:43, David Sanders a =E9crit :

> m.php wrote:
[color=darkred]
>
> PEAR::DB *is* the abstraction class. Also look at MDB2... some of the
> developers on here can probably explain the beneficial differences =20
> better than
> me.


I would say that PEAR DB is just a wrapper around existing native php =20=

database functions like _connect(), _query(), etc.
Thus, it makes you more productive since it provides a common API for =20=

every kind of databases that is supported. But it is not an =20
abstraction layer in the strict sense because SQL for Oracle is =20
different from MySQL SQL when you need advanced features (limits, =20
procedures, sequences, triggers, transactions...). PDO also belongs =20
to this kind of software but should be faster than DB since it's =20
implemented in C.

MDB2 as far as I know provides a better abstraction.

But complete abstraction is impossible to achieve in my opinion. If =20
you really need portable code, you could also create your own library =20=

which performs specialized tasks and implement one variant for each =20
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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com