List of utility methods to do SQL Type
int | getSQLTypePrecision(int sqlType) get SQL Type Precision int resultType = 10; switch (sqlType) { case java.sql.Types.BIT: { resultType = 1; case java.sql.Types.BIGINT: { resultType = 19; break; ... |
int | getSQLTypeRadix(int sqlType) get SQL Type Radix int result = -1; switch (sqlType) { case java.sql.Types.REAL: case java.sql.Types.DOUBLE: { result = 10; break; default: ... |
String | getSqlValue(Object o) get Sql Value String rtn = null; if (o == null) { rtn = null; } else { if (o instanceof String) { rtn = (String) o; } else if (o instanceof Number || o instanceof BigDecimal || o instanceof StringBuffer) { rtn = o.toString(); ... |
String | getStringFormat(int colType) get String Format switch (colType) { case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT: return "%f"; case Types.DATE: case Types.TIME: case Types.TIMESTAMP: ... |
List | getTableTypes(DatabaseMetaData dbmd) get Table Types final List<String> tableTypes = new LinkedList<String>(); final ResultSet rs = dbmd.getTableTypes(); while (rs.next()) { tableTypes.add(rs.getString(1)); rs.close(); return tableTypes; |
String | getTinyIntTypeString(Connection conn) get Tiny Int Type String String dbms = getDbmsFromConnection(conn); if (dbms.equals(ORACLE)) return "NUMBER(1,0)"; if (dbms.equals(POSTGRESQL)) return "SMALLINT"; return "TINYINT"; |
int | getType(int csqltype) get Type switch (csqltype) { case 0: return Types.INTEGER; case 1: return Types.BIGINT; case 2: return Types.BIGINT; case 3: ... |
String | getTypeforValue(int type) Gets the Field name corresponding to the given type value. try { Class c = Types.class; Field[] fields = c.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { String name = fields[i].getName(); int value = fields[i].getInt(null); if (value == type) { return name; ... |
String | getTypeName(int dataType) Given an int datatype, return the java.sql.Types name for that datatype. switch (dataType) { case Types.BIGINT: return "BIGINT"; case Types.BINARY: return "BINARY"; case Types.BIT: return "BIT"; case Types.CHAR: ... |
String | getTypeName(int typeNumber) returns the type names based on the type from java.sql.Types switch (typeNumber) { case Types.SMALLINT: return "SMALLINT"; case Types.INTEGER: return "INTEGER"; case Types.BIGINT: return "BIGINT"; case Types.FLOAT: ... |