[#5762] Add DataType.getSQLType(Configuration)

This commit is contained in:
lukaseder 2017-01-03 15:29:41 +01:00
parent 1ed96d2f18
commit 00ba912146
2 changed files with 20 additions and 1 deletions

View File

@ -69,6 +69,11 @@ public interface DataType<T> extends Serializable {
*/
int getSQLType();
/**
* Get the dialect-specific JDBC {@link Types} value.
*/
int getSQLType(Configuration configuration);
/**
* Get the data type binding associated with this data type.
*/

View File

@ -517,6 +517,11 @@ public class DefaultDataType<T> implements DataType<T> {
@Override
public /* final */ int getSQLType() {
return getSQLType(DSL.using(dialect).configuration());
}
@Override
public final int getSQLType(Configuration configuration) {
// TODO [#1227] There is some confusion with these types, especially
// when it comes to byte[] which can be mapped to BLOB, BINARY, VARBINARY
@ -578,6 +583,15 @@ public class DefaultDataType<T> implements DataType<T> {
else if (EnumType.class.isAssignableFrom(type)) {
return Types.VARCHAR;
}
@ -585,7 +599,7 @@ public class DefaultDataType<T> implements DataType<T> {
return Types.STRUCT;
}
else if (Result.class.isAssignableFrom(type)) {
switch (dialect.family()) {
switch (configuration.family()) {