Subject RE: [Firebird-Java] Conversions by ResultSet.getter Methods
Author Rick DeBay
> use ResultSet.getString().charAt(0)

Yeah, I have to change the code to special case this. The normal case
is similar to:

setter.invoke( dtoObject, new Object[]{rsGetter.invoke( rs, colName ) }

So it is a straight pass through from the result set to the DTO set.

-----Original Message-----
From: Roman Rokytskyy [mailto:rrokytskyy@...]
Sent: Friday, November 19, 2004 5:10 PM
Subject: Re: [Firebird-Java] Conversions by ResultSet.getter Methods

> I was hoping to get back the ascii value of the character.

This is not defined in JDBC specs. You can always use ASCII() function
you define corresponding UDF) in your SELECT (it will automatically
data to a numeric column).

> It probably makes more sense to get back a numeric value.

At least that's how I understand the specification.

> The problem I have is that I quickly wrote a class that, given a
> ResultSet and an object, will use introspection on the object to
> know how to get column values from the ResultSet and set them on the
> object. If the matching setter for the object takes a char, there is
> no output from a ResultSet getter that I can pass in directly to the
> setter.

It would make more sense to use ResultSet.getString().charAt(0) (and not
ResultSet.getBytes()[0]). This code will handle the encoding conversion

> BTW, what do you mean by "even more?" I can extend this class to
> take advantage of Jaybird enhancements.

There's no new getters or setters. Enhancements were done to:

- more conversions are available (for example LONGVARBINARY also
getBinaryStream() method). I do not have the conversion table, so you
to check the code. Though I would not do this, but stick to the

- it was before (and probably still is) that PreparedStatement.setXXX
could be called only with the objects of the default mapping (i.e. where
the capital "X" stays in the table). JayBird also provides conversion
PreparedStatement.setXXX for the mapping with "x" from the table. So to
JayBird is symmetric in regard to getters in ResultSet and setters in

But again, I would stick to the specification.