I would suggest checking for that value first and skipping the DT call
if there's a match.  Otherwise you could do a conditional sql query
which uses an if clause to convert those values to something valid on
the mysql side.

Bobby

-----Original Message-----
From: Napiorkowski, John [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 28, 2007 10:32 AM
To: [email protected]
Subject: trouble with DateTime::Format::MySQL and invalid database
entries

Hi,

 

I'm supporting some applications written on top of MySQL 4/5 and finding
that I have quite a few 

timestamp columns that are populated as "0000-00-00 00:00" from some
misbehaving programs.

My attempt to format those values into a DateTime object fails since DT
will die out when you

hit an invalid date.

 

Since altering those programs is something I can't do I was wondering if
anyone else had run

Into the problem and found a better way to handle it than simple to wrap
the call in an eval?

 

Perhaps there could be a flag that would relax the requirement of
parsing a bit so that instead

of die we could return a NULL or something else agreeable?

 

Thanks!

John Napiorkowski

Reply via email to