当前位置: 首页>>代码示例>>PHP>>正文


PHP DBALException::driverException方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\DBALException::driverException方法的典型用法代码示例。如果您正苦于以下问题:PHP DBALException::driverException方法的具体用法?PHP DBALException::driverException怎么用?PHP DBALException::driverException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\DBALException的用法示例。


在下文中一共展示了DBALException::driverException方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: connect

 /**
  * {@inheritdoc}
  */
 public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
 {
     try {
         $pdo = new PDOConnection($this->_constructPdoDsn($params), $username, $password, $driverOptions);
         if (PHP_VERSION_ID >= 50600 && (!isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]) || true === $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES])) {
             $pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
         }
         return $pdo;
     } catch (PDOException $e) {
         throw DBALException::driverException($this, $e);
     }
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:15,代码来源:Driver.php

示例2: connect

 /**
  * {@inheritdoc}
  */
 public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
 {
     try {
         return new MysqliConnection($params, $username, $password, $driverOptions);
     } catch (MysqliException $e) {
         throw DBALException::driverException($this, $e);
     }
 }
开发者ID:kierkegaard13,项目名称:graph-generator,代码行数:11,代码来源:Driver.php

示例3: connect

 /**
  * {@inheritdoc}
  */
 public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
 {
     try {
         return new PDOConnection($this->constructPdoDsn($params), $username, $password, $driverOptions);
     } catch (\PDOException $e) {
         throw DBALException::driverException($this, $e);
     }
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:11,代码来源:Driver.php

示例4: connect

 /**
  * {@inheritdoc}
  *
  * @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection.
  */
 public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
 {
     try {
         return new SQLAnywhereConnection($this->buildDsn(isset($params['host']) ? $params['host'] : null, isset($params['port']) ? $params['port'] : null, isset($params['server']) ? $params['server'] : null, isset($params['dbname']) ? $params['dbname'] : null, $username, $password, $driverOptions), isset($params['persistent']) ? $params['persistent'] : false);
     } catch (SQLAnywhereException $e) {
         throw DBALException::driverException($this, $e);
     }
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:13,代码来源:Driver.php

示例5: connect

 /**
  * {@inheritdoc}
  */
 public function connect(array $params, $username = NULL, $password = NULL, array $driverOptions = [])
 {
     try {
         // create our special driver
         $conn = new PDOConnection($this->constructPdoDsn($params), $username, $password, $driverOptions);
     } catch (PDOException $e) {
         throw DBALException::driverException($this, $e);
     }
     return $conn;
 }
开发者ID:RadekDvorak,项目名称:modular-testcase,代码行数:13,代码来源:MySqlDriver.php

示例6: connect

 /**
  * {@inheritdoc}
  *
  * @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection.
  * @throws SQLAnywhereException         if a mandatory connection parameter is missing.
  */
 public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
 {
     if (!isset($params['host'])) {
         throw new SQLAnywhereException("Missing 'host' in configuration for sqlanywhere driver.");
     }
     if (!isset($params['server'])) {
         throw new SQLAnywhereException("Missing 'server' in configuration for sqlanywhere driver.");
     }
     if (!isset($params['dbname'])) {
         throw new SQLAnywhereException("Missing 'dbname' in configuration for sqlanywhere driver.");
     }
     try {
         return new SQLAnywhereConnection($this->buildDsn($params['host'], isset($params['port']) ? $params['port'] : null, $params['server'], $params['dbname'], $username, $password, $driverOptions), isset($params['persistent']) ? $params['persistent'] : false);
     } catch (SQLAnywhereException $e) {
         throw DBALException::driverException($this, $e);
     }
 }
开发者ID:jay45,项目名称:porn,代码行数:23,代码来源:Driver.php

示例7: connect

 /**
  * {@inheritdoc}
  */
 public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
 {
     try {
         $pdo = new PDOConnection($this->_constructPdoDsn($params), $username, $password, $driverOptions);
         if (defined('PDO::PGSQL_ATTR_DISABLE_PREPARES') && (!isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]) || true === $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES])) {
             $pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
         }
         /* defining client_encoding via SET NAMES to avoid inconsistent DSN support
          * - the 'client_encoding' connection param only works with postgres >= 9.1
          * - passing client_encoding via the 'options' param breaks pgbouncer support
          */
         if (isset($params['charset'])) {
             $pdo->query('SET NAMES \'' . $params['charset'] . '\'');
         }
         return $pdo;
     } catch (PDOException $e) {
         throw DBALException::driverException($this, $e);
     }
 }
开发者ID:vectornet,项目名称:dbal,代码行数:22,代码来源:Driver.php

示例8: constructPdoDsn

 /**
  * Constructs the Informix PDO DSN.
  *
  * @param array $params
  * @return string The DSN.
  * @throws \Doctrine\DBAL\DBALException
  * @see \Doctrine\DBAL\Driver::connect
  */
 private function constructPdoDsn(array $params)
 {
     if (empty($params['dbname'])) {
         throw DBALException::driverException($this, new \Exception("Missing 'dbname' in configuration for informix driver"));
     }
     if (empty($params['host'])) {
         throw DBALException::driverException($this, new \Exception("Missing 'host' in configuration for informix driver"));
     }
     if (empty($params['protocol'])) {
         throw DBALException::driverException($this, new \Exception("Missing 'protocol' in configuration for informix driver"));
     }
     if (empty($params['server'])) {
         throw DBALException::driverException($this, new \Exception("Missing 'server' in configuration for informix driver"));
     }
     $dsn = 'informix:' . 'host=' . $params['host'] . ';' . 'server=' . $params['server'] . ';' . 'database=' . $params['dbname'] . ';' . 'protocol=' . $params['protocol'] . ';';
     if (!empty($params['port'])) {
         $dsn .= 'service=' . $params['port'] . ';';
     }
     return $dsn;
 }
开发者ID:josemalonsom,项目名称:ifx4dd,代码行数:28,代码来源:Driver.php


注:本文中的Doctrine\DBAL\DBALException::driverException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。