[jOOQ/jOOQ#13306] Separate QOM.Ln (natural logarithm) from QOM.Log (logarithm with base)
This commit is contained in:
parent
c718693d8f
commit
c703a89248
@ -16514,26 +16514,32 @@ public class DSL {
|
||||
|
||||
/**
|
||||
* The <code>LN</code> function.
|
||||
* <p>
|
||||
* Get the natural logarithm of a value.
|
||||
*
|
||||
* @param value is wrapped as {@link #val(Object)}.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<BigDecimal> ln(Number value) {
|
||||
return new Log(Tools.field(value));
|
||||
return new Ln(Tools.field(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LN</code> function.
|
||||
* <p>
|
||||
* Get the natural logarithm of a value.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<BigDecimal> ln(Field<? extends Number> value) {
|
||||
return new Log(value);
|
||||
return new Ln(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LOG</code> function.
|
||||
* <p>
|
||||
* Get the logarithm of a value for a base.
|
||||
*
|
||||
* @param value is wrapped as {@link #val(Object)}.
|
||||
* @param base is wrapped as {@link #val(Object)}.
|
||||
@ -16546,6 +16552,8 @@ public class DSL {
|
||||
|
||||
/**
|
||||
* The <code>LOG</code> function.
|
||||
* <p>
|
||||
* Get the logarithm of a value for a base.
|
||||
*
|
||||
* @param value is wrapped as {@link #val(Object)}.
|
||||
*/
|
||||
@ -16557,6 +16565,8 @@ public class DSL {
|
||||
|
||||
/**
|
||||
* The <code>LOG</code> function.
|
||||
* <p>
|
||||
* Get the logarithm of a value for a base.
|
||||
*
|
||||
* @param base is wrapped as {@link #val(Object)}.
|
||||
*/
|
||||
@ -16568,6 +16578,8 @@ public class DSL {
|
||||
|
||||
/**
|
||||
* The <code>LOG</code> function.
|
||||
* <p>
|
||||
* Get the logarithm of a value for a base.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
@ -16577,6 +16589,8 @@ public class DSL {
|
||||
|
||||
/**
|
||||
* The <code>LOG10</code> function.
|
||||
* <p>
|
||||
* Get the logarithm of a value for base 10.
|
||||
*
|
||||
* @param value is wrapped as {@link #val(Object)}.
|
||||
*/
|
||||
@ -16588,6 +16602,8 @@ public class DSL {
|
||||
|
||||
/**
|
||||
* The <code>LOG10</code> function.
|
||||
* <p>
|
||||
* Get the logarithm of a value for base 10.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
|
||||
@ -63,7 +63,7 @@ import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>LN</code> statement.
|
||||
* The <code>LOG</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
final class Log
|
||||
@ -76,24 +76,12 @@ implements
|
||||
final Field<? extends Number> value;
|
||||
final Field<? extends Number> base;
|
||||
|
||||
Log(
|
||||
Field<? extends Number> value
|
||||
) {
|
||||
super(
|
||||
N_LN,
|
||||
allNotNull(NUMERIC, value)
|
||||
);
|
||||
|
||||
this.value = nullSafeNotNull(value, INTEGER);
|
||||
this.base = null;
|
||||
}
|
||||
|
||||
Log(
|
||||
Field<? extends Number> value,
|
||||
Field<? extends Number> base
|
||||
) {
|
||||
super(
|
||||
N_LN,
|
||||
N_LOG,
|
||||
allNotNull(NUMERIC, value, base)
|
||||
);
|
||||
|
||||
@ -105,42 +93,9 @@ implements
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
if (base == null) {
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case SQLITE:
|
||||
ctx.visit(function(N_LOG, NUMERIC, value));
|
||||
return;
|
||||
|
||||
default:
|
||||
ctx.visit(function(N_LN, NUMERIC, value));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (ctx.family()) {
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
@ -167,17 +122,26 @@ implements
|
||||
|
||||
|
||||
|
||||
case DERBY:
|
||||
case HSQLDB:
|
||||
case IGNITE:
|
||||
case SQLITE:
|
||||
ctx.visit(idiv(DSL.ln(value), DSL.ln(base)));
|
||||
return;
|
||||
|
||||
default:
|
||||
ctx.visit(function(N_LOG, NUMERIC, base, value));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
case DERBY:
|
||||
case HSQLDB:
|
||||
case IGNITE:
|
||||
case SQLITE:
|
||||
ctx.visit(idiv(DSL.ln(value), DSL.ln(base)));
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
ctx.visit(function(N_LOG, NUMERIC, base, value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,8 +158,6 @@ implements
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -1460,6 +1460,15 @@ package org.jooq.impl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2605,6 +2605,23 @@ public final class QOM {
|
||||
|
||||
/**
|
||||
* The <code>LN</code> function.
|
||||
* <p>
|
||||
* Get the natural logarithm of a value.
|
||||
*/
|
||||
public /*sealed*/ interface Ln
|
||||
extends
|
||||
org.jooq.Field<BigDecimal>
|
||||
//permits
|
||||
// Ln
|
||||
{
|
||||
@NotNull Field<? extends Number> $value();
|
||||
@NotNull Ln $value(Field<? extends Number> value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LOG</code> function.
|
||||
* <p>
|
||||
* Get the logarithm of a value for a base.
|
||||
*/
|
||||
public /*sealed*/ interface Log
|
||||
extends
|
||||
@ -2613,13 +2630,15 @@ public final class QOM {
|
||||
// Log
|
||||
{
|
||||
@NotNull Field<? extends Number> $value();
|
||||
@Nullable Field<? extends Number> $base();
|
||||
@NotNull Field<? extends Number> $base();
|
||||
@NotNull Log $value(Field<? extends Number> value);
|
||||
@NotNull Log $base(Field<? extends Number> base);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LOG10</code> function.
|
||||
* <p>
|
||||
* Get the logarithm of a value for base 10.
|
||||
*/
|
||||
public /*sealed*/ interface Log10
|
||||
extends
|
||||
|
||||
Loading…
Reference in New Issue
Block a user