當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。