Re: pear mdb2 and null

From: Date: Sun, 12 Apr 2009 13:32:27 +0000
Subject: Re: pear mdb2 and null
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-291383@lists.php.net to get a copy of this message
On Apr 11, 2009, at 21:38, "Michael A. Peters" <mpeters@mac.com> wrote:
I've run into a small issue with mdb2. I have a mysql database with a field set to longtext not null. inserting "" into that field works just dandy when using the mysql_ functions. However, when using mdb2 - it converts "" to NULL which is NOT what I want to have happen, and the result is that the execute() fails because the database table does not accept NULL for that field. Why does mdb2 turn "" into NULL for a text type when MySQL knows there is a difference? How do I suppress that? --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Why not set a default in the field then, as am empty string and let the db handle field properly? Having a Not Null with no default is bad db design. Bastien

« previous php.general (#291383) next »