[jOOQ/jOOQ#11061] [jOOQ/jOOQ#11070] [jOOQ/jOOQ#11091] TRANSLATE
This commit is contained in:
parent
74775ffce5
commit
16bee574ef
@ -15721,6 +15721,78 @@ public class DSL {
|
||||
return new Substring(string, startingPosition);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TRANSLATE</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(String string, String from, String to) {
|
||||
return new Translate(Tools.field(string), Tools.field(from), Tools.field(to));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TRANSLATE</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(String string, String from, Field<String> to) {
|
||||
return new Translate(Tools.field(string), Tools.field(from), to);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TRANSLATE</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(String string, Field<String> from, String to) {
|
||||
return new Translate(Tools.field(string), from, Tools.field(to));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TRANSLATE</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(String string, Field<String> from, Field<String> to) {
|
||||
return new Translate(Tools.field(string), from, to);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TRANSLATE</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(Field<String> string, String from, String to) {
|
||||
return new Translate(string, Tools.field(from), Tools.field(to));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TRANSLATE</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(Field<String> string, String from, Field<String> to) {
|
||||
return new Translate(string, Tools.field(from), to);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TRANSLATE</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(Field<String> string, Field<String> from, String to) {
|
||||
return new Translate(string, from, Tools.field(to));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TRANSLATE</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(Field<String> string, Field<String> from, Field<String> to) {
|
||||
return new Translate(string, from, to);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>TRIM</code> function.
|
||||
*/
|
||||
@ -15817,26 +15889,6 @@ public class DSL {
|
||||
return lpad(field, length, Character.toString(character));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the translate(field, from, to) function.
|
||||
*
|
||||
* @see #translate(Field, Field, Field)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(Field<String> text, String from, String to) {
|
||||
return translate(text, Tools.field(from), Tools.field(to));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the translate(field, from, to) function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, HSQLDB, POSTGRES })
|
||||
public static Field<String> translate(Field<String> text, Field<String> from, Field<String> to) {
|
||||
return new Translate(text, from, to);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SQL Server specific <code>SPACE()</code> function.
|
||||
* <p>
|
||||
|
||||
@ -37,34 +37,53 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DSL.function;
|
||||
import static org.jooq.impl.Names.N_TRANSLATE;
|
||||
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.Context;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.*;
|
||||
import org.jooq.impl.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
* The <code>TRANSLATE</code> statement.
|
||||
*/
|
||||
final class Translate extends AbstractField<String> {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class Translate
|
||||
extends
|
||||
AbstractField<String>
|
||||
{
|
||||
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = 6776882414592454999L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Field<String> text;
|
||||
private final Field<String> string;
|
||||
private final Field<String> from;
|
||||
private final Field<String> to;
|
||||
|
||||
Translate(Field<String> text, Field<String> from, Field<String> to) {
|
||||
super(N_TRANSLATE, text.getDataType());
|
||||
Translate(
|
||||
Field<String> string,
|
||||
Field<String> from,
|
||||
Field<String> to
|
||||
) {
|
||||
super(N_TRANSLATE, allNotNull(VARCHAR, string, from, to));
|
||||
|
||||
this.text = text;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.string = nullSafeNotNull(string, VARCHAR);
|
||||
this.from = nullSafeNotNull(from, VARCHAR);
|
||||
this.to = nullSafeNotNull(to, VARCHAR);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
@ -79,8 +98,10 @@ final class Translate extends AbstractField<String> {
|
||||
|
||||
|
||||
default:
|
||||
ctx.visit(function("translate", getDataType(), text, from, to));
|
||||
ctx.visit(function("translate", getDataType(), string, from, to));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user