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=?
See also TableDataSet::doUpdate()
TableDataSet::doDelete()
Author Jon S. Stevens <jon@latchkey.com> (Village)
Michael Aichler <aichle@mediacluster.de> (Jargon)
Hans Lellelid <hans@xmpl.org> (Jargon)
Version
Revision
This file is part of the Creole[php4] library.
Copyright © 2004 Hans Lellelid |   |
Creole[php4] CVS
|