List of utility methods to do SQL Type
Class | getReturnClass(String typeName) get Return Class Class result = null; if (typeName.equalsIgnoreCase("long")) { result = long.class; } else if (typeName.equalsIgnoreCase("int")) { result = int.class; } else if (typeName.equalsIgnoreCase("integer")) { result = Integer.class; } else if (typeName.equalsIgnoreCase("short")) { ... |
String | getSemestre(Integer actionformation_id, Connection connection, String actionformation_libellecourt) get Semestre String semestre = ""; String theQuery = "SELECT structures_id,typestructure_id " + "FROM actionstructure " + "NATURAL JOIN structures " + "WHERE actionformation_id=" + actionformation_id; try { System.out.println("Executing : " + theQuery); Statement theStmt = connection.createStatement(); ResultSet theRS1 = theStmt.executeQuery(theQuery); while (theRS1.next()) { ... |
String | getSerialPrimaryKeyTypeString(Connection conn) get Serial Primary Key Type String String dbms = conn.getMetaData().getDatabaseProductName(); if (SQLSERVER.equalsIgnoreCase(dbms)) return "BIGINT PRIMARY KEY IDENTITY"; if (ORACLE.equalsIgnoreCase(dbms)) return ORACLE_SERIAL_TYPE; return "SERIAL PRIMARY KEY"; |
String | getSimpleTypeString(String dbType) get Simple Type String if (dbType.startsWith("int")) { return "int"; } else if (dbType.startsWith("double")) { return "double"; } else if (dbType.startsWith("char")) { return "String"; } else if (dbType.startsWith("varchar")) { return "String"; ... |
Class> | getSQLAttributeType(int sqlType) Convert database type to connector supported set of attribute types Can be redefined for different databases Class<?> ret; switch (sqlType) { case Types.DECIMAL: case Types.NUMERIC: ret = BigDecimal.class; break; case Types.DOUBLE: ret = Double.class; ... |
SQLException | getSQLException(String message, String sqlState, Exception exception) Returns a SQLException and sets the initCause if running with a 1.4+ JVM. return getSQLException(message, sqlState, Integer.MIN_VALUE, exception);
|
String | getSQLParameterSubstring(String value, int type) get SQL Parameter Substring if (isNumericType(type)) { return value; } else { return "'" + value + "'"; |
String | getSqlType(int type) Gets the sqlType attribute of the FBUtils class switch (type) { case Types.ARRAY: return "ARRAY "; case Types.BIGINT: return "BIGINT "; case Types.BINARY: return "BINARY"; case Types.BIT: ... |
int | getSqlType(Object param) Returns SQL type matches the object. int type; if (param == null) { type = Types.NULL; } else { if (param instanceof String) type = Types.VARCHAR; else if (param instanceof Integer) type = Types.INTEGER; ... |
int | getSqlType(String cubridType) get the java.sql type map to cubrid data type. if (cubridType == null || cubridType.trim().equals("")) { return Types.VARCHAR; cubridType = cubridType.toUpperCase(); if (cubridType.equals("CHAR")) { return Types.CHAR; } else if (cubridType.equals("VARCHAR")) { return Types.VARCHAR; ... |