Beispiel #1
0
 /**
  * @covers Zend\Db\Adapter\Driver\Pdo\Statement::execute
  */
 public function testExecute()
 {
     $this->statement->setDriver(new Pdo(new Connection($pdo = new TestAsset\SqliteMemoryPdo())));
     $this->statement->initialize($pdo);
     $this->statement->prepare('SELECT 1');
     $this->assertInstanceOf('Zend\\Db\\Adapter\\Driver\\Pdo\\Result', $this->statement->execute());
 }
Beispiel #2
0
 /**
  * Execute the statement
  *
  * @param   mixed $parameters
  * @return  \Zend\Db\Adapter\Driver\Pdo\Result
  * @throws  InvalidQueryException
  */
 public function execute($parameters = null)
 {
     try {
         return parent::execute($parameters);
     } catch (InvalidQueryException $exception) {
         throw new InvalidQueryException($exception->getMessage() . ':' . PHP_EOL . $this->resource->queryString, $exception->getCode(), $exception);
     }
 }
Beispiel #3
0
 public function execute($parameters = null)
 {
     if ($parameters === null) {
         if ($this->parameterContainer != null) {
             $saveParams = (array) $this->parameterContainer->getNamedArray();
         } else {
             $saveParams = array();
         }
     } else {
         $saveParams = $parameters;
     }
     $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
     $queryId = $this->getProfiler()->startQuery($this->getSql(), $saveParams, $stack);
     $result = parent::execute($parameters);
     $this->getProfiler()->endQuery($queryId);
     return $result;
 }
 public function testStatementExecuteWillUsePdoStrByDefaultWhenBinding()
 {
     $this->pdoStatementMock->expects($this->any())->method('bindParam')->with($this->equalTo('foo'), $this->equalTo('bar'), $this->equalTo(\PDO::PARAM_STR));
     $this->statement->execute(array('foo' => 'bar'));
 }