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

Class: DB_result

Source Location: /DB-1.9.2/DB.php

Class Overview


This class implements a wrapper for a DB result set


Author(s):

Version:

  • Release: 1.9.2

Copyright:

  • 1997-2007 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 1008]
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 1017]

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

Type:   boolean


[ Top ]

$dbh =

[line 1023]

A reference to the DB_<driver> object

Type:   object


[ Top ]

$fetchmode =

[line 1030]

The current default fetch mode

Type:   integer


[ Top ]

$fetchmode_object_class =

[line 1039]

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 1045]

The number of rows to fetch from a limit query

Type:   integer


[ Top ]

$limit_from =  null

[line 1051]

The row to start fetching from in limit queries

Type:   integer


[ Top ]

$parameters =

[line 1058]

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

Type:   array


[ Top ]

$query =

[line 1068]

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 1074]

The query result resource id created by PHP

Type:   resource


[ Top ]

$row_counter =  null

[line 1080]

The present row being dealt with

Type:   integer


[ Top ]

$statement =

[line 1097]

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

__construct (Constructor)   [line 1112]

void __construct( 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 1258]

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 1176]

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 1399]

bool free( )

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

[ Top ]

getQuery   [line 1435]

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 1448]

integer getRowCounter( )

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

[ Top ]

nextResult   [line 1386]

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 1319]

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 1332]

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 1135]

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 1417]

void tableInfo( [ $mode = null])


Parameters:

   $mode   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 16:04:19 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.