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

Class: GALIteratorIterator

Source Location: /libbase/result.inc.php

Class Overview


Iterator on another iterator.


Implements interfaces:

Variables

Methods



Class Details

[line 843]
Iterator on another iterator.

This class provides an iterator on the data of another iterator. This is useful if you want to use a database result in multiple modules. Because every iterator provides the GALREsultIterator::row() method, a new iterator on a GALResultIterator is easy to implement :).




[ Top ]


Class Variables

$index =  0

[line 857]

The current row.

This is the index starting from zero of the row that will be fetched by the next call of fetch().




Tags:

var:  A positive integer.
access:  protected

Type:   int


[ Top ]

$iterator =  false

[line 850]

The parent iterator.

The iterator whose data are accessed by this iterator.




Tags:

access:  protected

Type:   GALResultIterator


[ Top ]



Class Methods


constructor __construct [line 862]

GALIteratorIterator __construct( GALResultIterator $iterator)

Initializes the $iterator property.



Parameters:

GALResultIterator   $iterator  

[ Top ]

method count [line 1032]

int count( )

Returns the number of rows in $iterator.



Tags:




Implementation of:
GALResultIterator::count()
Returns the number of rows in this list or set.
[ Top ]

method countFields [line 922]

int countFields( )

Returns the number of fields contained in $iterator.



Tags:

return:  $iterator->countFields()



Implementation of:
GALDesc::countFields()
Returns the number of fields contained in a result.
[ Top ]

method data_seek [line 952]

void data_seek( int $index)

Sets the internal pointer to the specified row.

This method sets the internal row pointer $index 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()



Implementation of:
GALResultIterator::data_seek()
Moves the internal pointer to the row with the given position inside the list.

Parameters:

int   $index  

[ Top ]

method fetch [line 982]

GALDesc fetch( )

Fetches a row from the $iterator.

This function fetches the current row (indicated by $index) from the parent iterator and increases the internal pointer $index. The class of the returned row depends on the class of $iterator. In most cases it will be a subclass of GALRow.




Tags:

return:  The row that has been fetched, or FALSE if this iterator has reached the end.
see:  GALResultIterator::fetch()



Implementation of:
GALResultIterator::fetch()
Fetches the row the internal pointer points to and sets the internal pointer to the next row.
[ Top ]

method filter [line 1044]

GALRowSet filter( string $callback)

Filters $iterator with a callback function.

It is nor required that the result is a GALRowSet, but this is the most usual case.




Tags:

return:  All rows where the callback function returned TRUE.
see:  GALResultIterator::filter()



Implementation of:
GALResultIterator::filter()
Filters the rows of this iterator with a callback function.

Parameters:

string   $callback   The name of a callback function.

[ Top ]

method getFields [line 914]

array getFields( )

Returns all fields contained in $iterator.



Tags:

return:  $iterator->GALResultIterator::getFields()
throws:  GAL_EDatabase



Implementation of:
GALDesc::getFields()
Returns all fields contained in a result.
[ Top ]

method getFlags [line 872]

string getFlags( string $field)

Gets the flags of the given field.

This returns $iterator->GALResultIterator::getFlags()




Tags:

return:  $iterator->GALResultIterator::getFlags()
throws:  GAL_EDatabase



Implementation of:
GALDesc::getFlags()
Gets the flags of the given field.

Parameters:

string   $field   A field name.

[ Top ]

method getLength [line 894]

int getLength( string $field)

Gets the length of the given field.

This returns $iterator->GALResultIterator::getLength()




Tags:

return:  $iterator->GALResultIterator::getLength()
throws:  GAL_EDatabase



Implementation of:
GALDesc::getLength()
Gets the length of the given field.

Parameters:

string   $field   A field name.

[ Top ]

method getParent [line 939]

GALResultIterator getParent( )

Returns the top level parent of $iterator.



Tags:

return:  $iterator->GALResultIterator::getParent()



Implementation of:
GALDesc::getParent()
Return the top level parent of an entity.
[ Top ]

method getTable [line 905]

string getTable( string $field)

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

This returns $iterator->GALResultIterator::getTable()




Tags:

return:  $iterator->GALResultIterator::getTable()
throws:  GAL_EDatabase



Implementation of:
GALDesc::getTable()
Gets the name of the table the given field is contained in.

Parameters:

string   $field   A field name.

[ Top ]

method getType [line 883]

string getType( string $field)

Gets the type of the given field.

This returns $iterator->GALResultIterator::getType()




Tags:

return:  $iterator->GALResultIterator::getType()
throws:  GAL_EDatabase



Implementation of:
GALDesc::getType()
Gets the type of the given field.

Parameters:

string   $field   A field name.

[ Top ]

method isField [line 931]

bool isField( string $field)

Checks if the given field is contained in $iterator.



Tags:

return:  $iterator->GALResultIterator::isField()



Implementation of:
GALDesc::isField()
Checks if the given field is contained in a result.

Parameters:

string   $field   The name of a field.

[ Top ]

method iterator [line 1066]

GALIteratorIterator iterator( )

Creates a new iterator on the data of $iterator.

This method returns $iterator->iterator().




Tags:




Implementation of:
GALResultIterator::iterator()
Returns a new ResultIterator on the data of this iterator.
[ Top ]

method position [line 968]

int position( )

Returns the index of the current row.

This method returns the index of the row that will be returned by the next call of fetch() (starting from zero)




Tags:




Implementation of:
GALResultIterator::position()
Gets the index of the row the internal pointer points top.
[ Top ]

method rewind [line 1000]

bool rewind( )

Sets the internal pointer to zero.

This method changes the internal pointer so that it points to the first row, i.e. row 0.




Tags:

return:  FALSE if there are no rows in the result, TRUE otherwise.
see:  GALResultIterator::rewind()



Implementation of:
GALResultIterator::rewind()
Moves the internal pointer to position 0.
[ Top ]

method row [line 1022]

void row( mixed $index)

Fetches the row with the specified index (starting from 0).

This method fetches the row that has the specified index from $iterator without changing the internal pointer. It returns the same as

  1.  $this->data_seek($index);
  2.  $this->fetch();
, but the internal pointer keeps unchanged.




Tags:

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



Implementation of:
GALResultIterator::row()
Fetches the row with the given index.
[ Top ]

method verticalFetch [line 1056]

array verticalFetch( string $field)

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



Tags:

return:  An array with all values of the specified field.
throws:  GAL_EDatabase If the specified field doesn't exist.
see:  GALResultIterator::verticalFetch()
see:  GALResult::verticalFetch()



Implementation of:
GALResultIterator::verticalFetch()
Returns the value of a 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:26 +0200 by phpDocumentor 1.3.0RC6