Пример #1
0
 /**
  * 创建一个SQLite的PDO连接
  *
  * @param string $dsn
  * @param array $options
  * @throws CoreException
  */
 private function __construct($dsn, array $options)
 {
     try {
         $this->pdo = new PDO($dsn, null, null, parent::getOptions($options));
     } catch (Exception $e) {
         throw new CoreException($e->getMessage() . ' line:' . $e->getLine() . ' ' . $e->getFile());
     }
 }
Пример #2
0
 /**
  * 创建Mysql的PDO连接
  *
  * @param string $dsn dsn
  * @param string $user 数据库用户名
  * @param string $password 数据库密码
  * @param array $options
  * @throws CoreException
  */
 private function __construct($dsn, $user, $password, $options = array())
 {
     try {
         $this->pdo = new PDO($dsn, $user, $password, parent::getOptions($options));
     } catch (Exception $e) {
         throw new CoreException($e->getMessage() . ' line:' . $e->getLine() . ' ' . $e->getFile());
     }
 }