API Documentation

Zend/Test/DbStatement.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Test  
Subpackage
PHPUnit  
Version
$Id: DbStatement.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Test_DbStatement

Package: Zend\Test\PHPUnit

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

Implements
\Zend_Db_Statement_Interface
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotectedint  $_columnCount= '0'

Default value0Details
Type
int
Propertyprotectedarray  $_fetchStack= 'array()'

Default valuearray()Details
Type
array
Propertyprotected\Zend_Db_Profiler_Query  $_queryProfile= 'null'

Default valuenullDetails
Type
\Zend_Db_Profiler_Query
Propertyprotectedint  $_rowCount= '0'

Default value0Details
Type
int

Methods

methodprotected_createRowCountStatement( int $affectedRows ) : \Zend_Test_DbStatement
static

Create a Row Count Statement

Parameters
Name Type Description
$affectedRows int
Returns
Type Description
\Zend_Test_DbStatement
methodpublicappend( array $row ) : void

Append a new row to the fetch stack.

Parameters
Name Type Description
$row array
methodpublicbindColumn( string $column, mixed $param, mixed $type = null ) : bool

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

Parameters
Name Type Description
$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

Returns
Type Description
bool
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicbindParam( mixed $parameter, mixed $variable, mixed $type = null, mixed $length = null, mixed $options = null ) : bool

Binds a parameter to the specified variable name.

Parameters
Name Type Description
$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.

Returns
Type Description
bool
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicbindValue( mixed $parameter, mixed $value, mixed $type = null ) : bool

Binds a value to a parameter.

Parameters
Name Type Description
$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.

Returns
Type Description
bool
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpubliccloseCursor( ) : bool

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

Returns
Type Description
bool
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpubliccolumnCount( ) : int

Returns the number of columns in the result set.

Returns null if the statement has no result set metadata.

Returns
Type Description
int The number of columns.
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpubliccreateDeleteStatement( int $affectedRows = 0 ) : \Zend_Test_DbStatement
static

Create an Delete Statement

Parameters
Name Type Description
$affectedRows int
Returns
Type Description
\Zend_Test_DbStatement
methodpubliccreateInsertStatement( int $affectedRows = 0 ) : \Zend_Test_DbStatement
static

Create an Insert Statement

Parameters
Name Type Description
$affectedRows int
Returns
Type Description
\Zend_Test_DbStatement
methodpubliccreateSelectStatement( array $rows = array() ) : \Zend_Test_DbStatement
static

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

Parameters
Name Type Description
$rows array
Returns
Type Description
\Zend_Test_DbStatement
methodpubliccreateUpdateStatement( int $affectedRows = 0 ) : \Zend_Test_DbStatement
static

Create an Update Statement

Parameters
Name Type Description
$affectedRows int
Returns
Type Description
\Zend_Test_DbStatement
methodpublicerrorCode( ) : string

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

Returns
Type Description
string error code.
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicerrorInfo( ) : array

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

Returns
Type Description
array
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicexecute( array $params = array() ) : bool

Executes a prepared statement.

Parameters
Name Type Description
$params array

OPTIONAL Values to bind to parameter placeholders.

Returns
Type Description
bool
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicfetch( int $style = null, int $cursor = null, int $offset = null ) : mixed

Fetches a row from the result set.

Parameters
Name Type Description
$style int

OPTIONAL Fetch mode for this fetch operation.

$cursor int

OPTIONAL Absolute, relative, or other.

$offset int

OPTIONAL Number for absolute or relative cursors.

Returns
Type Description
mixed Array, object, or scalar depending on fetch mode.
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicfetchAll( int $style = null, int $col = null ) : array

Returns an array containing all of the result set rows.

Parameters
Name Type Description
$style int

OPTIONAL Fetch mode.

$col int

OPTIONAL Column number, if fetch mode is by column.

Returns
Type Description
array Collection of rows, each in a format by the fetch mode.
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicfetchColumn( int $col = 0 ) : string

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

Parameters
Name Type Description
$col int

OPTIONAL Position of the column to fetch.

Returns
Type Description
string
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicfetchObject( string $class = 'stdClass', array $config = array() ) : mixed

Fetches the next row and returns it as an object.

Parameters
Name Type Description
$class string

OPTIONAL Name of the class to create.

$config array

OPTIONAL Constructor arguments for the class.

Returns
Type Description
mixed One object instance of the specified class.
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicgetAttribute( string $key ) : mixed

Retrieve a statement attribute.

Parameters
Name Type Description
$key string

Attribute name.

Returns
Type Description
mixed Attribute value.
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicnextRowset( ) : bool

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.

Returns
Type Description
bool
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicrowCount( ) : int

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

Returns
Type Description
int The number of rows affected.
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicsetAttribute( string $key, mixed $val ) : bool

Set a statement attribute.

Parameters
Name Type Description
$key string

Attribute name.

$val mixed

Attribute value.

Returns
Type Description
bool
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicsetFetchMode( int $mode ) : bool

Set the default fetch mode for this statement.

Parameters
Name Type Description
$mode int

The fetch mode.

Returns
Type Description
bool
Throws
Exception Description
\Zend_Db_Statement_Exception
methodpublicsetQueryProfile( \Zend_Db_Profiler_Query $qp ) : void

Parameters
Name Type Description
$qp \Zend_Db_Profiler_Query
methodpublicsetRowCount( int $rowCount ) : void

Parameters
Name Type Description
$rowCount int
Documentation was generated by DocBlox 0.15.1.