Class MySQLSelectQueryResult

Description

Implements interfaces:

The MySQLSelectQueryResult interface provides the functionality common to a MySQL SELECT query result.

For example, you can fetch associative arrays, advance the current row position, etc.

  • version: $Id: MySQLSelectQueryResult.class.php,v 1.13 2007/09/11 17:34:38 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/DBHandler/MySQL/MySQLSelectQueryResult.class.php (line 25)


	
			
Variable Summary
array $_boundVars
mixed $_currentRow
mixed $_linkId
integer $_resourceId
Method Summary
object MySQLSelectQueryResult MySQLSelectQueryResult (integer $resourceId, integer $linkId)
boolean advanceRow ()
void bindField (string $field, ref $var)
mixed field (mixed $field)
void free ()
array getCurrentRow ([optional $arrayType = BOTH])
array getFieldNames ()
integer getNumberOfFields ()
integer getNumberOfRows ()
integer getResourceId ()
boolean hasMoreRows ()
boolean hasNext ()
boolean moveToRow (integer $rowNumber)
array next (optional 0)
void unbindField (string $field)
Variables
array $_boundVars (line 68)

This is an array consisting of all bound variables.

  • var: _boundVars
  • access: private
mixed $_currentRow (line 43)

An array storing three arrays (associative, numeric, and both) for the current row in the result.

integer $_currentRowIndex (line 36)

The index of the current row in the result.

The index of the current row in the result. The first row has an index of 0. The last row has an index of getNumberOfRows() - 1.

  • var: The index of the current row in the result.
mixed $_linkId (line 60)

The link identifier for the database connection.

The link identifier for the database connection.

  • access: private
integer $_resourceId (line 51)

The resource id for this SELECT query.

The resource id for this SELECT query.

  • var: The resource id for this SELECT query.
  • access: private
Methods
Constructor MySQLSelectQueryResult (line 79)

Creates a new MySQLSelectQueryResult object.

Creates a new MySQLSelectQueryResult object.

  • return: A new MySQLSelectQueryResult object.
  • access: public
object MySQLSelectQueryResult MySQLSelectQueryResult (integer $resourceId, integer $linkId)
  • integer $resourceId: The resource id for this SELECT query.
  • integer $linkId: The link identifier for the database connection.
advanceRow (line 152)

Advances the current row position.

Advances the current row position. If there are no more rows left, then it returns

  1. false
.

  • return: True, if successful; False, otherwise.
  • access: public
boolean advanceRow ()
bindField (line 313)

Binds the field specified by the first argument to the variable given as

the second argument. The method stores a reference to the variable represented by the second argument; whenever a new row is fetched, the value of the field in the new row will be updated in the referenced variable. This enables the user to avoid unnecessary calls to

  1. getCurrentRow()
or
  1. field()
.

  • access: public
void bindField (string $field, ref $var)
  • string $field: field The field to bind. This could be either a string value that would correspond to the field as returned by
    1. getFieldNames()
    , or an integer (less than
    1. getNumberOfFields()
    ) corresponding to the index of the field.
  • ref $var: mixed var The variable to be bound to the value of the field in the current row.
field (line 200)

Returns the specified field value in the current row.

Returns the specified field value in the current row.

  • return: The value that was requested.
  • access: public
mixed field (mixed $field)
  • mixed $field: The name or index of the field, whose value will be returned.
free (line 352)

Frees the memory for this result.

  • access: public
void free ()
getCurrentRow (line 242)

Returns an array that stores the current row in the result. The data can be accessed through associative indices as well as numeric indices.

  • return: An associative array of the current row.
  • access: public
array getCurrentRow ([optional $arrayType = BOTH])
  • optional $arrayType: integer arrayType Specifies what type of an array to return. Allowed values are: ASSOC, NUMERIC, and BOTH.
getFieldNames (line 229)

Returns an indexed array of all field names that were selected.

Returns an indexed array of all field names that were selected.

  • return: An array of all field names that were selected.
  • access: public
array getFieldNames ()
getNumberOfFields (line 218)

Get the number of fields that were selected by the SELECT query.

Get the number of fields that were selected by the SELECT query.

  • return: The number of fields.
  • access: public
integer getNumberOfFields ()
getNumberOfRows (line 263)

Returns the number of rows that the query processed.

Returns the number of rows that the query processed. For a SELECT query, this would be the total number of rows selected. For a DELETE, UPDATE, or INSERT query, this would be the number of rows that were affected.

  • return: Number of rows that were processed by the query.
integer getNumberOfRows ()
getResourceId (line 115)

Returns the resource id for this SELECT query.

Returns the resource id for this SELECT query. The resource id is returned by the mysql_query() function.

  • return: The resource id for this SELECT query.
  • access: public
integer getResourceId ()
hasMoreRows (line 188)

Indicates if there are any remaining rows returned by the SELECT query.

Indicates if there are any remaining rows returned by the SELECT query. The current row does count as well.

  • return: True, if there are some rows left; False, otherwise.
  • access: public
boolean hasMoreRows ()
hasNext (line 126)

Indicates if there are any remaining rows returned by the SELECT query.

Indicates if there are any remaining rows returned by the SELECT query including the current row.

  • return: True, if there are some rows left; False, otherwise.
  • access: public
boolean hasNext ()
moveToRow (line 276)

Moves the internal row pointer to the specified position. The range of possible values is

  1. 0 - (getNumberOfRows()-1)
.

  • return:
    1. true
    , if operation was successful;
    1. false
    , otherwise.
  • access: public
boolean moveToRow (integer $rowNumber)
  • integer $rowNumber: rowNumber The number of the row to move to.
next (line 139)

Returns an array that stores the current row in the result and advances to the next row. The data can be accessed through associative indices as well as numeric indices.

  • return: An associative array of the current row.
  • access: public
array next (optional 0)
  • optional 0: integer arrayType Specifies what type of an array to return. Allowed values are: ASSOC, NUMERIC, and BOTH.
unbindField (line 335)

Unbinds the field that has been bound by

  1. bindField()
.

  • access: public
void unbindField (string $field)
  • string $field: field The field to unbind. This could be either a string value that would correspond to the field as returned by
    1. getFieldNames()
    , or an integer (less than
    1. getNumberOfFields()
    ) corresponding to the index of the field.

Documentation generated on Wed, 19 Sep 2007 10:25:12 -0400 by phpDocumentor 1.3.0RC3