diff --git a/jOOQ/src/main/java/org/jooq/impl/Avg.java b/jOOQ/src/main/java/org/jooq/impl/Avg.java new file mode 100644 index 0000000000..978083b10c --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Avg.java @@ -0,0 +1,92 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + +import static org.jooq.impl.DSL.*; +import static org.jooq.impl.Internal.*; +import static org.jooq.impl.Keywords.*; +import static org.jooq.impl.Names.*; +import static org.jooq.impl.SQLDataType.*; +import static org.jooq.impl.Tools.*; +import static org.jooq.impl.Tools.BooleanDataKey.*; +import static org.jooq.impl.Tools.DataExtendedKey.*; +import static org.jooq.impl.Tools.DataKey.*; +import static org.jooq.SQLDialect.*; + +import org.jooq.*; +import org.jooq.Record; +import org.jooq.conf.*; +import org.jooq.impl.*; +import org.jooq.tools.*; + +import java.util.*; +import java.util.function.*; +import java.util.stream.*; +import java.math.BigDecimal; + + +/** + * The AVG statement. + */ +@SuppressWarnings({ "rawtypes", "unused" }) +final class Avg +extends + AbstractAggregateFunction +{ + + Avg( + Field field, + boolean avgDistinct + ) { + super( + avgDistinct, + N_AVG, + NUMERIC, + nullSafeNotNull(field, INTEGER) + ); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + @Override + public final void accept(Context ctx) { + super.accept(ctx); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/Count.java b/jOOQ/src/main/java/org/jooq/impl/Count.java new file mode 100644 index 0000000000..d0e16bfa73 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Count.java @@ -0,0 +1,91 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + +import static org.jooq.impl.DSL.*; +import static org.jooq.impl.Internal.*; +import static org.jooq.impl.Keywords.*; +import static org.jooq.impl.Names.*; +import static org.jooq.impl.SQLDataType.*; +import static org.jooq.impl.Tools.*; +import static org.jooq.impl.Tools.BooleanDataKey.*; +import static org.jooq.impl.Tools.DataExtendedKey.*; +import static org.jooq.impl.Tools.DataKey.*; +import static org.jooq.SQLDialect.*; + +import org.jooq.*; +import org.jooq.Record; +import org.jooq.conf.*; +import org.jooq.impl.*; +import org.jooq.tools.*; + +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + + +/** + * The COUNT statement. + */ +@SuppressWarnings({ "rawtypes", "unused" }) +final class Count +extends + AbstractAggregateFunction +{ + + Count( + Field field, + boolean countDistinct + ) { + super( + countDistinct, + N_COUNT, + INTEGER, + nullSafeNotNull(field, OTHER) + ); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + @Override + public final void accept(Context ctx) { + super.accept(ctx); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index 4207db44af..dc32ad0b6c 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -19799,6 +19799,24 @@ public class DSL { // Aggregate functions // ------------------------------------------------------------------------- + /** + * The AVG function. + */ + @NotNull + @Support + public static AggregateFunction avg(Field field) { + return new Avg(field, false); + } + + /** + * The AVG_DISTINCT function. + */ + @NotNull + @Support + public static AggregateFunction avgDistinct(Field field) { + return new Avg(field, true); + } + /** * The BIT_AND_AGG function. *

@@ -19846,6 +19864,24 @@ public class DSL { return new Corr(y, x); } + /** + * The COUNT function. + */ + @NotNull + @Support + public static AggregateFunction count(Field field) { + return new Count(field, false); + } + + /** + * The COUNT_DISTINCT function. + */ + @NotNull + @Support + public static AggregateFunction countDistinct(Field field) { + return new Count(field, true); + } + /** * The COVAR_SAMP function. *

@@ -19874,6 +19910,24 @@ public class DSL { return new CovarPop(y, x); } + /** + * The MAX function. + */ + @NotNull + @Support + public static AggregateFunction max(Field field) { + return new Max(field, false); + } + + /** + * The MAX_DISTINCT function. + */ + @NotNull + @Support + public static AggregateFunction maxDistinct(Field field) { + return new Max(field, true); + } + /** * The MEDIAN function. */ @@ -19883,6 +19937,24 @@ public class DSL { return new Median(field); } + /** + * The MIN function. + */ + @NotNull + @Support + public static AggregateFunction min(Field field) { + return new Min(field, false); + } + + /** + * The MIN_DISTINCT function. + */ + @NotNull + @Support + public static AggregateFunction minDistinct(Field field) { + return new Min(field, true); + } + /** * The REGR_AVGX function. *

@@ -20037,6 +20109,24 @@ public class DSL { return new StddevSamp(field); } + /** + * The SUM function. + */ + @NotNull + @Support + public static AggregateFunction sum(Field field) { + return new Sum(field, false); + } + + /** + * The SUM_DISTINCT function. + */ + @NotNull + @Support + public static AggregateFunction sumDistinct(Field field) { + return new Sum(field, true); + } + /** * The VAR_POP function. *

@@ -23597,15 +23687,6 @@ public class DSL { return count(DefaultAggregateFunction.ASTERISK); } - /** - * Get the count(field) function. - */ - @NotNull - @Support - public static AggregateFunction count(Field field) { - return new DefaultAggregateFunction<>(N_COUNT, SQLDataType.INTEGER, Tools.nullSafe(field)); - } - /** * Get the count(field) function. */ @@ -23628,15 +23709,6 @@ public class DSL { return new CountTable(table, false); } - /** - * Get the count(distinct field) function. - */ - @NotNull - @Support - public static AggregateFunction countDistinct(Field field) { - return new DefaultAggregateFunction<>(true, N_COUNT, SQLDataType.INTEGER, Tools.nullSafe(field)); - } - /** * Get the count(distinct field) function. */ @@ -24994,60 +25066,6 @@ public class DSL { - - /** - * Get the max value over a field: max(field). - */ - @NotNull - @Support - public static AggregateFunction max(Field field) { - return new DefaultAggregateFunction<>(N_MAX, Tools.nullSafeDataType(field), Tools.nullSafe(field)); - } - - /** - * Get the max value over a field: max(distinct field). - */ - @NotNull - @Support - public static AggregateFunction maxDistinct(Field field) { - return new DefaultAggregateFunction<>(true, N_MAX, Tools.nullSafeDataType(field), Tools.nullSafe(field)); - } - - /** - * Get the min value over a field: min(field). - */ - @NotNull - @Support - public static AggregateFunction min(Field field) { - return new DefaultAggregateFunction<>(N_MIN, Tools.nullSafeDataType(field), Tools.nullSafe(field)); - } - - /** - * Get the min value over a field: min(distinct field). - */ - @NotNull - @Support - public static AggregateFunction minDistinct(Field field) { - return new DefaultAggregateFunction<>(true, N_MIN, Tools.nullSafeDataType(field), Tools.nullSafe(field)); - } - - /** - * Get the sum over a numeric field: sum(field). - */ - @NotNull - @Support - public static AggregateFunction sum(Field field) { - return new DefaultAggregateFunction<>(N_SUM, SQLDataType.NUMERIC, Tools.nullSafe(field)); - } - - /** - * Get the sum over a numeric field: sum(distinct field). - */ - @NotNull - @Support - public static AggregateFunction sumDistinct(Field field) { - return new DefaultAggregateFunction<>(true, N_SUM, SQLDataType.NUMERIC, Tools.nullSafe(field)); - } /** * Get the product over a numeric field: product(field). @@ -25087,24 +25105,6 @@ public class DSL { return new Product(true, Tools.nullSafe(field)); } - /** - * Get the average over a numeric field: avg(field). - */ - @NotNull - @Support - public static AggregateFunction avg(Field field) { - return new DefaultAggregateFunction<>(N_AVG, SQLDataType.NUMERIC, Tools.nullSafe(field)); - } - - /** - * Get the average over a numeric field: avg(distinct field). - */ - @NotNull - @Support - public static AggregateFunction avgDistinct(Field field) { - return new DefaultAggregateFunction<>(true, N_AVG, SQLDataType.NUMERIC, Tools.nullSafe(field)); - } - /** * The mode(field) aggregate function. */ diff --git a/jOOQ/src/main/java/org/jooq/impl/Max.java b/jOOQ/src/main/java/org/jooq/impl/Max.java new file mode 100644 index 0000000000..d4d2302560 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Max.java @@ -0,0 +1,91 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + +import static org.jooq.impl.DSL.*; +import static org.jooq.impl.Internal.*; +import static org.jooq.impl.Keywords.*; +import static org.jooq.impl.Names.*; +import static org.jooq.impl.SQLDataType.*; +import static org.jooq.impl.Tools.*; +import static org.jooq.impl.Tools.BooleanDataKey.*; +import static org.jooq.impl.Tools.DataExtendedKey.*; +import static org.jooq.impl.Tools.DataKey.*; +import static org.jooq.SQLDialect.*; + +import org.jooq.*; +import org.jooq.Record; +import org.jooq.conf.*; +import org.jooq.impl.*; +import org.jooq.tools.*; + +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + + +/** + * The MAX statement. + */ +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class Max +extends + AbstractAggregateFunction +{ + + Max( + Field field, + boolean maxDistinct + ) { + super( + maxDistinct, + N_MAX, + Tools.nullSafeDataType(field), + nullSafeNotNull(field, (DataType) OTHER) + ); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + @Override + public final void accept(Context ctx) { + super.accept(ctx); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/Min.java b/jOOQ/src/main/java/org/jooq/impl/Min.java new file mode 100644 index 0000000000..ba45003c89 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Min.java @@ -0,0 +1,91 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + +import static org.jooq.impl.DSL.*; +import static org.jooq.impl.Internal.*; +import static org.jooq.impl.Keywords.*; +import static org.jooq.impl.Names.*; +import static org.jooq.impl.SQLDataType.*; +import static org.jooq.impl.Tools.*; +import static org.jooq.impl.Tools.BooleanDataKey.*; +import static org.jooq.impl.Tools.DataExtendedKey.*; +import static org.jooq.impl.Tools.DataKey.*; +import static org.jooq.SQLDialect.*; + +import org.jooq.*; +import org.jooq.Record; +import org.jooq.conf.*; +import org.jooq.impl.*; +import org.jooq.tools.*; + +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + + +/** + * The MIN statement. + */ +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class Min +extends + AbstractAggregateFunction +{ + + Min( + Field field, + boolean minDistinct + ) { + super( + minDistinct, + N_MIN, + Tools.nullSafeDataType(field), + nullSafeNotNull(field, (DataType) OTHER) + ); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + @Override + public final void accept(Context ctx) { + super.accept(ctx); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/Sum.java b/jOOQ/src/main/java/org/jooq/impl/Sum.java new file mode 100644 index 0000000000..8817cfbc00 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Sum.java @@ -0,0 +1,92 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + +import static org.jooq.impl.DSL.*; +import static org.jooq.impl.Internal.*; +import static org.jooq.impl.Keywords.*; +import static org.jooq.impl.Names.*; +import static org.jooq.impl.SQLDataType.*; +import static org.jooq.impl.Tools.*; +import static org.jooq.impl.Tools.BooleanDataKey.*; +import static org.jooq.impl.Tools.DataExtendedKey.*; +import static org.jooq.impl.Tools.DataKey.*; +import static org.jooq.SQLDialect.*; + +import org.jooq.*; +import org.jooq.Record; +import org.jooq.conf.*; +import org.jooq.impl.*; +import org.jooq.tools.*; + +import java.util.*; +import java.util.function.*; +import java.util.stream.*; +import java.math.BigDecimal; + + +/** + * The SUM statement. + */ +@SuppressWarnings({ "rawtypes", "unused" }) +final class Sum +extends + AbstractAggregateFunction +{ + + Sum( + Field field, + boolean sumDistinct + ) { + super( + sumDistinct, + N_SUM, + NUMERIC, + nullSafeNotNull(field, INTEGER) + ); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + @Override + public final void accept(Context ctx) { + super.accept(ctx); + } +}