Integer is okay: CHAR in SQL means one character. At the moment unicode is preserved for 65536 (four digits, hexadecimal => 16 ^ 4) different characters (http://www.unicode.org/charts/charindex.html). These are mapped to numbers, e.g. &#x20ac for the euro sign.
For Java it's similar (http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#9151):
The character '\u20ac' is mapped to the integer 8364. So the char type is a subset of the int type.


Joerg

Christian Kurz wrote:
Hi there,

when reusing some of the AbstractDatabaseAction code, I found that there
might be a tiny problem when working with CHAR fields: is it correct to
retrieve them as Integers? See code snippet below.

Best regards,
Christian


AbstractDatabaseAction.java:


... case Types.BIT:
value = new Integer(set.getInt(dbcol));
break;
case Types.CHAR:
=> value = new Integer(set.getInt(dbcol));


=> Shouldn't this be: value = new String(set.getString(dbcol)); ?

                break;
            case Types.STRUCT:
                  value = (Struct) set.getObject(dbcol);
            ...


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to