AnewtDatabaseResultSet Class Reference

Database result set. More...

List of all members.

Public Member Functions

 __construct ($sql, $connection_handle, $result_set_handle)
 Construct a new AnewtDatabaseResultSet instance (internal use).
 free ()
 Free resources associated with this result set.
Row Fetching Methods
 fetch_one ()
 Return the next row.
 fetch_all ()
 Return all remaining rows.
 fetch_many ($how_many)
 Return up to the specified number of rows.
Row Counting Methods
 count ()
 Return the number of resulting rows in this result set.
 count_affected ()
 Returns the number of rows that where affected by the last executed query.

Protected Member Functions

Helper Methods
 obtain_field_types ()
 Deduce the data types in this result set.
 cast_row (&$row)
 Cast a row of data into native PHP data types.

Protected Attributes

 $sql
 The SQL query for this result set.
 $connection_handle
 The underlying database connection resource.
 $result_set_handle
 The underlying database result set resource.
 $n_rows
 The number of rows.
 $n_rows_affected
 The number of affected rows.
 $field_types
 The data types for the columns of this result set.


Detailed Description

Database result set.

Result sets can be used to fetch or count rows returned by a database query.

You cannot instantiate AnewtDatabaseResultSet instances directly, instances of this class will be returned when an AnewtDatabasePreparedQuery is executed using AnewtDatabasePreparedQuery::prepare().

Definition at line 20 of file result-set.lib.php.


Constructor & Destructor Documentation

AnewtDatabaseResultSet::__construct ( sql,
connection_handle,
result_set_handle 
)

Construct a new AnewtDatabaseResultSet instance (internal use).

Do not call this method directly; it is for internal use only.

(Note to backend implementors: you should override this constructor, call into the parent, and then store the n_rows and n_rows_affected values)

Parameters:
$sql The SQL query for this result set
$connection_handle The internal connection handle
$result_set_handle The internal result set handle
See also:
AnewtDatabaseConnection::prepare

Reimplemented in AnewtDatabaseResultSetMySQLOld, AnewtDatabaseResultSetMySQL, AnewtDatabaseResultSetPostgreSQL, and AnewtDatabaseResultSetSQLite.

Definition at line 69 of file result-set.lib.php.


Member Function Documentation

AnewtDatabaseResultSet::free (  )  [abstract]

Free resources associated with this result set.

You cannot use any methods on the result set instance anymore after calling this method.

Reimplemented in AnewtDatabaseResultSetMySQLOld, AnewtDatabaseResultSetMySQL, AnewtDatabaseResultSetPostgreSQL, and AnewtDatabaseResultSetSQLite.

AnewtDatabaseResultSet::fetch_one (  )  [abstract]

Return the next row.

Returns:
An associative array containing all fields of the next result row from the result set.
See also:
AnewtDatabaseResultSet::fetch_all

AnewtDatabaseResultSet::fetch_many

Reimplemented in AnewtDatabaseResultSetMySQLOld, AnewtDatabaseResultSetMySQL, AnewtDatabaseResultSetPostgreSQL, and AnewtDatabaseResultSetSQLite.

AnewtDatabaseResultSet::fetch_all (  ) 

Return all remaining rows.

Returns:
A numeric array containing the result rows as associative arrays. This may be an empty list.
See also:
AnewtDatabaseResultSet::fetch

AnewtDatabaseResultSet::fetch_many

Reimplemented in AnewtDatabaseResultSetSQLite.

Definition at line 113 of file result-set.lib.php.

AnewtDatabaseResultSet::fetch_many ( how_many  ) 

Return up to the specified number of rows.

The actual number of rows may be lower than the value specified, since there may be less rows in the set.

Parameters:
$how_many The number of rows to return. This must be a positive integer value.
Returns:
A numeric array containing the result rows as associative arrays. This may be an empty list.
See also:
AnewtDatabaseResultSet::fetch

AnewtDatabaseResultSet::fetch_all

Definition at line 146 of file result-set.lib.php.

AnewtDatabaseResultSet::count (  ) 

Return the number of resulting rows in this result set.

Returns:
The total number of result rows.

Definition at line 176 of file result-set.lib.php.

AnewtDatabaseResultSet::count_affected (  ) 

Returns the number of rows that where affected by the last executed query.

Returns:
The total number of affected rows.

Definition at line 187 of file result-set.lib.php.

AnewtDatabaseResultSet::obtain_field_types (  )  [abstract, protected]

Deduce the data types in this result set.

This method should be implemented in backends to perform automatic type conversion.

Reimplemented in AnewtDatabaseResultSetMySQLOld, AnewtDatabaseResultSetMySQL, AnewtDatabaseResultSetPostgreSQL, and AnewtDatabaseResultSetSQLite.

AnewtDatabaseResultSet::cast_row ( &$  row  )  [abstract, protected]

Cast a row of data into native PHP data types.

This method should be implemented in backends to perform automatic type conversion.

Note that the array is modified in-place (and no result is returned).

Parameters:
$row A row of data.

Reimplemented in AnewtDatabaseResultSetMySQLOld, AnewtDatabaseResultSetMySQL, AnewtDatabaseResultSetPostgreSQL, and AnewtDatabaseResultSetSQLite.


The documentation for this class was generated from the following file:

Generated on Sun Aug 2 22:54:37 2009 for Anewt by  doxygen 1.5.9