AnantLabs / xerial

Automatically exported from code.google.com/p/xerial
0 stars 0 forks source link

Prepared statement can not handle boolean #90

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a table containing a field which type is 'boolean'
2. Insert some values
3. Create a PreparedStatement using boolan criteria
4. It won't retrieve any data.

I expect I can retrieve some matching rows

Version 3.7.2 on Ubuntu 10.04 64bit

This snippet may help you:

PreparedStatement st = connection.prepareStatement("select  md.\"from\", 
md.\"to\", md.going_out from mapping_details md    left join mappings m on m.id 
= md.mapping_id    left join endpoints e on e.id = m.endpoint_id where 
md.going_out = ?    and e.code = ?  and m.code = ?");
        //st.setBoolean(1, false); // THIS IS THE BUG
        st.setString(1, "false");
        st.setString(2, "edc01");
        st.setString(3, "02X000601");

        ResultSet rs = st.executeQuery();
        while (rs.next()) {
            System.out.println(rs.getString(1));
        }
        rs.close();

Original issue reported on code.google.com by ich...@gmail.com on 1 Feb 2011 at 10:30

GoogleCodeExporter commented 9 years ago
I've misposted. The problem is the field type is in text already. You should 
remove this bugs. Thx

Original comment by ich...@gmail.com on 1 Feb 2011 at 11:35