Re: TEMP column created via set_sql and MySQL DATE_FORMAT function returns 0 in Class::DBI but valid data from command-line

[prev] [thread] [next] [Date index for 2005/02/15]

From: Tim Bunce
Subject: Re: TEMP column created via set_sql and MySQL DATE_FORMAT function returns 0 in Class::DBI but valid data from command-line
Date: 22:39 on 15 Feb 2005
On Mon, Feb 14, 2005 at 02:31:30PM -0800, Terrence Brannon wrote:
> I am using mysql's DATE_FORMAT function to make a datetime column
> human-readable. Cutting and pasting the SQL in a set_sql statement from
> a Class::DBI package works fine. However, when I attempt to access this
> column as a TEMP column, the date comes back as double zeros.

> __PACKAGE__->set_sql(recent_results => qq{ 
>    SELECT DATE_FORMAT(creation_datetime,'%b %d') as battle_date,

I'd take a guess that those percent symbols need to be escaped, probably
by doubling them in standard sprintf style:

     SELECT DATE_FORMAT(creation_datetime,'%%b %%d') as battle_date,

But it's just a guess.

Tim.

Re: TEMP column created via set_sql and MySQL DATE_FORMAT function returns 0 in Class::DBI but valid data from command-line
Tim Bunce 22:39 on 15 Feb 2005

Generated at 11:21 on 20 Feb 2005 by mariachi v0.52