List of utility methods to do SQL Type
Class> | jdbcType2javaType(int jdbcType) jdbc Typejava Type switch (jdbcType) { case Types.BIT: case Types.BOOLEAN: case Types.TINYINT: return Byte.TYPE; case Types.SMALLINT: return Short.class; case Types.INTEGER: ... |
String | jdbcTypeToKylinDataType(int sqlType) jdbc Type To Kylin Data Type String result = "any"; switch (sqlType) { case Types.CHAR: result = "char"; break; case Types.VARCHAR: case Types.NVARCHAR: case Types.LONGVARCHAR: ... |
String | listToJson(List list To Json if (list == null) return "null"; boolean first = true; StringBuilder sb = new StringBuilder(); Iterator<Object> iter = list.iterator(); sb.append('['); while (iter.hasNext()) { if (first) ... |
void | loadAllTypesData(Connection conn) Load only one record try (PreparedStatement statement = conn .prepareStatement("insert into ALL_TYPES values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")) { statement.setShort(1, (short) 32767); statement.setInt(2, 2147483647); statement.setLong(3, 9223372036854775807l); statement.setFloat(4, 1.11111111f); statement.setDouble(5, 2.222222222); statement.setBigDecimal(6, new BigDecimal("1234567890.1234567890")); ... |
void | loadTestDataForEveryType(Connection conn) load Test Data For Every Type try (PreparedStatement statement = conn .prepareStatement("insert into TEST values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")) { statement.setInt(1, 1); statement.setShort(2, (short) 2); statement.setLong(3, 3l); statement.setFloat(4, 4f); statement.setDouble(5, 5d); statement.setFloat(6, 6f); ... |
int | mapECLtype2SQLtype(String ecltype) map EC Ltype SQ Ltype if (mapECLTypeNameToSQLType.containsKey(ecltype)) { return mapECLTypeNameToSQLType.get(ecltype); } else { String postfixUpper = ecltype.substring(ecltype.lastIndexOf(':') + 1).toUpperCase(); if (mapECLTypeNameToSQLType.containsKey(postfixUpper)) return mapECLTypeNameToSQLType.get(postfixUpper); else { Matcher m = TRAILINGNUMERICPATTERN.matcher(postfixUpper); ... |
String | mapType(Class javaType) Map a Java type to a SQL type. if (javaType == Long.class) { return "bigint"; } else if (javaType == Blob.class) { return "blob"; } else if (javaType == String.class) { return "varchar( 32672 )"; } else if (javaType == Clob.class) { return "clob"; ... |
int | mapXSDTypeName2SQLtype(String xsdtype) map XSD Type Name SQ Ltype xsdtype = xsdtype.toUpperCase(); if (mapXSDTypeNameToSQLType.containsKey(xsdtype)) return mapXSDTypeNameToSQLType.get(xsdtype); else { String postfixUpper = xsdtype.substring(xsdtype.lastIndexOf(':') + 1); if (mapXSDTypeNameToSQLType.containsKey(postfixUpper)) return mapXSDTypeNameToSQLType.get(postfixUpper); else ... |
String | marshalCurlType(String javaType, boolean isAllowNull, boolean generateGenerics) marshal Curl Type String v = javaType; if (equalsOneOf(v, null, "null", "void", "V")) return "void"; else if (equalsOneOf(v, "java.lang.Object", "Object")) return "any"; else if (equalsOneOf(v, "java.lang.Character", "Character", "char", "C")) return "char"; else if (equalsOneOf(v, "java.lang.Boolean", "Boolean", "boolean", "Z")) ... |
ArrayList | matchMethods(String name, Method[] methods, Class[] spt, int mrs, boolean exact) Matches the given method name and it's parameter types to each candidate method in a given list of candidate methods. ArrayList list = new ArrayList(); for (int i = 0; i < methods.length; i++) { Method m = methods[i]; Class[] tpt = m.getParameterTypes(); boolean trailingParams = (tpt.length > spt.length); if (name.equals(m.getName())) if (matchParams(spt, tpt)) ... |