Propel 2 API
Class

Propel\Runtime\Connection\StatementWrapper

class StatementWrapper implements StatementInterface, IteratorAggregate

Wraps a Statement class, providing logging.

Methods

__construct(string $sql, ConnectionWrapper $connection, array $options = array())

Creates a Statement instance

boolean bindParam(integer $pos, mixed $value, integer $type = \PDO::PARAM_STR, integer $length, mixed $driver_options = null)

Binds a PHP variable to a corresponding named or question mark placeholder in the SQL statement that was use to prepare the statement.

boolean bindValue(integer $pos, mixed $value, integer $type = \PDO::PARAM_STR)

Binds a value to a corresponding named or question mark placeholder in the SQL statement that was use to prepare the statement.

boolean closeCursor()

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

integer columnCount()

Returns the number of columns in the result set.

boolean execute(string $parameters = null)

Executes a prepared statement.

string getExecutedQueryString()

mixed fetch(integer $fetchStyle = 4)

Fetches the next row from a result set.

array fetchAll(integer $fetchStyle = 4)

Returns an array containing all of the result set rows.

string fetchColumn(integer $columnIndex)

Returns a single column from the next row of a result set.

integer rowCount()

Returns the number of rows affected by the last SQL statement

Traversable getIterator()

Return the internal statement, which is traversable

__call($method, $args)

Details

at line 61
public __construct(string $sql, ConnectionWrapper $connection, array $options = array())

Creates a Statement instance

Parameters

string $sql The SQL query for this statement
ConnectionWrapper $connection The parent connection
array $options Optional driver options

at line 81
public boolean bindParam(integer $pos, mixed $value, integer $type = \PDO::PARAM_STR, integer $length, mixed $driver_options = 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.
Returns a boolean value indicating success.

Parameters

integer $pos Parameter identifier (for determining what to replace in the query).
mixed $value The value to bind to the parameter.
integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. Defaults to PDO::PARAM_STR.
integer $length Length of the data type. To indicate that a parameter is an OUT parameter from a stored procedure, you must explicitly set the length.
mixed $driver_options

Return Value

boolean Returns TRUE on success or FALSE on failure.

at line 105
public boolean bindValue(integer $pos, mixed $value, integer $type = \PDO::PARAM_STR)

Binds a value to a corresponding named or question mark placeholder in the SQL statement that was use to prepare the statement.

Returns a boolean value indicating success.

Parameters

integer $pos Parameter identifier (for determining what to replace in the query).
mixed $value The value to bind to the parameter.
integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. Defaults to PDO::PARAM_STR.

Return Value

boolean Returns TRUE on success or FALSE on failure.

at line 133
public boolean closeCursor()

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

closeCursor() frees up the connection to the server so that other SQL
statements may be issued, but leaves the statement in a state that enables
it to be executed again.

This method is useful for database drivers that do not support executing
a PDOStatement object when a previously executed PDOStatement object still
has unfetched rows. If your database driver suffers from this limitation,
the problem may manifest itself in an out-of-sequence error.

Return Value

boolean Returns TRUE on success or FALSE on failure.

at line 155
public integer columnCount()

Returns the number of columns in the result set.

Use columnCount() to return the number of columns in the result set
represented by the Statement object.

If the Statement object was returned from PDO::query(), the column count
is immediately available.

If the Statement object was returned from PDO::prepare(), an accurate
column count will not be available until you invoke Statement::execute().
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.

at line 169
public boolean execute(string $parameters = null)

Executes a prepared statement.

Returns a boolean value indicating success.
Overridden for query counting and logging.

Parameters

string $parameters

Return Value

boolean Returns TRUE on success or FALSE on failure.

at line 185
public string getExecutedQueryString()

Return Value

string

at line 210
public mixed fetch(integer $fetchStyle = 4)

Fetches the next row from a result set.

Fetches a row from a result set associated with a Statement object.
The fetch_style parameter determines how the Connection returns the row.

Parameters

integer $fetchStyle Controls how the next row will be returned to the caller.

Return Value

mixed

at line 222
public array fetchAll(integer $fetchStyle = 4)

Returns an array containing all of the result set rows.

Parameters

integer $fetchStyle Controls the contents of the returned array as documented in fetch()

Return Value

array

at line 236
public string fetchColumn(integer $columnIndex)

Returns a single column from the next row of a result set.

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

at line 254
public integer rowCount()

Returns the number of rows affected by the last SQL statement

rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
executed by the corresponding Statement 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 The number of rows.

at line 264
public Traversable getIterator()

Return the internal statement, which is traversable

Return Value

Traversable

at line 269
public __call($method, $args)

Parameters

$method
$args