Java Utililty Methods SQL Type

List of utility methods to do SQL Type

Description

The list of methods to do SQL Type are organized into topic(s).

Method

inttranslateType(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)
...
StringtypeName(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:
...
inttypeNameToValueType(String typeName)
type Name To Value Type
Integer valueType = typeMap.get(typeName.toLowerCase(Locale.ENGLISH));
return valueType == null ? java.sql.Types.OTHER : valueType;
ClasstypeToClass(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;
...
StringtypeToString(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:
...
voidwriteObject(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;
...