TRUE converts to 1 and FALSE converts to 0 during query parsing, therefore those two values behave exactly like the respective numbers, e.g. TRUE + TRUE = 2 and FALSE is not NULL.
Posted by Victor Porton on September 27 2008 4:38pm
I suggest using "ENUM('on') NULL" for representing boolean values. This should work well with HTML checkboxes, which are submitted like x=on or as nothing (read undef in Perl, what correspond to NULL in SQL).
Posted by Jonathan Wooldridge on September 15 2009 3:54am
User Comments
TRUE converts to 1 and FALSE converts to 0 during query parsing, therefore those two values behave exactly like the respective numbers, e.g. TRUE + TRUE = 2 and FALSE is not NULL.
I suggest using "ENUM('on') NULL" for representing boolean values. This should work well with HTML checkboxes, which are submitted like x=on or as nothing (read undef in Perl, what correspond to NULL in SQL).
MaryOldEnough AND JaneOldEnough = SeatParty
true AND true = true; 1*1=1
true AND false = false; 1*0=0
false AND false = false; 0*0=0
MaryIsMember OR JaneIsMember = SeatParty
true OR true = true; 1+1=1
true OR false = true; 1+0=1
false OR false = false; 0+0=0
Is there a counter-argument that suggests substituting other non-zero integers would be detrimental?
Add your own comment.