[jOOQ/jOOQ#14009] Add DataType.isBoolean()
This commit is contained in:
parent
3893d1e324
commit
0e63acf298
@ -1250,6 +1250,17 @@ public interface DataType<T> extends Named {
|
||||
*/
|
||||
boolean isInteger();
|
||||
|
||||
/**
|
||||
* Whether this data type is any boolean data type.
|
||||
* <p>
|
||||
* This applies to any of these types:
|
||||
* <ul>
|
||||
* <li> {@link SQLDataType#BIT}</li>
|
||||
* <li> {@link SQLDataType#BOOLEAN}</li>
|
||||
* </ul>
|
||||
*/
|
||||
boolean isBoolean();
|
||||
|
||||
/**
|
||||
* Whether this data type is any character data type.
|
||||
* <p>
|
||||
|
||||
@ -802,6 +802,11 @@ implements
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isBoolean() {
|
||||
return tType0() == Boolean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isString() {
|
||||
return tType0() == String.class;
|
||||
|
||||
@ -81,7 +81,7 @@ final class Coalesce<T> extends AbstractField<T> implements QOM.Coalesce<T> {
|
||||
case DERBY: {
|
||||
// [#13601] Workaround for https://issues.apache.org/jira/browse/DERBY-7139
|
||||
ctx.visit(DSL.function(N_COALESCE, getDataType(),
|
||||
Tools.map(fields, f -> f.getType() == Boolean.class ? new ParenthesisedField<>(f) : f, Field[]::new)
|
||||
Tools.map(fields, f -> f.getDataType().isBoolean() ? new ParenthesisedField<>(f) : f, Field[]::new)
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -7566,7 +7566,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
DataType dataType = f.getDataType();
|
||||
Class<?> type = dataType.getType();
|
||||
|
||||
if (type == Boolean.class)
|
||||
if (dataType.isBoolean())
|
||||
return condition(f);
|
||||
|
||||
// [#11631] [#12394] Numeric expressions are booleans in MySQL
|
||||
|
||||
Loading…
Reference in New Issue
Block a user