Emulates a PDOStatement for native database adapters.

category Zend
package Zend_Db
subpackage Statement
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Bind a column of the statement result set to a PHP variable.

bindColumn(string $column, mixed $param, mixed $type = null) : boolean

Parameters

$column

string

Name the column in the result set, either by position or by name.

$param

mixed

Reference to the PHP variable containing the value.

$type

mixed

OPTIONAL

Exceptions

\Zend_Db_Statement_Exception

Returns

boolean

Binds a parameter to the specified variable name.

bindParam(mixed $parameter, mixed $variable, mixed $type = null, mixed $length = null, mixed $options = null) : boolean

Parameters

$parameter

mixed

Name the parameter, either integer or string.

$variable

mixed

Reference to PHP variable containing the value.

$type

mixed

OPTIONAL Datatype of SQL parameter.

$length

mixed

OPTIONAL Length of SQL parameter.

$options

mixed

OPTIONAL Other options.

Exceptions

\Zend_Db_Statement_Exception

Returns

boolean

Binds a value to a parameter.

bindValue(mixed $parameter, mixed $value, mixed $type = null) : boolean

Parameters

$parameter

mixed

Name the parameter, either integer or string.

$value

mixed

Scalar value to bind to the parameter.

$type

mixed

OPTIONAL Datatype of the parameter.

Exceptions

\Zend_Db_Statement_Exception

Returns

boolean

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

closeCursor() : boolean

Exceptions

\Zend_Db_Statement_Exception

Returns

boolean

Returns the number of columns in the result set.

columnCount() : integer

Returns null if the statement has no result set metadata.

Exceptions

\Zend_Db_Statement_Exception

Returns

integerThe number of columns.

Retrieves the error code, if any, associated with the last operation on the statement handle.

errorCode() : string

Exceptions

\Zend_Db_Statement_Exception

Returns

stringerror code.

Retrieves an array of error information, if any, associated with the last operation on the statement handle.

errorInfo() : array

Exceptions

\Zend_Db_Statement_Exception

Returns

array

Executes a prepared statement.

execute(array $params = array()) : boolean

Parameters

$params

array

OPTIONAL Values to bind to parameter placeholders.

Exceptions

\Zend_Db_Statement_Exception

Returns

boolean

Fetches a row from the result set.

fetch(integer $style = null, integer $cursor = null, integer $offset = null) : mixed

Parameters

$style

integer

OPTIONAL Fetch mode for this fetch operation.

$cursor

integer

OPTIONAL Absolute, relative, or other.

$offset

integer

OPTIONAL Number for absolute or relative cursors.

Exceptions

\Zend_Db_Statement_Exception

Returns

mixedArray, object, or scalar depending on fetch mode.

Returns an array containing all of the result set rows.

fetchAll(integer $style = null, integer $col = null) : array

Parameters

$style

integer

OPTIONAL Fetch mode.

$col

integer

OPTIONAL Column number, if fetch mode is by column.

Exceptions

\Zend_Db_Statement_Exception

Returns

arrayCollection of rows, each in a format by the fetch mode.

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

fetchColumn(integer $col = 0) : string

Parameters

$col

integer

OPTIONAL Position of the column to fetch.

Exceptions

\Zend_Db_Statement_Exception

Returns

string

Fetches the next row and returns it as an object.

fetchObject(string $class = 'stdClass', array $config = array()) : mixed

Parameters

$class

string

OPTIONAL Name of the class to create.

$config

array

OPTIONAL Constructor arguments for the class.

Exceptions

\Zend_Db_Statement_Exception

Returns

mixedOne object instance of the specified class.

Retrieve a statement attribute.

getAttribute(string $key) : mixed

Parameters

$key

string

Attribute name.

Exceptions

\Zend_Db_Statement_Exception

Returns

mixedAttribute value.

Retrieves the next rowset (result set) for a SQL statement that has multiple result sets. An example is a stored procedure that returns the results of multiple queries.

nextRowset() : boolean

Exceptions

\Zend_Db_Statement_Exception

Returns

boolean

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

rowCount() : integer

Exceptions

\Zend_Db_Statement_Exception

Returns

integerThe number of rows affected.

Set a statement attribute.

setAttribute(string $key, mixed $val) : boolean

Parameters

$key

string

Attribute name.

$val

mixed

Attribute value.

Exceptions

\Zend_Db_Statement_Exception

Returns

boolean

Set the default fetch mode for this statement.

setFetchMode(integer $mode) : boolean

Parameters

$mode

integer

The fetch mode.

Exceptions

\Zend_Db_Statement_Exception

Returns

boolean