List of utility methods to do SQL Type
String | getTypeNameForJDBCType(int jdbcType) Return the type name to be used for a given JDBC type. String typeName = null; switch (jdbcType) { case OPAQUE: case Types.SQLXML: typeName = XMLTYPE_STR; break; default: break; ... |
String | getTypeStringForObject(Object o) Gets an SQL Type field string based on the given object. if (o instanceof String) return "VARCHAR"; if (o instanceof Byte) return "TINYINT"; if (o instanceof Boolean) return "BOOLEAN"; if (o instanceof Short) return "SMALLINT"; ... |
String | getUDTOwner(String typeName, String dbName, Connection conn) get UDT Owner if (typeName != null && !typeName.trim().equals("")) { Statement stat = null; ResultSet rs = null; String ownerName = null; try { String query = "SELECT U.name owner_name,T.name udt_name, PHY.name udt_sys_name, T.length udt_length," + "T.prec udt_precision, T.scale udt_scale, T.allownulls udt_allow_nulls, T.ident udt_is_identity," + "(SELECT DO.name + '.' + object_name(T.tdefault,db_id('" + dbName + "')) " + "FROM " ... |
int | getValueType(String inputValue) get Value Type double doubleValue; long intValue; if (inputValue.startsWith("\"") | inputValue.startsWith("'")) return Types.CHAR; try { if (inputValue.trim().indexOf(".") > -1) { doubleValue = Double.parseDouble(inputValue.trim()); return Types.FLOAT; ... |
String | getVarcharTypeString(Connection conn, int length) get Varchar Type String if (isOracleServer(conn)) return String.format("VARCHAR2(%s)", length); return String.format("VARCHAR(%s)", length); |
List | getViewIdsForTypes(Connection connection, String... types) get View Ids For Types ArrayList<Long> ids = new ArrayList<>(); StringBuilder sql = new StringBuilder("SELECT id FROM portti_view"); if (types != null && types.length > 0) { sql.append(" WHERE type IN (?"); for (int i = 1; i < types.length; ++i) { sql.append(", ?"); sql.append(")"); ... |
int | indexOf(Object[] array, Object objectToFind) Find the index of the given object in the array. This method returns return indexOf(array, objectToFind, 0);
|
Object | invokeJdbcMethod(Class> interfaceClass, String methodName, Class>[] argTypes, Object target, Object[] args) invoke Jdbc Method Method method = ClassUtils.getMethodIfAvailable(interfaceClass, methodName, argTypes); if (method == null) { return null; return ReflectionUtils.invokeJdbcMethod(method, target, args); |
boolean | isBinary(int dataType) is Binary switch (dataType) { case java.sql.Types.BLOB: case java.sql.Types.CLOB: case java.sql.Types.NCLOB: case java.sql.Types.BINARY: case java.sql.Types.VARBINARY: case java.sql.Types.LONGVARBINARY: case java.sql.Types.SQLXML: ... |
boolean | isBinary(int jdbcType) is Binary switch (jdbcType) { case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return true; default: return false; |