[jOOQ/jOOQ#10210] Improved API generation
- Generate code for CreateSequenceImpl - Generate code for DropSequenceImpl - Added new arg@wrap attribute - Added convenience for no arg clauses
This commit is contained in:
parent
ce73ad314a
commit
16b3fda0a8
@ -37,8 +37,12 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import static org.jooq.SQLDialect.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* A {@link Query} that can create sequences.
|
||||
* A step in the construction of the <code>CREATE SEQUENCE</code> statement.
|
||||
* <p>
|
||||
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
|
||||
* <p>
|
||||
@ -57,9 +61,7 @@ package org.jooq;
|
||||
* <li>They're less readable</li>
|
||||
* <li>They might have binary incompatible changes between minor releases</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
@SuppressWarnings({ "unused" })
|
||||
public interface CreateSequenceFinalStep extends DDLQuery {
|
||||
|
||||
}
|
||||
|
||||
@ -37,27 +37,12 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.HSQLDB;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* A {@link Query} that can create sequences.
|
||||
* A step in the construction of the <code>CREATE SEQUENCE</code> statement.
|
||||
* <p>
|
||||
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
|
||||
* <p>
|
||||
@ -76,97 +61,96 @@ import static org.jooq.SQLDialect.POSTGRES;
|
||||
* <li>They're less readable</li>
|
||||
* <li>They might have binary incompatible changes between minor releases</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
@SuppressWarnings({ "unused" })
|
||||
public interface CreateSequenceFlagsStep extends CreateSequenceFinalStep {
|
||||
|
||||
/**
|
||||
* Add a <code>START WITH</code> clause to the sequence definition.
|
||||
* Add the <code>START WITH</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep startWith(Number value);
|
||||
CreateSequenceFlagsStep startWith(Number startWith);
|
||||
|
||||
/**
|
||||
* Add a <code>START WITH</code> clause to the sequence definition.
|
||||
* Add the <code>START WITH</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep startWith(Field<? extends Number> value);
|
||||
CreateSequenceFlagsStep startWith(Field<? extends Number> startWith);
|
||||
|
||||
/**
|
||||
* Add a <code>INCREMENT BY</code> clause to the sequence definition.
|
||||
* Add the <code>INCREMENT BY</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep incrementBy(Number value);
|
||||
CreateSequenceFlagsStep incrementBy(Number incrementBy);
|
||||
|
||||
/**
|
||||
* Add a <code>INCREMENT BY</code> clause to the sequence definition.
|
||||
* Add the <code>INCREMENT BY</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep incrementBy(Field<? extends Number> value);
|
||||
CreateSequenceFlagsStep incrementBy(Field<? extends Number> incrementBy);
|
||||
|
||||
/**
|
||||
* Add a <code>MINVALUE</code> clause to the sequence definition.
|
||||
* Add the <code>MINVALUE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep minvalue(Number value);
|
||||
CreateSequenceFlagsStep minvalue(Number minvalue);
|
||||
|
||||
/**
|
||||
* Add a <code>MINVALUE</code> clause to the sequence definition.
|
||||
* Add the <code>MINVALUE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep minvalue(Field<? extends Number> value);
|
||||
CreateSequenceFlagsStep minvalue(Field<? extends Number> minvalue);
|
||||
|
||||
/**
|
||||
* Add a <code>NO MINVALUE</code> clause to the sequence definition.
|
||||
* Add the <code>NO MINVALUE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep noMinvalue();
|
||||
|
||||
/**
|
||||
* Add a <code>MINVALUE</code> clause to the sequence definition.
|
||||
* Add the <code>MAXVALUE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep maxvalue(Number value);
|
||||
CreateSequenceFlagsStep maxvalue(Number maxvalue);
|
||||
|
||||
/**
|
||||
* Add a <code>MINVALUE</code> clause to the sequence definition.
|
||||
* Add the <code>MAXVALUE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep maxvalue(Field<? extends Number> value);
|
||||
CreateSequenceFlagsStep maxvalue(Field<? extends Number> maxvalue);
|
||||
|
||||
/**
|
||||
* Add a <code>NO MINVALUE</code> clause to the sequence definition.
|
||||
* Add the <code>NO MAXVALUE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep noMaxvalue();
|
||||
|
||||
/**
|
||||
* Add a <code>CYCLE</code> clause to the sequence definition.
|
||||
* Add the <code>CYCLE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep cycle();
|
||||
|
||||
/**
|
||||
* Add a <code>NO CYCLE</code> clause to the sequence definition.
|
||||
* Add the <code>NO CYCLE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep noCycle();
|
||||
|
||||
/**
|
||||
* Add a <code>CACHE</code> clause to the sequence definition.
|
||||
* Add the <code>CACHE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, H2, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep cache(Number value);
|
||||
CreateSequenceFlagsStep cache(Number cache);
|
||||
|
||||
/**
|
||||
* Add a <code>CACHE</code> clause to the sequence definition.
|
||||
* Add the <code>CACHE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, H2, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep cache(Field<? extends Number> value);
|
||||
CreateSequenceFlagsStep cache(Field<? extends Number> cache);
|
||||
|
||||
/**
|
||||
* Add a <code>NO CACHE</code> clause to the sequence definition.
|
||||
* Add the <code>NO CACHE</code> clause to the <code>CREATE SEQUENCE</code> statement.
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep noCache();
|
||||
|
||||
@ -8884,6 +8884,54 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
@Support({ H2, MARIADB, MYSQL, POSTGRES })
|
||||
CreateSchemaFinalStep createSchemaIfNotExists(Schema schema);
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#createSequence(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequence(String sequence);
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#createSequence(Name)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequence(Name sequence);
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#createSequence(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequence(Sequence<?> sequence);
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSL#createSequenceIfNotExists(String)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequenceIfNotExists(String sequence);
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSL#createSequenceIfNotExists(Name)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequenceIfNotExists(Name sequence);
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSL#createSequenceIfNotExists(Sequence)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequenceIfNotExists(Sequence<?> sequence);
|
||||
|
||||
/**
|
||||
* The <code>ALTER DATABASE</code> statement.
|
||||
*
|
||||
@ -9172,6 +9220,54 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
|
||||
DropSchemaStep dropSchemaIfExists(Schema schema);
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#dropSequence(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequence(String sequence);
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#dropSequence(Name)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequence(Name sequence);
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#dropSequence(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequence(Sequence<?> sequence);
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
*
|
||||
* @see DSL#dropSequenceIfExists(String)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequenceIfExists(String sequence);
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
*
|
||||
* @see DSL#dropSequenceIfExists(Name)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequenceIfExists(Name sequence);
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
*
|
||||
* @see DSL#dropSequenceIfExists(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequenceIfExists(Sequence<?> sequence);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -9990,54 +10086,6 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
@Support({ FIREBIRD, H2, HSQLDB, POSTGRES, SQLITE })
|
||||
CreateIndexStep createUniqueIndexIfNotExists(Index index);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#createSequence(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequence(String sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#createSequence(Name)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequence(Name sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#createSequence(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequence(Sequence<?> sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#createSequenceIfNotExists(String)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequenceIfNotExists(String sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#createSequenceIfNotExists(Name)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequenceIfNotExists(Name sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#createSequenceIfNotExists(Sequence)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
CreateSequenceFlagsStep createSequenceIfNotExists(Sequence<?> sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>ALTER SEQUENCE</code> statement.
|
||||
*
|
||||
@ -10449,63 +10497,6 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, SQLITE })
|
||||
DropIndexOnStep dropIndexIfExists(Index index);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#dropSequence(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequence(String sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#dropSequence(Name)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequence(Name sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSL#dropSequence(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequence(Sequence<?> sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
* <p>
|
||||
* If your database doesn't natively support <code>IF EXISTS</code>, this is
|
||||
* emulated by catching (and ignoring) the relevant {@link SQLException}.
|
||||
*
|
||||
* @see DSL#dropSequenceIfExists(String)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequenceIfExists(String sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
* <p>
|
||||
* If your database doesn't natively support <code>IF EXISTS</code>, this is
|
||||
* emulated by catching (and ignoring) the relevant {@link SQLException}.
|
||||
*
|
||||
* @see DSL#dropSequenceIfExists(Name)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequenceIfExists(Name sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
* <p>
|
||||
* If your database doesn't natively support <code>IF EXISTS</code>, this is
|
||||
* emulated by catching (and ignoring) the relevant {@link SQLException}.
|
||||
*
|
||||
* @see DSL#dropSequenceIfExists(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
DropSequenceFinalStep dropSequenceIfExists(Sequence<?> sequence);
|
||||
|
||||
/**
|
||||
* Create a new DSL truncate statement.
|
||||
* <p>
|
||||
|
||||
@ -37,8 +37,12 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import static org.jooq.SQLDialect.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* A {@link Query} that can drop sequences.
|
||||
* A step in the construction of the <code>DROP SEQUENCE</code> statement.
|
||||
* <p>
|
||||
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
|
||||
* <p>
|
||||
@ -57,9 +61,7 @@ package org.jooq;
|
||||
* <li>They're less readable</li>
|
||||
* <li>They might have binary incompatible changes between minor releases</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
@SuppressWarnings({ "unused" })
|
||||
public interface DropSequenceFinalStep extends DDLQuery {
|
||||
|
||||
}
|
||||
|
||||
@ -37,8 +37,6 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.Clause.CREATE_SEQUENCE;
|
||||
import static org.jooq.Clause.CREATE_SEQUENCE_SEQUENCE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
@ -71,100 +69,139 @@ import java.util.Set;
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.CreateSequenceFinalStep;
|
||||
import org.jooq.CreateSequenceFlagsStep;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.Sequence;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
* The <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*/
|
||||
final class CreateSequenceImpl extends AbstractRowCountQuery implements
|
||||
@SuppressWarnings({ "hiding", "rawtypes", "unchecked", "unused" })
|
||||
final class CreateSequenceImpl
|
||||
extends
|
||||
AbstractRowCountQuery
|
||||
implements
|
||||
CreateSequenceFlagsStep,
|
||||
CreateSequenceFinalStep
|
||||
{
|
||||
|
||||
// Cascading interface implementations for CREATE SEQUENCE behaviour
|
||||
CreateSequenceFlagsStep {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = 8904572826501186329L;
|
||||
private static final Clause[] CLAUSES = { CREATE_SEQUENCE };
|
||||
private static final Set<SQLDialect> NO_SUPPORT_IF_NOT_EXISTS = SQLDialect.supportedBy(DERBY, FIREBIRD);
|
||||
private static final Set<SQLDialect> REQUIRES_START_WITH = SQLDialect.supportedBy(DERBY);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_CACHE = SQLDialect.supportedBy(DERBY, FIREBIRD, HSQLDB);
|
||||
private static final Set<SQLDialect> NO_SEPARATOR = SQLDialect.supportedBy(CUBRID, MARIADB);
|
||||
private static final Set<SQLDialect> OMIT_NO_CACHE = SQLDialect.supportedBy(FIREBIRD, POSTGRES);
|
||||
private static final Set<SQLDialect> OMIT_NO_CYCLE = SQLDialect.supportedBy(FIREBIRD);
|
||||
private static final Set<SQLDialect> OMIT_NO_MINVALUE = SQLDialect.supportedBy(FIREBIRD);
|
||||
private static final Set<SQLDialect> OMIT_NO_MAXVALUE = SQLDialect.supportedBy(FIREBIRD);
|
||||
private final Sequence<?> sequence;
|
||||
private final boolean createSequenceIfNotExists;
|
||||
private Field<? extends Number> startWith;
|
||||
private Field<? extends Number> incrementBy;
|
||||
private Field<? extends Number> minvalue;
|
||||
private boolean noMinvalue;
|
||||
private Field<? extends Number> maxvalue;
|
||||
private boolean noMaxvalue;
|
||||
private boolean cycle;
|
||||
private boolean noCycle;
|
||||
private Field<? extends Number> cache;
|
||||
private boolean noCache;
|
||||
|
||||
private final Sequence<?> sequence;
|
||||
private final boolean ifNotExists;
|
||||
private Field<? extends Number> startWith;
|
||||
private Field<? extends Number> incrementBy;
|
||||
private Field<? extends Number> minvalue;
|
||||
private boolean noMinvalue;
|
||||
private Field<? extends Number> maxvalue;
|
||||
private boolean noMaxvalue;
|
||||
private boolean cycle;
|
||||
private boolean noCycle;
|
||||
private Field<? extends Number> cache;
|
||||
private boolean noCache;
|
||||
CreateSequenceImpl(
|
||||
Configuration configuration,
|
||||
Sequence sequence,
|
||||
boolean createSequenceIfNotExists
|
||||
) {
|
||||
this(
|
||||
configuration,
|
||||
sequence,
|
||||
createSequenceIfNotExists,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
CreateSequenceImpl(Configuration configuration, Sequence<?> sequence, boolean ifNotExists) {
|
||||
CreateSequenceImpl(
|
||||
Configuration configuration,
|
||||
Sequence sequence,
|
||||
boolean createSequenceIfNotExists,
|
||||
Field startWith,
|
||||
Field incrementBy,
|
||||
Field minvalue,
|
||||
boolean noMinvalue,
|
||||
Field maxvalue,
|
||||
boolean noMaxvalue,
|
||||
boolean cycle,
|
||||
boolean noCycle,
|
||||
Field cache,
|
||||
boolean noCache
|
||||
) {
|
||||
super(configuration);
|
||||
|
||||
this.sequence = sequence;
|
||||
this.ifNotExists = ifNotExists;
|
||||
this.createSequenceIfNotExists = createSequenceIfNotExists;
|
||||
this.startWith = startWith;
|
||||
this.incrementBy = incrementBy;
|
||||
this.minvalue = minvalue;
|
||||
this.noMinvalue = noMinvalue;
|
||||
this.maxvalue = maxvalue;
|
||||
this.noMaxvalue = noMaxvalue;
|
||||
this.cycle = cycle;
|
||||
this.noCycle = noCycle;
|
||||
this.cache = cache;
|
||||
this.noCache = noCache;
|
||||
}
|
||||
|
||||
final Sequence<?> $sequence() { return sequence; }
|
||||
final boolean $ifNotExists() { return ifNotExists; }
|
||||
final Field<? extends Number> $startWith() { return startWith; }
|
||||
final Field<? extends Number> $incrementBy() { return incrementBy; }
|
||||
final Field<? extends Number> $minvalue() { return minvalue; }
|
||||
final boolean $noMinvalue() { return noMinvalue; }
|
||||
final Field<? extends Number> $maxvalue() { return maxvalue; }
|
||||
final boolean $noMaxvalue() { return noMaxvalue; }
|
||||
final boolean $cycle() { return cycle; }
|
||||
final boolean $noCycle() { return noCycle; }
|
||||
final Field<? extends Number> $cache() { return cache; }
|
||||
final boolean $noCache() { return noCache; }
|
||||
final Sequence<?> $sequence() { return sequence; }
|
||||
final boolean $createSequenceIfNotExists() { return createSequenceIfNotExists; }
|
||||
final Field<? extends Number> $startWith() { return startWith; }
|
||||
final Field<? extends Number> $incrementBy() { return incrementBy; }
|
||||
final Field<? extends Number> $minvalue() { return minvalue; }
|
||||
final boolean $noMinvalue() { return noMinvalue; }
|
||||
final Field<? extends Number> $maxvalue() { return maxvalue; }
|
||||
final boolean $noMaxvalue() { return noMaxvalue; }
|
||||
final boolean $cycle() { return cycle; }
|
||||
final boolean $noCycle() { return noCycle; }
|
||||
final Field<? extends Number> $cache() { return cache; }
|
||||
final boolean $noCache() { return noCache; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// XXX: Sequence API
|
||||
// ------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: DSL API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl startWith(Number value) {
|
||||
return startWith(Tools.field(value, sequence.getDataType()));
|
||||
public final CreateSequenceImpl startWith(Number startWith) {
|
||||
return startWith(Tools.field(startWith, sequence.getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl startWith(Field<? extends Number> value) {
|
||||
this.startWith = value;
|
||||
public final CreateSequenceImpl startWith(Field<? extends Number> startWith) {
|
||||
this.startWith = startWith;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl incrementBy(Number value) {
|
||||
return incrementBy(Tools.field(value, sequence.getDataType()));
|
||||
public final CreateSequenceImpl incrementBy(Number incrementBy) {
|
||||
return incrementBy(Tools.field(incrementBy, sequence.getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl incrementBy(Field<? extends Number> value) {
|
||||
this.incrementBy = value;
|
||||
public final CreateSequenceImpl incrementBy(Field<? extends Number> incrementBy) {
|
||||
this.incrementBy = incrementBy;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl minvalue(Number value) {
|
||||
return minvalue(Tools.field(value, sequence.getDataType()));
|
||||
public final CreateSequenceImpl minvalue(Number minvalue) {
|
||||
return minvalue(Tools.field(minvalue, sequence.getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl minvalue(Field<? extends Number> value) {
|
||||
this.minvalue = value;
|
||||
public final CreateSequenceImpl minvalue(Field<? extends Number> minvalue) {
|
||||
this.minvalue = minvalue;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -175,13 +212,13 @@ final class CreateSequenceImpl extends AbstractRowCountQuery implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl maxvalue(Number value) {
|
||||
return maxvalue(Tools.field(value, sequence.getDataType()));
|
||||
public final CreateSequenceImpl maxvalue(Number maxvalue) {
|
||||
return maxvalue(Tools.field(maxvalue, sequence.getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl maxvalue(Field<? extends Number> value) {
|
||||
this.maxvalue = value;
|
||||
public final CreateSequenceImpl maxvalue(Field<? extends Number> maxvalue) {
|
||||
this.maxvalue = maxvalue;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -204,13 +241,13 @@ final class CreateSequenceImpl extends AbstractRowCountQuery implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl cache(Number value) {
|
||||
return cache(Tools.field(value, sequence.getDataType()));
|
||||
public final CreateSequenceImpl cache(Number cache) {
|
||||
return cache(Tools.field(cache, sequence.getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CreateSequenceImpl cache(Field<? extends Number> value) {
|
||||
this.cache = value;
|
||||
public final CreateSequenceImpl cache(Field<? extends Number> cache) {
|
||||
this.cache = cache;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -220,9 +257,21 @@ final class CreateSequenceImpl extends AbstractRowCountQuery implements
|
||||
return this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// ------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
private static final Clause[] CLAUSES = { Clause.CREATE_SEQUENCE };
|
||||
private static final Set<SQLDialect> NO_SUPPORT_IF_NOT_EXISTS = SQLDialect.supportedBy(DERBY, FIREBIRD);
|
||||
private static final Set<SQLDialect> REQUIRES_START_WITH = SQLDialect.supportedBy(DERBY);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_CACHE = SQLDialect.supportedBy(DERBY, FIREBIRD, HSQLDB);
|
||||
private static final Set<SQLDialect> NO_SEPARATOR = SQLDialect.supportedBy(CUBRID, MARIADB);
|
||||
private static final Set<SQLDialect> OMIT_NO_CACHE = SQLDialect.supportedBy(FIREBIRD, POSTGRES);
|
||||
private static final Set<SQLDialect> OMIT_NO_CYCLE = SQLDialect.supportedBy(FIREBIRD);
|
||||
private static final Set<SQLDialect> OMIT_NO_MINVALUE = SQLDialect.supportedBy(FIREBIRD);
|
||||
private static final Set<SQLDialect> OMIT_NO_MAXVALUE = SQLDialect.supportedBy(FIREBIRD);
|
||||
|
||||
private final boolean supportsIfNotExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_NOT_EXISTS.contains(ctx.family());
|
||||
@ -230,7 +279,7 @@ final class CreateSequenceImpl extends AbstractRowCountQuery implements
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
if (ifNotExists && !supportsIfNotExists(ctx)) {
|
||||
if (createSequenceIfNotExists && !supportsIfNotExists(ctx)) {
|
||||
Tools.beginTryCatch(ctx, DDLStatementType.CREATE_SEQUENCE);
|
||||
accept0(ctx);
|
||||
Tools.endTryCatch(ctx, DDLStatementType.CREATE_SEQUENCE);
|
||||
@ -243,13 +292,13 @@ final class CreateSequenceImpl extends AbstractRowCountQuery implements
|
||||
private final void accept0(Context<?> ctx) {
|
||||
SQLDialect family = ctx.family();
|
||||
|
||||
ctx.start(CREATE_SEQUENCE_SEQUENCE)
|
||||
ctx.start(Clause.CREATE_SEQUENCE_SEQUENCE)
|
||||
.visit(K_CREATE)
|
||||
.sql(' ')
|
||||
.visit(family == CUBRID ? K_SERIAL : K_SEQUENCE)
|
||||
.sql(' ');
|
||||
|
||||
if (ifNotExists && supportsIfNotExists(ctx))
|
||||
if (createSequenceIfNotExists && supportsIfNotExists(ctx))
|
||||
ctx.visit(K_IF_NOT_EXISTS)
|
||||
.sql(' ');
|
||||
|
||||
@ -286,11 +335,13 @@ final class CreateSequenceImpl extends AbstractRowCountQuery implements
|
||||
else if (noCache && !OMIT_NO_CACHE.contains(family))
|
||||
ctx.sql(' ').visit(K_NO).sql(noSeparator).visit(K_CACHE);
|
||||
|
||||
ctx.end(CREATE_SEQUENCE_SEQUENCE);
|
||||
ctx.end(Clause.CREATE_SEQUENCE_SEQUENCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Clause[] clauses(Context<?> ctx) {
|
||||
return CLAUSES;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -184,7 +184,6 @@ import org.jooq.ConstraintForeignKeyReferencesStepN;
|
||||
import org.jooq.ConstraintTypeStep;
|
||||
// ...
|
||||
import org.jooq.CreateIndexStep;
|
||||
import org.jooq.CreateSequenceFlagsStep;
|
||||
import org.jooq.CreateTableColumnStep;
|
||||
import org.jooq.CreateTypeStep;
|
||||
import org.jooq.CreateViewAsStep;
|
||||
@ -197,7 +196,6 @@ import org.jooq.DeleteUsingStep;
|
||||
import org.jooq.DerivedColumnList;
|
||||
import org.jooq.Domain;
|
||||
import org.jooq.DropIndexOnStep;
|
||||
import org.jooq.DropSequenceFinalStep;
|
||||
import org.jooq.DropTableStep;
|
||||
import org.jooq.DropTypeStep;
|
||||
import org.jooq.DropViewFinalStep;
|
||||
@ -6999,6 +6997,66 @@ public class DSL {
|
||||
return dsl().createSchemaIfNotExists(schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequence(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.CreateSequenceFlagsStep createSequence(String sequence) {
|
||||
return dsl().createSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequence(Name)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.CreateSequenceFlagsStep createSequence(Name sequence) {
|
||||
return dsl().createSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequence(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.CreateSequenceFlagsStep createSequence(Sequence<?> sequence) {
|
||||
return dsl().createSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequenceIfNotExists(String)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.CreateSequenceFlagsStep createSequenceIfNotExists(String sequence) {
|
||||
return dsl().createSequenceIfNotExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequenceIfNotExists(Name)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.CreateSequenceFlagsStep createSequenceIfNotExists(Name sequence) {
|
||||
return dsl().createSequenceIfNotExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequenceIfNotExists(Sequence)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.CreateSequenceFlagsStep createSequenceIfNotExists(Sequence<?> sequence) {
|
||||
return dsl().createSequenceIfNotExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>ALTER DATABASE</code> statement.
|
||||
*
|
||||
@ -7359,6 +7417,66 @@ public class DSL {
|
||||
return dsl().dropSchemaIfExists(schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#dropSequence(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.DropSequenceFinalStep dropSequence(String sequence) {
|
||||
return dsl().dropSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#dropSequence(Name)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.DropSequenceFinalStep dropSequence(Name sequence) {
|
||||
return dsl().dropSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#dropSequence(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.DropSequenceFinalStep dropSequence(Sequence<?> sequence) {
|
||||
return dsl().dropSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
*
|
||||
* @see DSLContext#dropSequenceIfExists(String)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.DropSequenceFinalStep dropSequenceIfExists(String sequence) {
|
||||
return dsl().dropSequenceIfExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
*
|
||||
* @see DSLContext#dropSequenceIfExists(Name)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.DropSequenceFinalStep dropSequenceIfExists(Name sequence) {
|
||||
return dsl().dropSequenceIfExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
*
|
||||
* @see DSLContext#dropSequenceIfExists(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static org.jooq.DropSequenceFinalStep dropSequenceIfExists(Sequence<?> sequence) {
|
||||
return dsl().dropSequenceIfExists(sequence);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -8067,66 +8185,6 @@ public class DSL {
|
||||
return dsl().createUniqueIndexIfNotExists(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequence(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static CreateSequenceFlagsStep createSequence(String sequence) {
|
||||
return dsl().createSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequence(Name)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static CreateSequenceFlagsStep createSequence(Name sequence) {
|
||||
return dsl().createSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequence(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static CreateSequenceFlagsStep createSequence(Sequence<?> sequence) {
|
||||
return dsl().createSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequenceIfNotExists(String)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static CreateSequenceFlagsStep createSequenceIfNotExists(String sequence) {
|
||||
return dsl().createSequenceIfNotExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequenceIfNotExists(Name)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static CreateSequenceFlagsStep createSequenceIfNotExists(Name sequence) {
|
||||
return dsl().createSequenceIfNotExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE SEQUENCE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSLContext#createSequenceIfNotExists(Sequence)
|
||||
*/
|
||||
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static CreateSequenceFlagsStep createSequenceIfNotExists(Sequence<?> sequence) {
|
||||
return dsl().createSequenceIfNotExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>ALTER SEQUENCE</code> statement.
|
||||
*
|
||||
@ -8634,75 +8692,6 @@ public class DSL {
|
||||
return dsl().dropIndexIfExists(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#dropSequence(String)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static <T extends Number> DropSequenceFinalStep dropSequence(String sequence) {
|
||||
return dsl().dropSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#dropSequence(Name)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static <T extends Number> DropSequenceFinalStep dropSequence(Name sequence) {
|
||||
return dsl().dropSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE</code> statement.
|
||||
*
|
||||
* @see DSLContext#dropSequence(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static <T extends Number> DropSequenceFinalStep dropSequence(Sequence<?> sequence) {
|
||||
return dsl().dropSequence(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
* <p>
|
||||
* If your database doesn't natively support <code>IF EXISTS</code>, this is
|
||||
* emulated by catching (and ignoring) the relevant {@link SQLException}.
|
||||
*
|
||||
* @see DSLContext#dropSequenceIfExists(String)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static <T extends Number> DropSequenceFinalStep dropSequenceIfExists(String sequence) {
|
||||
return dsl().dropSequenceIfExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
* <p>
|
||||
* If your database doesn't natively support <code>IF EXISTS</code>, this is
|
||||
* emulated by catching (and ignoring) the relevant {@link SQLException}.
|
||||
*
|
||||
* @see DSLContext#dropSequenceIfExists(Name)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static <T extends Number> DropSequenceFinalStep dropSequenceIfExists(Name sequence) {
|
||||
return dsl().dropSequenceIfExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
* <p>
|
||||
* If your database doesn't natively support <code>IF EXISTS</code>, this is
|
||||
* emulated by catching (and ignoring) the relevant {@link SQLException}.
|
||||
*
|
||||
* @see DSLContext#dropSequenceIfExists(Sequence)
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
|
||||
public static <T extends Number> DropSequenceFinalStep dropSequenceIfExists(Sequence<?> sequence) {
|
||||
return dsl().dropSequenceIfExists(sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL truncate statement.
|
||||
* <p>
|
||||
|
||||
@ -114,7 +114,6 @@ import org.jooq.ConnectionRunnable;
|
||||
import org.jooq.ContextTransactionalCallable;
|
||||
import org.jooq.ContextTransactionalRunnable;
|
||||
import org.jooq.CreateIndexStep;
|
||||
import org.jooq.CreateSequenceFlagsStep;
|
||||
import org.jooq.CreateTableColumnStep;
|
||||
import org.jooq.CreateTypeStep;
|
||||
import org.jooq.CreateViewAsStep;
|
||||
@ -127,7 +126,6 @@ import org.jooq.DeleteQuery;
|
||||
import org.jooq.DeleteUsingStep;
|
||||
import org.jooq.Domain;
|
||||
import org.jooq.DropIndexOnStep;
|
||||
import org.jooq.DropSequenceFinalStep;
|
||||
import org.jooq.DropTableStep;
|
||||
import org.jooq.DropTypeStep;
|
||||
import org.jooq.DropViewFinalStep;
|
||||
@ -3006,6 +3004,36 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
return new CreateSchemaImpl(configuration(), schema, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.CreateSequenceFlagsStep createSequence(String sequence) {
|
||||
return new CreateSequenceImpl(configuration(), DSL.sequence(sequence), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.CreateSequenceFlagsStep createSequence(Name sequence) {
|
||||
return new CreateSequenceImpl(configuration(), DSL.sequence(sequence), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.CreateSequenceFlagsStep createSequence(Sequence<?> sequence) {
|
||||
return new CreateSequenceImpl(configuration(), sequence, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.CreateSequenceFlagsStep createSequenceIfNotExists(String sequence) {
|
||||
return new CreateSequenceImpl(configuration(), DSL.sequence(sequence), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.CreateSequenceFlagsStep createSequenceIfNotExists(Name sequence) {
|
||||
return new CreateSequenceImpl(configuration(), DSL.sequence(sequence), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.CreateSequenceFlagsStep createSequenceIfNotExists(Sequence<?> sequence) {
|
||||
return new CreateSequenceImpl(configuration(), sequence, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.AlterDatabaseStep alterDatabase(String database) {
|
||||
return new AlterDatabaseImpl(configuration(), DSL.catalog(database), false);
|
||||
@ -3186,6 +3214,36 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
return new DropSchemaImpl(configuration(), schema, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.DropSequenceFinalStep dropSequence(String sequence) {
|
||||
return new DropSequenceImpl(configuration(), DSL.sequence(sequence), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.DropSequenceFinalStep dropSequence(Name sequence) {
|
||||
return new DropSequenceImpl(configuration(), DSL.sequence(sequence), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.DropSequenceFinalStep dropSequence(Sequence<?> sequence) {
|
||||
return new DropSequenceImpl(configuration(), sequence, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.DropSequenceFinalStep dropSequenceIfExists(String sequence) {
|
||||
return new DropSequenceImpl(configuration(), DSL.sequence(sequence), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.DropSequenceFinalStep dropSequenceIfExists(Name sequence) {
|
||||
return new DropSequenceImpl(configuration(), DSL.sequence(sequence), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.DropSequenceFinalStep dropSequenceIfExists(Sequence<?> sequence) {
|
||||
return new DropSequenceImpl(configuration(), sequence, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@ -3698,36 +3756,6 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
return new CreateIndexImpl(configuration(), index, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateSequenceFlagsStep createSequence(String sequence) {
|
||||
return createSequence(name(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateSequenceFlagsStep createSequence(Name sequence) {
|
||||
return createSequence(sequence(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateSequenceFlagsStep createSequence(Sequence<?> sequence) {
|
||||
return new CreateSequenceImpl(configuration(), sequence, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateSequenceFlagsStep createSequenceIfNotExists(String sequence) {
|
||||
return createSequenceIfNotExists(name(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateSequenceFlagsStep createSequenceIfNotExists(Name sequence) {
|
||||
return createSequenceIfNotExists(sequence(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateSequenceFlagsStep createSequenceIfNotExists(Sequence<?> sequence) {
|
||||
return new CreateSequenceImpl(configuration(), sequence, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlterSequenceStep<BigInteger> alterSequence(String sequence) {
|
||||
return alterSequence(name(sequence));
|
||||
@ -3968,36 +3996,6 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
return new DropIndexImpl(configuration(), index, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DropSequenceFinalStep dropSequence(String sequence) {
|
||||
return dropSequence(name(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DropSequenceFinalStep dropSequence(Name sequence) {
|
||||
return dropSequence(sequence(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DropSequenceFinalStep dropSequence(Sequence<?> sequence) {
|
||||
return new DropSequenceImpl(configuration(), sequence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DropSequenceFinalStep dropSequenceIfExists(String sequence) {
|
||||
return dropSequenceIfExists(name(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DropSequenceFinalStep dropSequenceIfExists(Name sequence) {
|
||||
return dropSequenceIfExists(sequence(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DropSequenceFinalStep dropSequenceIfExists(Sequence<?> sequence) {
|
||||
return new DropSequenceImpl(configuration(), sequence, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TruncateIdentityStep<Record> truncate(String table) {
|
||||
return truncateTable(table);
|
||||
|
||||
@ -37,8 +37,6 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.Clause.DROP_SEQUENCE;
|
||||
import static org.jooq.Clause.DROP_SEQUENCE_SEQUENCE;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
@ -65,40 +63,44 @@ import org.jooq.SQLDialect;
|
||||
import org.jooq.Sequence;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
* The <code>DROP SEQUENCE IF EXISTS</code> statement.
|
||||
*/
|
||||
final class DropSequenceImpl extends AbstractRowCountQuery implements
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
final class DropSequenceImpl
|
||||
extends
|
||||
AbstractRowCountQuery
|
||||
implements
|
||||
DropSequenceFinalStep
|
||||
{
|
||||
|
||||
// Cascading interface implementations for DROP SEQUENCE behaviour
|
||||
DropSequenceFinalStep {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = 8904572826501186329L;
|
||||
private static final Clause[] CLAUSES = { DROP_SEQUENCE };
|
||||
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS = SQLDialect.supportedBy(DERBY, FIREBIRD);
|
||||
private final Sequence<?> sequence;
|
||||
private final boolean dropSequenceIfExists;
|
||||
|
||||
private final Sequence<?> sequence;
|
||||
private final boolean ifExists;
|
||||
|
||||
DropSequenceImpl(Configuration configuration, Sequence<?> sequence) {
|
||||
this(configuration, sequence, false);
|
||||
}
|
||||
|
||||
DropSequenceImpl(Configuration configuration, Sequence<?> sequence, boolean ifExists) {
|
||||
DropSequenceImpl(
|
||||
Configuration configuration,
|
||||
Sequence sequence,
|
||||
boolean dropSequenceIfExists
|
||||
) {
|
||||
super(configuration);
|
||||
|
||||
this.sequence = sequence;
|
||||
this.ifExists = ifExists;
|
||||
this.dropSequenceIfExists = dropSequenceIfExists;
|
||||
}
|
||||
|
||||
final Sequence<?> $sequence() { return sequence; }
|
||||
final boolean $ifExists() { return ifExists; }
|
||||
final Sequence<?> $sequence() { return sequence; }
|
||||
final boolean $dropSequenceIfExists() { return dropSequenceIfExists; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// ------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
private static final Clause[] CLAUSES = { Clause.DROP_SEQUENCE };
|
||||
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS = SQLDialect.supportedBy(DERBY, FIREBIRD);
|
||||
|
||||
private final boolean supportsIfExists(Context<?> ctx) {
|
||||
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
|
||||
@ -106,7 +108,7 @@ final class DropSequenceImpl extends AbstractRowCountQuery implements
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
if (ifExists && !supportsIfExists(ctx)) {
|
||||
if (dropSequenceIfExists && !supportsIfExists(ctx)) {
|
||||
Tools.beginTryCatch(ctx, DDLStatementType.DROP_SEQUENCE);
|
||||
accept0(ctx);
|
||||
Tools.endTryCatch(ctx, DDLStatementType.DROP_SEQUENCE);
|
||||
@ -117,13 +119,13 @@ final class DropSequenceImpl extends AbstractRowCountQuery implements
|
||||
}
|
||||
|
||||
private void accept0(Context<?> ctx) {
|
||||
ctx.start(DROP_SEQUENCE_SEQUENCE)
|
||||
ctx.start(Clause.DROP_SEQUENCE_SEQUENCE)
|
||||
.visit(K_DROP)
|
||||
.sql(' ')
|
||||
.visit(ctx.family() == CUBRID ? K_SERIAL : K_SEQUENCE)
|
||||
.sql(' ');
|
||||
|
||||
if (ifExists && supportsIfExists(ctx))
|
||||
if (dropSequenceIfExists && supportsIfExists(ctx))
|
||||
ctx.visit(K_IF_EXISTS).sql(' ');
|
||||
|
||||
switch (ctx.family()) {
|
||||
@ -148,11 +150,13 @@ final class DropSequenceImpl extends AbstractRowCountQuery implements
|
||||
if (ctx.family() == DERBY)
|
||||
ctx.sql(' ').visit(K_RESTRICT);
|
||||
|
||||
ctx.end(DROP_SEQUENCE_SEQUENCE);
|
||||
ctx.end(Clause.DROP_SEQUENCE_SEQUENCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Clause[] clauses(Context<?> ctx) {
|
||||
return CLAUSES;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -849,7 +849,7 @@ final class Interpreter {
|
||||
|
||||
MutableSequence existing = schema.sequence(sequence);
|
||||
if (existing != null) {
|
||||
if (!query.$ifNotExists())
|
||||
if (!query.$createSequenceIfNotExists())
|
||||
throw sequenceAlreadyExists(sequence);
|
||||
|
||||
return;
|
||||
@ -931,7 +931,7 @@ final class Interpreter {
|
||||
|
||||
MutableSequence existing = schema.sequence(sequence);
|
||||
if (existing == null) {
|
||||
if (!query.$ifExists())
|
||||
if (!query.$dropSequenceIfExists())
|
||||
throw sequenceNotExists(sequence);
|
||||
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user