/** * 创建数据源对象 * * @param mixed $dsType * @param mixed $dsConnect * @access public * @return void */ public function factory($dsType, $dsConnect = NULL) { if (!in_array($dsType, $this->dsType)) { throw new N8_Dblayer_Exception('N8 can not support this ds type', 4404); } include_once N8_ROOT . './Dblayer/' . $dsType . '.php'; $dsName = 'N8_Dblayer_' . $dsType; //self::$ds[$this->dsFlag] = $dsName::getSingle(); self::$ds[$this->dsFlag] = N8_Dblayer_Mysql::getSingle(); $dsConnect && !self::$ds['link'] ? self::$ds[$this->dsFlag]->setConnect($dsConnect) : ''; return $this; }
/** * 单件返回对象 * * @static * @access public * @return void */ public static function getSingle() { if (!is_object(self::$dsObj)) { self::$dsObj = new N8_Dblayer_Mysql(); } return self::$dsObj; }