<?php

/** Power By Tmac PHP MVC framework
 *  $Author: zhangwentao $
 *  $Id: DatabaseDriver.class.php 4 2011-11-02 11:02:08Z zhangwentao $
 */
class DatabaseDriver
{

    /**
     * 数据库实例
     *
     * @var object
     * @static
     */
    protected static $instance = array();

    /**
     * 取得缓存实例
     *
     * @return object
     * @access public
     * @static
     */
    public static function getInstance($name)
    {
        $class = 'Db' . $GLOBALS['db'][$name]['dbdriver'];
        if (!isset(self::$instance[$name])) {
            $config = $GLOBALS['db'][$name];
            self::$instance[$name] = new $class($config);
        }
        return self::$instance[$name];
    }
	
}