diff --git a/jOOQ/src/main/java/org/jooq/impl/Cos.java b/jOOQ/src/main/java/org/jooq/impl/Cos.java new file mode 100644 index 0000000000..44642cec6d --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Cos.java @@ -0,0 +1,88 @@ +/* + * 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.SQLDialect.*; + +import org.jooq.*; +import org.jooq.impl.*; + +import java.math.*; +import java.util.*; + +/** + * The COS statement. + */ +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class Cos +extends + AbstractField +{ + + private static final long serialVersionUID = 1L; + + private final Field number; + + Cos( + Field number + ) { + super(N_COS, allNotNull(NUMERIC, number)); + + this.number = nullSafeNotNull(number, INTEGER); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + + + @Override + public final void accept(Context ctx) { + ctx.visit(function(N_COS, getDataType(), number)); + } + + +} diff --git a/jOOQ/src/main/java/org/jooq/impl/Cosh.java b/jOOQ/src/main/java/org/jooq/impl/Cosh.java index f03eb2c824..cb1e31e988 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Cosh.java +++ b/jOOQ/src/main/java/org/jooq/impl/Cosh.java @@ -37,36 +37,48 @@ */ package org.jooq.impl; -import static org.jooq.impl.DSL.one; -import static org.jooq.impl.DSL.two; -import static org.jooq.impl.Internal.iadd; -import static org.jooq.impl.Internal.idiv; -import static org.jooq.impl.Internal.imul; -import static org.jooq.impl.Names.N_COSH; +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.SQLDialect.*; -import java.math.BigDecimal; +import org.jooq.*; +import org.jooq.impl.*; -import org.jooq.Context; -import org.jooq.Field; +import java.math.*; +import java.util.*; /** - * @author Lukas Eder + * The COSH statement. */ -final class Cosh extends AbstractField { +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class Cosh +extends + AbstractField +{ - /** - * Generated UID - */ - private static final long serialVersionUID = -7273879239726265322L; + private static final long serialVersionUID = 1L; - private final Field argument; + private final Field number; - Cosh(Field argument) { - super(N_COSH, SQLDataType.NUMERIC); + Cosh( + Field number + ) { + super(N_COSH, allNotNull(NUMERIC, number)); - this.argument = argument; + this.number = nullSafeNotNull(number, INTEGER); } + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + + @Override public final void accept(Context ctx) { switch (ctx.family()) { @@ -91,16 +103,18 @@ final class Cosh extends AbstractField { case POSTGRES: ctx.visit(idiv( iadd( - DSL.exp(imul(argument, two())), + DSL.exp(imul(number, two())), one() ), - imul(DSL.exp(argument), two()) + imul(DSL.exp(number), two()) )); break; default: - ctx.visit(N_COSH).sql('(').visit(argument).sql(')'); + ctx.visit(N_COSH).sql('(').visit(number).sql(')'); break; } } + + } diff --git a/jOOQ/src/main/java/org/jooq/impl/Cot.java b/jOOQ/src/main/java/org/jooq/impl/Cot.java index e70c524173..1550c10735 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Cot.java +++ b/jOOQ/src/main/java/org/jooq/impl/Cot.java @@ -37,32 +37,48 @@ */ package org.jooq.impl; -import static org.jooq.impl.Internal.idiv; -import static org.jooq.impl.Names.N_COT; +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.SQLDialect.*; -import java.math.BigDecimal; +import org.jooq.*; +import org.jooq.impl.*; -import org.jooq.Context; -import org.jooq.Field; +import java.math.*; +import java.util.*; /** - * @author Lukas Eder + * The COT statement. */ -final class Cot extends AbstractField { +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class Cot +extends + AbstractField +{ - /** - * Generated UID - */ - private static final long serialVersionUID = -7273879239726265322L; + private static final long serialVersionUID = 1L; - private final Field argument; + private final Field number; - Cot(Field argument) { - super(N_COT, SQLDataType.NUMERIC); + Cot( + Field number + ) { + super(N_COT, allNotNull(NUMERIC, number)); - this.argument = argument; + this.number = nullSafeNotNull(number, INTEGER); } + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + + @Override public final void accept(Context ctx) { switch (ctx.family()) { @@ -77,8 +93,10 @@ final class Cot extends AbstractField { default: - ctx.visit(N_COT).sql('(').visit(argument).sql(')'); + ctx.visit(N_COT).sql('(').visit(number).sql(')'); break; } } + + } diff --git a/jOOQ/src/main/java/org/jooq/impl/Coth.java b/jOOQ/src/main/java/org/jooq/impl/Coth.java new file mode 100644 index 0000000000..d9bfeffbe3 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Coth.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.SQLDialect.*; + +import org.jooq.*; +import org.jooq.impl.*; + +import java.math.*; +import java.util.*; + +/** + * The COTH statement. + */ +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class Coth +extends + AbstractField +{ + + private static final long serialVersionUID = 1L; + + private final Field number; + + Coth( + Field number + ) { + super(N_COTH, allNotNull(NUMERIC, number)); + + this.number = nullSafeNotNull(number, INTEGER); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + + + @Override + public final void accept(Context ctx) { + ctx.visit(idiv( + iadd(DSL.exp(imul(number, two())), one()), + isub(DSL.exp(imul(number, two())), one()) + )); + } + + +} diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index f0e41a2d8a..166034efc8 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -88,17 +88,11 @@ import static org.jooq.SQLDialect.SQLITE; // ... // ... // ... -import static org.jooq.impl.Internal.iadd; -import static org.jooq.impl.Internal.idiv; import static org.jooq.impl.Internal.imul; -import static org.jooq.impl.Internal.isub; import static org.jooq.impl.Keywords.K_CUBE; import static org.jooq.impl.Keywords.K_GROUPING_SETS; -import static org.jooq.impl.Names.N_ABS; -import static org.jooq.impl.Names.N_COS; import static org.jooq.impl.Names.N_IF; import static org.jooq.impl.Names.N_IIF; -import static org.jooq.impl.Names.N_SIN; import static org.jooq.impl.Names.N_SYSTEM_TIME; import static org.jooq.impl.Names.N_TAN; import static org.jooq.impl.Names.N_VALUE; @@ -138,7 +132,6 @@ import java.time.LocalTime; import java.time.OffsetDateTime; import java.time.OffsetTime; import java.time.temporal.Temporal; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -14953,6 +14946,78 @@ public class DSL { return new CharLength(string); } + /** + * The COS function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field cos(Number number) { + return new Cos(Tools.field(number)); + } + + /** + * The COS function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field cos(Field number) { + return new Cos(number); + } + + /** + * The COSH function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field cosh(Number number) { + return new Cosh(Tools.field(number)); + } + + /** + * The COSH function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field cosh(Field number) { + return new Cosh(number); + } + + /** + * The COT function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field cot(Number number) { + return new Cot(Tools.field(number)); + } + + /** + * The COT function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field cot(Field number) { + return new Cot(number); + } + + /** + * The COTH function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field coth(Number number) { + return new Coth(Tools.field(number)); + } + + /** + * The COTH function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field coth(Field number) { + return new Coth(number); + } + /** * The DEG function. */ @@ -15634,6 +15699,42 @@ public class DSL { return new Sign(number); } + /** + * The SIN function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field sin(Number number) { + return new Sin(Tools.field(number)); + } + + /** + * The SIN function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field sin(Field number) { + return new Sin(number); + } + + /** + * The SINH function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field sinh(Number number) { + return new Sinh(Tools.field(number)); + } + + /** + * The SINH function. + */ + @NotNull + @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + public static Field sinh(Field number) { + return new Sinh(number); + } + /** * The SPACE function. */ @@ -19966,52 +20067,6 @@ public class DSL { return new DefaultAggregateFunction<>(Term.ATAN2, SQLDataType.NUMERIC, Tools.nullSafe(x), Tools.nullSafe(y)); } - /** - * Get the cosine(field) function. - * - * @see #cos(Field) - */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field cos(Number value) { - return cos(Tools.field(value)); - } - - /** - * Get the cosine(field) function. - *

- * This renders the cos function where available: - *

cos([field])
- */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field cos(Field field) { - return function(N_COS, SQLDataType.NUMERIC, field); - } - - /** - * Get the sine(field) function. - * - * @see #sin(Field) - */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field sin(Number value) { - return sin(Tools.field(value)); - } - - /** - * Get the sine(field) function. - *

- * This renders the sin function where available: - *

sin([field])
- */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field sin(Field field) { - return function(N_SIN, SQLDataType.NUMERIC, field); - } - /** * Get the tangent(field) function. * @@ -20035,78 +20090,6 @@ public class DSL { return function(N_TAN, SQLDataType.NUMERIC, field); } - /** - * Get the cotangent(field) function. - * - * @see #cot(Field) - */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field cot(Number value) { - return cot(Tools.field(value)); - } - - /** - * Get the cotangent(field) function. - *

- * This renders the cot function where available: - *

cot([field])
... or emulates it elsewhere using - * sin and cos:
cos([field]) / sin([field])
- */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field cot(Field field) { - return new Cot(Tools.nullSafe(field)); - } - - /** - * Get the hyperbolic sine function: sinh(field). - * - * @see #sinh(Field) - */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field sinh(Number value) { - return sinh(Tools.field(value)); - } - - /** - * Get the hyperbolic sine function: sinh(field). - *

- * This renders the sinh function where available: - *

sinh([field])
... or emulates it elsewhere using - * exp:
(exp([field] * 2) - 1) / (exp([field] * 2))
- */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field sinh(Field field) { - return new Sinh(Tools.nullSafe(field)); - } - - /** - * Get the hyperbolic cosine function: cosh(field). - * - * @see #cosh(Field) - */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field cosh(Number value) { - return cosh(Tools.field(value)); - } - - /** - * Get the hyperbolic cosine function: cosh(field). - *

- * This renders the cosh function where available: - *

cosh([field])
... or emulates it elsewhere using - * exp:
(exp([field] * 2) + 1) / (exp([field] * 2))
- */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field cosh(Field field) { - return new Cosh(Tools.nullSafe(field)); - } - /** * Get the hyperbolic tangent function: tanh(field). * @@ -20132,33 +20115,6 @@ public class DSL { return new Tanh(Tools.nullSafe(field)); } - /** - * Get the hyperbolic cotangent function: coth(field). - * - * @see #coth(Field) - */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field coth(Number value) { - return coth(Tools.field(value)); - } - - /** - * Get the hyperbolic cotangent function: coth(field). - *

- * This is not supported by any RDBMS, but emulated using exp exp: - *

(exp([field] * 2) + 1) / (exp([field] * 2) - 1)
- */ - @NotNull - @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) - public static Field coth(Field field) { - field = Tools.nullSafe(field); - return idiv( - iadd(exp(imul(field, two())), one()), - isub(exp(imul(field, two())), one()) - ); - } - diff --git a/jOOQ/src/main/java/org/jooq/impl/Names.java b/jOOQ/src/main/java/org/jooq/impl/Names.java index 1c475f31d2..0e2a3b769f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Names.java +++ b/jOOQ/src/main/java/org/jooq/impl/Names.java @@ -88,6 +88,7 @@ final class Names { static final Name N_COS = unquotedName("cos"); static final Name N_COSH = unquotedName("cosh"); static final Name N_COT = unquotedName("cot"); + static final Name N_COTH = unquotedName("coth"); static final Name N_COUNT = unquotedName("count"); static final Name N_COUNTSET = unquotedName("countset"); static final Name N_CURRENT_BIGDATETIME = unquotedName("current_bigdatetime"); diff --git a/jOOQ/src/main/java/org/jooq/impl/Sin.java b/jOOQ/src/main/java/org/jooq/impl/Sin.java new file mode 100644 index 0000000000..8e1c28125f --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Sin.java @@ -0,0 +1,88 @@ +/* + * 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.SQLDialect.*; + +import org.jooq.*; +import org.jooq.impl.*; + +import java.math.*; +import java.util.*; + +/** + * The SIN statement. + */ +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class Sin +extends + AbstractField +{ + + private static final long serialVersionUID = 1L; + + private final Field number; + + Sin( + Field number + ) { + super(N_SIN, allNotNull(NUMERIC, number)); + + this.number = nullSafeNotNull(number, INTEGER); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + + + @Override + public final void accept(Context ctx) { + ctx.visit(function(N_SIN, getDataType(), number)); + } + + +} diff --git a/jOOQ/src/main/java/org/jooq/impl/Sinh.java b/jOOQ/src/main/java/org/jooq/impl/Sinh.java index fd143f5e75..734d072d1c 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Sinh.java +++ b/jOOQ/src/main/java/org/jooq/impl/Sinh.java @@ -37,37 +37,48 @@ */ package org.jooq.impl; -import static org.jooq.impl.DSL.one; -import static org.jooq.impl.DSL.two; -import static org.jooq.impl.Internal.idiv; -import static org.jooq.impl.Internal.imul; -import static org.jooq.impl.Internal.isub; -import static org.jooq.impl.Names.N_SINH; -import static org.jooq.impl.SQLDataType.NUMERIC; +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.SQLDialect.*; -import java.math.BigDecimal; +import org.jooq.*; +import org.jooq.impl.*; -import org.jooq.Context; -import org.jooq.Field; +import java.math.*; +import java.util.*; /** - * @author Lukas Eder + * The SINH statement. */ -final class Sinh extends AbstractField { +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class Sinh +extends + AbstractField +{ - /** - * Generated UID - */ - private static final long serialVersionUID = -7273879239726265322L; + private static final long serialVersionUID = 1L; - private final Field argument; + private final Field number; - Sinh(Field argument) { - super(N_SINH, NUMERIC); + Sinh( + Field number + ) { + super(N_SINH, allNotNull(NUMERIC, number)); - this.argument = argument; + this.number = nullSafeNotNull(number, INTEGER); } + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + + @Override public final void accept(Context ctx) { switch (ctx.family()) { @@ -91,14 +102,16 @@ final class Sinh extends AbstractField { case MYSQL: case POSTGRES: ctx.visit(idiv( - isub(DSL.exp(imul(argument, two())), one()), - imul(DSL.exp(argument), two()) + isub(DSL.exp(imul(number, two())), one()), + imul(DSL.exp(number), two()) )); break; default: - ctx.visit(N_SINH).sql('(').visit(argument).sql(')'); + ctx.visit(N_SINH).sql('(').visit(number).sql(')'); break; } } + + }