ToBoolean method return correct Boolean values as per JDBC spec

From: Kim Ho <kho(at)redhat(dot)com>
To: pgsql-jdbc-list <pgsql-jdbc(at)postgresql(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: ToBoolean method return correct Boolean values as per JDBC spec
Date: 2003-06-18 18:02:56
Message-ID: 1055959376.13891.57.camel@topanga.toronto.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches

Problem:
- The toBoolean() method treats all input strings that start with T, t,
or 1 as true. For instance, "The sun is not a star." is evaluated as
true...
However, booleans are only supposed to be true if the
value of the input string is equalsignorecase "True".
I've left in a single character string "1" and
a single character string "t" (or "T") for backwards compatibility.

new Boolean("this is not a boolean") produces a Boolean object that
represents false.

However, when you insert 'this is not a boolean' into a CHAR column and
use getBoolean to extract it, it returns true.

Fix:
- Different check in toBoolean()

Cheers,

Kim

Attachment Content-Type Size
fixtoboolean.diff text/plain 914 bytes

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Deepak Vasudevan K P 2003-06-18 18:49:34 forName finds Driver but getConnection doesn't (AGAIN)
Previous Message Kim Ho 2003-06-18 17:44:39 Fix getXXX methods when used with CHAR columns or columns with decimals

Browse pgsql-patches by date

  From Date Subject
Next Message Rod Taylor 2003-06-18 20:18:54 System Catalog Foreign Keys (linked)
Previous Message Rod Taylor 2003-06-18 17:45:40 Re: Runtime.SGML diff ... please expedite!