On Thu, Jul 9, 2009 at 5:02 PM, Matt Whipple <[email protected]> wrote:
> Paul Makepeace wrote: > >> On Thu, Jul 9, 2009 at 4:47 PM, fREW Schmidt<[email protected]> wrote: >> >> >>> On Thu, Jul 9, 2009 at 4:34 PM, Chisel Wright <[email protected]> >>> wrote: >>> >>> >>>> On Thu, Jul 09, 2009 at 10:17:46AM -0500, fREW Schmidt wrote: >>>> >>>> >>>>> 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.� >>>>> >>>>> >>>> Erk! Each to their own. >>>> >>>> Where are these empty strings coming from in the first place? Ideally, >>>> and unsurprisingly, I'd much rather have "undef" for "a field value that >>>> hasn't been defined". >>>> >>>> To me, and presumably others, '' (blank) means "we know what it is, it's >>>> nothingness". >>>> >>>> Can't the incoming data be "fixed" instead of kludging your queries? >>>> >>>> >>> Well that's what I'm doing. I'm fixing it. Iterating over given values >>> and >>> changing them from blanks to undefs. If you know a way to do that with >>> javascript (http posts) let me know, but as far as I know it will submit >>> blanks for blank fields. >>> >>> >> HTML::FormFu does this I think (treats empty as undefined). > This is all in javascript. I'm sure I could just use formfu for the receiving end, but I've been pretty happy with Data::FormValidator. > > >> Why do you want them to be NULL? As a general rule, unless you have a >> specific requirement for NULL they're best avoided (see discussion >> passim). Even when you think you have all the bases covered there's >> some weird case where they turn out to be a PITA later... >> >> Paul >> >> > I think the danced around suggestion is that you remove those fields from > the query entirely and let the database system handle it implicitly. > That doesn't work. If the user is trying to change a field with 5 to null how could they do it if I removed it from the update? Anyway, Thanks for all of your responses guys, but I think that my handling it in the controller (or per field in the model) will work fine for now. -- fREW Schmidt http://blog.afoolishmanifesto.com
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]
