View Single Post
Old 11-01-2007, 01:24 PM   #7 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

I have another question.
Your static function factory, can I name it something else?

PHP Code:
public static function &getType($szType '') {
if(!
is_object(self::$pDB))
        {
            switch(
$szType)
            {
                case 
'mysql':
                    
self::$pDB = new DBmysql;
                    break;
                case 
'mssql':
                    
self::$pDB = new DBmssql;
                    break;
                default:
                    
self::$pDB = new DBmysql;
                    break;
            }
        }
        return 
self::$pDB;
    } 

PHP Code:
$db DB::getType('mysql');
$db->connect()->query('...'); 
???
Tanax is offline  
Reply With Quote