From 4bffbc4148cccdcba6748e983abbb6b2841e86a3 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Mon, 8 Oct 2018 10:43:14 +0200 Subject: [PATCH] [#7865] Add support for SQLite window functions --- jOOQ/src/main/java/org/jooq/SelectQuery.java | 4 +- .../main/java/org/jooq/SelectWindowStep.java | 5 +- .../main/java/org/jooq/WindowExcludeStep.java | 3 +- .../main/java/org/jooq/WindowOrderByStep.java | 5 +- .../main/java/org/jooq/WindowOverStep.java | 11 ++- .../java/org/jooq/WindowPartitionByStep.java | 7 +- .../main/java/org/jooq/WindowRowsAndStep.java | 11 ++- .../main/java/org/jooq/WindowRowsStep.java | 41 ++++---- .../jooq/WindowSpecificationExcludeStep.java | 3 +- .../jooq/WindowSpecificationOrderByStep.java | 5 +- .../WindowSpecificationPartitionByStep.java | 7 +- .../jooq/WindowSpecificationRowsAndStep.java | 11 ++- .../org/jooq/WindowSpecificationRowsStep.java | 41 ++++---- jOOQ/src/main/java/org/jooq/impl/DSL.java | 94 +++++++++---------- .../java/org/jooq/impl/RatioToReport.java | 5 +- .../java/org/jooq/impl/SelectQueryImpl.java | 2 +- .../jooq/impl/WindowSpecificationImpl.java | 3 +- 17 files changed, 137 insertions(+), 121 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/SelectQuery.java b/jOOQ/src/main/java/org/jooq/SelectQuery.java index 11e40d8279..02c5b81804 100644 --- a/jOOQ/src/main/java/org/jooq/SelectQuery.java +++ b/jOOQ/src/main/java/org/jooq/SelectQuery.java @@ -375,7 +375,7 @@ public interface SelectQuery extends Select, ConditionProvi * * @param definitions The definitions */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) void addWindow(WindowDefinition... definitions); /** @@ -383,7 +383,7 @@ public interface SelectQuery extends Select, ConditionProvi * * @param definitions The definitions */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) void addWindow(Collection definitions); /** diff --git a/jOOQ/src/main/java/org/jooq/SelectWindowStep.java b/jOOQ/src/main/java/org/jooq/SelectWindowStep.java index 17092d4887..5585ef3ea2 100644 --- a/jOOQ/src/main/java/org/jooq/SelectWindowStep.java +++ b/jOOQ/src/main/java/org/jooq/SelectWindowStep.java @@ -49,6 +49,7 @@ import static org.jooq.SQLDialect.MYSQL_8_0; // ... import static org.jooq.SQLDialect.POSTGRES; // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -129,7 +130,7 @@ public interface SelectWindowStep extends SelectOrderByStep * use this clause in all other databases supporting window functions. jOOQ * will inline window definitions where they are referenced. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) SelectOrderByStep window(WindowDefinition... definitions); /** @@ -143,6 +144,6 @@ public interface SelectWindowStep extends SelectOrderByStep * use this clause in all other databases supporting window functions. jOOQ * will inline window definitions where they are referenced. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) SelectOrderByStep window(Collection definitions); } diff --git a/jOOQ/src/main/java/org/jooq/WindowExcludeStep.java b/jOOQ/src/main/java/org/jooq/WindowExcludeStep.java index 21c9fd45c2..929c24e6f2 100644 --- a/jOOQ/src/main/java/org/jooq/WindowExcludeStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowExcludeStep.java @@ -47,6 +47,7 @@ import static org.jooq.SQLDialect.POSTGRES; import static org.jooq.SQLDialect.POSTGRES_11; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -91,6 +92,6 @@ public interface WindowExcludeStep extends WindowFinalStep { /** * Add an EXCLUDE NO OTHERS clause. */ - @Support({ MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowFinalStep excludeNoOthers(); } diff --git a/jOOQ/src/main/java/org/jooq/WindowOrderByStep.java b/jOOQ/src/main/java/org/jooq/WindowOrderByStep.java index 7335724af6..fd08766789 100644 --- a/jOOQ/src/main/java/org/jooq/WindowOrderByStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowOrderByStep.java @@ -50,6 +50,7 @@ import static org.jooq.SQLDialect.MYSQL_8_0; import static org.jooq.SQLDialect.POSTGRES; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -78,12 +79,12 @@ public interface WindowOrderByStep extends WindowFinalStep { /** * Add an ORDER BY clause to the window function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsStep orderBy(OrderField... fields); /** * Add an ORDER BY clause to the window function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsStep orderBy(Collection> fields); } diff --git a/jOOQ/src/main/java/org/jooq/WindowOverStep.java b/jOOQ/src/main/java/org/jooq/WindowOverStep.java index 2a4ed707ef..4945eea4ff 100644 --- a/jOOQ/src/main/java/org/jooq/WindowOverStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowOverStep.java @@ -52,6 +52,7 @@ import static org.jooq.SQLDialect.MYSQL_8_0; import static org.jooq.SQLDialect.POSTGRES; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -86,7 +87,7 @@ public interface WindowOverStep { * * */ - @Support({ CUBRID, DERBY, FIREBIRD_3_0, H2, HSQLDB, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, DERBY, FIREBIRD_3_0, H2, HSQLDB, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowPartitionByStep over(); /** @@ -102,7 +103,7 @@ public interface WindowOverStep { * {@link SelectWindowStep#window(WindowDefinition...)}, then referenced * windows will be inlined. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowFinalStep over(Name name); /** @@ -118,7 +119,7 @@ public interface WindowOverStep { * {@link SelectWindowStep#window(WindowDefinition...)}, then referenced * windows will be inlined. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowFinalStep over(String name); /** @@ -129,7 +130,7 @@ public interface WindowOverStep { * * */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowFinalStep over(WindowSpecification specification); /** @@ -145,7 +146,7 @@ public interface WindowOverStep { * {@link SelectWindowStep#window(WindowDefinition...)}, then referenced * windows will be inlined. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowFinalStep over(WindowDefinition definition); } diff --git a/jOOQ/src/main/java/org/jooq/WindowPartitionByStep.java b/jOOQ/src/main/java/org/jooq/WindowPartitionByStep.java index b588df6418..8aef335d1d 100644 --- a/jOOQ/src/main/java/org/jooq/WindowPartitionByStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowPartitionByStep.java @@ -50,6 +50,7 @@ import static org.jooq.SQLDialect.MYSQL_8_0; import static org.jooq.SQLDialect.POSTGRES; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -78,13 +79,13 @@ public interface WindowPartitionByStep extends WindowOrderByStep { /** * Add a PARTITION BY clause to the window functions. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowOrderByStep partitionBy(Field... fields); /** * Add a PARTITION BY clause to the window functions. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowOrderByStep partitionBy(Collection> fields); /** @@ -99,7 +100,7 @@ public interface WindowPartitionByStep extends WindowOrderByStep { * omit the clause entirely. */ @Deprecated - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowOrderByStep partitionByOne(); } diff --git a/jOOQ/src/main/java/org/jooq/WindowRowsAndStep.java b/jOOQ/src/main/java/org/jooq/WindowRowsAndStep.java index 7ef86301a3..a9b4fd3124 100644 --- a/jOOQ/src/main/java/org/jooq/WindowRowsAndStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowRowsAndStep.java @@ -47,6 +47,7 @@ import static org.jooq.SQLDialect.MYSQL_8_0; import static org.jooq.SQLDialect.POSTGRES; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -73,34 +74,34 @@ public interface WindowRowsAndStep { * Add a ... AND UNBOUNDED PRECEDING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep andUnboundedPreceding(); /** * Add a ... AND [number] PRECEDING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep andPreceding(int number); /** * Add a ... AND CURRENT ROW frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep andCurrentRow(); /** * Add a ... AND UNBOUNDED FOLLOWING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep andUnboundedFollowing(); /** * Add a ... AND [number] FOLLOWING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep andFollowing(int number); } diff --git a/jOOQ/src/main/java/org/jooq/WindowRowsStep.java b/jOOQ/src/main/java/org/jooq/WindowRowsStep.java index be45e2554a..6dd3016df0 100644 --- a/jOOQ/src/main/java/org/jooq/WindowRowsStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowRowsStep.java @@ -48,6 +48,7 @@ import static org.jooq.SQLDialect.POSTGRES; import static org.jooq.SQLDialect.POSTGRES_11; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -75,138 +76,138 @@ public interface WindowRowsStep extends WindowFinalStep { * Add a ROWS UNBOUNDED PRECEDING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rowsUnboundedPreceding(); /** * Add a ROWS [number] PRECEDING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rowsPreceding(int number); /** * Add a ROWS CURRENT ROW frame clause to the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rowsCurrentRow(); /** * Add a ROWS UNBOUNDED FOLLOWING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rowsUnboundedFollowing(); /** * Add a ROWS [number] FOLLOWING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rowsFollowing(int number); /** * Add a ROWS BETWEEN UNBOUNDED PRECEDING ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rowsBetweenUnboundedPreceding(); /** * Add a ROWS BETWEEN [number] PRECEDING ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rowsBetweenPreceding(int number); /** * Add a ROWS BETWEEN CURRENT ROW ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rowsBetweenCurrentRow(); /** * Add a ROWS BETWEEN UNBOUNDED FOLLOWING ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rowsBetweenUnboundedFollowing(); /** * Add a ROWS BETWEEN [number] FOLLOWING ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rowsBetweenFollowing(int number); /** * Add a RANGE UNBOUNDED PRECEDING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rangeUnboundedPreceding(); /** * Add a RANGE [number] PRECEDING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rangePreceding(int number); /** * Add a RANGE CURRENT ROW frame clause to the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rangeCurrentRow(); /** * Add a RANGE UNBOUNDED FOLLOWING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rangeUnboundedFollowing(); /** * Add a RANGE [number] FOLLOWING frame clause to the window * function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowExcludeStep rangeFollowing(int number); /** * Add a RANGE BETWEEN UNBOUNDED PRECEDING ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rangeBetweenUnboundedPreceding(); /** * Add a RANGE BETWEEN [number] PRECEDING ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rangeBetweenPreceding(int number); /** * Add a RANGE BETWEEN CURRENT ROW ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rangeBetweenCurrentRow(); /** * Add a RANGE BETWEEN UNBOUNDED FOLLOWING ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rangeBetweenUnboundedFollowing(); /** * Add a RANGE BETWEEN [number] FOLLOWING ... frame clause to * the window function. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowRowsAndStep rangeBetweenFollowing(int number); /** diff --git a/jOOQ/src/main/java/org/jooq/WindowSpecificationExcludeStep.java b/jOOQ/src/main/java/org/jooq/WindowSpecificationExcludeStep.java index d12354ba2c..4097c8d4f3 100644 --- a/jOOQ/src/main/java/org/jooq/WindowSpecificationExcludeStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowSpecificationExcludeStep.java @@ -48,6 +48,7 @@ import static org.jooq.SQLDialect.POSTGRES; import static org.jooq.SQLDialect.POSTGRES_11; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -107,6 +108,6 @@ public interface WindowSpecificationExcludeStep extends WindowSpecificationFinal /** * Add an EXCLUDE NO OTHERS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationFinalStep excludeNoOthers(); } diff --git a/jOOQ/src/main/java/org/jooq/WindowSpecificationOrderByStep.java b/jOOQ/src/main/java/org/jooq/WindowSpecificationOrderByStep.java index 488d9621d5..8a964e9f7c 100644 --- a/jOOQ/src/main/java/org/jooq/WindowSpecificationOrderByStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowSpecificationOrderByStep.java @@ -50,6 +50,7 @@ import static org.jooq.SQLDialect.MYSQL_8_0; import static org.jooq.SQLDialect.POSTGRES; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -93,12 +94,12 @@ public interface WindowSpecificationOrderByStep extends WindowSpecificationRowsS /** * Add an ORDER BY clause to the window specification. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsStep orderBy(OrderField... fields); /** * Add an ORDER BY clause to the window specification. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsStep orderBy(Collection> fields); } diff --git a/jOOQ/src/main/java/org/jooq/WindowSpecificationPartitionByStep.java b/jOOQ/src/main/java/org/jooq/WindowSpecificationPartitionByStep.java index 650c5099d8..dd5c488bba 100644 --- a/jOOQ/src/main/java/org/jooq/WindowSpecificationPartitionByStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowSpecificationPartitionByStep.java @@ -50,6 +50,7 @@ import static org.jooq.SQLDialect.MYSQL_8_0; import static org.jooq.SQLDialect.POSTGRES; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -93,13 +94,13 @@ public interface WindowSpecificationPartitionByStep extends WindowSpecificationO /** * Add a PARTITION BY clause to the window specification. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationOrderByStep partitionBy(Field... fields); /** * Add a PARTITION BY clause to the window specification. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationOrderByStep partitionBy(Collection> fields); /** @@ -114,6 +115,6 @@ public interface WindowSpecificationPartitionByStep extends WindowSpecificationO * omit the clause entirely. */ @Deprecated - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationOrderByStep partitionByOne(); } diff --git a/jOOQ/src/main/java/org/jooq/WindowSpecificationRowsAndStep.java b/jOOQ/src/main/java/org/jooq/WindowSpecificationRowsAndStep.java index 90eee7f15c..2bfe6b41c7 100644 --- a/jOOQ/src/main/java/org/jooq/WindowSpecificationRowsAndStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowSpecificationRowsAndStep.java @@ -47,6 +47,7 @@ import static org.jooq.SQLDialect.MYSQL_8_0; import static org.jooq.SQLDialect.POSTGRES; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -89,35 +90,35 @@ public interface WindowSpecificationRowsAndStep { * Add a ... AND UNBOUNDED PRECEDING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep andUnboundedPreceding(); /** * Add a ... AND [number] PRECEDING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep andPreceding(int number); /** * Add a ... AND CURRENT ROW frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep andCurrentRow(); /** * Add a ... AND UNBOUNDED FOLLOWING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep andUnboundedFollowing(); /** * Add a ... AND [number] FOLLOWING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep andFollowing(int number); } diff --git a/jOOQ/src/main/java/org/jooq/WindowSpecificationRowsStep.java b/jOOQ/src/main/java/org/jooq/WindowSpecificationRowsStep.java index 8a0bd04f93..058b290b74 100644 --- a/jOOQ/src/main/java/org/jooq/WindowSpecificationRowsStep.java +++ b/jOOQ/src/main/java/org/jooq/WindowSpecificationRowsStep.java @@ -48,6 +48,7 @@ import static org.jooq.SQLDialect.POSTGRES; import static org.jooq.SQLDialect.POSTGRES_11; // ... // ... +import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... @@ -90,140 +91,140 @@ public interface WindowSpecificationRowsStep extends WindowSpecificationFinalSte * Add a ROWS UNBOUNDED PRECEDING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE, SQLITE }) WindowSpecificationExcludeStep rowsUnboundedPreceding(); /** * Add a ROWS [number] PRECEDING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep rowsPreceding(int number); /** * Add a ROWS CURRENT ROW frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep rowsCurrentRow(); /** * Add a ROWS UNBOUNDED FOLLOWING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep rowsUnboundedFollowing(); /** * Add a ROWS [number] FOLLOWING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep rowsFollowing(int number); /** * Add a ROWS BETWEEN UNBOUNDED PRECEDING ... frame clause to * the window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rowsBetweenUnboundedPreceding(); /** * Add a ROWS BETWEEN [number] PRECEDING ... frame clause to * the window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rowsBetweenPreceding(int number); /** * Add a ROWS BETWEEN CURRENT ROW ... frame clause to the * window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rowsBetweenCurrentRow(); /** * Add a ROWS BETWEEN UNBOUNDED FOLLOWING ... frame clause to * the window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rowsBetweenUnboundedFollowing(); /** * Add a ROWS BETWEEN [number] FOLLOWING ... frame clause to * the window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rowsBetweenFollowing(int number); /** * Add a RANGE UNBOUNDED PRECEDING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep rangeUnboundedPreceding(); /** * Add a RANGE [number] PRECEDING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep rangePreceding(int number); /** * Add a RANGE CURRENT ROW frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep rangeCurrentRow(); /** * Add a RANGE UNBOUNDED FOLLOWING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep rangeUnboundedFollowing(); /** * Add a RANGE [number] FOLLOWING frame clause to the window * specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationExcludeStep rangeFollowing(int number); /** * Add a RANGE BETWEEN UNBOUNDED PRECEDING ... frame clause to * the window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rangeBetweenUnboundedPreceding(); /** * Add a RANGE BETWEEN [number] PRECEDING ... frame clause to * the window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rangeBetweenPreceding(int number); /** * Add a RANGE BETWEEN CURRENT ROW ... frame clause to the * window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rangeBetweenCurrentRow(); /** * Add a RANGE BETWEEN UNBOUNDED FOLLOWING ... frame clause to * the window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rangeBetweenUnboundedFollowing(); /** * Add a RANGE BETWEEN [number] FOLLOWING ... frame clause to * the window specification. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) WindowSpecificationRowsAndStep rangeBetweenFollowing(int number); /** diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index e76a7c6d88..f93abff863 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -17373,7 +17373,7 @@ public class DSL { * More information here: https://blog.jooq.org/2018/09/21/how-to-write-a-multiplication-aggregate-function-in-sql. */ - @Support + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) public static AggregateFunction product(Field field) { return new org.jooq.impl.Function(Term.PRODUCT, SQLDataType.NUMERIC, nullSafe(field)); } @@ -17391,7 +17391,7 @@ public class DSL { * More information here: https://blog.jooq.org/2018/09/21/how-to-write-a-multiplication-aggregate-function-in-sql. */ - @Support + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) public static AggregateFunction productDistinct(Field field) { return new org.jooq.impl.Function(Term.PRODUCT, true, SQLDataType.NUMERIC, nullSafe(field)); } @@ -17870,7 +17870,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a PARTITION BY clause. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationOrderByStep partitionBy(Field... fields) { return new WindowSpecificationImpl().partitionBy(fields); } @@ -17878,7 +17878,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a PARTITION BY clause. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationOrderByStep partitionBy(Collection> fields) { return new WindowSpecificationImpl().partitionBy(fields); } @@ -17886,7 +17886,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with an ORDER BY clause. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsStep orderBy(Field... fields) { return new WindowSpecificationImpl().orderBy(fields); } @@ -17894,7 +17894,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with an ORDER BY clause. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsStep orderBy(OrderField... fields) { return new WindowSpecificationImpl().orderBy(fields); } @@ -17902,7 +17902,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with an ORDER BY clause. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsStep orderBy(Collection> fields) { return new WindowSpecificationImpl().orderBy(fields); } @@ -17910,7 +17910,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rowsUnboundedPreceding() { return new WindowSpecificationImpl().rowsUnboundedPreceding(); } @@ -17918,7 +17918,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rowsPreceding(int number) { return new WindowSpecificationImpl().rowsPreceding(number); } @@ -17926,7 +17926,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rowsCurrentRow() { return new WindowSpecificationImpl().rowsCurrentRow(); } @@ -17934,7 +17934,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rowsUnboundedFollowing() { return new WindowSpecificationImpl().rowsUnboundedFollowing(); } @@ -17942,7 +17942,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rowsFollowing(int number) { return new WindowSpecificationImpl().rowsFollowing(number); } @@ -17950,7 +17950,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rowsBetweenUnboundedPreceding() { return new WindowSpecificationImpl().rowsBetweenUnboundedPreceding(); } @@ -17958,7 +17958,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rowsBetweenPreceding(int number) { return new WindowSpecificationImpl().rowsBetweenPreceding(number); } @@ -17966,7 +17966,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rowsBetweenCurrentRow() { return new WindowSpecificationImpl().rowsBetweenCurrentRow(); } @@ -17974,7 +17974,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rowsBetweenUnboundedFollowing() { return new WindowSpecificationImpl().rowsBetweenUnboundedFollowing(); } @@ -17982,7 +17982,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a ROWS clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rowsBetweenFollowing(int number) { return new WindowSpecificationImpl().rowsBetweenFollowing(number); } @@ -17990,7 +17990,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rangeUnboundedPreceding() { return new WindowSpecificationImpl().rangeUnboundedPreceding(); } @@ -17998,7 +17998,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rangePreceding(int number) { return new WindowSpecificationImpl().rangePreceding(number); } @@ -18006,7 +18006,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rangeCurrentRow() { return new WindowSpecificationImpl().rangeCurrentRow(); } @@ -18014,7 +18014,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rangeUnboundedFollowing() { return new WindowSpecificationImpl().rangeUnboundedFollowing(); } @@ -18022,7 +18022,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationExcludeStep rangeFollowing(int number) { return new WindowSpecificationImpl().rangeFollowing(number); } @@ -18030,7 +18030,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rangeBetweenUnboundedPreceding() { return new WindowSpecificationImpl().rangeBetweenUnboundedPreceding(); } @@ -18038,7 +18038,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rangeBetweenPreceding(int number) { return new WindowSpecificationImpl().rangeBetweenPreceding(number); } @@ -18046,7 +18046,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rangeBetweenCurrentRow() { return new WindowSpecificationImpl().rangeBetweenCurrentRow(); } @@ -18054,7 +18054,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rangeBetweenUnboundedFollowing() { return new WindowSpecificationImpl().rangeBetweenUnboundedFollowing(); } @@ -18062,7 +18062,7 @@ public class DSL { /** * Create a {@link WindowSpecification} with a RANGE clause. */ - @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowSpecificationRowsAndStep rangeBetweenFollowing(int number) { return new WindowSpecificationImpl().rangeBetweenFollowing(number); } @@ -18160,7 +18160,7 @@ public class DSL { * {@link SQLDialect#HSQLDB} can emulate this function using * ROWNUM() */ - @Support({ CUBRID, DERBY, FIREBIRD_3_0, H2, HSQLDB, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, DERBY, FIREBIRD_3_0, H2, HSQLDB, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowOverStep rowNumber() { return new org.jooq.impl.Function(ROW_NUMBER, SQLDataType.INTEGER); } @@ -18168,7 +18168,7 @@ public class DSL { /** * The rank() over ([analytic clause]) function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowOverStep rank() { return new org.jooq.impl.Function("rank", SQLDataType.INTEGER); } @@ -18176,7 +18176,7 @@ public class DSL { /** * The dense_rank() over ([analytic clause]) function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowOverStep denseRank() { return new org.jooq.impl.Function("dense_rank", SQLDataType.INTEGER); } @@ -18184,7 +18184,7 @@ public class DSL { /** * The precent_rank() over ([analytic clause]) function. */ - @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowOverStep percentRank() { return new org.jooq.impl.Function("percent_rank", SQLDataType.NUMERIC); } @@ -18192,7 +18192,7 @@ public class DSL { /** * The cume_dist() over ([analytic clause]) function. */ - @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowOverStep cumeDist() { return new org.jooq.impl.Function("cume_dist", SQLDataType.NUMERIC); } @@ -18200,7 +18200,7 @@ public class DSL { /** * The ntile([number]) over ([analytic clause]) function. */ - @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowOverStep ntile(int number) { return new org.jooq.impl.Function("ntile", SQLDataType.INTEGER, inline(number)); } @@ -18208,7 +18208,7 @@ public class DSL { /** * The ratio_to_report([expression]) over ([analytic clause]) function. */ - @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowOverStep ratioToReport(Number number) { return ratioToReport(Tools.field(number)); } @@ -18216,7 +18216,7 @@ public class DSL { /** * The ratio_to_report([expression]) over ([analytic clause]) function. */ - @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowOverStep ratioToReport(Field field) { return new RatioToReport(nullSafe(field)); } @@ -18224,7 +18224,7 @@ public class DSL { /** * The first_value(field) over ([analytic clause]) function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep firstValue(Field field) { return new org.jooq.impl.Function("first_value", nullSafeDataType(field), nullSafe(field)); } @@ -18232,7 +18232,7 @@ public class DSL { /** * The last_value(field) over ([analytic clause]) function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep lastValue(Field field) { return new org.jooq.impl.Function("last_value", nullSafeDataType(field), nullSafe(field)); } @@ -18240,7 +18240,7 @@ public class DSL { /** * The nth_value(field) over ([analytic clause]) function. */ - @Support({ FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowFromFirstLastStep nthValue(Field field, int nth) { return nthValue(field, val(nth)); } @@ -18248,7 +18248,7 @@ public class DSL { /** * The nth_value(field) over ([analytic clause]) function. */ - @Support({ FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowFromFirstLastStep nthValue(Field field, Field nth) { return new org.jooq.impl.Function("nth_value", nullSafeDataType(field), nullSafe(field), nullSafe(nth)); } @@ -18256,7 +18256,7 @@ public class DSL { /** * The lead(field) over ([analytic clause]) function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep lead(Field field) { return new LeadLag("lead", nullSafe(field)); } @@ -18264,7 +18264,7 @@ public class DSL { /** * The lead(field, offset) over ([analytic clause]) function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep lead(Field field, int offset) { return new LeadLag("lead", nullSafe(field), offset); } @@ -18274,7 +18274,7 @@ public class DSL { * lead(field, offset, defaultValue) over ([analytic clause]) * function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep lead(Field field, int offset, T defaultValue) { return lead(nullSafe(field), offset, Tools.field(defaultValue, field)); } @@ -18284,7 +18284,7 @@ public class DSL { * lead(field, offset, defaultValue) over ([analytic clause]) * function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep lead(Field field, int offset, Field defaultValue) { return new LeadLag("lead", nullSafe(field), offset, nullSafe(defaultValue)); } @@ -18292,7 +18292,7 @@ public class DSL { /** * The lag(field) over ([analytic clause]) function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep lag(Field field) { return new LeadLag("lag", nullSafe(field)); } @@ -18300,7 +18300,7 @@ public class DSL { /** * The lag(field, offset) over ([analytic clause]) function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MARIADB, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep lag(Field field, int offset) { return new LeadLag("lag", nullSafe(field), offset); } @@ -18310,7 +18310,7 @@ public class DSL { * lag(field, offset, defaultValue) over ([analytic clause]) * function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep lag(Field field, int offset, T defaultValue) { return lag(nullSafe(field), offset, Tools.field(defaultValue, field)); } @@ -18320,7 +18320,7 @@ public class DSL { * lag(field, offset, defaultValue) over ([analytic clause]) * function. */ - @Support({ CUBRID, FIREBIRD_3_0, H2, MYSQL_8_0, POSTGRES }) + @Support({ CUBRID, FIREBIRD_3_0, H2, MYSQL_8_0, POSTGRES, SQLITE }) public static WindowIgnoreNullsStep lag(Field field, int offset, Field defaultValue) { return new LeadLag("lag", nullSafe(field), offset, nullSafe(defaultValue)); } diff --git a/jOOQ/src/main/java/org/jooq/impl/RatioToReport.java b/jOOQ/src/main/java/org/jooq/impl/RatioToReport.java index 536a8969f3..408fcc6a11 100644 --- a/jOOQ/src/main/java/org/jooq/impl/RatioToReport.java +++ b/jOOQ/src/main/java/org/jooq/impl/RatioToReport.java @@ -37,11 +37,14 @@ */ package org.jooq.impl; +import static org.jooq.SQLDialect.SQLITE; import static org.jooq.impl.SQLDataType.DECIMAL; +import static org.jooq.impl.SQLDataType.DOUBLE; import java.math.BigDecimal; import org.jooq.Context; +import org.jooq.DataType; import org.jooq.Field; /** @@ -79,7 +82,7 @@ final class RatioToReport extends Function { default: - ctx.visit(field.cast(DECIMAL)) + ctx.visit(field.cast((DataType) (ctx.family() == SQLITE ? DOUBLE : DECIMAL))) .sql(" / ") .visit(DSL.sum(field)); toSQLOverClause(ctx); diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java index f6e981af8a..74e6f7c2ac 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java @@ -202,7 +202,7 @@ final class SelectQueryImpl extends AbstractResultQuery imp private static final EnumSet NO_SUPPORT_FOR_UPDATE = EnumSet.of(CUBRID); private static final EnumSet NO_SUPPORT_FOR_UPDATE_QUALIFIED = EnumSet.of(DERBY, FIREBIRD, H2, HSQLDB); private static final EnumSet SUPPORT_SELECT_INTO = EnumSet.of(HSQLDB, POSTGRES); - static final EnumSet SUPPORT_WINDOW_CLAUSE = EnumSet.of(H2, MYSQL, POSTGRES); + static final EnumSet SUPPORT_WINDOW_CLAUSE = EnumSet.of(H2, MYSQL, POSTGRES, SQLITE); private static final EnumSet REQUIRES_FROM_CLAUSE = EnumSet.of(CUBRID, DERBY, FIREBIRD, HSQLDB, MARIADB, MYSQL); private static final EnumSet EMULATE_EMPTY_GROUP_BY_OTHER = EnumSet.of(FIREBIRD, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE); diff --git a/jOOQ/src/main/java/org/jooq/impl/WindowSpecificationImpl.java b/jOOQ/src/main/java/org/jooq/impl/WindowSpecificationImpl.java index 6d3d1d824b..2bd2cd3e56 100644 --- a/jOOQ/src/main/java/org/jooq/impl/WindowSpecificationImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/WindowSpecificationImpl.java @@ -41,6 +41,7 @@ package org.jooq.impl; import static org.jooq.SQLDialect.CUBRID; // ... import static org.jooq.SQLDialect.MYSQL; +import static org.jooq.SQLDialect.SQLITE; // ... import static org.jooq.impl.DSL.one; import static org.jooq.impl.Keywords.K_AND; @@ -93,7 +94,7 @@ final class WindowSpecificationImpl extends AbstractQueryPart implements * Generated UID */ private static final long serialVersionUID = 2996016924769376361L; - private static final EnumSet OMIT_PARTITION_BY_ONE = EnumSet.of(CUBRID, MYSQL); + private static final EnumSet OMIT_PARTITION_BY_ONE = EnumSet.of(CUBRID, MYSQL, SQLITE); private final WindowDefinitionImpl windowDefinition; private final QueryPartList> partitionBy;