Source code raw phps
<?php
require_once 'libraries/expt.DB_Exception.php';
require_once 'libraries/class.DB_mySQL.php';
class DB
{
static protected $_instance;
public static function instance()
{
if (!DB::$_instance instanceof DB_Common) {
throw new DB_Exception('Invalid instance');
}
return DB::$_instance;
}
public static function initiate($type)
{
$className = 'DB_'.$type;
if (!class_exists($className)) {
throw new DB_Exception('Unable to instanciate the database handler class ('.$className.'), you need to defined it first.');
}
DB::$_instance = new $className;
return DB::$_instance;
}
}
?>
Comments
There is currently no comment here.