in reply to NULL and placeholders

Okay I tried this little fix just before the statement gets executed in prepare_and_execute()

my $i = 0; for (@binds) { undef $binds[$i] unless $binds[$i]; ++$i; }

That seems to get the desired results now.</code>

Replies are listed 'Best First'.
Re: Re: NULL and placeholders
by dws (Chancellor) on Jul 26, 2002 at 16:50 UTC
    The problem with   for (@binds) { undef $binds[$i] unless $binds[$i]; ++$i; } is that you'll bind NULL in place of zero or blank. If that's what you want, then O.K. If it's not what you want, then you need to make sure that you're carrying around a blank or zero in your data structures where you really undef/NULL. Then you can omit the statement above entirely.

      Yes someone else pointed me to that little problem as well on the mason-users mailing list. Someone also mentioned a little bit about the problem I am having. Unless the value is explicitly defined as undef MySQL will automatically interpret it as foo varchar(50) NOT NULL default ''. It was also said that this behaviour cannot be changed in MySQL.