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

Class: DB_result

Source Location: /DB-1.7.2/DB.php

Class Overview


This class implements a wrapper for a DB result set


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 1997-2005 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 915]
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 924]

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

Type:   boolean


[ Top ]

$dbh =

[line 930]

A reference to the DB_<driver> object

Type:   object


[ Top ]

$fetchmode =

[line 937]

The current default fetch mode

Type:   integer


[ Top ]

$fetchmode_object_class =

[line 946]

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

The number of rows to fetch from a limit query

Type:   integer


[ Top ]

$limit_from =  null

[line 958]

The row to start fetching from in limit queries

Type:   integer


[ Top ]

$parameters =

[line 965]

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

Type:   array


[ Top ]

$query =

[line 975]

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

The query result resource id created by PHP

Type:   resource


[ Top ]

$row_counter =  null

[line 987]

The present row being dealt with

Type:   integer


[ Top ]

$statement =

[line 1004]

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

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

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

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

bool free( )

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

[ Top ]

getQuery   [line 1319]

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

integer getRowCounter( )

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

[ Top ]

nextResult   [line 1270]

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

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

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

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

void tableInfo( [ $mode = null])


Parameters:

   $mode   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:28:03 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.