Subject | Re: [Firebird-Java] Conversions by ResultSet.getter Methods |
---|---|
Author | Roman Rokytskyy |
Post date | 2004-11-19T21:01:36Z |
> I'm calling ResultSet.getByte() on a field defined as CHAR(1) andJayBird supports this table already (and even more). For your case it is
> I'm getting the exception:
>
> org.firebirdsql.jdbc.field.TypeConvertionException: Error converting to
> byte. Y
>
> According to
> http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/mapping.html#101
> 3836 drivers may support this mapping. Is it Jaybird's intention to
> support the entire table?
defined as:
public byte getByte() throws SQLException {
if (rs.row[numCol]==null) return BYTE_NULL_VALUE;
try {
return Byte.parseByte(getString().trim());
} catch (NumberFormatException nfex) {
throw (SQLException) createException(
BYTE_CONVERSION_ERROR+"
"+getString().trim()).fillInStackTrace();
}
}
However, if you have a CHAR(1) column containing "Y" as a value, converting
it to a byte seems problematic. :) Can you suggest what should be the result
of this conversion?
Roman