Empty field gets set to 0 when updating bug

Andrew Marold drew at marold.org
Mon Aug 4 17:52:24 UTC 2008


David Marshall wrote:
> IIRC, the empty string gets "numified" to 0 by MySQL if it's putting it into
> a numeric column.  If you really want a NULL, your value needs to be undef.

Thanks David, that was enough to get me pointed in the right direction. 
I looked at other integer fields that allowed NULL values (qa_contact) 
and looked more at how those were handled. I took my field out of the 
loop it was in and handled it on its own, and just don't pass it to 
mysql if it's not set.

	Drew
-- 
Drew Marold - Drew at marold.org
Perl programmer, bass player, luthier, Gentleman Adventurer
Photography: http://www.flickr.com/photos/unstoppabledrew/

Nothing looks worse on your outdoors resume than a list of the possible
locations of your remains.




More information about the developers mailing list