phpDocumentor MySQL
[ class tree: MySQL ] [ index: MySQL ] [ all elements ]

Class: Mysql_Result

Source Location: /result.php

Class Mysql_Result

Class Overview

Mysql_Result provides easy access to data contained in a MySQL result.

Mysql_Result has been designed to provide easy access to data contained within a MySQL result set. Other than the usual fetch* methods Mysql_Result also contains methods such as fetchAllColumnAsIndex and dataSeek

Access to object provided through Mysql and Mysql_Statement objects.

Located in /result.php [line 36]



		
				Author(s):
		
		
		
Information Tags:
Link:  http://albertfama.com/pkgs/distro/mysql/mysql.zip
Since:  File available since release .01 Alpha
Version:  1.0 (Stable)
License:  GNU GPL
Copyright:  2009 Albert Fama

Properties

Methods

[ Top ]
Property Summary
resource   $_handle   MySQL resource
pointer   $_result   Result returned by MySQL

[ Top ]
Method Summary
Mysql_Result   __construct()   Mysql_Result Constructor
void   dataSeek()   Moves internal result pointer to specified row
array   fetchAll()   Returns an array of all rows in the current result set.
array   fetchAllColumnAsIndex()   Returns an array of all rows returned in a result set using a column value as the array's index.
mixed   fetchAssoc()   Fetch row as an associative array from result set
int   fetchInsertId()   Returns last insert id.
int   fetchNumAffectedRows()   Return the number of rows affected by previous statement
int   fetchNumRows()   Returns number of rows in the current MySQL data set.
mixed   fetchRow()   Fetch row as a numerically indexed array from result set

[ Top ]
Properties
resource   $_handle [line 52]

MySQL resource

Resource returned from MySQL connection.

API Tags:
Access:  protected


[ Top ]
pointer   $_result [line 43]

Result returned by MySQL

API Tags:
Access:  protected


[ Top ]
Methods
Constructor __construct  [line 63]

  Mysql_Result __construct( resource $handle, mixed $result  )

Mysql_Result Constructor

Constructor assigns resources to member attributes.

Parameters:
resource   $handle:  handle (resource to MySQL connection)
mixed   $result:  result (result returned by MySQL)

API Tags:
Access:  public


[ Top ]
dataSeek  [line 192]

  void dataSeek( [int $row_number = 0]  )

Moves internal result pointer to specified row

Parameters:
int   $row_number:  row_number (row number to position internal pointer)

API Tags:
Access:  public
See:  mysql_data_seek

Information Tags:
Usedby:  Mysql_Result::fetchAllColumnAsIndex()
Throws:  Mysql_Exception

[ Top ]
fetchAll  [line 119]

  array fetchAll( )

Returns an array of all rows in the current result set.

Array returned is a numerically indexed array, each element of that array is a row from the result set. Each row is stored as an associative array.


API Tags:
Access:  public
Uses:  Mysql_Result::fetchAssoc()


[ Top ]
fetchAllColumnAsIndex  [line 145]

  array fetchAllColumnAsIndex( string $column  )

Returns an array of all rows returned in a result set using a column value as the array's index.

Using the column name sent as the parameter, method returns all rows in the current result set indexed by the value of the column. When using this method you must ensure the column used for index IS UNIQUE.

Example use would be for creating an array indexed by primary id.

Parameters:
string   $column:  column (column name)

API Tags:
Access:  public
Uses:  Mysql_Result::dataSeek()
Uses:  Mysql_Result::fetchAssoc()


[ Top ]
fetchAssoc  [line 100]

  mixed fetchAssoc( )

Fetch row as an associative array from result set

Returns an associative array of the current row in the MySQL result set and advances the internal pointer one row. If the end of the result set is reached method returns boolean FALSE.


API Tags:
Return:  assoc. array or boolean FALSE
Access:  public
See:  mysql_fetch_assoc

Information Tags:
Usedby:  Mysql_Result::fetchAllColumnAsIndex()
Usedby:  Mysql_Result::fetchAll()
Throws:  Mysql_Exception

[ Top ]
fetchInsertId  [line 237]

  int fetchInsertId( )

Returns last insert id.

Return the last insert id generated by the current MySQL connection.


API Tags:
Access:  public
See:  mysql_insert_id

Information Tags:
Throws:  Mysql_Exception

[ Top ]
fetchNumAffectedRows  [line 219]

  int fetchNumAffectedRows( )

Return the number of rows affected by previous statement

Returns the number of rows affected by the last INSERT, UPDATE, REPLACE or DELETE statement.


API Tags:
Access:  public
See:  mysql_affected_rows

Information Tags:
Throws:  Mysql_Exception

[ Top ]
fetchNumRows  [line 175]

  int fetchNumRows( )

Returns number of rows in the current MySQL data set.


API Tags:
Access:  public
See:  mysql_num_rows

Information Tags:
Throws:  Mysql_Exception

[ Top ]
fetchRow  [line 80]

  mixed fetchRow( )

Fetch row as a numerically indexed array from result set

Returns a numerically indexed array of the current row in the MySQL result set and advances the internal pointer one row. If the end of the result set is reached method returns boolean FALSE.


API Tags:
Return:  numerical array or boolean FALSE
Access:  public
See:  mysql_fetch_row

Information Tags:
Throws:  Mysql_Exception

[ Top ]

Documentation generated on Mon, 15 Jun 2009 16:50:06 -0600 by phpDocumentor 1.3.0RC3