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

StringsqlTypeToSetterGetter(int sqlType)
sql Type To Setter Getter
switch (sqlType) {
case Types.BIT:
    return "Boolean";
case Types.TINYINT:
    return "Boolean";
case Types.SMALLINT:
    return "Short";
case Types.INTEGER:
...
StringsqlTypeToSqlTypeName(final int type)
sql Type To Sql Type Name
try {
    final Integer typeValue = new Integer(type);
    final Field[] fields = Types.class.getDeclaredFields();
    for (int i = 0; i < fields.length; i++) {
        final Field field = fields[i];
        final Integer l = (Integer) field.get(null);
        if (typeValue.equals(l)) {
            return field.getName();
...
ClasstoClass(final int type)
Translates a data type from an integer (java.sql.Types value) to a class type.
Class<?> result = null;
switch (type) {
case Types.CHAR:
    result = Character.class;
    break;
case Types.VARCHAR:
case Types.LONGVARCHAR:
    result = String.class;
...
ClasstoClass(int sqlType, boolean isUnsigned)
to Class
return toClass(sqlType, -1, isUnsigned);
StringtoHCatType(int sqlType)
Resolve a database-specific type to HCat data type.
switch (sqlType) {
case Types.SMALLINT:
case Types.TINYINT:
case Types.INTEGER:
    return "int";
case Types.VARCHAR:
    return "varchar";
case Types.CHAR:
...
ClasstoJavaType(int sqlType, String type)
to Java Type
switch (sqlType) {
case Types.ARRAY:
    return Array.class;
case Types.BIGINT:
    return Long.class;
case Types.BINARY:
case Types.LONGVARBINARY:
case Types.VARBINARY:
...
inttoOdaDataType(Class odiTypeClass)
Converts an ODI type class to its corresponding ODA data type code.
int odaType = Types.CHAR; 
if (odiTypeClass == null)
    odaType = Types.CHAR;
else if (odiTypeClass == String.class)
    odaType = Types.CHAR;
else if (odiTypeClass == Integer.class)
    odaType = Types.INTEGER;
else if (odiTypeClass == Double.class)
...
inttoSqlType(Class clazz)
to Sql Type
if (clazz == String.class) {
    return Types.VARCHAR;
if (clazz == Float.class) {
    return Types.FLOAT;
if (clazz == Double.class) {
    return Types.DOUBLE;
...
inttoSqlType(String clickshouseType)
to Sql Type
if (isNullable(clickshouseType)) {
    clickshouseType = unwrapNullable(clickshouseType);
if (clickshouseType.startsWith("Int") || clickshouseType.startsWith("UInt")) {
    return clickshouseType.endsWith("64") ? Types.BIGINT : Types.INTEGER;
if ("String".equals(clickshouseType))
    return Types.VARCHAR;
...
inttoSqlType(String clickshouseType)
to Sql Type
if (clickshouseType.startsWith("Int") || clickshouseType.startsWith("UInt")) {
    return clickshouseType.endsWith("64") ? Types.BIGINT : Types.INTEGER;
if ("String".equals(clickshouseType))
    return Types.VARCHAR;
if (clickshouseType.startsWith("Float"))
    return Types.FLOAT;
if ("Date".equals(clickshouseType))
...