Flexible Content Management System


Time for Multiple Database

Contributed by Database abstraction on Jul 17, 2001 - 01:00 AM

Personally I have only worked with mysql, and have never had something multi-database, but I think that will be not too complicated, maybe something like:

1-Include a variable in config.php where you can specify the database type (e.g. $database_type="mysql")

2-Make that variable global where needed (almost everywhere ;-)

3-And include databse functions (maybe in mainfile or a new database.php file) where you simple make a switch of the options.

Lets say that we make a function named do_query as follows:

function do_query($db,$query){

global $database_type;

swith ($database_type){

case "pg":

pg_exec($db, $query);


case "mysql":

mysql_sd_query($db, $query);



and so on, of course this will consume CPU time (I do not know how much), but this can meet many people needs.

What do you think? is this the time to implement multiple database support, or shuld this wait for version 2.0?