[Dbix-class] RFC: Patch for InflateColumn::Datetime to handle invalid date values

John Napiorkowski jjn1056 at yahoo.com
Wed Jun 13 19:49:28 GMT 2007


Hi,

I'm running into a problem with
DBIC::InflateColumn::Datetime on MySql 5 when the
datetime column has an invalid value.  Seems like
Mysql5 likes to set timestamp columns to 00-00-00
00:00:00 if there is a null value.  Anyway, this
database I'm inheriting is littered with rows like
that and I have no access to the fix the systems
causing that data.

The problem is that when the mentioned module tries to
inflate those values DateTime throws an exception,
rightfully so, since that value isn't a valid date or
time value.

I've temporarily solved it by wrapping the inflation
in an eval like:

eval{$obj->_datetime_parser->$parse($value)};

But I'm trying to figure out the best way to handle
this and if you'd all like some sort of patch and test
for this issue.  Part of me thinks this should be
handled in the Mysql Storage module, under the
datetime parser section, but not sure what we'd like
the behavior to be.

for myself I'd prefer the behavior for this to return
a null value but perhaps raise a warning of some sort.

Any thoughts?  What would you all like (if anything)
in terms of a solution for this.  I can get some paid
time to work on this for us.  Please don't say
"Postgresql", I don't have that option on this
contract.

--john


       
____________________________________________________________________________________
Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz 



More information about the Dbix-class mailing list