You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2010/11/06 02:44:41 UTC
[jira] Created: (DERBY-4890) Different string to boolean conversion
on embedded and client
Different string to boolean conversion on embedded and client
-------------------------------------------------------------
Key: DERBY-4890
URL: https://issues.apache.org/jira/browse/DERBY-4890
Project: Derby
Issue Type: Bug
Components: JDBC
Affects Versions: 10.7.1.0
Reporter: Knut Anders Hatlen
The following code fragment behaves differently on client and embedded:
PreparedStatement ps = c.prepareStatement("values cast(? as boolean)");
ps.setString(1, "TRUE");
ResultSet rs = ps.executeQuery();
rs.next();
System.out.println(rs.getBoolean(1));
Embedded prints "true". Client raises an exception:
Exception in thread "main" java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:72)
at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:884)
at SetByte.main(SetByte.java:6)
Caused by: org.apache.derby.client.am.SqlException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
at org.apache.derby.client.am.PreparedStatement$PossibleTypes.throw22005Exception(PreparedStatement.java:3069)
at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:874)
... 1 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4890) Different string to boolean
conversion on embedded and client
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12928912#action_12928912 ]
Knut Anders Hatlen commented on DERBY-4890:
-------------------------------------------
Same problem with setObject("TRUE").
> Different string to boolean conversion on embedded and client
> -------------------------------------------------------------
>
> Key: DERBY-4890
> URL: https://issues.apache.org/jira/browse/DERBY-4890
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.7.1.0
> Reporter: Knut Anders Hatlen
>
> The following code fragment behaves differently on client and embedded:
> PreparedStatement ps = c.prepareStatement("values cast(? as boolean)");
> ps.setString(1, "TRUE");
> ResultSet rs = ps.executeQuery();
> rs.next();
> System.out.println(rs.getBoolean(1));
> Embedded prints "true". Client raises an exception:
> Exception in thread "main" java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:72)
> at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:884)
> at SetByte.main(SetByte.java:6)
> Caused by: org.apache.derby.client.am.SqlException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.PreparedStatement$PossibleTypes.throw22005Exception(PreparedStatement.java:3069)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:874)
> ... 1 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (DERBY-4890) Different string to boolean
conversion on embedded and client
Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4890?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rick Hillegas reassigned DERBY-4890:
------------------------------------
Assignee: Rick Hillegas
> Different string to boolean conversion on embedded and client
> -------------------------------------------------------------
>
> Key: DERBY-4890
> URL: https://issues.apache.org/jira/browse/DERBY-4890
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.7.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
> Attachments: derby-4890-01-aa-setStringBoolean.diff
>
>
> The following code fragment behaves differently on client and embedded:
> PreparedStatement ps = c.prepareStatement("values cast(? as boolean)");
> ps.setString(1, "TRUE");
> ResultSet rs = ps.executeQuery();
> rs.next();
> System.out.println(rs.getBoolean(1));
> Embedded prints "true". Client raises an exception:
> Exception in thread "main" java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:72)
> at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:884)
> at SetByte.main(SetByte.java:6)
> Caused by: org.apache.derby.client.am.SqlException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.PreparedStatement$PossibleTypes.throw22005Exception(PreparedStatement.java:3069)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:874)
> ... 1 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (DERBY-4890) Different string to boolean
conversion on embedded and client
Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4890?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rick Hillegas resolved DERBY-4890.
----------------------------------
Resolution: Fixed
Fix Version/s: 10.7.1.0
Tests passed cleanly for me. Committed at subversion revision 1032780.
> Different string to boolean conversion on embedded and client
> -------------------------------------------------------------
>
> Key: DERBY-4890
> URL: https://issues.apache.org/jira/browse/DERBY-4890
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.7.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
> Fix For: 10.7.1.0
>
> Attachments: derby-4890-01-aa-setStringBoolean.diff
>
>
> The following code fragment behaves differently on client and embedded:
> PreparedStatement ps = c.prepareStatement("values cast(? as boolean)");
> ps.setString(1, "TRUE");
> ResultSet rs = ps.executeQuery();
> rs.next();
> System.out.println(rs.getBoolean(1));
> Embedded prints "true". Client raises an exception:
> Exception in thread "main" java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:72)
> at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:884)
> at SetByte.main(SetByte.java:6)
> Caused by: org.apache.derby.client.am.SqlException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.PreparedStatement$PossibleTypes.throw22005Exception(PreparedStatement.java:3069)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:874)
> ... 1 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DERBY-4890) Different string to boolean conversion
on embedded and client
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4890?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Knut Anders Hatlen closed DERBY-4890.
-------------------------------------
Verified. Thanks, Rick.
> Different string to boolean conversion on embedded and client
> -------------------------------------------------------------
>
> Key: DERBY-4890
> URL: https://issues.apache.org/jira/browse/DERBY-4890
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.7.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
> Fix For: 10.7.1.0
>
> Attachments: derby-4890-01-aa-setStringBoolean.diff
>
>
> The following code fragment behaves differently on client and embedded:
> PreparedStatement ps = c.prepareStatement("values cast(? as boolean)");
> ps.setString(1, "TRUE");
> ResultSet rs = ps.executeQuery();
> rs.next();
> System.out.println(rs.getBoolean(1));
> Embedded prints "true". Client raises an exception:
> Exception in thread "main" java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:72)
> at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:884)
> at SetByte.main(SetByte.java:6)
> Caused by: org.apache.derby.client.am.SqlException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.PreparedStatement$PossibleTypes.throw22005Exception(PreparedStatement.java:3069)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:874)
> ... 1 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4890) Different string to boolean
conversion on embedded and client
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12929493#action_12929493 ]
Knut Anders Hatlen commented on DERBY-4890:
-------------------------------------------
ParameterMappingTest contains two workarounds for this issue. Search for comments with this issue number in the source file.
> Different string to boolean conversion on embedded and client
> -------------------------------------------------------------
>
> Key: DERBY-4890
> URL: https://issues.apache.org/jira/browse/DERBY-4890
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.7.1.0
> Reporter: Knut Anders Hatlen
>
> The following code fragment behaves differently on client and embedded:
> PreparedStatement ps = c.prepareStatement("values cast(? as boolean)");
> ps.setString(1, "TRUE");
> ResultSet rs = ps.executeQuery();
> rs.next();
> System.out.println(rs.getBoolean(1));
> Embedded prints "true". Client raises an exception:
> Exception in thread "main" java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:72)
> at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:884)
> at SetByte.main(SetByte.java:6)
> Caused by: org.apache.derby.client.am.SqlException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.PreparedStatement$PossibleTypes.throw22005Exception(PreparedStatement.java:3069)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:874)
> ... 1 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4890) Different string to boolean conversion
on embedded and client
Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4890?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rick Hillegas updated DERBY-4890:
---------------------------------
Attachment: derby-4890-01-aa-setStringBoolean.diff
Attaching derby-4890-01-aa-setStringBoolean.diff. This patch fixes the bug. I am running tests now.
BOOLEAN needed to be added to the list of datatypes for which the network setString() method works.
Touches the following files:
-------------
M java/client/org/apache/derby/client/am/PreparedStatement.java
Added BOOLEAN to the list of datatypes for which setString() works.
-------------
M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
Added some test cases for this bug and for DERBY-4889.
-------------
M java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java
Removed code recently added to bypass this problem.
> Different string to boolean conversion on embedded and client
> -------------------------------------------------------------
>
> Key: DERBY-4890
> URL: https://issues.apache.org/jira/browse/DERBY-4890
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.7.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
> Attachments: derby-4890-01-aa-setStringBoolean.diff
>
>
> The following code fragment behaves differently on client and embedded:
> PreparedStatement ps = c.prepareStatement("values cast(? as boolean)");
> ps.setString(1, "TRUE");
> ResultSet rs = ps.executeQuery();
> rs.next();
> System.out.println(rs.getBoolean(1));
> Embedded prints "true". Client raises an exception:
> Exception in thread "main" java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:72)
> at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:884)
> at SetByte.main(SetByte.java:6)
> Caused by: org.apache.derby.client.am.SqlException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
> at org.apache.derby.client.am.PreparedStatement$PossibleTypes.throw22005Exception(PreparedStatement.java:3069)
> at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:874)
> ... 1 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.