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


PHP DBALException::driverExceptionDuringQuery方法代码示例

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


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

示例1: validateDataProvider

 /**
  * @return array
  */
 public function validateDataProvider()
 {
     return [[$this->getDataSourceInterfaceMock(), false, DBALException::driverExceptionDuringQuery(new \Exception('failed'), 'sql')], [$this->getDataSourceInterfaceMock(), false, new InvalidConfigurationException()], [$this->getDataSourceInterfaceMock(), false, null], [$this->getOrmDataSourceInterfaceMock(), true, DBALException::driverExceptionDuringQuery(new \Exception('failed'), 'sql')], [$this->getOrmDataSourceInterfaceMock(), true, new InvalidConfigurationException()], [$this->getOrmDataSourceInterfaceMock(), true, null]];
 }
开发者ID:xamin123,项目名称:platform,代码行数:7,代码来源:QueryValidatorTest.php

示例2: testDoctrineExceptionFailedTransaction

 public function testDoctrineExceptionFailedTransaction()
 {
     $db = $this->db();
     $ex = new \PDOException('SQLSTATE[25P02]: In failed sql transaction: 7 ERROR:  current transaction is aborted, commands ignored until end of transaction block');
     $first = DBALException::driverExceptionDuringQuery($ex, 'SELECT * FROM auth_users WHERE ok = ?', $db->resolveParams(array(1), array()));
     $second = DBALException::driverExceptionDuringQuery($ex, 'SELECT * FROM product WHERE id = ?', $db->resolveParams(array(2), array()));
     $firstContext = MonologBubble::exceptionContext($first);
     $secondContext = MonologBubble::exceptionContext($second);
     $this->assertNotEquals($firstContext, $secondContext);
     $this->assertEquals($this->loggerRecord($first), $this->loggerRecord($second));
 }
开发者ID:Magomogo,项目名称:monolog-bubble,代码行数:11,代码来源:MonologBubbleTest.php

示例3: exec

 /**
  * {@inheritdoc}
  */
 public function exec($statement)
 {
     $this->connect();
     $logger = $this->_config->getSQLLogger();
     if ($logger) {
         $logger->startQuery($statement);
     }
     try {
         $this->executeQuery($statement);
     } catch (\Exception $ex) {
         throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $statement);
     }
     if ($logger) {
         $logger->stopQuery();
     }
     return 1;
 }
开发者ID:perfect-web,项目名称:cassandra-doctrine,代码行数:20,代码来源:ConnectionWrapper.php

示例4: execute

 /**
  * Executes the statement with the currently bound parameters.
  *
  * @param array|null $params
  *
  * @return boolean TRUE on success, FALSE on failure.
  *
  * @throws \Doctrine\DBAL\DBALException
  */
 public function execute($params = null)
 {
     if (is_array($params)) {
         $this->params = $params;
     }
     $logger = $this->conn->getConfiguration()->getSQLLogger();
     if ($logger) {
         $logger->startQuery($this->sql, $this->params, $this->types);
     }
     try {
         $stmt = $this->stmt->execute($params);
     } catch (\Exception $ex) {
         if ($logger) {
             $logger->stopQuery();
         }
         throw DBALException::driverExceptionDuringQuery($this->conn->getDriver(), $ex, $this->sql, $this->conn->resolveParams($this->params, $this->types));
     }
     if ($logger) {
         $logger->stopQuery();
     }
     $this->params = array();
     $this->types = array();
     return $stmt;
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:33,代码来源:Statement.php

示例5: query

 /**
  * Executes an SQL statement, returning a result set as a Statement object.
  *
  * @return \Doctrine\DBAL\Driver\Statement
  *
  * @throws \Doctrine\DBAL\DBALException
  */
 public function query()
 {
     $this->connect();
     $args = func_get_args();
     $logger = $this->_config->getSQLLogger();
     if ($logger) {
         $logger->startQuery($args[0]);
     }
     try {
         switch (func_num_args()) {
             case 1:
                 $statement = $this->_conn->query($args[0]);
                 break;
             case 2:
                 $statement = $this->_conn->query($args[0], $args[1]);
                 break;
             default:
                 $statement = call_user_func_array(array($this->_conn, 'query'), $args);
                 break;
         }
     } catch (\Exception $ex) {
         throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $args[0]);
     }
     $statement->setFetchMode($this->defaultFetchMode);
     if ($logger) {
         $logger->stopQuery();
     }
     return $statement;
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:36,代码来源:Connection.php

示例6: prepare

 /**
  * Prepares an SQL statement.
  *
  * @param string $statement The SQL statement to prepare.
  * @throws DBALException
  * @return PDOStatement The prepared statement.
  */
 public function prepare($statement)
 {
     $this->connect();
     try {
         $stmt = new PDOStatement($statement, $this);
     } catch (\Exception $ex) {
         throw $this->resolveException(Doctrine\DBAL\DBALException::driverExceptionDuringQuery($this->getDriver(), $ex, $statement), $statement);
     }
     $stmt->setFetchMode(PDO::FETCH_ASSOC);
     return $stmt;
 }
开发者ID:LidskaSila,项目名称:Doctrine,代码行数:18,代码来源:Connection.php

示例7: testDriverExceptionDuringQueryAcceptsBinaryData

 public function testDriverExceptionDuringQueryAcceptsBinaryData()
 {
     $driver = $this->getMock('\\Doctrine\\DBAL\\Driver');
     $e = DBALException::driverExceptionDuringQuery($driver, new \Exception(), '', array('ABC', chr(128)));
     $this->assertContains('with params ["ABC", "\\x80"]', $e->getMessage());
 }
开发者ID:selimcr,项目名称:servigases,代码行数:6,代码来源:DBALExceptionTest.php


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