From a3f25af543039f613f17ebce5392ce7a3f59e2c3 Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Tue, 3 Sep 2019 09:04:08 +0200 Subject: [PATCH] [jOOQ/jOOQ#9134] Fix NTH_VALUE() [ FROM { FIRST | LAST } ] rendering The `NTH_VALUE() [ FROM { FIRST | LAST } ]` clause is rendered the same for all dialects. --- .../src/main/java/org/jooq/impl/Function.java | 68 ++++++++----------- 1 file changed, 27 insertions(+), 41 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/Function.java b/jOOQ/src/main/java/org/jooq/impl/Function.java index 6ef0123d9c..e84ee59c80 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Function.java +++ b/jOOQ/src/main/java/org/jooq/impl/Function.java @@ -594,51 +594,37 @@ class Function extends AbstractField implements if (distinct) if (args.size() > 1 && SUPPORT_DISTINCT_RVE.contains(ctx.family())) ctx.sql(')'); - - if (ctx.family() != H2) { - if (TRUE.equals(fromLast)) - ctx.sql(' ').visit(K_FROM).sql(' ').visit(K_LAST); - else if (FALSE.equals(fromLast)) - ctx.sql(' ').visit(K_FROM).sql(' ').visit(K_FIRST); - - if (TRUE.equals(ignoreNulls)) { - switch (ctx.family()) { - - - - - - default: - ctx.sql(' ').visit(K_IGNORE_NULLS); - break; - } - } - else if (FALSE.equals(ignoreNulls)) { - switch (ctx.family()) { - - - - - - default: - ctx.sql(' ').visit(K_RESPECT_NULLS); - break; - } - } - } } final void toSQLArguments2(Context ctx) { - if (ctx.family() == H2) { - if (TRUE.equals(fromLast)) - ctx.sql(' ').visit(K_FROM).sql(' ').visit(K_LAST); - else if (FALSE.equals(fromLast)) - ctx.sql(' ').visit(K_FROM).sql(' ').visit(K_FIRST); + if (TRUE.equals(fromLast)) + ctx.sql(' ').visit(K_FROM).sql(' ').visit(K_LAST); + else if (FALSE.equals(fromLast)) + ctx.sql(' ').visit(K_FROM).sql(' ').visit(K_FIRST); - if (TRUE.equals(ignoreNulls)) - ctx.sql(' ').visit(K_IGNORE_NULLS); - else if (FALSE.equals(ignoreNulls)) - ctx.sql(' ').visit(K_RESPECT_NULLS); + if (TRUE.equals(ignoreNulls)) { + switch (ctx.family()) { + + + + + + default: + ctx.sql(' ').visit(K_IGNORE_NULLS); + break; + } + } + else if (FALSE.equals(ignoreNulls)) { + switch (ctx.family()) { + + + + + + default: + ctx.sql(' ').visit(K_RESPECT_NULLS); + break; + } } }