Class PostgreSQLSelectQueryResult

Description

Implements interfaces:

The PostgreSQLSelectQueryResult interface provides the functionality common to a PostgreSQL SELECT query result.

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

  • version: $Id: PostgreSQLSelectQueryResult.class.php,v 1.1 2007/09/14 13:57:08 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/DBHandler/PostgreSQL/PostgreSQLSelectQueryResult.class.php (line 24)


	
			
Variable Summary
mixed $_currentRow
mixed $_linkId
integer $_resourceId
Method Summary
object PostgreSQLSelectQueryResult PostgreSQLSelectQueryResult (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
mixed $_currentRow (line 42)

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

integer $_currentRowIndex (line 35)

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 59)

The link identifier for the database connection.

The link identifier for the database connection.

  • access: private
integer $_resourceId (line 50)

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 PostgreSQLSelectQueryResult (line 70)

Creates a new PostgreSQLSelectQueryResult object.

Creates a new PostgreSQLSelectQueryResult object.

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

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 298)

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 182)

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 319)

Frees the memory for this result.

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

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 216)

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 205)

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 250)

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 105)

Returns the resource id for this SELECT query.

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

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

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 116)

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 263)

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 129)

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 310)

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:34 -0400 by phpDocumentor 1.3.0RC3