From: | Barry Lind <blind(at)xythos(dot)com> |
---|---|
To: | Kim Ho <kho(at)redhat(dot)com> |
Cc: | pgsql-jdbc-list <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: ToBoolean method return correct Boolean values as per |
Date: | 2003-09-17 07:00:55 |
Message-ID: | 3F6806A7.90302@xythos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc pgsql-patches |
Patch applied.
thanks,
--Barry
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.
>
> 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
>
>
> ------------------------------------------------------------------------
>
> ? cloudscape.LOG
> Index: org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java,v
> retrieving revision 1.12
> diff -c -p -c -p -r1.12 AbstractJdbc1ResultSet.java
> *** org/postgresql/jdbc1/AbstractJdbc1ResultSet.java 3 May 2003 20:40:45 -0000 1.12
> --- org/postgresql/jdbc1/AbstractJdbc1ResultSet.java 18 Jun 2003 14:22:43 -0000
> *************** public abstract class AbstractJdbc1Resul
> *** 766,773 ****
> {
> if (s != null)
> {
> ! int c = s.charAt(0);
> ! return ((c == 't') || (c == 'T') || (c == '1'));
> }
> return false; // SQL NULL
> }
> --- 766,773 ----
> {
> if (s != null)
> {
> ! s = s.trim();
> ! return (s.equalsIgnoreCase("true") || s.equals("1") || s.equalsIgnoreCase("t"));
> }
> return false; // SQL NULL
> }
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2003-09-17 08:21:59 | Re: Fix for receiving empty query errors. |
Previous Message | sc0698 | 2003-09-17 04:56:45 | Re: rsetMetaData.getColumnCount(); |
From | Date | Subject | |
---|---|---|---|
Next Message | psql-mail | 2003-09-17 14:35:31 | Re: backend crashing despite tsearch2 patch |
Previous Message | Mendola Gaetano | 2003-09-16 16:41:35 | Re: strdup => xstrdup patche |