[CDBI] Re: Trouble writing non-character fields

Edward J. Sabol sabol at alderaan.gsfc.nasa.gov
Tue Aug 9 01:12:01 BST 2005

>> I think you need to tweak the SQL. Take a look at
>> http://wiki.class-dbi.com/index.cgi?SettingDefaultValues
> Thanks, but in this case I'm not creating a new record but updating
> one. The set_sql() function looks to assume you're doing a SELECT.

I think you didn't look closely enough. Look for the text "If you wanted to
do something similar for UPDATEs, you would override the 'update' SQL".

> The standard 'update' method shows itself in the doc, but there's no 
> indication of how to do
>     if typeof thing-to-update == DATE
>     {
>        CAST %S as "date"
>     }
>     else
>     {
>        %s
>     }
> inside the SQL ...

Class::DBI doesn't support that, out of the box, because that's
DBMS-specific. But I think you can override the SQL on a per-class basis as
that Wiki page suggests.

More information about the ClassDBI mailing list