boolean values in postgresql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux