On 12/8/11 7:16 AM, Bryan Pendleton wrote:
ResultSet rs = s.executeQuery("values upper('Straße')");
So it seems the value is returned correctly, but the meta-data is wrong
(STRASSE is 7 characters long, not 6). ij uses the meta-data to
determine how much space each column should have.
6 *characters* long, but 7 *bytes* long?
Do we have a way to represent such a difference?
The javadoc for ResultSetMetaData.getColumnDisplaySize() says that the
method returns a length in characters, not bytes. For character data,
ResultSetMetaData.getPrecision() is also supposed to return a length in
characters. Since there is no JDBC standard way of declaring the
application's character encoding, I don't think we can expect more
support out of the JDBC driver. Maybe ij could figure out the maximum
number of bytes per character in the codeset specified by
derby.ui.codeset. Then ij could multiply that by
ResultSetMetaData.getColumnDisplaySize() in order to calculate the
actual column display size.
Certainly sounds like a bug, and with a nice small test case!
As a workaround, the value can be cast to a slightly larger length:
values cast( ucase('Straßenbahn') as varchar( 12 ) );
Hope this helps,
-Rick
bryan