[jOOQ/jOOQ#10064] trueCondition() and falseCondition() should generate TRUE and FALSE, where BOOLEAN types are supported
This commit is contained in:
parent
9a0f57a01c
commit
8fdbbcc500
@ -39,6 +39,9 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.Clause.CONDITION;
|
||||
import static org.jooq.Clause.CONDITION_COMPARISON;
|
||||
import static org.jooq.impl.Keywords.K_FALSE;
|
||||
import static org.jooq.impl.Keywords.K_TRUE;
|
||||
import static org.jooq.impl.TrueCondition.NO_SUPPORT_BOOLEAN;
|
||||
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Context;
|
||||
@ -60,7 +63,10 @@ final class FalseCondition extends AbstractCondition implements False {
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
ctx.sql("1 = 0");
|
||||
if (NO_SUPPORT_BOOLEAN.contains(ctx.dialect()))
|
||||
ctx.sql("1 = 0");
|
||||
else
|
||||
ctx.visit(K_FALSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -40,9 +40,30 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.Clause.CONDITION;
|
||||
import static org.jooq.Clause.CONDITION_COMPARISON;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.impl.Keywords.K_TRUE;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.True;
|
||||
|
||||
/**
|
||||
@ -50,9 +71,10 @@ import org.jooq.True;
|
||||
*/
|
||||
final class TrueCondition extends AbstractCondition implements True {
|
||||
|
||||
private static final long serialVersionUID = 775364624704563687L;
|
||||
private static final Clause[] CLAUSES = { CONDITION, CONDITION_COMPARISON };
|
||||
static final TrueCondition INSTANCE = new TrueCondition();
|
||||
private static final long serialVersionUID = 775364624704563687L;
|
||||
private static final Clause[] CLAUSES = { CONDITION, CONDITION_COMPARISON };
|
||||
static final TrueCondition INSTANCE = new TrueCondition();
|
||||
static final Set<SQLDialect> NO_SUPPORT_BOOLEAN = SQLDialect.supportedBy(FIREBIRD, SQLITE);
|
||||
|
||||
@Override
|
||||
final boolean isNullable() {
|
||||
@ -61,7 +83,10 @@ final class TrueCondition extends AbstractCondition implements True {
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
ctx.sql("1 = 1");
|
||||
if (NO_SUPPORT_BOOLEAN.contains(ctx.dialect()))
|
||||
ctx.sql("1 = 1");
|
||||
else
|
||||
ctx.visit(K_TRUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user