ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | enhydra List | March 2005 Index

<--  Date Index  --> <--  Thread Index  -->

DODS problem for boolean fields with Postgresql 8.0.1


Hi all,

I'm currently working with enhydra 5.2, using DODS (the same problem is also present with enhydra 5.1 (last revision).

I'm using DODS to store my data objects. One of which has q boolean field.

When I'm creating a new object and inserting it in the DB (postgresql 8.0.1), I get the error:

ERROR: column "reverse" is of type boolean but expression is of type character varying

When calling the save method.

I tracked down the bug to dods 6.2 method :

    protected void setPrepStmtParam_boolean(
            PreparedStatement stmt, int[] paramIndex, boolean value)
        throws java.sql.SQLException {
        stmt.setString(paramIndex[0]++, value ? "1" : "0");
    }

Which uses a string to represent the boolean value (which by the way, should be OK with postgres, '0' being a correct value for false...). After fixing dods-6.2-2 with th following method definition :

    protected void setPrepStmtParam_boolean(
            PreparedStatement stmt, int[] paramIndex, boolean value)
        throws java.sql.SQLException {
// FIX GS: Use a setBoolean, as the setString poses pbs with postgres 8.0.1
        //        stmt.setString(paramIndex[0]++, value ? "1" : "0");
        stmt.setBoolean(paramIndex[0]++, value);
    }

I recompiled dods and installed it in enhydra-5.2 directory and it works...

I don't know why the implementation used a setString rather than a setBoolean, maybe this breaks other databases ?

Hope this will be integrated soon in enhydra releases.

Regards, Gilles,

--
Gilles Sérasset
GETA-CLIPS-IMAG (UJF, INPG & CNRS)
BP 53 - F-38041 Grenoble Cedex 9
Phone: +33 4 76 51 43 80
Fax:   +33 4 76 44 66 75




<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.