Forum Moderators: coopster

Message Too Old, No Replies

Programming to be compatible with multiple database types

         

benj0323

7:38 pm on Jun 30, 2005 (gmt 0)

10+ Year Member



I'm developing software in PHP that needs to be able to work with different types of databases, not just MySQL. If their server has PostRegSQL, MSSQL, MySQL, etc. all of my queries in my php code should still work properly. Essentailly when they set up the software I'm going to have them specify what type of database they want to use.

I found this class and I'm not sure this will solve my problem.

[phpclasses.org...]

In other words I want to be able to do pass this through a class:

SELECT * from table_name

and depending on the database type it would work the same no matter what kind of database they are using.

If you know where I can get a class to pass all of my queries through that would be perfect. Any help is greatly appreciated. Thanks.

ergophobe

9:58 pm on Jun 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The two most common DB abstraction classes are

PEAR::DB
ADODB

There's another that's pretty popular. The ADODB guy (John Lim) claims his is the fastest and I have no reason do doubt him. On the other hand, PEAR::DB has the caché of being a PEAR package and having some of the core PHP developers behind it. There is also a project to make it into a binary C library, meaning that if that ever happens, it will blow everything else away in terms of speed.

PS, PEAR:DB is being superceded by PEAR:MDB2 but it is harder to find documentation on the latter.