Ouzo\Db\StatementExecutor::prepare PHP Метод

prepare() публичный статический Метод

public static prepare ( $dbHandle, $sql, $boundValues, $options )
    public static function prepare($dbHandle, $sql, $boundValues, $options)
    {
        $pdoExecutor = PDOExecutor::newInstance($options);
        return new StatementExecutor($dbHandle, $sql, $boundValues, $pdoExecutor);
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function shouldThrowConnectionExceptionFromForPostgres()
 {
     //given
     Config::overrideProperty('sql_dialect')->with('\\Ouzo\\Db\\Dialect\\PostgresDialect');
     Mock::when($this->pdoMock)->errorInfo()->thenReturn(array('57P01', 7, 'Execution error'));
     $executor = StatementExecutor::prepare($this->dbMock, 'SELECT 1', array(), array());
     //when
     CatchException::when($executor)->execute();
     //then
     CatchException::assertThat()->isInstanceOf('\\Ouzo\\DbConnectionException');
     Config::revertProperty('sql_dialect');
 }
All Usage Examples Of Ouzo\Db\StatementExecutor::prepare