[
https://issues.apache.org/jira/browse/DERBY-4965?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen updated DERBY-4965:
--------------------------------------
Attachment: derby-4965-1a.diff
Attaching a patch (1a) that makes ParameterMappingTest expose the bug and
changes the code so that the test passes. I'm running the regression tests now.
The patch makes the following changes:
1) Tests: Make ParameterMappingTest expect "true" instead of "1" when putting a
boolean into a character type column.
2) Engine: Make SQLChar.setValue(boolean) set "true"/"false" instead of "1"/"0".
3) Client: Send boolean parameter values as booleans instead of smallints.
There was already code to do this in NetStatementRequest, but it didn't seem to
be used. I activated this code, but since older servers don't expect parameters
to be sent as booleans, I also added a new metadata method to check if this is
supported by the server. I need to do some more digging to see if the code was
actually used in some situations in 10.7 after all, in which case we need more
logic to decide whether or not to use the code.
4) Server: Let DRDAConnThread know what to do if it receives a parameter value
with type equal to DRDAConstants.DRDA_TYPE_NBOOLEAN.
> 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
> Attachments: derby-4965-1a.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.