Testing Database Statement that acts as a stack to SQL resultsets.

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

 Methods

Append a new row to the fetch stack.

append(array $row) 

Parameters

$row

array

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

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

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
inherited_from \Zend_Db_Statement_Interface::bindParam()

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
inherited_from \Zend_Db_Statement_Interface::bindValue()

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
inherited_from \Zend_Db_Statement_Interface::closeCursor()

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.

inherited_from \Zend_Db_Statement_Interface::columnCount()

Exceptions

\Zend_Db_Statement_Exception

Returns

integerThe number of columns.

Create an Delete Statement

createDeleteStatement(integer $affectedRows = 0) : \Zend_Test_DbStatement
Static

Parameters

$affectedRows

integer

Returns

\Zend_Test_DbStatement

Create an Insert Statement

createInsertStatement(integer $affectedRows = 0) : \Zend_Test_DbStatement
Static

Parameters

$affectedRows

integer

Returns

\Zend_Test_DbStatement

Create a Select statement which returns the given array of rows.

createSelectStatement(array $rows = array()) : \Zend_Test_DbStatement
Static

Parameters

$rows

array

Returns

\Zend_Test_DbStatement

Create an Update Statement

createUpdateStatement(integer $affectedRows = 0) : \Zend_Test_DbStatement
Static

Parameters

$affectedRows

integer

Returns

\Zend_Test_DbStatement

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

errorCode() : string
inherited_from \Zend_Db_Statement_Interface::errorCode()

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
inherited_from \Zend_Db_Statement_Interface::errorInfo()

Exceptions

\Zend_Db_Statement_Exception

Returns

array

Executes a prepared statement.

execute(array $params = array()) : boolean
inherited_from \Zend_Db_Statement_Interface::execute()

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
inherited_from \Zend_Db_Statement_Interface::fetch()

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
inherited_from \Zend_Db_Statement_Interface::fetchAll()

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
inherited_from \Zend_Db_Statement_Interface::fetchColumn()

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
inherited_from \Zend_Db_Statement_Interface::fetchObject()

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
inherited_from \Zend_Db_Statement_Interface::getAttribute()

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
inherited_from \Zend_Db_Statement_Interface::nextRowset()

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
inherited_from \Zend_Db_Statement_Interface::rowCount()

Exceptions

\Zend_Db_Statement_Exception

Returns

integerThe number of rows affected.

Set a statement attribute.

setAttribute(string $key, mixed $val) : boolean
inherited_from \Zend_Db_Statement_Interface::setAttribute()

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
inherited_from \Zend_Db_Statement_Interface::setFetchMode()

Parameters

$mode

integer

The fetch mode.

Exceptions

\Zend_Db_Statement_Exception

Returns

boolean

setQueryProfile()

setQueryProfile(\Zend_Db_Profiler_Query $qp) 

Parameters

$qp

\Zend_Db_Profiler_Query

setRowCount()

setRowCount(integer $rowCount) 

Parameters

$rowCount

integer

Create a Row Count Statement

_createRowCountStatement(integer $affectedRows) : \Zend_Test_DbStatement
Static

Parameters

$affectedRows

integer

Returns

\Zend_Test_DbStatement

 Properties

 

$_columnCount

$_columnCount : integer

Default

0
 

$_fetchStack

$_fetchStack : array

Default

array()
 

$_queryProfile

$_queryProfile : \Zend_Db_Profiler_Query

Default

null
 

$_rowCount

$_rowCount : integer

Default

0