Quote:
Originally Posted by sketchMedia
hey,
sorry i havent posted in a while, ive been busy.
anyway
bluesaga is correct about PHP5 and referencing, i do know that the new keyword returns a reference by default but i am unsure about returning from functions and i must admit i havent tested to see (if sum1 else knows please let me know :) ).
@Tanax i am unsure about your question, can u elaborate more?
just add to the switch for oracle (if thats what your question was :confused:)
|
Nono, that wasn't my question ;)
My question was that if I have several database classes, for instance mysql, mssql, and oracle.
Then I will have the switch, and creates objects of the class depending on what type.
But how will it create an object of a class, in ANOTHER file.
I have this DBfactory.php where the static factory method is.
Then I have a new file for each of the database types.
DBmysql.php
DBmssql.php
DBoracle.php
Which means, that I have to include them in order to create the object like so:
And where do I include them?
Like this?
PHP Code:
switch($type) {
case 'mysql':
include_once('DB'.$type.'.php');
self::$DB = new DBmysql;
break;
case 'mssql':
include_once('DB'.$type.'.php');
self::$DB = new DBmssql;
break;
default:
include_once('DB'.$type.'.php');
self::$DB = new DBmysql;
break;
}