It contains a collection of records and implements the IteratorAggregate interface so that you can use the dataset in a foreach() {} loop.
$ds = new TableDataSet($conn, "mytable"); $ds->fetchRecords(); foreach($ds as $record) { $record->setValue("col1", "new value"); $record->save(); }
This class is extended by QueryDataSet and TableDataSet and should not be used directly.
NOTE: Iterating over a dataset in the php4 version has to be done in a for-loop:
$ds = new TableDataSet($conn, "mytable"); $ds->fetchRecords();
for ($it =& $ds->getIterator(); $it->valid(); $it->next()) { $record =& $it->current(); $record->setValue("col1", "new value"); $record->save(); }
Author Jon S. Stevens <jon@latchkey.com> (Village)
Michael Aichler <aichler@mediacluster.de> (Jargon)
Hans Lellelid <hans@xmpl.org> (Jargon)
Version
Revision
|
indicates that all records should be retrieved during a fetch |
|
Return iterator (for IteratorAggregate interface). This allows this class to be used in a foreach() loop. Returns DataSetIterator |
|
Gets the ResultSet for this DataSet
Returns mixed ResultSet The result set for this DataSet on success, DataSetException - if resultset is null |
|
Check if all the records have been retrieve
Returns boolean True if all records have been retrieved |
|
Set all records retrieved
Returns void |
|
Remove a record from the DataSet's internal storage
Returns mixed Record The record removed on success, DataSetException on failure.
mixed Record The record removed on success, FALSE if not found. |
|
Remove all records from the DataSet and nulls those records out and close() the DataSet.
Returns an instance of myself |
|
Removes the records from the DataSet, but does not null the records out
Returns an instance of myself |
|
Releases the records, closes the ResultSet and the Statement, and nulls the Schema and Connection references.
Returns void |
|
Essentially the same as releaseRecords, but it won't work on a QueryDataSet that has been created with a ResultSet
Returns mixed DataSet This object on success, DataSetException on failure. |
|
Gets the current database connection
Returns Connection A database connection. |
|
Gets the Schema for this DataSet
Returns Schema The Schema for this DataSet |
|
Get Record at 0 based index position NOTE: Behaviour of this function is slightly different compared to the php5 version. Instead of throwing (returning) an exception, this function simply returnes FALSE, if the record at position $pos cannot be found.
Returns mixed Record An instance of the found Record or FALSE if not found. |
|
Find Record at 0 based index position. This is an internal alternative to getRecord which tries to be smart about the type of record it is. NOTE: Behaviour of this function is slightly different compared to the php5 version. Instead of throwing (returning) an exception, this function simply returnes FALSE, if the record at position $pos cannot be found.
Returns mixed Record an instance of the found Record on success, otherwise FALSE. |
|
Check to see if the DataSet contains a Record at 0 based position
Returns TRUE if record exists otherwise FALSE. |
|
Causes the DataSet to hit the database and fetch max records, starting at start. Record count begins at 0. This method supports two signatures:
Returns DataSet This class on success.
SQL- or DataSetException on failure. Reimplemented in TableDataSet. |
|
The number of records that were fetched with the last fetchRecords.
Returns int |
|
gets the KeyDef object for this DataSet
Returns KeyDef The keydef for this DataSet, this value can be null |
|
This returns a represention of this DataSet |
|
Classes extending this class must implement this method.
Returns string The SELECT SQL.
Reimplemented in QueryDataSet, and TableDataSet. |
|
Returns the columns attribute for the DataSet
Returns the columns attribute for the DataSet |
|
Gets the number of Records in this DataSet. It is 0 based.
Returns int Number of Records in this DataSet |
|
this DataSet's collection of Record objects |
|
this DataSet's connection object |
|
have all records been retrieved with the fetchRecords? |
|
number of records retrieved |
|
number of records that were last fetched |
|
number of records total that have been fetched |
|
the columns in the SELECT statement for this DataSet |
|
the select string that was used to build this DataSet |
|
the KeyDef for this DataSet |
|
the result set for this DataSet |
|
the Statement for this DataSet |
This file is part of the Creole[php4] library.
Copyright © 2004 Hans Lellelid |   |
Creole[php4] CVS
|