PHP Class Doctrine\DBAL\Statement

Since: 1.0
Author: Konsta Vesterinen ([email protected])
Show file Open project: doctrine/dbal Class Usage Examples

Protected Properties

Property Type Description
$conn Doctrine\DBAL\Connection The connection this statement is bound to and executed on.
$params array The bound parameters.
$platform Doctrine\DBAL\Platforms\AbstractPlatform The underlying database platform.
$sql string The SQL statement.
$stmt Doctrine\DBAL\Driver\Statement The underlying driver statement.
$types array The parameter types.

Public Methods

Method Description
__construct ( string $sql, Doctrine\DBAL\Connection $conn ) Creates a new Statement for the given SQL and Connection.
bindParam ( string $name, mixed &$var, integer $type = PDO::PARAM_STR, integer | null $length = null ) : boolean Binds a parameter to a value by reference.
bindValue ( string $name, mixed $value, mixed $type = null ) : boolean Binds a parameter value to the statement.
closeCursor ( ) : boolean Closes the cursor, freeing the database resources used by this statement.
columnCount ( ) : integer Returns the number of columns in the result set.
errorCode ( ) : string Fetches the SQLSTATE associated with the last operation on the statement.
errorInfo ( ) : array Fetches extended error information associated with the last operation on the statement.
execute ( array | null $params = null ) : boolean Executes the statement with the currently bound parameters.
fetch ( integer | null $fetchMode = null ) : mixed Fetches the next row from a result set.
fetchAll ( integer | null $fetchMode = null, mixed $fetchArgument ) : array Returns an array containing all of the result set rows.
fetchColumn ( integer $columnIndex ) : mixed Returns a single column from the next row of a result set.
getIterator ( ) Required by interface IteratorAggregate.
getWrappedStatement ( ) : Doctrine\DBAL\Driver\Statement Gets the wrapped driver statement.
rowCount ( ) : integer Returns the number of rows affected by the last execution of this statement.
setFetchMode ( $fetchMode, $arg2 = null, $arg3 = null )

Method Details

__construct() public method

Creates a new Statement for the given SQL and Connection.
public __construct ( string $sql, Doctrine\DBAL\Connection $conn )
$sql string The SQL of the statement.
$conn Doctrine\DBAL\Connection The connection on which the statement should be executed.

bindParam() public method

Binding a parameter by reference does not support DBAL mapping types.
public bindParam ( string $name, mixed &$var, integer $type = PDO::PARAM_STR, integer | null $length = null ) : boolean
$name string The name or position of the parameter.
$var mixed The reference to the variable to bind.
$type integer The PDO binding type.
$length integer | null Must be specified when using an OUT bind so that PHP allocates enough memory to hold the returned value.
return boolean TRUE on success, FALSE on failure.

bindValue() public method

The value can optionally be bound with a PDO binding type or a DBAL mapping type. If bound with a DBAL mapping type, the binding type is derived from the mapping type and the value undergoes the conversion routines of the mapping type before being bound.
public bindValue ( string $name, mixed $value, mixed $type = null ) : boolean
$name string The name or position of the parameter.
$value mixed The value of the parameter.
$type mixed Either a PDO binding type or a DBAL mapping type name or instance.
return boolean TRUE on success, FALSE on failure.

closeCursor() public method

Closes the cursor, freeing the database resources used by this statement.
public closeCursor ( ) : boolean
return boolean TRUE on success, FALSE on failure.

columnCount() public method

Returns the number of columns in the result set.
public columnCount ( ) : integer
return integer

errorCode() public method

Fetches the SQLSTATE associated with the last operation on the statement.
public errorCode ( ) : string
return string

errorInfo() public method

Fetches extended error information associated with the last operation on the statement.
public errorInfo ( ) : array
return array

execute() public method

Executes the statement with the currently bound parameters.
public execute ( array | null $params = null ) : boolean
$params array | null
return boolean TRUE on success, FALSE on failure.

fetch() public method

Fetches the next row from a result set.
public fetch ( integer | null $fetchMode = null ) : mixed
$fetchMode integer | null
return mixed The return value of this function on success depends on the fetch type. In all cases, FALSE is returned on failure.

fetchAll() public method

Returns an array containing all of the result set rows.
public fetchAll ( integer | null $fetchMode = null, mixed $fetchArgument ) : array
$fetchMode integer | null
$fetchArgument mixed
return array An array containing all of the remaining rows in the result set.

fetchColumn() public method

Returns a single column from the next row of a result set.
public fetchColumn ( integer $columnIndex ) : mixed
$columnIndex integer
return mixed A single column from the next row of a result set or FALSE if there are no more rows.

getIterator() public method

public getIterator ( )

getWrappedStatement() public method

Gets the wrapped driver statement.
public getWrappedStatement ( ) : Doctrine\DBAL\Driver\Statement
return Doctrine\DBAL\Driver\Statement

rowCount() public method

Returns the number of rows affected by the last execution of this statement.
public rowCount ( ) : integer
return integer The number of affected rows.

setFetchMode() public method

public setFetchMode ( $fetchMode, $arg2 = null, $arg3 = null )

Property Details

$conn protected property

The connection this statement is bound to and executed on.
protected Connection,Doctrine\DBAL $conn
return Doctrine\DBAL\Connection

$params protected property

The bound parameters.
protected array $params
return array

$platform protected property

The underlying database platform.
protected AbstractPlatform,Doctrine\DBAL\Platforms $platform
return Doctrine\DBAL\Platforms\AbstractPlatform

$sql protected property

The SQL statement.
protected string $sql
return string

$stmt protected property

The underlying driver statement.
protected Statement,Doctrine\DBAL\Driver $stmt
return Doctrine\DBAL\Driver\Statement

$types protected property

The parameter types.
protected array $types
return array