This class is used for doing select/insert/delete/update on the database.
A Record represents a row in the database.
This class is used to represent the results of a SQL select statements on the database.
Class for representing a SQL query for RETRIEVING results from a database.
Class for representing a SQL query for retrieving paged results from a database.
A KeyDef is a way to define the key columns in a table.
A DataSetException represents exception specific to the DataSet/Record layer.
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.
The KeyDef is generally used in conjunction with a TableDataSet. Essentially a KeyDef is what forms the WHERE clause for an UPDATE or DELETE.
In order to use the KeyDef, you simply use it like this: $kd = new KeyDef() $kd->addAttrib("key_column_a");
$tds = new TableDataSet($conn, "table", $kd); $tds->fetchRecords(); $rec = $tds->getRecord(0); $rec->setValue("column_name", "new value" ); $rec->save(); $tds->close();
In the above example, Record 0 is retrieved from the database table and the following update statement is generated:
UPDATE table SET column_name=? WHERE key_column_a=?
TableDataSet::doDelete()
Note that this class is for retrieving results and not performing updates.
Note that this class is for retrieving results and not performing updates.
Eventually this class may include methods which allow building of queries. Currently this just provides some convenience functions like getRows(), getCol() (based on PEAR::DB methods) and getDataSet().
This class is extended by PagedQuery, a convenience class for handling paged queries.
It should not be used for doing modifications via update/delete/insert statements. If you would like to perform those functions, please use a TableDataSet.
$qds = new QueryDataSet($conn, "SELECT * from my_table"); $qds->fetchRecords(10); // fetch the first 10 records foreach($qds as $rec) { $value = $rec->getValue("column"); } $qds->close();
It contains a hash of values which represent the column values for each row.
A TableDataSet cannot be used to join multiple tables for an update, if you need join functionality on a select, you should use a QueryDataSet.