db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fogwill <tfogw...@csir.co.za>
Subject Postgres aapter bug
Date Fri, 25 Apr 2003 15:12:48 GMT
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

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Mailscanner thanks transtec Computers for their support.


Mime
View raw message