Skip to content

Commit

Permalink
[#6933] Not all databases support the NULL statement (could result fr…
Browse files Browse the repository at this point in the history
…om parsing)
  • Loading branch information
lukaseder committed Jan 9, 2018
1 parent d0b2831 commit 1c23e0f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions jOOQ/src/main/java/org/jooq/impl/BlockImpl.java
Expand Up @@ -41,6 +41,7 @@
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.SQLDialect.MARIADB;
// ...
import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.conf.ParamType.INLINED;
import static org.jooq.impl.Keywords.K_AS;
import static org.jooq.impl.Keywords.K_ATOMIC;
Expand Down Expand Up @@ -78,6 +79,7 @@ final class BlockImpl extends AbstractQuery implements Block {
*/
private static final long serialVersionUID = 6881305779639901498L;
private static final EnumSet<SQLDialect> REQUIRES_EXECUTE_IMMEDIATE_ON_DDL = EnumSet.of(FIREBIRD);
private static final EnumSet<SQLDialect> SUPPORTS_NULL_STATEMENT = EnumSet.of(POSTGRES);

private final Collection<? extends Statement> statements;

Expand Down Expand Up @@ -182,7 +184,11 @@ private final void accept0(Context<?> ctx) {
}
}
else {
for (Statement query : statements) {
statementLoop:
for (Statement s : statements) {
if (s instanceof NullStatement && !SUPPORTS_NULL_STATEMENT.contains(ctx.family()))
continue statementLoop;

ctx.formatSeparator();


Expand All @@ -193,14 +199,14 @@ private final void accept0(Context<?> ctx) {



ctx.visit(query);
ctx.visit(s);






if (!(query instanceof Block))
if (!(s instanceof Block))
ctx.sql(';');
}
}
Expand Down

0 comments on commit 1c23e0f

Please sign in to comment.