Home » Database » DB_DataObject » Bug #4535
postgresql's boolean still broken
Details
| Submitted | 2005-06-06 08:41 UTC |
|---|---|
| From | daniel at konczyk dot net |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | 4.3.10 |
| OS | debian gnu/linux |
| Roadmaps | (Not assigned) |
Comments
[2005-06-06 08:41 UTC] daniel at konczyk dot net
Description:
------------
Handling of boolean values in postgresql database is still broken in db_dataobject
look at the current CVS, method 'update', line 1198
($v & DB_DATAOBJECT_BOOL) ? (int)(bool)$this->$k : $this->$k
when you select boolean field from postgresql, then the result value will be (let's assume there's 'not null' flag) 't' for true or 'f' for false
then piece of code above will always return true, in this example it will return 1 and thus will update all boolean fields that do not appear in posted data to true...
unless I overlooked something
[2005-06-16 08:14 UTC] daniel at konczyk dot net
Well, you have to make a dirty patch for postgresql I think. I know you don't like it and you have already told us a zillion times about it, but as that's the only way I guess, as this is postgresql-only 'feature'
Actually, you have to take care of false only, for example
($v & DB_DATAOBJECT_BOOL) ? (int)(bool)($this->$k == 'f'?0:$this->$k) : $this->$k
or so
I know it looks awful, but I'd better it looks so, than do not work at all..