This seems like confusion and bugs waiting to happen. Forcing the user to do something
> $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..
alan,
you hit the "nail on the head" - zeev, do you see any way to solve alans problem?
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...
Zeev
counter intuitive like :
$do->birthday = DB_DataObject::setNull();
vs.
$do->birthday = null;
This just begs for mistakes to happen using actuall null, since it is used everywhere else within PHP. People will forget they have to use a 'hacked' setNull() method, just to set something to a logical null value. This doesn't seem like a good 'solution' to me. People will want to do $foo = null;
Walt
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php