This commit is contained in:
Lukas Eder 2020-12-15 15:03:50 +01:00
parent 97c2c2fb44
commit f884803879
5 changed files with 226 additions and 70 deletions

View File

@ -15151,6 +15151,17 @@ public class DSL {
return new Degrees(radians);
}
/**
* The <code>E</code> function.
* <p>
* The E literal (Euler number).
*/
@NotNull
@Support
public static Field<BigDecimal> e() {
return new E();
}
/**
* The <code>FLOOR</code> function.
* <p>
@ -15637,6 +15648,17 @@ public class DSL {
return new Overlay(in, placing, startIndex);
}
/**
* The <code>PI</code> function.
* <p>
* The π literal.
*/
@NotNull
@Support
public static Field<BigDecimal> pi() {
return new Pi();
}
/**
* The <code>POSITION</code> function.
* <p>
@ -16571,6 +16593,17 @@ public class DSL {
return new Substring(string, startingPosition);
}
/**
* The <code>TAU</code> function.
* <p>
* The τ literal, or π, in a better world.
*/
@NotNull
@Support
public static Field<BigDecimal> tau() {
return new Tau();
}
/**
* The <code>TO_CHAR</code> function.
* <p>
@ -26652,45 +26685,6 @@ public class DSL {
return inline(2);
}
/**
* The <code>π</code> literal.
* <p>
* This will be any of the following:
* <ul>
* <li>The underlying RDBMS' <code>PI</code> literal or <code>PI()</code> function</li>
* <li>{@link Math#PI}</li>
* </ul>
*/
@NotNull
@Support
public static Field<BigDecimal> pi() {
return new Pi();
}
/**
* The <code>τ</code> literal, or <code>π</code>, in a better world.
*/
@NotNull
@Support
public static Field<BigDecimal> tau() {
return imul(pi(), two());
}
/**
* The <code>E</code> literal (Euler number).
* <p>
* This will be any of the following:
* <ul>
* <li>The underlying RDBMS' <code>E</code> literal or <code>E()</code> function</li>
* <li>{@link Math#E}</li>
* </ul>
*/
@NotNull
@Support
public static Field<BigDecimal> e() {
return new Euler();
}
// -------------------------------------------------------------------------
// XXX utility API
// -------------------------------------------------------------------------

View File

@ -37,30 +37,47 @@
*/
package org.jooq.impl;
import static org.jooq.impl.DSL.function;
import static org.jooq.impl.DSL.inline;
import static org.jooq.impl.DSL.one;
import static org.jooq.impl.Names.N_E;
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 org.jooq.*;
import org.jooq.impl.*;
import org.jooq.tools.*;
import java.util.*;
import java.math.BigDecimal;
import org.jooq.Context;
/**
* @author Lukas Eder
* The <code>E</code> statement.
*/
final class Euler extends AbstractField<BigDecimal> {
@SuppressWarnings({ "unused" })
final class E
extends
AbstractField<BigDecimal>
{
/**
* Generated UID
*/
private static final long serialVersionUID = -420788300355442056L;
private static final long serialVersionUID = 1L;
Euler() {
super(N_E, NUMERIC.notNull());
E() {
super(
N_E,
allNotNull(NUMERIC)
);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
switch (ctx.family()) {
@ -100,8 +117,23 @@ final class Euler extends AbstractField<BigDecimal> {
// The Euler number doesn't seem to exist in any dialect...
default:
ctx.visit(function("e", getDataType()));
ctx.visit(function(N_E, getDataType()));
return;
}
}
// -------------------------------------------------------------------------
// The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof E) {
return true;
}
else
return super.equals(that);
}
}

View File

@ -209,7 +209,6 @@ final class Names {
static final Name N_RAWTOHEX = unquotedName("rawtohex");
static final Name N_REGEXP_REPLACE = unquotedName("regexp_replace");
static final Name N_REGEX_REPLACE = unquotedName("regex_replace");
static final Name N_REGR_AVGX = unquotedName("regr_avgx");
static final Name N_REGR_AVGY = unquotedName("regr_avgy");
static final Name N_REGR_COUNT = unquotedName("regr_count");
@ -280,6 +279,7 @@ final class Names {
static final Name N_TO_DATE = unquotedName("to_date");
static final Name N_TO_NUMBER = unquotedName("to_number");
static final Name N_TO_TIMESTAMP = unquotedName("to_timestamp");
static final Name N_TAU = unquotedName("tau");
static final Name N_TRANSLATE = unquotedName("translate");
static final Name N_TRIM = unquotedName("trim");
static final Name N_TRUNC = unquotedName("trunc");

View File

@ -37,32 +37,47 @@
*/
package org.jooq.impl;
import static org.jooq.impl.DSL.function;
import static org.jooq.impl.DSL.inline;
import static org.jooq.impl.DSL.one;
import static org.jooq.impl.DSL.two;
import static org.jooq.impl.Internal.imul;
import static org.jooq.impl.Names.N_PI;
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 org.jooq.*;
import org.jooq.impl.*;
import org.jooq.tools.*;
import java.util.*;
import java.math.BigDecimal;
import org.jooq.Context;
/**
* @author Lukas Eder
* The <code>PI</code> statement.
*/
final class Pi extends AbstractField<BigDecimal> {
@SuppressWarnings({ "unused" })
final class Pi
extends
AbstractField<BigDecimal>
{
/**
* Generated UID
*/
private static final long serialVersionUID = -420788300355442056L;
private static final long serialVersionUID = 1L;
Pi() {
super(N_PI, NUMERIC.notNull());
super(
N_PI,
allNotNull(NUMERIC)
);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
switch (ctx.family()) {
@ -86,4 +101,19 @@ final class Pi extends AbstractField<BigDecimal> {
return;
}
}
// -------------------------------------------------------------------------
// The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof Pi) {
return true;
}
else
return super.equals(that);
}
}

View File

@ -0,0 +1,100 @@
/*
* 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 org.jooq.tools.*;
import java.util.*;
import java.math.BigDecimal;
/**
* The <code>TAU</code> statement.
*/
@SuppressWarnings({ "unused" })
final class Tau
extends
AbstractField<BigDecimal>
{
private static final long serialVersionUID = 1L;
Tau() {
super(
N_TAU,
allNotNull(NUMERIC)
);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
ctx.visit(imul(pi(), two()));
}
// -------------------------------------------------------------------------
// The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof Tau) {
return true;
}
else
return super.equals(that);
}
}