setBoolean and char/varchar

From: "Paulo Merson" <paulo(at)summa-tech(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: setBoolean and char/varchar
Date: 2002-01-16 16:52:33
Message-ID: 000d01c19eae$31d14160$c501a8c0@PAULO
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

If you store '0' and '1' in a varchar(1) or char(1) column, you can read
false and true respectively using ResultSet.getBoolean. This is great,
especially if you are migrating from an Oracle database (shamefully
Oracle doesn't have a Boolean data type).

However, if you try to use PreparedStatement.setBoolean to set a value
used in the "where" clause to compare to that '0'-or-'1' varchar(1) or
char(1) column, then your select returns nothing.

Isn't this behavior inconsistent between getBoolean and setBoolean? Is
this a bug?

(Oracle jdbc driver does allow getBoolean and setBoolean with char(1)
and varchar2(1) consistently).

Thanks,

Paulo Merson
Summa Technologies - www.summa-tech.com

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vianen, Jeroen van 2002-01-16 19:06:55 Re: Problem with getImportedKeys / getExportedKeys
Previous Message zhousj 2002-01-16 02:29:13 jdbc bug