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

Class: GALRow

Source Location: /libbase/result.inc.php

Class Overview


This class represents a row of a database result.


Implements interfaces:

Variables

Methods


Child classes:

GALTableRow
Extension of GALRow that implements write access and references a whole row of a table.

Class Details

[line 267]
This class represents a row of a database result.

It implements the magic __get() method to access fields almost like native member variables. Write access is not supported as the fields of an arbitrary result could be created by MySQL functions like COUNT() or arithmetic operations. Write support is the scope of table.inc.php. Note that all "real" properties start with an underscore so that they do not interfere with fields accessed by __get().




[ Top ]


Class Variables

$_data =

[line 273]

The data of this row.



Tags:

var:  Associative array where the field names are the keys.
access:  protected

Type:   array


[ Top ]

$_dead =  false

[line 289]

Indicates if this row is "dead", i.e. deleted from the database or destructed.

This object variable was introduced for the subclass GALTableRow, because this way the get() and __destruct() methods needn't to be reimplemented. In GALTableRow a delete() method is implemented that deletes the row from the database. As I can't find a way for objects to unset() or destroy themself, a deleted row renders itself a "zombie" by setting $_dead to TRUE, i.e. they become an object that should be dead, but can't be... ;)




Tags:

access:  protected

Type:   bool


[ Top ]

$_result =

[line 279]

The source of this row.

It points to the GALResultIterator this row is fetched from.




Tags:

access:  protected

Type:   GALResultIterator


[ Top ]



Class Methods


constructor __construct [line 297]

GALRow __construct( GALResult $result, array &$data)

Initializes a row.

This constructor ist not intended to be called "by hand", it is called inside GALResultIterator::fetch().




Overridden in child classes as:

GALTableRow::__construct()
Initializes this object.
GALUser::__construct()
GALNode::__construct()
Initialize
GALFilm::__construct()
Initialize This constructor is not intended to be called by library users, it is called inside GALFilmIterator::fetch().
GALHelp::__construct()
GALComment::__construct()
Initialize.
GALImage::__construct()
Initialize This constructor is not intended to be called by library users, it is called inside GALImageIterator::fetch().
GALSeries::__construct()
GALGroup::__construct()
Initialize.
GALInstance::__construct()
Initialize
GALLogin::__construct()
GALJob::__construct()
Initialize
GALCategory::__construct()
Initialize This constructor is not intended to be called by library users, it is called inside GALCategoryIterator::fetch().
GALToken::__construct()

Parameters:

GALResult   $result   The result the current row is fetched from.
array   &$data   The data that are used to initialize $_data.

[ Top ]

destructor __destruct [line 308]

void __destruct( )

Deletes the stored data and sets $_dead to TRUE.

This method is called in GALTableRow::delete(). It wouldn't be useful otherwise and has the task to invalidate this row so that it cannot be used any more.




[ Top ]

method countFields [line 407]

int countFields( )

Returns the number of fields contained in a result.

Wrapper for GALResult::countFields().




Tags:

return:  $_result->countFields()



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

method get [line 330]

void get( string $field)

Returns the value of a field.

This method returns the value of this row's field with the given name.




Tags:

throws:  GAL_EDatabase If the field doesn't exist.


Overridden in child classes as:

GALUser::get()
GALNode::get()
Read a property via method call.
GALFilm::get()
Read a property via method call.
GALHelp::get()
GALComment::get()
Reads a property via method call.
GALImage::get()
Read a property via method call.
GALSeries::get()
GALGroup::get()
Reads a property via method call.
GALInstance::get()
Read a property via method call.
GALLogin::get()
GALJob::get()
Read a property via method call.
GALCategory::get()
Read a property via method call.
GALToken::get()

Parameters:

string   $field   A field's name.

[ Top ]

method getData [line 344]

array getData( )

Provides access to the stored data.



Tags:

return:  Just returns $_data.


[ Top ]

method getFields [line 398]

array getFields( )

Returns all fields contained in this result.



Tags:

return:  $_result->getFields()
throws:  GAL_EDatabase



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

method getFlags [line 356]

string getFlags( string $field)

Gets the flags of the given field.

Wrapper for GALResult::getFlags().




Tags:

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



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

Parameters:

string   $field   A field name.

[ Top ]

method getLength [line 378]

int getLength( string $field)

Gets the length of the given field.

Wrapper for GALResult::getLength().




Tags:

return:  $_result->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 426]

GALResultIterator getParent( )

Returns the top level parent of an entity.

Wrapper for GALResult::getParent().




Tags:

return:  $_result->getParent()


Overridden in child classes as:

GALTableRow::getParent()
Returns the top level parent of this row.
GALComment::getParent()
Return the comment's parent.


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

method getTable [line 389]

string getTable( string $field)

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

Wrapper for GALResult::getTable().




Tags:

return:  $_result->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 367]

string getType( mixed $field)

Gets the type of the given field.

Wrapper for GALResult::getType().




Tags:

return:  $_result->getType()
throws:  GAL_EDatabase



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

method isField [line 417]

bool isField( string $field)

Checks if the given field is contained in a result.

Wrapper for GALResult::isField().




Tags:

return:  $_result->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 __get [line 321]

void __get( string $field)

Magic method to access this row's fields like native PHP properties.

It is a wrapper for the get() method.




Tags:

throws:  GAL_EDatabase If the field doesn't exist.


Overridden in child classes as:

GALUser::__get()
GALNode::__get()
Magic method to read properties.
GALFilm::__get()
Magic method to read properties.
GALHelp::__get()
GALComment::__get()
Magic method to read properties.
GALImage::__get()
Magic method to read properties.
GALSeries::__get()
GALGroup::__get()
Magic method to read properties.
GALInstance::__get()
Magic method to read properties.
GALLogin::__get()
GALJob::__get()
Magic method to read properties.
GALCategory::__get()
Magic method to read properties.
GALToken::__get()

Parameters:

string   $field   A field's name.

[ Top ]


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