List of utility methods to do SQL Type
Integer | getSQLType(String text) Returns the SQL TYPE for a string for example if text is "VARCHAR" java.sql.Types.VARCHAR is returned if (text.contains(".") && text.substring(0, types.length()).equalsIgnoreCase(types)) { text = text.substring(types.length(), text.length()); if (!text.contains(".")) { try { java.lang.reflect.Field f = java.sql.Types.class.getField(text); return f.getInt(f); } catch (IllegalArgumentException e) { ... |
int | getSQLType(String type) get SQL Type if ("string".equalsIgnoreCase(type)) { return Types.VARCHAR; } else if ("varchar".equalsIgnoreCase(type)) { return Types.VARCHAR; } else if ("char".equalsIgnoreCase(type)) { return Types.CHAR; } else if ("float".equalsIgnoreCase(type)) { return Types.FLOAT; ... |
String | getSqlTypeAsString(int jdbcType) Returns a string representation of the given java.sql.Types value. String statusName = "*can't find String representation for sql type '" + jdbcType + "'*"; try { Field[] fields = Types.class.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { if (fields[i].getInt(null) == jdbcType) { statusName = fields[i].getName(); break; } catch (Exception ignore) { return statusName; |
int | getSQLTypeByName(String type) Returns the SQL type by type name. Integer val = sqlTypeMap.get(type.toUpperCase()); if (val != null) { return val; throw new RuntimeException("Type by name '" + type + "' is not a recognized java.sql.Types type"); |
int | getSqlTypeByValue(Object value) Finds appropriate SQL type for the given value. if (value instanceof Integer) { return Types.INTEGER; } else if (value instanceof java.math.BigDecimal) { return Types.NUMERIC; } else if (value instanceof String) { return Types.VARCHAR; } else if (value instanceof Byte) { return Types.TINYINT; ... |
String | getSqlTypeName(int sqlType) get Sql Type Name try { Integer val = sqlType; for (Field field : Types.class.getFields()) { if (val.equals(field.get(null))) { return field.getName(); } catch (IllegalAccessException e) { ... |
String | getSQLTypeName(int sqlType) get SQL Type Name String resultType = null; switch (sqlType) { case java.sql.Types.BIT: { resultType = "BIT"; case java.sql.Types.BIGINT: { resultType = "BIGINT"; break; ... |
String | getSQLTypeName(int sqlType) get SQL Type Name switch (sqlType) { case java.sql.Types.BIGINT: return "BIGINT"; case java.sql.Types.BINARY: return "BINARY"; case java.sql.Types.BIT: return "BIT"; case java.sql.Types.CHAR: ... |
String | getSqlTypeName(int type) get Sql Type Name switch (type) { case Types.BIT: return "BIT"; case Types.TINYINT: return "TINYINT"; case Types.SMALLINT: return "SMALLINT"; case Types.INTEGER: ... |
String | getSQLTypeName(Integer sqltypecode) get SQL Type Name if (SQLFieldMapping.size() <= 0) throw new Exception("java.sql.Types.class.getFields were not feched, cannot get SQL Type name"); return SQLFieldMapping.get(sqltypecode); |