Db/Statement.php

Show: PublicProtectedPrivateinherited
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_Db  
Subpackage
Statement  
Version
$Id: Statement.php 24790 2012-05-10 12:28:51Z mcleod@spaceweb.nl $  

\Zend_Db_Statement

Package: Zend\Db\Statement
Abstract class to emulate a PDOStatement for native database adapters.
Implements
\Zend_Db_Statement_Interface
Children
\Zend_Db_Statement_Oracle
\Zend_Db_Statement_Mysqli
\Zend_Db_Statement_Pdo
\Zend_Db_Statement_Sqlsrv
\Zend_Db_Statement_Db2
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotected\Zend_Db_Adapter_Abstract $_adapter = null
Default valuenullDetails
Type
\Zend_Db_Adapter_Abstract
>VPropertyprotectedarray $_attribute = array()
Attributes.
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_bindColumn = array()
Column result bindings.
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_bindParam = array()
Query parameter bindings; covers bindParam() and bindValue().
Default valuearray()Details
Type
array
>VPropertyprotectedinteger $_fetchMode = \Zend_Db::FETCH_ASSOC
The current fetch mode.
Default value\Zend_Db::FETCH_ASSOCDetails
Type
integer
>VPropertyprotected\Zend_Db_Profiler_Query $_queryId = null
Default valuenullDetails
Type
\Zend_Db_Profiler_Query
>VPropertyprotectedarray $_sqlParam = array()
Parameter placeholders in the SQL string by position in the split array.
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_sqlSplit = array()
SQL string split into an array at placeholders.
Default valuearray()Details
Type
array
>VPropertyprotectedresource|object $_stmt = null

The driver level statement object/resource

Default valuenullDetails
Type
resource | object

Methods

methodpublic__construct(\Zend_Db_Adapter_Abstract $adapter, mixed $sql) : void

Constructor for a statement.

Parameters
NameTypeDescription
$adapter\Zend_Db_Adapter_Abstract
$sqlmixed

Either a string or Zend_Db_Select.

methodpublic_fetchBound(array $row) : bool

Helper function to map retrieved row to bound column variables

Parameters
NameTypeDescription
$rowarray
Returns
TypeDescription
boolTrue
methodprotected_parseParameters(string $sql) : void

Parameters
NameTypeDescription
$sqlstring
methodprotected_prepare( $sql) : void

Internal method called by abstract statment constructor to setup the driver level statement

Parameters
NameTypeDescription
$sql
methodprotected_stripQuoted(string $sql) : string

Remove parts of a SQL string that contain quoted strings of values or identifiers.

Parameters
NameTypeDescription
$sqlstring
Returns
TypeDescription
string
methodpublicbindColumn(string $column, mixed $param, mixed $type = null) : bool

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

Parameters
NameTypeDescription
$columnstring

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

$parammixed

Reference to the PHP variable containing the value.

$typemixed

OPTIONAL

Returns
TypeDescription
bool
Throws
ExceptionDescription
\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
NameTypeDescription
$parametermixed

Name the parameter, either integer or string.

$variablemixed

Reference to PHP variable containing the value.

$typemixed

OPTIONAL Datatype of SQL parameter.

$lengthmixed

OPTIONAL Length of SQL parameter.

$optionsmixed

OPTIONAL Other options.

Returns
TypeDescription
bool
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicbindValue(mixed $parameter, mixed $value, mixed $type = null) : bool

Binds a value to a parameter.

Parameters
NameTypeDescription
$parametermixed

Name the parameter, either integer or string.

$valuemixed

Scalar value to bind to the parameter.

$typemixed

OPTIONAL Datatype of the parameter.

Returns
TypeDescription
bool
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpubliccloseCursor() : bool
inherited

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

Inherited from: \Zend_Db_Statement_Interface::closeCursor()
Returns
TypeDescription
bool
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpubliccolumnCount() : int
inherited

Returns the number of columns in the result set.

Inherited from: \Zend_Db_Statement_Interface::columnCount()

Returns null if the statement has no result set metadata.

Returns
TypeDescription
intThe number of columns.
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicerrorCode() : string
inherited

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

Inherited from: \Zend_Db_Statement_Interface::errorCode()
Returns
TypeDescription
stringerror code.
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicerrorInfo() : array
inherited

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

Inherited from: \Zend_Db_Statement_Interface::errorInfo()
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicexecute(array $params = null) : bool

Executes a prepared statement.

Parameters
NameTypeDescription
$paramsarray

OPTIONAL Values to bind to parameter placeholders.

Returns
TypeDescription
bool
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicfetch(int $style = null, int $cursor = null, int $offset = null) : mixed
inherited

Fetches a row from the result set.

Inherited from: \Zend_Db_Statement_Interface::fetch()
Parameters
NameTypeDescription
$styleint

OPTIONAL Fetch mode for this fetch operation.

$cursorint

OPTIONAL Absolute, relative, or other.

$offsetint

OPTIONAL Number for absolute or relative cursors.

Returns
TypeDescription
mixedArray, object, or scalar depending on fetch mode.
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicfetchAll(int $style = null, int $col = null) : array

Returns an array containing all of the result set rows.

Parameters
NameTypeDescription
$styleint

OPTIONAL Fetch mode.

$colint

OPTIONAL Column number, if fetch mode is by column.

Returns
TypeDescription
arrayCollection of rows, each in a format by the fetch mode.
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicfetchColumn(int $col = 0) : string

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

Parameters
NameTypeDescription
$colint

OPTIONAL Position of the column to fetch.

Returns
TypeDescription
stringOne value from the next row of result set, or false.
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicfetchObject(string $class = 'stdClass', array $config = array()) : mixed

Fetches the next row and returns it as an object.

Parameters
NameTypeDescription
$classstring

OPTIONAL Name of the class to create.

$configarray

OPTIONAL Constructor arguments for the class.

Returns
TypeDescription
mixedOne object instance of the specified class, or false.
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicgetAdapter() : \Zend_Db_Adapter_Abstract

Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Statement object.

Returns
TypeDescription
\Zend_Db_Adapter_Abstract
methodpublicgetAttribute(string $key) : mixed

Retrieve a statement attribute.

Parameters
NameTypeDescription
$keystring

Attribute name.

Returns
TypeDescription
mixedAttribute value.
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicgetDriverStatement() : \unknown_type

Gets the resource or object setup by the _parse

Returns
TypeDescription
\unknown_type
methodpublicnextRowset() : bool
inherited

Retrieves the next rowset (result set) for a SQL statement that has multiple result sets.

Inherited from: \Zend_Db_Statement_Interface::nextRowset()

An example is a stored procedure that returns the results of multiple queries.

Returns
TypeDescription
bool
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicrowCount() : int
inherited

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

Inherited from: \Zend_Db_Statement_Interface::rowCount()
Returns
TypeDescription
intThe number of rows affected.
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicsetAttribute(string $key, mixed $val) : bool

Set a statement attribute.

Parameters
NameTypeDescription
$keystring

Attribute name.

$valmixed

Attribute value.

Returns
TypeDescription
bool
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
methodpublicsetFetchMode(int $mode) : bool

Set the default fetch mode for this statement.

Parameters
NameTypeDescription
$modeint

The fetch mode.

Returns
TypeDescription
bool
Throws
ExceptionDescription
\Zend_Db_Statement_Exception
Documentation was generated by phpDocumentor 2.0.0a12.