Re: variable_exists() patch
| From: | Zeev Suraski | Date: | Fri, 15 Aug 2003 13:29:02 +0000 |
| Subject: | Re: variable_exists() patch | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-3992@lists.php.net to get a copy of this message | ||
At 12:36 15/08/2003, Thies C. Arntzen wrote:
On Fri, Aug 15, 2003 at 07:41:48AM +0800, Alan Knowles wrote: I hit this a couple of months ago.. trying to implement NULL support in dataobjects: $do = DB_DataObject::factory('test'); $do->get(12); $do->birthday = null; $do->update(); was supposed to generate SELECT * FROM test WHERE id=12; UPDATE test SET birthday=NULL where id = 12; or $do = DB_DataObject::factory('test'); $do->birthday = null; $do->find(); to do SELECT * FROM test WHERE birthday IS NULL; but since there was no effective way to detect null, as apposed to unset.. I had to give up... - If this could be solved by variable_exists() - even though var $birthday is defined.. It would be great..Yep, there are several options, but using the language-level NULL is probably not one of them. You could have a setNull() method that defines the NULL values. You could have DB_DataObject::null_value defined to some value that is not used in SQL (e.g., an object) and use it instead. There are probably other ways as well... Zeevalan,you hit the "nail on the head" - zeev, do you see any way to solve alans problem?