@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof DefaultDataTypeDefinition) { DefaultDataTypeDefinition other = (DefaultDataTypeDefinition) obj; if (!normalise(type).equals(normalise(other.type))) return false; if (userType == null && other.userType == null) return true; if (userType == null || other.userType == null) return false; return normalise(userType.last()).equals(normalise(other.userType.last())); } return false; }
public static DataType<?> getDataType(SQLDialect dialect, String typeName) { String normalised = DefaultDataType.normalise(typeName); DataType<?> result = TYPES_BY_NAME[dialect.ordinal()].get(normalised); // UDT data types and others are registered using SQL99 if (result == null) { result = TYPES_BY_NAME[SQLDialect.SQL99.ordinal()].get(normalised); } if (result == null) { // [#366] Don't log a warning here. The warning is logged when // catching the exception in jOOQ-codegen throw new SQLDialectNotSupportedException("Type " + typeName + " is not supported in dialect " + dialect, false); } return result; }
String normalised = DefaultDataType.normalise(typeName);
public static final DataType<?> getDataType(SQLDialect dialect, String typeName) { SQLDialect family = dialect.family(); int ordinal = family.ordinal(); String upper = typeName.toUpperCase(); String normalised = typeName; DataType<?> result = TYPES_BY_NAME[ordinal].get(upper); // [#3225] Normalise only if necessary if (result == null) { result = TYPES_BY_NAME[ordinal].get(normalised = DefaultDataType.normalise(typeName)); // UDT data types and others are registered using DEFAULT if (result == null) { result = TYPES_BY_NAME[SQLDialect.DEFAULT.ordinal()].get(normalised); // [#4065] PostgreSQL reports array types as _typename, e.g. _varchar if (result == null && ( family == POSTGRES) && normalised.charAt(0) == '_') result = getDataType(dialect, normalised.substring(1)).getArrayDataType(); // [#6466] HSQLDB reports array types as XYZARRAY if (result == null && family == HSQLDB && upper.endsWith(" ARRAY")) result = getDataType(dialect, typeName.substring(0, typeName.length() - 6)).getArrayDataType(); // [#366] Don't log a warning here. The warning is logged when // catching the exception in jOOQ-codegen if (result == null) throw new SQLDialectNotSupportedException("Type " + typeName + " is not supported in dialect " + dialect, false); } } return result; }
String normalised = DefaultDataType.normalise(typeName);
/** * Convert a type name (using precision and scale) into a Java class */ public static DataType<?> getDataType(SQLDialect dialect, String t, int p, int s) throws SQLDialectNotSupportedException { DataType<?> result = DefaultDataType.getDataType(dialect, DefaultDataType.normalise(t)); if (result.getType() == BigDecimal.class) { result = DefaultDataType.getDataType(dialect, getNumericClass(p, s)); } return result; }