SourceForge.net LogoPHPGallue
[ class tree: libbase ] [ index: libbase ] [ all elements ]

Class: GALTableIterator

Source Location: /libbase/table.inc.php

Class Overview

GALResult
   |
   --GALTableIterator

This class provides access to a set of GALTableRow objects.


Variables

Methods


Child classes:

GALUserIterator
GALNodeIterator
Access to a set of GALNode objects.
GALFilmIterator
Access to a set of GALFilm objects.
GALHelpIterator
GALCommentIterator
Access to a set of GALComment objects.
GALImageIterator
Access to a set of GALImage objects.
GALSeriesIterator
GALGroupIterator
Access to a set of GALGroup objects.
GALInstanceIterator
Access to a set of GALInstance objects.
GALLoginIterator
GALJobIterator
Access to a set of GALJob objects.
GALCategoryIterator
Access to a set of GALCategory objects.
GALTokenIterator

Inherited Variables

Inherited Methods

Class: GALResult

GALResult::__construct()
Initializes a GALResult.
GALResult::buildRow()
Implements the GALRowFactory interface.
GALResult::count()
Returns the number of rows in this result.
GALResult::countFields()
Returns the number of fields contained in a result.
GALResult::data_seek()
Sets the internal pointer to the specified row.
GALResult::fetch()
Fetches a row from the MySQL query result.
GALResult::filter()
Filters the rows of this result with a callback function.
GALResult::getFields()
Returns all fields contained in a result.
GALResult::getFlags()
Gets the flags of the given field.
GALResult::getLength()
Gets the length of the given field.
GALResult::getParent()
Returns a reference to this object.
GALResult::getRowFactory()
Returns the factory to construct rows.
GALResult::getTable()
Gets the name of the table the given field is contained in.
GALResult::getType()
Gets the type of the given field.
GALResult::isField()
Checks if the given field is contained in a result.
GALResult::iterator()
Creates a new iterator on the data of this result.
GALResult::position()
Returns the index of the current row.
GALResult::rewind()
Sets the internal pointer to zero.
GALResult::row()
Fetches the row with the specified index (starting from 0).
GALResult::setRowFactory()
Sets the factory to construct rows.
GALResult::verticalFetch()
Returns the value of the specified field in all rows of this iterator.
GALResult::__destruct()
Free memory associated with this query result.

Class Details

[line 452]
This class provides access to a set of GALTableRow objects.

This class is very similar to GALResult.




[ Top ]


Class Variables

$items = array()

[line 459]



Tags:

access:  protected

Type:   mixed


[ Top ]

$table =

[line 458]

Reference to the table this result was fetched from.



Tags:

access:  protected

Type:   GALTable


[ Top ]



Class Methods


constructor __construct [line 467]

GALTableIterator __construct( GALTable $table, resource $handle, [ $rowFactory = false])

Initializes this object.

This constructor is not intended to be called by a library user; it is called in GALTable::rawLoad().




Overridden in child classes as:

GALUserIterator::__construct()
GALNodeIterator::__construct()
Initialize the $glb variable, then call parent constructor.
GALFilmIterator::__construct()
Initialize the $glb variable, then call parent constructor.
GALHelpIterator::__construct()
GALCommentIterator::__construct()
GALImageIterator::__construct()
Initialize the $glb variable, then call parent constructor.
GALSeriesIterator::__construct()
GALGroupIterator::__construct()
Initializes the $glb variable, then calls the parent constructor.
GALInstanceIterator::__construct()
Initialize the $glb variable, then call parent constructor.
GALLoginIterator::__construct()
GALJobIterator::__construct()
Initialize the $glb variable, then call parent constructor.
GALCategoryIterator::__construct()
Initialize the $glb variable, then call parent constructor.
GALTokenIterator::__construct()

Overrides GALResult::__construct() (Initializes a GALResult.)

Parameters:

GALTable   $table   Used to initialize $table.
resource   $handle   The MySQL result resource of the query in GALTable::rawLoad().
   $rowFactory  

[ Top ]

destructor __destruct [line 488]

void __destruct( )

Overwrite inherited destructor.

The inherited destructor must be overwritten, because the $handle is already destroyed.




Overrides GALResult::__destruct() (Free memory associated with this query result.)

[ Top ]

method buildRow [line 520]

void buildRow( GALResult $source, array &$data)

Implements the GALRowFactory interface.



Overridden in child classes as:

GALUserIterator::buildRow()
GALNodeIterator::buildRow()
GALFilmIterator::buildRow()
GALHelpIterator::buildRow()
GALCommentIterator::buildRow()
Constructs the items of this iterator.
GALImageIterator::buildRow()
GALSeriesIterator::buildRow()
GALGroupIterator::buildRow()
Constructs the items of this iterator.
GALInstanceIterator::buildRow()
GALLoginIterator::buildRow()
GALJobIterator::buildRow()
GALCategoryIterator::buildRow()
Constructs the items of this iterator.
GALTokenIterator::buildRow()

Overrides GALResult::buildRow() (Implements the GALRowFactory interface.)

Parameters:

GALResult   $source  
array   &$data   Reference to an array containing the row data

[ Top ]

method countFields [line 664]

int countFields( )

Returns the number of fields contained in a result.

Wrapper for GALResult::countFields().




Tags:



Overrides GALResult::countFields() (Returns the number of fields contained in a result.)

[ Top ]

method data_seek [line 546]

void data_seek( int $index)

Sets the internal pointer to the specified row.

This method sets the internal row pointer so that the next row returned by fetch() is the one on position $index in the result (starting from zero).




Tags:

throws:  GAL_EDatabase If the index is out of range.
see:  GALResultIterator::data_seek()


Overrides GALResult::data_seek() (Sets the internal pointer to the specified row.)

Parameters:

int   $index  

[ Top ]

method fetch [line 504]

GALTableRow fetch( )

Fetches the current row from the database.

In contrast to GALResult::fetch(), all rows are built inside the constructor and stored internally. fetch() just acesses those stored data, very similar to GALRowSet::fetch()




Tags:

return:  The fetched row or FALSE if the iterator has reached the end.


Overrides GALResult::fetch() (Fetches a row from the MySQL query result.)

[ Top ]

method getFields [line 654]

array getFields( )

Returns all fields contained in this result.



Tags:

return:  $table->getFields()
throws:  GAL_EDatabase
see:  GALDesc::getFields()


Overrides GALResult::getFields() (Returns all fields contained in a result.)

[ Top ]

method getFlags [line 620]

string getFlags( string $field)

Gets the flags of the given field.

Wrapper for GALResult::getFlags().




Tags:

return:  $table->getFlags()
throws:  GAL_EDatabase
todo:  Make it possible to inherit documentation from interfaces (not only from classes).
see:  GALDesc::getFlags()


Overrides GALResult::getFlags() (Gets the flags of the given field.)

Parameters:

string   $field   A field name.

[ Top ]

method getLength [line 644]

int getLength( string $field)

Gets the length of the given field.

Wrapper for GALResult::getLength().




Tags:

return:  $table->getLength()
throws:  GAL_EDatabase
see:  GALDesc::getLength()


Overrides GALResult::getLength() (Gets the length of the given field.)

Parameters:

string   $field   A field name.

[ Top ]

method getParent [line 494]

GALDesc getParent( )

Returns the parent of this result.

In most cases this is $table




Tags:

return:  $table->getParent()


Overrides GALResult::getParent() (Returns a reference to this object.)

[ Top ]

method getRowFactory [line 534]

GALRowFactory getRowFactory( )

Returns the factory to construct rows.



Overrides GALResult::getRowFactory() (Returns the factory to construct rows.)

[ Top ]

method getTable [line 603]

string getTable( string $field)

Gets the name of the table the given field is contained in.

Just returns the name of the table this iteraor is loaded from.




Tags:

throws:  GAL_EDatabase If the field name is invalid.
see:  GALDesc::getTable()


Overrides GALResult::getTable() (Gets the name of the table the given field is contained in.)

Parameters:

string   $field   The name of a field.

[ Top ]

method getType [line 632]

string getType( string $field)

Gets the type of the given field.

Wrapper for GALResult::getType().




Tags:

return:  $table->getType()
throws:  GAL_EDatabase
see:  GALDesc::getType()


Overrides GALResult::getType() (Gets the type of the given field.)

Parameters:

string   $field   The name of a field.

[ Top ]

method setRowFactory [line 527]

void setRowFactory( GALRowFactory $rowFactory)

Changing the row factory is not possible.

Please set the row factory via GALTableIterator::__construct()




Overrides GALResult::setRowFactory() (Sets the factory to construct rows.)

Parameters:

GALRowFactory   $rowFactory  

[ Top ]

method verticalFetch [line 578]

array verticalFetch( string $field)

Returns the value of the specified field in all rows of this iterator.

In the following example the table "users" contains these three rows:

  • name, id
  • 'Kurt', 1
  • 'Egon', 2
  • 'Herbert', 3
    1.  $database new GALDatabase($host$user$password$database);
    2.  $result $database->query("SELECT `name`, `id` FROM `users`");
    3.  $names $result->verticalFetch('name');
    4.  print_r($names);
    would print
     Array
     (
         [0] => Kurt
         [1] => Egon
         [2] => Herbert
     )
to stdout.




Tags:

return:  An array with all values of the specified field in this result.
throws:  GAL_EDatabase If the specified field doesn't exist.


Overrides GALResult::verticalFetch() (Returns the value of the specified field in all rows of this iterator.)

Parameters:

string   $field   The name of a field.

[ Top ]


Documentation generated on Wed, 16 Aug 2006 15:36:47 +0200 by phpDocumentor 1.3.0RC6