boolean values in postgresql

From: Date: Tue, 22 Feb 2005 02:54:21 +0000
Subject: boolean values in postgresql
Groups: php.db 
Request: Send a blank email to php-db+get-38631@lists.php.net to get a copy of this message
I am adding some functionality to a php/postgres based system and have a value that I want to be a boolean. digging around the pg doc I see the boolean datatype. Cool I say. So I happily alter the table and add the boolean column notify all is good until I retrieve it using pg_fetch_object and get a t or f back in myobject->notify Rats says I. a simple if ($myobject->notify) { blah } contruct won't work. So.. after reading a lot of stuff from both the php and pg doc and STFW until my eyes are tired, I am coming to you guys for advice. Assumption: There is no easy way to map a pg boolean data type to a value that will evaluate simply in php. I know I can code it but I would really like to keep this as simple as possible Question: Assuming the above assumption is correct, what is the most efficient way to define a column that will take only two values who's values will evaluate as intended in php? I am going to punt an go with a smallint unlet there is a way to store a bit. I am trying to get my head around bytea right now but thought I would ask while I am reading. Bret

« previous php.db (#38631) next »