Class DB_result

Description

This class implements a wrapper for a DB result set

A new instance of this class will be returned by the DB implementation after processing a query that returns data.

Located in /web/lib/external/pear-db/DB.php (line 995)


	
			
Variable Summary
 boolean $autofree
 object $dbh
 integer $fetchmode
 integer $limit_count
 integer $limit_from
 array $parameters
 string $query
 resource $result
 integer $row_counter
 resource $statement
Method Summary
 void DB_result (object &$dbh, resource $result, [array $options = array()])
 mixed fetchInto (array &$arr, [int $fetchmode = DB_FETCHMODE_DEFAULT], [int $rownum = null])
 mixed &fetchRow ([int $fetchmode = DB_FETCHMODE_DEFAULT], [int $rownum = null])
 bool free ()
 string getQuery ()
 integer getRowCounter ()
 bool nextResult ()
 int numCols ()
 int numRows ()
 void setOption (string $key, [mixed $value = null])
 void tableInfo ([ $mode = null])
Variables
boolean $autofree (line 1004)

Should results be freed automatically when there are no more rows?

object $dbh (line 1010)

A reference to the DB_<driver> object

integer $fetchmode (line 1017)

The current default fetch mode

string $fetchmode_object_class (line 1026)

The name of the class into which results should be fetched when DB_FETCHMODE_OBJECT is in effect

integer $limit_count = null (line 1032)

The number of rows to fetch from a limit query

integer $limit_from = null (line 1038)

The row to start fetching from in limit queries

array $parameters (line 1045)

The execute parameters that created this result

  • since: Property available since Release 1.7.0
string $query (line 1055)

The query string that created this result

Copied here incase it changes in $dbh, which is referenced

  • since: Property available since Release 1.7.0
resource $result (line 1061)

The query result resource id created by PHP

integer $row_counter = null (line 1067)

The present row being dealt with

resource $statement (line 1084)

The prepared statement resource id created by PHP in $dbh

This resource is only available when the result set was created using a driver's native execute() method, not PEAR DB's emulated one.

Copied here incase it changes in $dbh, which is referenced

  • since: Property available since Release 1.7.0
Methods
Constructor DB_result (line 1099)

This constructor sets the object's properties

void DB_result (object &$dbh, resource $result, [array $options = array()])
  • object &$dbh: the DB object reference
  • resource $result: the result resource id
  • array $options: an associative array with result options
fetchInto (line 1245)

Fetch a row of data into an array which is passed by reference

The type of array returned can be controlled either by setting this method's $fetchmode parameter or by changing the default fetch mode setFetchMode() before calling this method.

There are two options for standardizing the information returned from databases, ensuring their values are consistent when changing DBMS's. These portability options can be turned on when creating a new DB object or by using setOption().

  • DB_PORTABILITY_LOWERCASE convert names of fields to lower case
  • DB_PORTABILITY_RTRIM right trim the data

mixed fetchInto (array &$arr, [int $fetchmode = DB_FETCHMODE_DEFAULT], [int $rownum = null])
  • array &$arr: the variable where the data should be placed
  • int $fetchmode: the constant indicating how to format the data
  • int $rownum: the row number to fetch (index starts at 0)
fetchRow (line 1163)

Fetch a row of data and return it by reference into an array

The type of array returned can be controlled either by setting this method's $fetchmode parameter or by changing the default fetch mode setFetchMode() before calling this method.

There are two options for standardizing the information returned from databases, ensuring their values are consistent when changing DBMS's. These portability options can be turned on when creating a new DB object or by using setOption().

  • DB_PORTABILITY_LOWERCASE convert names of fields to lower case
  • DB_PORTABILITY_RTRIM right trim the data

mixed &fetchRow ([int $fetchmode = DB_FETCHMODE_DEFAULT], [int $rownum = null])
  • int $fetchmode: the constant indicating how to format the data
  • int $rownum: the row number to fetch (index starts at 0)
free (line 1386)

Frees the resources allocated for this result set

  • return: true on success. A DB_Error object on failure.
bool free ()
getQuery (line 1422)

Determine the query string that created this result

  • return: the query string
  • since: Method available since Release 1.7.0
string getQuery ()
getRowCounter (line 1435)

Tells which row number is currently being processed

  • return: the current row being looked at. Starts at 1.
integer getRowCounter ()
nextResult (line 1373)

Get the next result if a batch of queries was executed

  • return: true if a new result is available or false if not
bool nextResult ()
numCols (line 1306)

Get the the number of columns in a result set

  • return: the number of columns. A DB_Error object on failure.
int numCols ()
numRows (line 1319)

Get the number of rows in a result set

  • return: the number of rows. A DB_Error object on failure.
int numRows ()
setOption (line 1122)

Set options for the DB_result object

void setOption (string $key, [mixed $value = null])
  • string $key: the option to set
  • mixed $value: the value to set the option to
tableInfo (line 1404)
void tableInfo ([ $mode = null])
  • $mode

Documentation generated on Wed, 09 Feb 2011 08:59:19 +0700 by phpDocumentor 1.4.2