Re: DB_DataObjects
| From: | Alan Knowles | Date: | Mon, 22 Mar 2004 05:55:13 +0000 |
| Subject: | Re: DB_DataObjects | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-11436@lists.php.net to get a copy of this message | ||
Markus Wolff wrote:
Daniel Kopp schrieb:Actually that message comes from the database. - DataObjects, just relays it back. $person = DB_DataObject::factory('person'); $person->get(12); $person->name = 'fred'; $person->update(); // will create and send a query with all data from person. $person = DB_DataObject::factory('person'); $person->get(12); $original_person = clone($person); $person->name = 'fred'; $person->update($original_person); will only create a shorter SQL statement like UPDATE person SET name='fred' WHERE id=12; (where only the differences are sent thorugh as the SET part.) Regards AlanAnd ... does DB_DataObjects know now that it does not need to do anything upon "update" if the given array is the same as the Objects values?When you turn up the debug level using (for example) DB_DataObject::debugLevel(5), then you'll see that DataObject is capable of finding out by itself if an update actually needs to be performed. If not, it will print a debug message like "No data affected by update".
CU Markus