db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: German Sharp S and UCASE
Date Thu, 08 Dec 2011 15:49:18 GMT
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,
> bryan

View raw message