List of utility methods to do SQL Type
int | translateType(int sqlType) Translate a SQL type into one of a few values. int retType = sqlType; if (Types.BIT == sqlType || Types.TINYINT == sqlType || Types.SMALLINT == sqlType || Types.INTEGER == sqlType) retType = Types.INTEGER; else if (Types.CHAR == sqlType || Types.VARCHAR == sqlType) retType = Types.VARCHAR; else if (Types.DECIMAL == sqlType || Types.DOUBLE == sqlType || Types.FLOAT == sqlType || Types.NUMERIC == sqlType || Types.REAL == sqlType) ... |
String | typeName(int type) Returns the name associated with a SQL type. switch (type) { case Types.BIGINT: return "BIGINT "; case Types.BINARY: return "BINARY"; case Types.BIT: return "BIT"; case Types.CHAR: ... |
int | typeNameToValueType(String typeName) type Name To Value Type Integer valueType = typeMap.get(typeName.toLowerCase(Locale.ENGLISH));
return valueType == null ? java.sql.Types.OTHER : valueType;
|
Class> | typeToClass(int type) Returns the class associated with a SQL type. Class<?> result; switch (type) { case Types.BIGINT: result = Long.class; break; case Types.BINARY: result = String.class; break; ... |
String | typeToString(int sqlType) type To String switch (sqlType) { case Types.ARRAY: return "ARRAY"; case Types.BIGINT: return "BIGINT"; case Types.BINARY: return "BINARY"; case Types.BIT: ... |
void | writeObject(Object obj, int sqlType, DataOutput out) write Object switch (sqlType) { case Types.VARCHAR: { String s = obj.toString(); out.writeUTF(s); return; case Types.FLOAT: { Float f = (Float) obj; ... |