Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7da6afe

Browse files
author
Barry Lind
committed
Small jdbc patch from Kim Ho at RedHat to fix some boolean problems
Modified Files: jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
1 parent 47cb1c3 commit 7da6afe

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Copyright (c) 2003, PostgreSQL Global Development Group
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.19 2003/09/17 07:00:24 barry Exp $
12+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.20 2003/09/18 04:09:02 barry Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -798,7 +798,18 @@ public static boolean toBoolean(String s)
798798
if (s != null)
799799
{
800800
s = s.trim();
801-
return (s.equalsIgnoreCase("true") || s.equals("1") || s.equalsIgnoreCase("t"));
801+
802+
if (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("t"))
803+
return true;
804+
805+
try
806+
{
807+
if (Double.parseDouble(s)==1)
808+
return true;
809+
}
810+
catch (NumberFormatException e)
811+
{
812+
}
802813
}
803814
return false; // SQL NULL
804815
}

0 commit comments

Comments
 (0)