Re: [CDBI] Re: Trouble writing non-character fields

[prev] [thread] [next] [Date index for 2005/08/09]

From: Mark McWiggins
Subject: Re: [CDBI] Re: Trouble writing non-character fields
Date: 00:04 on 09 Aug 2005
Edward J. Sabol wrote:

>>Hi All, I presume this information is somewhere on the old mailing list
>>but I can't get to the archives, so I appreciate any guidance whatever
>>... I have Class::DBI working fine (with PostgreSQL) for everything but
>>writing non-character values.
>>
>>If I try to write (for instance) a Date field, I get an error like:
>>    
>>
>[...]
>  
>
>>Do I need to explicitly do something with 'deflate' for these
>>non-character types?
>>    
>>
>
>I think you need to tweak the SQL. Take a look at
>http://wiki.class-dbi.com/index.cgi?SettingDefaultValues
>
>If you have control over your database schema, another option is to make your
>date fields char fields instead of a DBMS-specific date field. Then "deflate"
>would work great and your code more portable to other database systems.
>
>Hope this helps,
>Ed
>
>_______________________________________________
>ClassDBI mailing list
>ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
>http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>
>  
>
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.

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 ...

Any thoughts? Thanks again.

        -- 
        Mark McWiggins
mark@xxxxxxxxxxxx.xxx
425-369-8286 (home/cell/vm -- let ring)


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Trouble writing non-character fields
Mark McWiggins 21:55 on 08 Aug 2005

[CDBI] Re: Trouble writing non-character fields
Edward J. Sabol 23:04 on 08 Aug 2005

Re: [CDBI] Re: Trouble writing non-character fields
Mark McWiggins 00:04 on 09 Aug 2005

[CDBI] Re: Trouble writing non-character fields
Edward J. Sabol 00:12 on 09 Aug 2005

Re: [CDBI] Trouble writing non-character fields
William Ross 09:45 on 09 Aug 2005

Generated at 13:17 on 19 Aug 2005 by mariachi v0.52