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

Class: GALRowSet

Source Location: /libbase/result.inc.php

Class Overview


A set or list of rows.


Implements interfaces:

Variables

Methods



Class Details

[line 1083]
A set or list of rows.

This class handles a list of GALRow objects. All rows must have the same top level parent. It is more a list than an iterator, but implements the GALResultIterator interface because I am too lazy to write an extra iterator class and implement invalidating the iterator if rows are added/removed.




[ Top ]


Class Variables

$index =  0

[line 1096]

Current row.

The index of the row that will be returned by the next call of fetch() (starting from zero}.




Tags:

access:  protected

Type:   int


[ Top ]

$num_rows =

[line 1101]

The number of rows that is currently contained inside this iterator.



Tags:

access:  protected

Type:   int


[ Top ]

$rows = array()

[line 1089]

The rows of this iterator.



Tags:

var:  Array of instances of GALRow.
access:  protected

Type:   array


[ Top ]

$source =

[line 1108]

The parent of all rows contained in this iterator.

This needn't be a top level object - The result of getParent() of this variable and a row that is to be added is compared.




Tags:

var:  Usually a GALResult or a GALTable
access:  protected

Type:   GALDesc


[ Top ]



Class Methods


constructor __construct [line 1115]

GALRowSet __construct( GALDesc $source, [ $rows = array()])

Initializes this object and optionally adds rows.

This constructor initializes the $source property and optionally adds an array of GALRow objects.




Parameters:

GALDesc   $source   You can only add rows where the getParent() method returns the same as $source->getParent()
   $rows  

[ Top ]

method add [line 1347]

void add( object $container)

Adds rows to this list.

This method accepts rows as arguments and adds them to this list. The top level parent of $source and the top level parent of all rows that are to be added need to be the same, this is a reference to the same instance.




Tags:

throws:  GAL_EDatabase If a row hasn't got the same parent as $source.


Parameters:

object   $container   An instance of GALRow or an instance of GALResultIterator.

[ Top ]

method contains [line 1402]

bool contains( GALRow $row)

Checks if the specified row is in this list.



Tags:

return:  TRUE if the specified list is in this list, FALSE otherwise.


Parameters:

GALRow   $row  

[ Top ]

method count [line 1214]

int count( )

Returns the number of rows in this GALRowSet.



Tags:




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

method countFields [line 1317]

int countFields( )

Returns the number of fields contained in $source.



Tags:

return:  $source->countFields()



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

method data_seek [line 1136]

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

GALDesc fetch( )

Fetches the current row from $rows.

This function returns $rows[$index] and increases $index. The class of the returned row is 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 1224]

GALRowSet filter( string $callback)

Filters $rows with a callback function.



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

array getFields( )

Returns all fields contained in $source.



Tags:

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



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

method getFlags [line 1267]

string getFlags( string $field)

Gets the flags of the given field.

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




Tags:

return:  $source->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 1289]

int getLength( string $field)

Gets the length of the given field.

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




Tags:

return:  $source->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 1334]

GALResultIterator getParent( )

Returns the top level parent of $source.



Tags:

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



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

method getRows [line 1393]

array getRows( )

Returns an array with all rows in this list.



Tags:

return:  $rows, an array of GALRow objects.


[ Top ]

method getTable [line 1300]

string getTable( string $field)

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

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




Tags:

return:  $source->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 1278]

string getType( string $field)

Gets the type of the given field.

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




Tags:

return:  $source->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 1326]

bool isField( string $field)

Checks if the given field is contained in $source.



Tags:

return:  $source->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 1256]

GALIteratorIterator iterator( )

Creates a new iterator on the data of this iterator.



Tags:




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

method position [line 1152]

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 remove [line 1384]

void remove( GALRow $row)

Removes the specified row form this list.

If the row isn't in this list, nothing happens.




Parameters:

GALRow   $row   The row to remove.

[ Top ]

method rewind [line 1182]

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

void row( mixed $index)

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

This method fetches the row that has the specified index 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 1237]

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:29 +0200 by phpDocumentor 1.3.0RC6