Exemple #1
0
 public static function driver($driver = null, $default = 0)
 {
     if ($default) {
         if (is_null($driver)) {
             return self::$default_dirver;
         } else {
             if (is_object(self::$default_driver)) {
                 return self::$default_driver;
             }
             //默认的数据库只设置一次
             self::$default_driver = dbfactory::driver($driver);
             self::$current_driver = self::$default_driver;
             return self::$default_driver;
         }
     } else {
         return is_null($driver) ? self::$current_driver : (self::$current_driver = dbfactory::driver($driver));
     }
 }
Exemple #2
0
 public static function __callstatic($name, $params)
 {
     self::$default_driver = dbfactory::driver('pdo');
     return call_user_func_array(array(self::$default_driver, $name), $params);
 }
Exemple #3
0
 public static function selectdb($name)
 {
     return dbfactory::create($name, self::$cfg[$name]);
 }