From e77b29036e752b2e0d4e387d349667eeb04be65f Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 12 Nov 2019 17:44:16 +0100 Subject: [PATCH] [jOOQ/jOOQ#9536] Fix ln() and exp() --- jOOQ/src/main/java/org/jooq/impl/DSL.java | 2 +- jOOQ/src/main/java/org/jooq/impl/Exp.java | 82 +++++++++++++++++++++++ jOOQ/src/main/java/org/jooq/impl/Ln.java | 15 +++++ 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 jOOQ/src/main/java/org/jooq/impl/Exp.java diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index ec2dd2b664..ddfc6179a0 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -17461,7 +17461,7 @@ public class DSL { */ @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) public static Field exp(Field field) { - return function("exp", SQLDataType.NUMERIC, field); + return new Exp(nullSafe(field)); } /** diff --git a/jOOQ/src/main/java/org/jooq/impl/Exp.java b/jOOQ/src/main/java/org/jooq/impl/Exp.java new file mode 100644 index 0000000000..dfae334b6f --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Exp.java @@ -0,0 +1,82 @@ +/* + * 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.function; +import static org.jooq.impl.SQLDataType.NUMERIC; + +import java.math.BigDecimal; + +import org.jooq.Configuration; +import org.jooq.Field; + +/** + * @author Lukas Eder + */ +final class Exp extends AbstractFunction { + + /** + * Generated UID + */ + private static final long serialVersionUID = -7273879239726265322L; + + private final Field argument; + + Exp(Field argument) { + super("exp", NUMERIC, argument); + + this.argument = argument; + } + + @Override + final Field getFunction0(Configuration configuration) { + switch (configuration.family()) { + + + + + + + + + + default: + return function("exp", NUMERIC, argument); + } + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/Ln.java b/jOOQ/src/main/java/org/jooq/impl/Ln.java index 83a0526be8..55dfa677a5 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Ln.java +++ b/jOOQ/src/main/java/org/jooq/impl/Ln.java @@ -38,6 +38,7 @@ package org.jooq.impl; import static org.jooq.impl.DSL.function; +import static org.jooq.impl.SQLDataType.NUMERIC; import java.math.BigDecimal; @@ -83,6 +84,13 @@ final class Ln extends AbstractFunction { + + + + + + + default: return function("ln", SQLDataType.NUMERIC, argument); } @@ -102,6 +110,13 @@ final class Ln extends AbstractFunction { + + + + + + +