DB
[ class tree: DB ] [ index: DB ] [ all elements ]

Class: DB_result

Source Location: /DB-1.8.2/DB.php

Class Overview


This class implements a wrapper for a DB result set


Author(s):

Version:

  • Release: 1.8.2

Copyright:

  • 1997-2007 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 994]
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.



[ Top ]


Class Variables

$autofree =

[line 1003]

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

Type:   boolean


[ Top ]

$dbh =

[line 1009]

A reference to the DB_<driver> object

Type:   object


[ Top ]

$fetchmode =

[line 1016]

The current default fetch mode

Type:   integer


[ Top ]

$fetchmode_object_class =

[line 1025]

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

Type:   string


[ Top ]

$limit_count =  null

[line 1031]

The number of rows to fetch from a limit query

Type:   integer


[ Top ]

$limit_from =  null

[line 1037]

The row to start fetching from in limit queries

Type:   integer


[ Top ]

$parameters =

[line 1044]

The execute parameters that created this result
  • Since: Property available since Release 1.7.0

Type:   array


[ Top ]

$query =

[line 1054]

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

Type:   string


[ Top ]

$result =

[line 1060]

The query result resource id created by PHP

Type:   resource


[ Top ]

$row_counter =  null

[line 1066]

The present row being dealt with

Type:   integer


[ Top ]

$statement =

[line 1083]

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

Type:   resource


[ Top ]



Method Detail

DB_result (Constructor)   [line 1098]

void DB_result( object &$dbh, resource $result, [array $options = array()])

This constructor sets the object's properties

Parameters:

object   &$dbh     the DB object reference
resource   $result     the result resource id
array   $options     an associative array with result options

[ Top ]

fetchInto   [line 1244]

mixed fetchInto( array &$arr, [int $fetchmode = DB_FETCHMODE_DEFAULT], [int $rownum = null])

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


Parameters:

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)

[ Top ]

fetchRow   [line 1162]

mixed &fetchRow( [int $fetchmode = DB_FETCHMODE_DEFAULT], [int $rownum = null])

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


Parameters:

int   $fetchmode     the constant indicating how to format the data
int   $rownum     the row number to fetch (index starts at 0)

[ Top ]

free   [line 1385]

bool free( )

Frees the resources allocated for this result set
  • Return: true on success. A DB_Error object on failure.

[ Top ]

getQuery   [line 1421]

string getQuery( )

Determine the query string that created this result
  • Return: the query string
  • Since: Method available since Release 1.7.0

[ Top ]

getRowCounter   [line 1434]

integer getRowCounter( )

Tells which row number is currently being processed
  • Return: the current row being looked at. Starts at 1.

[ Top ]

nextResult   [line 1372]

bool nextResult( )

Get the next result if a batch of queries was executed
  • Return: true if a new result is available or false if not

[ Top ]

numCols   [line 1305]

int numCols( )

Get the the number of columns in a result set
  • Return: the number of columns. A DB_Error object on failure.

[ Top ]

numRows   [line 1318]

int numRows( )

Get the number of rows in a result set
  • Return: the number of rows. A DB_Error object on failure.

[ Top ]

setOption   [line 1121]

void setOption( string $key, [mixed $value = null])

Set options for the DB_result object

Parameters:

string   $key     the option to set
mixed   $value     the value to set the option to

[ Top ]

tableInfo   [line 1403]

void tableInfo( [ $mode = null])


Parameters:

   $mode     

[ Top ]


Documentation generated on Thu, 27 Nov 2014 17:30:08 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.