UPDATED Re: 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>
Subject: UPDATED Re: ToBoolean method return correct Boolean values as per JDBC spec
Date: 2003-07-03 18:35:19
Message-ID: 1057257319.4299.33.camel@topanga.toronto.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches

On Wed, 2003-06-18 at 14:02, Kim Ho wrote:
> 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.
>
Now accepts things like 1.0 from Double columns and whatnot.

> 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()
>

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Roman Fail 2003-07-03 18:40:19 No timeout to establish Connection?
Previous Message Kim Ho 2003-07-03 17:17:57 JDBC Driver: Check for closed statement

Browse pgsql-patches by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-07-04 01:50:36 Re: "fix" for plpgsql polymorphism
Previous Message Joe Conway 2003-07-03 18:10:38 Re: "fix" for plpgsql polymorphism