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

fREW Schmidt frioux at gmail.com
Fri Jul 10 01:21:38 GMT 2009


Yeah, I wrote a small filter for DFV that would translate '' to undef
because that is not built in behavior (or at least not according to Stosberg
:-)  ).  I am using missing_optional_valid, but it turns out that that
doesn't matter because of how dbix::class::validation works.  It doesn't
validate the params of update or insert, it validates the state of the
object just before saving it to the db.

And yes, clearly I'm not using js for EVERYTHING as I said I was using dfv,
dbic, and obviously perl.

Anyway, I'm reading up on what another poster said about nulls in the db.
So far I'm not convinced, but give me a while to read up on some of this
stuff.  I'd appreciate any other, more complete links relating to nulls in
the database.

It just seems to me that it make sense to have undefined values in a field,
but I need to think through that some more.

Thanks guys.

On Jul 9, 2009 6:59 PM, "Aaron Schrab" <aaron at schrab.com> wrote:

At 17:17 -0500 09 Jul 2009, fREW Schmidt <frioux at gmail.com> wrote: > > This
is all in javascript.  I...
It's obviously not all in JavaScript, since you're using DBIC.  And relying
completely on JS for data validation is an extremely bad idea.

If you're using Data::FormValidator, it should already handle giving you
undef for fields that were submitted as empty.  Normally, it won't even
include those fields in the hash of valid data that it returns, so trying to
get the value of the field out of that hash will default to undef.  If you
include the missing_optional_valid option in your call to it, empty fields
will be included in the valid hash, but still with undef as the value.

_______________________________________________ List:
http://lists.scsys.co.uk/cgi-bin/mailman/lis...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090709/42b=
43f2e/attachment.htm


More information about the DBIx-Class mailing list