[jOOQ/jOOQ#11061] [jOOQ/jOOQ#11070] [jOOQ/jOOQ#11091] LEFT / RIGHT
- Fixed formatting
This commit is contained in:
parent
f2036e022e
commit
6e85c37a54
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -66,7 +68,7 @@ implements
|
||||
private final Catalog database;
|
||||
private final boolean alterDatabaseIfExists;
|
||||
private Catalog renameTo;
|
||||
|
||||
|
||||
AlterDatabaseImpl(
|
||||
Configuration configuration,
|
||||
Catalog database,
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -79,7 +81,7 @@ implements
|
||||
private boolean dropNotNull;
|
||||
private Boolean cascade;
|
||||
private Constraint renameConstraintTo;
|
||||
|
||||
|
||||
AlterDomainImpl(
|
||||
Configuration configuration,
|
||||
Domain domain,
|
||||
@ -139,20 +141,20 @@ implements
|
||||
this.renameConstraintTo = renameConstraintTo;
|
||||
}
|
||||
|
||||
final Domain<T> $domain() { return domain; }
|
||||
final boolean $alterDomainIfExists() { return alterDomainIfExists; }
|
||||
final Constraint $addConstraint() { return addConstraint; }
|
||||
final Constraint $dropConstraint() { return dropConstraint; }
|
||||
final boolean $dropConstraintIfExists() { return dropConstraintIfExists; }
|
||||
final Domain<?> $renameTo() { return renameTo; }
|
||||
final Constraint $renameConstraint() { return renameConstraint; }
|
||||
final Domain<T> $domain() { return domain; }
|
||||
final boolean $alterDomainIfExists() { return alterDomainIfExists; }
|
||||
final Constraint $addConstraint() { return addConstraint; }
|
||||
final Constraint $dropConstraint() { return dropConstraint; }
|
||||
final boolean $dropConstraintIfExists() { return dropConstraintIfExists; }
|
||||
final Domain<?> $renameTo() { return renameTo; }
|
||||
final Constraint $renameConstraint() { return renameConstraint; }
|
||||
final boolean $renameConstraintIfExists() { return renameConstraintIfExists; }
|
||||
final Field<T> $setDefault() { return setDefault; }
|
||||
final boolean $dropDefault() { return dropDefault; }
|
||||
final boolean $setNotNull() { return setNotNull; }
|
||||
final boolean $dropNotNull() { return dropNotNull; }
|
||||
final Boolean $cascade() { return cascade; }
|
||||
final Constraint $renameConstraintTo() { return renameConstraintTo; }
|
||||
final Field<T> $setDefault() { return setDefault; }
|
||||
final boolean $dropDefault() { return dropDefault; }
|
||||
final boolean $setNotNull() { return setNotNull; }
|
||||
final boolean $dropNotNull() { return dropNotNull; }
|
||||
final Boolean $cascade() { return cascade; }
|
||||
final Constraint $renameConstraintTo() { return renameConstraintTo; }
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: DSL API
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -66,7 +68,7 @@ implements
|
||||
private final Schema schema;
|
||||
private final boolean alterSchemaIfExists;
|
||||
private Schema renameTo;
|
||||
|
||||
|
||||
AlterSchemaImpl(
|
||||
Configuration configuration,
|
||||
Schema schema,
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -64,7 +66,7 @@ implements
|
||||
|
||||
private final Catalog database;
|
||||
private final boolean createDatabaseIfNotExists;
|
||||
|
||||
|
||||
|
||||
CreateDatabaseImpl(
|
||||
Configuration configuration,
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -70,7 +72,7 @@ implements
|
||||
private DataType<T> dataType;
|
||||
private Field<T> default_;
|
||||
private Collection<? extends Constraint> constraints;
|
||||
|
||||
|
||||
CreateDomainImpl(
|
||||
Configuration configuration,
|
||||
Domain domain,
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -64,7 +66,7 @@ implements
|
||||
|
||||
private final Schema schema;
|
||||
private final boolean createSchemaIfNotExists;
|
||||
|
||||
|
||||
|
||||
CreateSchemaImpl(
|
||||
Configuration configuration,
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -75,7 +77,7 @@ implements
|
||||
private boolean noCycle;
|
||||
private Field<? extends Number> cache;
|
||||
private boolean noCache;
|
||||
|
||||
|
||||
CreateSequenceImpl(
|
||||
Configuration configuration,
|
||||
Sequence sequence,
|
||||
|
||||
@ -14879,6 +14879,82 @@ public class DSL {
|
||||
// XXX String function factory
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The <code>LEFT</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> left(String string, int length) {
|
||||
return new Left(Tools.field(string), Tools.field(length));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LEFT</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> left(String string, Field<? extends Number> length) {
|
||||
return new Left(Tools.field(string), length);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LEFT</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> left(Field<String> string, int length) {
|
||||
return new Left(string, Tools.field(length));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LEFT</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> left(Field<String> string, Field<? extends Number> length) {
|
||||
return new Left(string, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>RIGHT</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> right(String string, int length) {
|
||||
return new Right(Tools.field(string), Tools.field(length));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>RIGHT</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> right(String string, Field<? extends Number> length) {
|
||||
return new Right(Tools.field(string), length);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>RIGHT</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> right(Field<String> string, int length) {
|
||||
return new Right(string, Tools.field(length));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>RIGHT</code> function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> right(Field<String> string, Field<? extends Number> length) {
|
||||
return new Right(string, length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the upper(field) function.
|
||||
*
|
||||
@ -15814,118 +15890,6 @@ public class DSL {
|
||||
return substring(field, startingPosition, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the left outermost characters from a string.
|
||||
* <p>
|
||||
* Example:
|
||||
* <code><pre>
|
||||
* 'abc' = LEFT('abcde', 3)
|
||||
* </pre></code>
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> left(String field, int length) {
|
||||
return left(Tools.field(field), Tools.field(length));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the left outermost characters from a string.
|
||||
* <p>
|
||||
* Example:
|
||||
* <code><pre>
|
||||
* 'abc' = LEFT('abcde', 3)
|
||||
* </pre></code>
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> left(String field, Field<? extends Number> length) {
|
||||
return left(Tools.field(field), length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the left outermost characters from a string.
|
||||
* <p>
|
||||
* Example:
|
||||
* <code><pre>
|
||||
* 'abc' = LEFT('abcde', 3)
|
||||
* </pre></code>
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> left(Field<String> field, int length) {
|
||||
return left(field, Tools.field(length));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the left outermost characters from a string.
|
||||
* <p>
|
||||
* Example:
|
||||
* <code><pre>
|
||||
* 'abc' = LEFT('abcde', 3)
|
||||
* </pre></code>
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> left(Field<String> field, Field<? extends Number> length) {
|
||||
return new Left(field, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the right outermost characters from a string.
|
||||
* <p>
|
||||
* Example:
|
||||
* <code><pre>
|
||||
* 'cde' = RIGHT('abcde', 3)
|
||||
* </pre></code>
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> right(String field, int length) {
|
||||
return right(Tools.field(field), Tools.field(length));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the right outermost characters from a string.
|
||||
* <p>
|
||||
* Example:
|
||||
* <code><pre>
|
||||
* 'cde' = RIGHT('abcde', 3)
|
||||
* </pre></code>
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> right(String field, Field<? extends Number> length) {
|
||||
return right(Tools.field(field), length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the right outermost characters from a string.
|
||||
* <p>
|
||||
* Example:
|
||||
* <code><pre>
|
||||
* 'cde' = RIGHT('abcde', 3)
|
||||
* </pre></code>
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> right(Field<String> field, int length) {
|
||||
return right(field, Tools.field(length));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the right outermost characters from a string.
|
||||
* <p>
|
||||
* Example:
|
||||
* <code><pre>
|
||||
* 'cde' = RIGHT('abcde', 3)
|
||||
* </pre></code>
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
public static Field<String> right(Field<String> field, Field<? extends Number> length) {
|
||||
return new Right(field, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of a <code>VARCHAR</code> type. This is a synonym for
|
||||
* {@link #charLength(String)}.
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -64,7 +66,7 @@ implements
|
||||
|
||||
private final Catalog database;
|
||||
private final boolean dropDatabaseIfExists;
|
||||
|
||||
|
||||
|
||||
DropDatabaseImpl(
|
||||
Configuration configuration,
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -66,7 +68,7 @@ implements
|
||||
private final Domain<?> domain;
|
||||
private final boolean dropDomainIfExists;
|
||||
private Boolean cascade;
|
||||
|
||||
|
||||
DropDomainImpl(
|
||||
Configuration configuration,
|
||||
Domain domain,
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -66,7 +68,7 @@ implements
|
||||
private final Schema schema;
|
||||
private final boolean dropSchemaIfExists;
|
||||
private Boolean cascade;
|
||||
|
||||
|
||||
DropSchemaImpl(
|
||||
Configuration configuration,
|
||||
Schema schema,
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -64,7 +66,7 @@ implements
|
||||
|
||||
private final Sequence<?> sequence;
|
||||
private final boolean dropSequenceIfExists;
|
||||
|
||||
|
||||
|
||||
DropSequenceImpl(
|
||||
Configuration configuration,
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -70,7 +72,7 @@ implements
|
||||
private Role to;
|
||||
private Boolean toPublic;
|
||||
private Boolean withGrantOption;
|
||||
|
||||
|
||||
GrantImpl(
|
||||
Configuration configuration,
|
||||
Collection privileges
|
||||
@ -102,10 +104,10 @@ implements
|
||||
this.withGrantOption = withGrantOption;
|
||||
}
|
||||
|
||||
final Collection<? extends Privilege> $privileges() { return privileges; }
|
||||
final Table<?> $on() { return on; }
|
||||
final Role $to() { return to; }
|
||||
final Boolean $toPublic() { return toPublic; }
|
||||
final Collection<? extends Privilege> $privileges() { return privileges; }
|
||||
final Table<?> $on() { return on; }
|
||||
final Role $to() { return to; }
|
||||
final Boolean $toPublic() { return toPublic; }
|
||||
final Boolean $withGrantOption() { return withGrantOption; }
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -37,36 +37,54 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DSL.inline;
|
||||
import static org.jooq.impl.Names.N_LEFT;
|
||||
import static org.jooq.impl.SQLDataType.INTEGER;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.impl.Tools.allNotNull;
|
||||
import static org.jooq.impl.Tools.nullSafeNotNull;
|
||||
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>LEFT</code> statement.
|
||||
*/
|
||||
final class Left extends AbstractField<String> {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class Left
|
||||
extends
|
||||
AbstractField<String>
|
||||
{
|
||||
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = 2200760781944082146L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Field<String> field;
|
||||
private Field<? extends Number> length;
|
||||
private final Field<String> string;
|
||||
private final Field<? extends Number> length;
|
||||
|
||||
Left(Field<String> field, Field<? extends Number> length) {
|
||||
super(N_LEFT, allNotNull(VARCHAR, field, length));
|
||||
|
||||
this.field = nullSafeNotNull(field, VARCHAR);
|
||||
Left(
|
||||
Field string,
|
||||
Field length
|
||||
) {
|
||||
super(N_LEFT, allNotNull(VARCHAR, string, length));
|
||||
|
||||
this.string = nullSafeNotNull(string, VARCHAR);
|
||||
this.length = nullSafeNotNull(length, INTEGER);
|
||||
}
|
||||
|
||||
final Field<String> $string() { return string; }
|
||||
final Field<? extends Number> $length() { return length; }
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
@ -75,7 +93,7 @@ final class Left extends AbstractField<String> {
|
||||
|
||||
case DERBY:
|
||||
case SQLITE:
|
||||
ctx.visit(DSL.substring(field, inline(1), length));
|
||||
ctx.visit(DSL.substring(string, inline(1), length));
|
||||
break;
|
||||
|
||||
|
||||
@ -97,8 +115,10 @@ final class Left extends AbstractField<String> {
|
||||
case MYSQL:
|
||||
case POSTGRES:
|
||||
default:
|
||||
ctx.visit(N_LEFT).sql('(').visit(field).sql(", ").visit(length).sql(')');
|
||||
ctx.visit(N_LEFT).sql('(').visit(string).sql(", ").visit(length).sql(')');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -38,9 +38,11 @@
|
||||
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.*;
|
||||
|
||||
@ -69,7 +71,7 @@ implements
|
||||
private Table<?> on;
|
||||
private Role from;
|
||||
private Boolean fromPublic;
|
||||
|
||||
|
||||
RevokeImpl(
|
||||
Configuration configuration,
|
||||
Collection privileges,
|
||||
|
||||
@ -37,50 +37,66 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DSL.one;
|
||||
import static org.jooq.impl.Internal.iadd;
|
||||
import static org.jooq.impl.Internal.isub;
|
||||
import static org.jooq.impl.Names.N_RIGHT;
|
||||
import static org.jooq.impl.SQLDataType.INTEGER;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.impl.Tools.allNotNull;
|
||||
import static org.jooq.impl.Tools.nullSafeNotNull;
|
||||
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>RIGHT</code> statement.
|
||||
*/
|
||||
final class Right extends AbstractField<String> {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class Right
|
||||
extends
|
||||
AbstractField<String>
|
||||
{
|
||||
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = 2200760781944082146L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Field<String> field;
|
||||
private Field<? extends Number> length;
|
||||
private final Field<String> string;
|
||||
private final Field<? extends Number> length;
|
||||
|
||||
Right(Field<String> field, Field<? extends Number> length) {
|
||||
super(N_RIGHT, allNotNull(VARCHAR, field, length));
|
||||
|
||||
this.field = nullSafeNotNull(field, VARCHAR);
|
||||
Right(
|
||||
Field string,
|
||||
Field length
|
||||
) {
|
||||
super(N_RIGHT, allNotNull(VARCHAR, string, length));
|
||||
|
||||
this.string = nullSafeNotNull(string, VARCHAR);
|
||||
this.length = nullSafeNotNull(length, INTEGER);
|
||||
}
|
||||
|
||||
final Field<String> $string() { return string; }
|
||||
final Field<? extends Number> $length() { return length; }
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
case DERBY:
|
||||
ctx.visit(DSL.substring(field, iadd(DSL.length(field), isub(one(), length))));
|
||||
ctx.visit(DSL.substring(string, iadd(DSL.length(string), isub(one(), length))));
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
case SQLITE:
|
||||
ctx.visit(DSL.substring(field, length.neg()));
|
||||
ctx.visit(DSL.substring(string, length.neg()));
|
||||
break;
|
||||
|
||||
|
||||
@ -102,8 +118,10 @@ final class Right extends AbstractField<String> {
|
||||
case MYSQL:
|
||||
case POSTGRES:
|
||||
default:
|
||||
ctx.visit(N_RIGHT).sql('(').visit(field).sql(", ").visit(length).sql(')');
|
||||
ctx.visit(N_RIGHT).sql('(').visit(string).sql(", ").visit(length).sql(')');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user