Kdyby\Doctrine\Connection::prepare PHP Method

prepare() public method

Prepares an SQL statement.
public prepare ( string $statement ) : Kdyby\Doctrine\PDOStatement
$statement string The SQL statement to prepare.
return Kdyby\Doctrine\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;
    }

Usage Example

 /**
  * do not use, only used by Statement-class
  * needs to be public for access from the Statement-class
  *
  * @deprecated
  */
 public function prepareUnwrapped($sql)
 {
     // returns the actual statement
     return parent::prepare($sql);
 }