db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James A. Hillyerd" <ja...@whynotown.com>
Subject Re: Postgres aapter bug
Date Fri, 25 Apr 2003 17:03:35 GMT
Hi Thomas,

I've submitted a similar patch in the past, I think other people have as
well.  If you look at the patch that went into revision 1.8: "added a DB
adapter method to give a valid boolean value, used it in SqlExpression,
and added tests for the couple variations."  It's exactly what you
propose.  

But then someone reverts it for revision 1.10:
http://scarab.tigris.org/issues/show_bug.cgi?id=368

Basically every postgresql/torque user has to pay for Scarab's shoddy
database design.  I'm stuck using a modified version of torque for this
very reason.

Link to my previous threads on this subject:

http://www.mail-archive.com/turbine-torque-dev@jakarta.apache.org/msg01625.html
http://www.mail-archive.com/turbine-torque-dev@jakarta.apache.org/msg00329.html

-james

On Fri, 2003-04-25 at 08:12, Thomas Fogwill wrote:
> Hi
> 
> There seems to be a bug in the postgres adapter. Postgres expects the
> strings "true" and "false" for boolean fields, but the adapter returns
> "1" and "0".
> 
> Currently, this is what method getBooleanString in
> org.apache.torque.adapter.DBPostgres looks like:
> 
>     /**
>      * Override the default behavior to associate b with null?
>      *
>      * @see org.apache.torque.adapters.DB#getBooleanString
>      */
>     public String getBooleanString(Boolean b)
>     {
>         return (b == null) ? "0" : (Boolean.TRUE.equals(b) ? "1" : "0");
>     }
> 
> 
> I propose that it should be:
> 
>     /**
>      * Override the default behavior. If b is null return
>      * "false", else return b.toString(). 
>      *
>      * @see org.apache.torque.adapters.DB#getBooleanString
>      */
>     public String getBooleanString(Boolean b)
>     {
>         return (b == null) ? "false" : b.toString();
>     }
> 
> 
> A patch is attached.
> 
> -- 
> Thomas Fogwill <tfogwill@csir.co.za>
> Senior Systems Architect/Developer: ICT Programme
> Information, Communication and Space Technology
> CSIR
> Tel: +27 12 841 3155
-- 
James A. Hillyerd <james@whynotown.com>
WhyNotOwn.com - http://www.whynotown.com/


Mime
View raw message