[ 
https://issues.apache.org/jira/browse/DERBY-4965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986897#action_12986897
 ] 

Knut Anders Hatlen commented on DERBY-4965:
-------------------------------------------

Thanks for digging through ancient history, Myrna. I'm wondering if it
could be referring to some version of this document:
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/rjvjcdif.htm

It says the following about the conversion changed in this issue:

,----
| Result of using setObject with a Boolean input type and a CHAR target type
| 
| With the DB2 Universal JDBC Driver, when you execute
| PreparedStatement.setObject(parameterIndex,x,CHAR), and x is Boolean,
| the value "0" or "1" is inserted into the table column.
| 
| With the DB2 JDBC Type 2 Driver, the string "false" or "true" is
| inserted into the table column. The table column length must be at
| least 5.
`----

Before the change, our drivers behaved like what's described for the
DB2 Universal JDBC Driver. After the change, our drivers behave like
what the document describes for the DB2 JDBC Type 2 Driver, with the
exception that the value "true" can be inserted into a column whose
length is 4.

The other reference to differences.html in CrossConverters.java is
about getBoolean() semantics. Here's what the document says about that
case:

,----
| Result of using getBoolean to retrieve a value from a CHAR column
| 
| With the DB2 Universal JDBC Driver, when you execute
| ResultSet.getBoolean or CallableStatement.getBoolean to retrieve a
| Boolean value from a CHAR column, and the column contains the value
| "false" or "0", the value false is returned. If the column contains
| any other value, true is returned.
| 
| With the DB2 JDBC Type 2 Driver, when you execute ResultSet.getBoolean
| or CallableStatement.getBoolean to retrieve a Boolean value from a
| CHAR column, and the column contains the value "true" or "1", the
| value true is returned. If the column contains any other value, false
| is returned.
`----

Here, both our drivers behave like the DB2 Universal JDBC Driver. This
behaviour is unchanged from previous releases.

In any case, I think it's fine to remove the references. Will post a
patch shortly.

> Boolean to char conversion results in integer
> ---------------------------------------------
>
>                 Key: DERBY-4965
>                 URL: https://issues.apache.org/jira/browse/DERBY-4965
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.8.0.0
>
>         Attachments: derby-4965-1a.diff, derby-4965-1b.diff, 
> derby-4965-1c.diff
>
>
> Seen when running the Java EE CTS on Derby 10.7.1.1. The following code 
> results in "1" being printed, whereas the expected result is "true":
>         PreparedStatement ps = c.prepareStatement("values cast(? as 
> char(10))");
>         ps.setObject(1, Boolean.TRUE, Types.CHAR);
>         ResultSet rs = ps.executeQuery();
>         rs.next();
>         System.out.println(rs.getString(1));
> Same seen when using VARCHAR or LONGVARCHAR instead of CHAR, and when using 
> setBoolean() instead of setObject().

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to