interface Statement (View source)

Statement interface.

Drivers must implement this interface.

This resembles (a subset of) the PDOStatement interface.

Methods

boolean
bindValue(mixed $param, mixed $value, integer $type = null)

Binds a value to a corresponding named or positional placeholder in the SQL statement that was used to prepare the statement.

boolean
bindParam($column, $variable, $type = null)

Binds a PHP variable to a corresponding named 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.

boolean
closeCursor()

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

integer
columnCount()

columnCount Returns the number of columns in the result set

string
errorCode()

errorCode Fetch the SQLSTATE associated with the last operation on the statement handle

array
errorInfo()

errorInfo Fetch extended error information associated with the last operation on the statement handle

boolean
execute(array $params = null)

Executes a prepared statement

mixed
fetch($fetchStyle = PDO::FETCH_BOTH)

fetch

array
fetchAll($fetchStyle = PDO::FETCH_BOTH)

Returns an array containing all of the result set rows

string
fetchColumn(integer $columnIndex = 0)

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

integer
rowCount()

rowCount rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding object.

Details

boolean bindValue(mixed $param, mixed $value, integer $type = null)

Binds a value to a corresponding named or positional placeholder in the SQL statement that was used to prepare the statement.

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.
integer $type Explicit data type for the parameter using the PDO::PARAM_* constants.

Return Value

boolean Returns TRUE on success or FALSE on failure.

boolean bindParam($column, $variable, $type = null)

Binds a PHP variable to a corresponding named 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.

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

$column
$variable
$type

Return Value

boolean Returns TRUE on success or FALSE on failure.

boolean closeCursor()

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

Return Value

boolean Returns TRUE on success or FALSE on failure.

integer columnCount()

columnCount Returns the number of columns in the result set

Return Value

integer Returns 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 errorCode()

errorCode Fetch the SQLSTATE associated with the last operation on the statement handle

Return Value

string error code string

See also

Doctrine_Adapter_Interface::errorCode()

array errorInfo()

errorInfo Fetch extended error information associated with the last operation on the statement handle

Return Value

array error info array

See also

Doctrine_Adapter_Interface::errorInfo()

boolean execute(array $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 $params An array of values with as many elements as there are bound parameters in the SQL statement being executed.

Return Value

boolean Returns TRUE on success or FALSE on failure.

mixed fetch($fetchStyle = PDO::FETCH_BOTH)

fetch

Parameters

$fetchStyle

Return Value

mixed

See also

Query::HYDRATE_* constants

array fetchAll($fetchStyle = PDO::FETCH_BOTH)

Returns an array containing all of the result set rows

Parameters

$fetchStyle

Return Value

array

string fetchColumn(integer $columnIndex = 0)

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

Parameters

integer $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 returns a single column in the next row of a result set.

integer rowCount()

rowCount 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

integer Returns the number of rows.