[Dbix-class] '' != NULL for great sadness

fREW Schmidt frioux at gmail.com
Thu Jul 9 15:17:46 GMT 2009


On Thu, Jul 9, 2009 at 10:11 AM, Joel Bernstein <joel at fysh.org> wrote:

>
> On 9 Jul 2009, at 16:00, fREW Schmidt wrote:
>
>> On Thu, Jul 9, 2009 at 9:36 AM, Mike South <msouth at gmail.com> wrote:
>> First thing I would try is going to
>>
>> http://search.cpan.org/~timb/DBI/DBI.pm<http://search.cpan.org/%7Etimb/D=
BI/DBI.pm>
>>
>> search page for NULL, see if that helps.
>>
>> I looked through it and didn't see anything.  Someone told me it is a
>> function of the DBD so I am looking through DBD::ODBC, but so far, no lu=
ck.
>>
>
>
> He gave you a pointer to the answer already.
> Did you look at every occurrence of NULL on the DBI.pm POD?
>
> I just searched the page for NULL and found the relevant info that you
> needed regarding how NULL values are represented to Perl and thus how to
> enter NULLs into the database. Do you really not see it?
>

Oh yeah, I saw that for sure.  I was hoping for some kind of setting that I
could set that would convert '' to null in fields that aren't strings.  I
gave up and did this:

method fix_nullable($param) {
   if ($param eq '' ) {
      return undef;
   }
}

my $params =3D $self->query->Vars;
$params->{$_} =3D $self->fix_nullable($params->{$_}) for (qw{
      fixture_amount fixture_id photo_id photo_neg_id  });

-- =

fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090709/bb1=
c8b4d/attachment.htm


More information about the DBIx-Class mailing list