class Statement extends PDOStatement (View source)

PDO SQL Server Statement

Constants

PARAM_TYPE_MAP

FETCH_MODE_MAP

Methods

__construct(PDOStatement $stmt)

No description

bool
setFetchMode(int $fetchMode, mixed[] ...$args)

Sets the fetch mode to use while iterating this statement.

bool
bindValue(mixed $param, mixed $value, int $type = ParameterType::STRING)

Binds a value to a corresponding named (not supported by mysqli driver, see comment below) or positional placeholder in the SQL statement that was used to prepare the statement.

bool
bindParam(mixed $column, mixed $variable, int|null $type = ParameterType::STRING, int|null $length = null, $driverOptions = null)

Binds a PHP variable to a corresponding named (not supported by mysqli driver, see comment below) or question mark placeholder in the SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(), the variable is bound as a reference and will only be evaluated at the time that PDOStatement->execute() is called.

bool
closeCursor()

Closes the cursor, enabling the statement to be executed again.

int
columnCount()

Returns the number of columns in the result set

string|int|bool
errorCode()

Fetches the SQLSTATE associated with the last operation on the statement handle.

array
errorInfo()

Fetches extended error information associated with the last operation on the statement handle.

bool
execute(array|null $params = null)

Executes a prepared statement

int
rowCount()

Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding object.

mixed
fetch(int|null $fetchMode = null, mixed[] ...$args)

Returns the next row of a result set.

array
fetchAll(int|null $fetchMode = null, mixed[] ...$args)

Returns an array containing all of the result set rows.

string|boolean
fetchColumn(int $columnIndex = 0)

Returns a single column from the next row of a result set or FALSE if there are no more rows.

getIterator()

{@inheritdoc}

Details

__construct(PDOStatement $stmt)

Parameters

PDOStatement $stmt

bool setFetchMode(int $fetchMode, mixed[] ...$args)

Sets the fetch mode to use while iterating this statement.

Parameters

int $fetchMode Controls how the next row will be returned to the caller. The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants.
mixed[] ...$args Optional mode-specific arguments (see {@link self::fetchAll()}).

Return Value

bool

bool bindValue(mixed $param, mixed $value, int $type = ParameterType::STRING)

Binds a value to a corresponding named (not supported by mysqli driver, see comment below) or positional placeholder in the SQL statement that was used to prepare the statement.

As mentioned above, the named parameters are not natively supported by the mysqli driver, use executeQuery(), fetchAll(), fetchArray(), fetchColumn(), fetchAssoc() methods to have the named parameter emulated by doctrine.

Parameters

mixed $param Parameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the 1-indexed position of the parameter.
mixed $value The value to bind to the parameter.
int $type Explicit data type for the parameter using the {@link \Doctrine\DBAL\ParameterType} constants.

Return Value

bool TRUE on success or FALSE on failure.

bool bindParam(mixed $column, mixed $variable, int|null $type = ParameterType::STRING, int|null $length = null, $driverOptions = null)

Binds a PHP variable to a corresponding named (not supported by mysqli driver, see comment below) or question mark placeholder in the SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(), the variable is bound as a reference and will only be evaluated at the time that PDOStatement->execute() is called.

As mentioned above, the named parameters are not natively supported by the mysqli driver, use executeQuery(), fetchAll(), fetchArray(), fetchColumn(), fetchAssoc() methods to have the named parameter emulated by doctrine.

Most parameters are input parameters, that is, parameters that are used in a read-only fashion to build up the query. Some drivers support the invocation of stored procedures that return data as output parameters, and some also as input/output parameters that both send in data and are updated to receive it.

Parameters

mixed $column Parameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the 1-indexed position of the parameter.
mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
int|null $type Explicit data type for the parameter using the {@link \Doctrine\DBAL\ParameterType} constants.
int|null $length You must specify maxlength when using an OUT bind so that PHP allocates enough memory to hold the returned value.
$driverOptions

Return Value

bool TRUE on success or FALSE on failure.

bool closeCursor()

Closes the cursor, enabling the statement to be executed again.

Return Value

bool TRUE on success or FALSE on failure.

int columnCount()

Returns the number of columns in the result set

Return Value

int The number of columns in the result set represented by the PDOStatement object. If there is no result set, this method should return 0.

string|int|bool errorCode()

Fetches the SQLSTATE associated with the last operation on the statement handle.

Return Value

string|int|bool The error code string.

array errorInfo()

Fetches extended error information associated with the last operation on the statement handle.

Return Value

array The error info array.

bool execute(array|null $params = null)

Executes a prepared statement

If the prepared statement included parameter markers, you must either: call PDOStatement->bindParam() to bind PHP variables to the parameter markers: bound variables pass their value as input and receive the output value, if any, of their associated parameter markers or pass an array of input-only parameter values.

Parameters

array|null $params An array of values with as many elements as there are bound parameters in the SQL statement being executed.

Return Value

bool TRUE on success or FALSE on failure.

int rowCount()

Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding object.

If the last SQL statement executed by the associated Statement object was a SELECT statement, some databases may return the number of rows returned by that statement. However, this behaviour is not guaranteed for all databases and should not be relied on for portable applications.

Return Value

int The number of rows.

mixed fetch(int|null $fetchMode = null, mixed[] ...$args)

Returns the next row of a result set.

Parameters

int|null $fetchMode Controls how the next row will be returned to the caller. The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants, defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
mixed[] ...$args Optional mode-specific arguments (see {@link self::fetchAll()}).

Return Value

mixed The return value of this method on success depends on the fetch mode. In all cases, FALSE is returned on failure.

array fetchAll(int|null $fetchMode = null, mixed[] ...$args)

Returns an array containing all of the result set rows.

Parameters

int|null $fetchMode Controls how the next row will be returned to the caller. The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants, defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
mixed[] ...$args Optional mode-specific arguments. Supported modes: * {@link \Doctrine\DBAL\FetchMode::COLUMN} 1. The 0-indexed column to be returned. * {@link \Doctrine\DBAL\FetchMode::CUSTOM_OBJECT} 1. The classname of the object to be created, 2. Array of constructor arguments

Return Value

array

string|boolean fetchColumn(int $columnIndex = 0)

Returns a single column from the next row of a result set or FALSE if there are no more rows.

Parameters

int $columnIndex 0-indexed number of the column you wish to retrieve from the row. If no value is supplied, PDOStatement->fetchColumn() fetches the first column.

Return Value

string|boolean A single column in the next row of a result set, or FALSE if there are no more rows.

getIterator()

{@inheritdoc}