Zend Framework  1.12
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zend_Db_Statement Class Reference

Public Member Functions

 __construct ($adapter, $sql)
 Constructor for a statement.
 
 bindColumn ($column, &$param, $type=null)
 Bind a column of the statement result set to a PHP variable.
 
 bindParam ($parameter, &$variable, $type=null, $length=null, $options=null)
 Binds a parameter to the specified variable name.
 
 bindValue ($parameter, $value, $type=null)
 Binds a value to a parameter.
 
 execute (array $params=null)
 Executes a prepared statement.
 
 fetchAll ($style=null, $col=null)
 Returns an array containing all of the result set rows.
 
 fetchColumn ($col=0)
 Returns a single column from the next row of a result set.
 
 fetchObject ($class= 'stdClass', array $config=array())
 Fetches the next row and returns it as an object.
 
 getAttribute ($key)
 Retrieve a statement attribute.
 
 setAttribute ($key, $val)
 Set a statement attribute.
 
 setFetchMode ($mode)
 Set the default fetch mode for this statement.
 
 _fetchBound ($row)
 Helper function to map retrieved row to bound column variables.
 
 getAdapter ()
 Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Statement object.
 
 getDriverStatement ()
 Gets the resource or object setup by the _parse.
 
- Public Member Functions inherited from Zend_Db_Statement_Interface
 closeCursor ()
 Closes the cursor, allowing the statement to be executed again.
 
 columnCount ()
 Returns the number of columns in the result set.
 
 errorCode ()
 Retrieves the error code, if any, associated with the last operation on the statement handle.
 
 errorInfo ()
 Retrieves an array of error information, if any, associated with the last operation on the statement handle.
 
 fetch ($style=null, $cursor=null, $offset=null)
 Fetches a row from the result set.
 
 nextRowset ()
 Retrieves the next rowset (result set) for a SQL statement that has multiple result sets.
 
 rowCount ()
 Returns the number of rows affected by the execution of the last INSERT, DELETE, or UPDATE statement executed by this statement object.
 

Protected Member Functions

 _prepare ($sql)
 Internal method called by abstract statment constructor to setup the driver level statement.
 
 _parseParameters ($sql)
 
 _stripQuoted ($sql)
 Remove parts of a SQL string that contain quoted strings of values or identifiers.
 

Protected Attributes

 $_stmt = null
 
 $_adapter = null
 
 $_fetchMode = Zend_Db::FETCH_ASSOC
 
 $_attribute = array()
 
 $_bindColumn = array()
 
 $_bindParam = array()
 
 $_sqlSplit = array()
 
 $_sqlParam = array()
 
 $_queryId = null
 

Constructor & Destructor Documentation

__construct (   $adapter,
  $sql 
)

Constructor for a statement.

Parameters
Zend_Db_Adapter_Abstract$adapter
mixed$sqlEither a string or Zend_Db_Select.

Member Function Documentation

_fetchBound (   $row)

Helper function to map retrieved row to bound column variables.

Parameters
array$row
Returns
bool True
_parseParameters (   $sql)
protected
Parameters
string$sql
Returns
void
See Also
Zend_Db_Statement_Exception
Zend_Db_Statement_Exception
_prepare (   $sql)
protected

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

Returns
void
_stripQuoted (   $sql)
protected

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

Parameters
string$sql
Returns
string
bindColumn (   $column,
$param,
  $type = null 
)

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

Parameters
string$columnName the column in the result set, either by position or by name.
mixed$paramReference to the PHP variable containing the value.
mixed$typeOPTIONAL
Returns
bool

Implements Zend_Db_Statement_Interface.

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

Binds a parameter to the specified variable name.

Parameters
mixed$parameterName the parameter, either integer or string.
mixed$variableReference to PHP variable containing the value.
mixed$typeOPTIONAL Datatype of SQL parameter.
mixed$lengthOPTIONAL Length of SQL parameter.
mixed$optionsOPTIONAL Other options.
Returns
bool
See Also
Zend_Db_Statement_Exception
Zend_Db_Statement_Exception

Implements Zend_Db_Statement_Interface.

bindValue (   $parameter,
  $value,
  $type = null 
)

Binds a value to a parameter.

Parameters
mixed$parameterName the parameter, either integer or string.
mixed$valueScalar value to bind to the parameter.
mixed$typeOPTIONAL Datatype of the parameter.
Returns
bool

Implements Zend_Db_Statement_Interface.

execute ( array  $params = null)

Executes a prepared statement.

Parameters
array$paramsOPTIONAL Values to bind to parameter placeholders.
Returns
bool

Implements Zend_Db_Statement_Interface.

fetchAll (   $style = null,
  $col = null 
)

Returns an array containing all of the result set rows.

Parameters
int$styleOPTIONAL Fetch mode.
int$colOPTIONAL Column number, if fetch mode is by column.
Returns
array Collection of rows, each in a format by the fetch mode.

Implements Zend_Db_Statement_Interface.

fetchColumn (   $col = 0)

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

Parameters
int$colOPTIONAL Position of the column to fetch.
Returns
string One value from the next row of result set, or false.

Implements Zend_Db_Statement_Interface.

fetchObject (   $class = 'stdClass',
array  $config = array() 
)

Fetches the next row and returns it as an object.

Parameters
string$classOPTIONAL Name of the class to create.
array$configOPTIONAL Constructor arguments for the class.
Returns
mixed One object instance of the specified class, or false.

Implements Zend_Db_Statement_Interface.

getAdapter ( )

Gets the Zend_Db_Adapter_Abstract for this particular Zend_Db_Statement object.

Returns
Zend_Db_Adapter_Abstract
getAttribute (   $key)

Retrieve a statement attribute.

Parameters
string$keyAttribute name.
Returns
mixed Attribute value.

Implements Zend_Db_Statement_Interface.

getDriverStatement ( )

Gets the resource or object setup by the _parse.

Returns
unknown_type
setAttribute (   $key,
  $val 
)

Set a statement attribute.

Parameters
string$keyAttribute name.
mixed$valAttribute value.
Returns
bool

Implements Zend_Db_Statement_Interface.

setFetchMode (   $mode)

Set the default fetch mode for this statement.

Parameters
int$modeThe fetch mode.
Returns
bool
Exceptions
Zend_Db_Statement_Exception
See Also
Zend_Db_Statement_Exception

Implements Zend_Db_Statement_Interface.

Member Data Documentation

$_adapter = null
protected
$_attribute = array()
protected
$_bindColumn = array()
protected
$_bindParam = array()
protected
$_fetchMode = Zend_Db::FETCH_ASSOC
protected
$_queryId = null
protected
$_sqlParam = array()
protected
$_sqlSplit = array()
protected
$_stmt = null
protected