[jOOQ/jOOQ#10210] Improved API generation

- Generate AlterSchemaImpl and DropSchemaImpl
- Step Javadoc improvement
This commit is contained in:
Lukas Eder 2020-05-27 22:22:39 +02:00
parent 19c2b28237
commit c766fcdbfb
24 changed files with 469 additions and 481 deletions

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the ALTER DATABASE statement.
* A step in the construction of the <code>ALTER DATABASE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the ALTER DATABASE statement.
* A step in the construction of the <code>ALTER DATABASE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the ALTER DOMAIN statement.
* A step in the construction of the <code>ALTER DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the ALTER DOMAIN statement.
* A step in the construction of the <code>ALTER DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the ALTER DOMAIN statement.
* A step in the construction of the <code>ALTER DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the ALTER DOMAIN statement.
* A step in the construction of the <code>ALTER DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -37,8 +37,12 @@
*/
package org.jooq;
import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* The final step in the <code>DROP SCHEMA</code> DSL.
* A step in the construction of the <code>ALTER SCHEMA</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 AlterSchemaFinalStep extends DDLQuery {
}

View File

@ -37,16 +37,12 @@
*/
package org.jooq;
// ...
import static org.jooq.SQLDialect.H2;
// ...
import static org.jooq.SQLDialect.HSQLDB;
import static org.jooq.SQLDialect.POSTGRES;
// ...
import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* The step in the <code>ALTER SCHEMA</code> DSL used to specify
* <code>ALTER</code> behaviour.
* A step in the construction of the <code>ALTER SCHEMA</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
@ -65,30 +61,25 @@ 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 AlterSchemaStep {
/**
* Add a <code>RENAME TO</code> clause to the <code>ALTER SCHEMA</code>
* statement.
* Add the <code>RENAME TO</code> clause to the <code>ALTER SCHEMA</code> statement.
*/
@Support({ H2, HSQLDB, POSTGRES })
AlterSchemaFinalStep renameTo(Schema newName);
AlterSchemaFinalStep renameTo(String renameTo);
/**
* Add a <code>RENAME TO</code> clause to the <code>ALTER SCHEMA</code>
* statement.
* Add the <code>RENAME TO</code> clause to the <code>ALTER SCHEMA</code> statement.
*/
@Support({ H2, HSQLDB, POSTGRES })
AlterSchemaFinalStep renameTo(Name newName);
AlterSchemaFinalStep renameTo(Name renameTo);
/**
* Add a <code>RENAME TO</code> clause to the <code>ALTER SCHEMA</code>
* statement.
* Add the <code>RENAME TO</code> clause to the <code>ALTER SCHEMA</code> statement.
*/
@Support({ H2, HSQLDB, POSTGRES })
AlterSchemaFinalStep renameTo(String newName);
AlterSchemaFinalStep renameTo(Schema renameTo);
}

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the CREATE DATABASE statement.
* A step in the construction of the <code>CREATE DATABASE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the CREATE DOMAIN statement.
* A step in the construction of the <code>CREATE DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the CREATE DOMAIN statement.
* A step in the construction of the <code>CREATE DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the CREATE DOMAIN statement.
* A step in the construction of the <code>CREATE DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the CREATE DOMAIN statement.
* A step in the construction of the <code>CREATE DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the CREATE SCHEMA statement.
* A step in the construction of the <code>CREATE SCHEMA</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -8980,6 +8980,54 @@ public interface DSLContext extends Scope , AutoCloseable {
@Support({ POSTGRES })
<T> AlterDomainStep<T> alterDomainIfExists(Domain<T> domain);
/**
* The <code>ALTER SCHEMA</code> statement.
*
* @see DSL#alterSchema(String)
*/
@Support({ H2, HSQLDB, POSTGRES })
AlterSchemaStep alterSchema(String schema);
/**
* The <code>ALTER SCHEMA</code> statement.
*
* @see DSL#alterSchema(Name)
*/
@Support({ H2, HSQLDB, POSTGRES })
AlterSchemaStep alterSchema(Name schema);
/**
* The <code>ALTER SCHEMA</code> statement.
*
* @see DSL#alterSchema(Schema)
*/
@Support({ H2, HSQLDB, POSTGRES })
AlterSchemaStep alterSchema(Schema schema);
/**
* The <code>ALTER SCHEMA IF EXISTS</code> statement.
*
* @see DSL#alterSchemaIfExists(String)
*/
@Support({ H2 })
AlterSchemaStep alterSchemaIfExists(String schema);
/**
* The <code>ALTER SCHEMA IF EXISTS</code> statement.
*
* @see DSL#alterSchemaIfExists(Name)
*/
@Support({ H2 })
AlterSchemaStep alterSchemaIfExists(Name schema);
/**
* The <code>ALTER SCHEMA IF EXISTS</code> statement.
*
* @see DSL#alterSchemaIfExists(Schema)
*/
@Support({ H2 })
AlterSchemaStep alterSchemaIfExists(Schema schema);
/**
* The <code>DROP DATABASE</code> statement.
*
@ -9076,6 +9124,54 @@ public interface DSLContext extends Scope , AutoCloseable {
@Support({ H2, POSTGRES })
DropDomainCascadeStep dropDomainIfExists(Domain<?> domain);
/**
* The <code>DROP SCHEMA</code> statement.
*
* @see DSL#dropSchema(String)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchema(String schema);
/**
* The <code>DROP SCHEMA</code> statement.
*
* @see DSL#dropSchema(Name)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchema(Name schema);
/**
* The <code>DROP SCHEMA</code> statement.
*
* @see DSL#dropSchema(Schema)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchema(Schema schema);
/**
* The <code>DROP SCHEMA IF EXISTS</code> statement.
*
* @see DSL#dropSchemaIfExists(String)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchemaIfExists(String schema);
/**
* The <code>DROP SCHEMA IF EXISTS</code> statement.
*
* @see DSL#dropSchemaIfExists(Name)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchemaIfExists(Name schema);
/**
* The <code>DROP SCHEMA IF EXISTS</code> statement.
*
* @see DSL#dropSchemaIfExists(Schema)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchemaIfExists(Schema schema);
/**
@ -10038,54 +10134,6 @@ public interface DSLContext extends Scope , AutoCloseable {
@Support({ H2, MARIADB, POSTGRES })
AlterTableStep alterTableIfExists(Table<?> table);
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSL#alterSchema(String)
*/
@Support({ H2, HSQLDB, POSTGRES })
AlterSchemaStep alterSchema(String schema);
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSL#alterSchema(Name)
*/
@Support({ H2, HSQLDB, POSTGRES })
AlterSchemaStep alterSchema(Name schema);
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSL#alterSchema(Schema)
*/
@Support({ H2, HSQLDB, POSTGRES })
AlterSchemaStep alterSchema(Schema schema);
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSL#alterSchemaIfExists(String)
*/
@Support({ H2 })
AlterSchemaStep alterSchemaIfExists(String schema);
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSL#alterSchemaIfExists(Name)
*/
@Support({ H2 })
AlterSchemaStep alterSchemaIfExists(Name schema);
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSL#alterSchemaIfExists(Schema)
*/
@Support({ H2 })
AlterSchemaStep alterSchemaIfExists(Schema schema);
/**
* Create a new DSL <code>ALTER VIEW</code> statement.
*
@ -10182,54 +10230,6 @@ public interface DSLContext extends Scope , AutoCloseable {
@Support({ H2, POSTGRES })
AlterIndexStep alterIndexIfExists(Index index);
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSL#dropSchema(String)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchema(String schema);
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSL#dropSchema(Name)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchema(Name schema);
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSL#dropSchema(Schema)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchema(Schema schema);
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSL#dropSchemaIfExists(String)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchemaIfExists(String schema);
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSL#dropSchemaIfExists(Name)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchemaIfExists(Name schema);
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSL#dropSchemaIfExists(Schema)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
DropSchemaStep dropSchemaIfExists(Schema schema);
/**
* Create a new DSL <code>DROP VIEW</code> statement.
*

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the DROP DATABASE statement.
* A step in the construction of the <code>DROP DATABASE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the DROP DOMAIN statement.
* A step in the construction of the <code>DROP DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -42,7 +42,7 @@ import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* A step in the construction of the DROP DOMAIN statement.
* A step in the construction of the <code>DROP DOMAIN</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>

View File

@ -37,8 +37,12 @@
*/
package org.jooq;
import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* The final step in the <code>DROP DATABASE</code> DSL.
* A step in the construction of the <code>DROP SCHEMA</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 DropSchemaFinalStep extends DDLQuery {
}

View File

@ -37,16 +37,12 @@
*/
package org.jooq;
// ...
import static org.jooq.SQLDialect.H2;
// ...
import static org.jooq.SQLDialect.HSQLDB;
import static org.jooq.SQLDialect.POSTGRES;
// ...
import static org.jooq.SQLDialect.*;
import java.util.*;
/**
* The step in the <code>DROP SCHEMA</code> DSL used to specify
* <code>DROP</code> behaviour.
* A step in the construction of the <code>DROP SCHEMA</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
@ -65,21 +61,18 @@ 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 DropSchemaStep extends DropSchemaFinalStep {
/**
* Add a <code>CASCADE</code> clause to the <code>DROP SCHEMA</code>
* statement.
* Add the <code>CASCADE</code> clause to the <code>DROP SCHEMA</code> statement.
*/
@Support({ H2, HSQLDB, POSTGRES })
DropSchemaFinalStep cascade();
/**
* Add a <code>RESTRICT</code> clause to the <code>DROP SCHEMA</code>
* statement.
* Add the <code>RESTRICT</code> clause to the <code>DROP SCHEMA</code> statement.
*/
@Support({ H2, HSQLDB, POSTGRES })
DropSchemaFinalStep restrict();

View File

@ -37,93 +37,96 @@
*/
package org.jooq.impl;
import static org.jooq.Clause.ALTER_SCHEMA;
import static org.jooq.Clause.ALTER_SCHEMA_RENAME;
import static org.jooq.Clause.ALTER_SCHEMA_SCHEMA;
// ...
import static org.jooq.impl.DSL.name;
import static org.jooq.impl.Keywords.K_ALTER_SCHEMA;
import static org.jooq.impl.Keywords.K_IF_EXISTS;
import static org.jooq.impl.Keywords.K_RENAME;
import static org.jooq.impl.Keywords.K_RENAME_TO;
import static org.jooq.impl.Keywords.K_SCHEMA;
import static org.jooq.impl.Keywords.K_TO;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.SQLDialect.*;
import java.util.Set;
import org.jooq.*;
import org.jooq.impl.*;
import org.jooq.AlterSchemaFinalStep;
import org.jooq.AlterSchemaStep;
import org.jooq.Clause;
import org.jooq.Configuration;
import org.jooq.Context;
import org.jooq.Name;
// ...
import org.jooq.SQLDialect;
import org.jooq.Schema;
import java.util.*;
/**
* @author Lukas Eder
* The <code>ALTER SCHEMA IF EXISTS</code> statement.
*/
final class AlterSchemaImpl extends AbstractRowCountQuery implements
// Cascading interface implementations for ALTER SCHEMA behaviour
@SuppressWarnings({ "hiding", "unused" })
final class AlterSchemaImpl
extends
AbstractRowCountQuery
implements
AlterSchemaStep,
AlterSchemaFinalStep {
AlterSchemaFinalStep
{
private static final long serialVersionUID = 1L;
/**
* Generated UID
*/
private static final long serialVersionUID = 8904572826501186329L;
private static final Clause[] CLAUSES = { ALTER_SCHEMA };
private final Schema schema;
private final boolean ifExists;
private Schema renameTo;
AlterSchemaImpl(Configuration configuration, Schema schema) {
this(configuration, schema, false);
private final Schema schema;
private final boolean ifExists;
private Schema renameTo;
AlterSchemaImpl(
Configuration configuration,
Schema schema,
boolean ifExists
) {
this(
configuration,
schema,
ifExists,
null
);
}
AlterSchemaImpl(Configuration configuration, Schema schema, boolean ifExists) {
AlterSchemaImpl(
Configuration configuration,
Schema schema,
boolean ifExists,
Schema renameTo
) {
super(configuration);
this.schema = schema;
this.ifExists = ifExists;
this.renameTo = renameTo;
}
final Schema $schema() { return schema; }
final boolean $ifExists() { return ifExists; }
final Schema $renameTo() { return renameTo; }
// ------------------------------------------------------------------------
// -------------------------------------------------------------------------
// XXX: DSL API
// ------------------------------------------------------------------------
// -------------------------------------------------------------------------
@Override
public final AlterSchemaImpl renameTo(String renameTo) {
return renameTo(DSL.schema(renameTo));
}
@Override
public final AlterSchemaImpl renameTo(Schema newName) {
this.renameTo = newName;
public final AlterSchemaImpl renameTo(Name renameTo) {
return renameTo(DSL.schema(renameTo));
}
@Override
public final AlterSchemaImpl renameTo(Schema renameTo) {
this.renameTo = renameTo;
return this;
}
@Override
public final AlterSchemaImpl renameTo(Name newName) {
return renameTo(DSL.schema(newName));
}
@Override
public final AlterSchemaImpl renameTo(String newName) {
return renameTo(name(newName));
}
// ------------------------------------------------------------------------
// -------------------------------------------------------------------------
// XXX: QueryPart API
// ------------------------------------------------------------------------
// -------------------------------------------------------------------------
private static final Clause[] CLAUSES = { Clause.ALTER_SCHEMA };
@ -146,7 +149,7 @@ final class AlterSchemaImpl extends AbstractRowCountQuery implements
}
private final void accept0(Context<?> ctx) {
ctx.start(ALTER_SCHEMA_SCHEMA);
ctx.start(Clause.ALTER_SCHEMA_SCHEMA);
boolean supportRename = false;
@ -162,18 +165,18 @@ final class AlterSchemaImpl extends AbstractRowCountQuery implements
ctx.sql(' ').visit(K_IF_EXISTS);
ctx.sql(' ').visit(schema)
.end(ALTER_SCHEMA_SCHEMA)
.end(Clause.ALTER_SCHEMA_SCHEMA)
.formatIndentStart()
.formatSeparator();
if (renameTo != null) {
boolean qualify = ctx.qualify();
ctx.start(ALTER_SCHEMA_RENAME)
ctx.start(Clause.ALTER_SCHEMA_RENAME)
.qualify(false)
.visit(supportRename ? K_TO : K_RENAME_TO).sql(' ').visit(renameTo)
.qualify(qualify)
.end(ALTER_SCHEMA_RENAME);
.end(Clause.ALTER_SCHEMA_RENAME);
}
ctx.formatIndentEnd();
@ -183,4 +186,6 @@ final class AlterSchemaImpl extends AbstractRowCountQuery implements
public final Clause[] clauses(Context<?> ctx) {
return CLAUSES;
}
}

View File

@ -137,7 +137,6 @@ import javax.sql.DataSource;
import org.jooq.AggregateFunction;
import org.jooq.AlterIndexOnStep;
import org.jooq.AlterIndexStep;
import org.jooq.AlterSchemaStep;
import org.jooq.AlterSequenceStep;
import org.jooq.AlterTableStep;
import org.jooq.AlterTypeStep;
@ -198,7 +197,6 @@ import org.jooq.DeleteUsingStep;
import org.jooq.DerivedColumnList;
import org.jooq.Domain;
import org.jooq.DropIndexOnStep;
import org.jooq.DropSchemaStep;
import org.jooq.DropSequenceFinalStep;
import org.jooq.DropTableStep;
import org.jooq.DropTypeStep;
@ -7121,6 +7119,66 @@ public class DSL {
return dsl().alterDomainIfExists(domain);
}
/**
* The <code>ALTER SCHEMA</code> statement.
*
* @see DSLContext#alterSchema(String)
*/
@Support({ H2, HSQLDB, POSTGRES })
public static org.jooq.AlterSchemaStep alterSchema(String schema) {
return dsl().alterSchema(schema);
}
/**
* The <code>ALTER SCHEMA</code> statement.
*
* @see DSLContext#alterSchema(Name)
*/
@Support({ H2, HSQLDB, POSTGRES })
public static org.jooq.AlterSchemaStep alterSchema(Name schema) {
return dsl().alterSchema(schema);
}
/**
* The <code>ALTER SCHEMA</code> statement.
*
* @see DSLContext#alterSchema(Schema)
*/
@Support({ H2, HSQLDB, POSTGRES })
public static org.jooq.AlterSchemaStep alterSchema(Schema schema) {
return dsl().alterSchema(schema);
}
/**
* The <code>ALTER SCHEMA IF EXISTS</code> statement.
*
* @see DSLContext#alterSchemaIfExists(String)
*/
@Support({ H2 })
public static org.jooq.AlterSchemaStep alterSchemaIfExists(String schema) {
return dsl().alterSchemaIfExists(schema);
}
/**
* The <code>ALTER SCHEMA IF EXISTS</code> statement.
*
* @see DSLContext#alterSchemaIfExists(Name)
*/
@Support({ H2 })
public static org.jooq.AlterSchemaStep alterSchemaIfExists(Name schema) {
return dsl().alterSchemaIfExists(schema);
}
/**
* The <code>ALTER SCHEMA IF EXISTS</code> statement.
*
* @see DSLContext#alterSchemaIfExists(Schema)
*/
@Support({ H2 })
public static org.jooq.AlterSchemaStep alterSchemaIfExists(Schema schema) {
return dsl().alterSchemaIfExists(schema);
}
/**
* The <code>DROP DATABASE</code> statement.
*
@ -7241,6 +7299,66 @@ public class DSL {
return dsl().dropDomainIfExists(domain);
}
/**
* The <code>DROP SCHEMA</code> statement.
*
* @see DSLContext#dropSchema(String)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static org.jooq.DropSchemaStep dropSchema(String schema) {
return dsl().dropSchema(schema);
}
/**
* The <code>DROP SCHEMA</code> statement.
*
* @see DSLContext#dropSchema(Name)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static org.jooq.DropSchemaStep dropSchema(Name schema) {
return dsl().dropSchema(schema);
}
/**
* The <code>DROP SCHEMA</code> statement.
*
* @see DSLContext#dropSchema(Schema)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static org.jooq.DropSchemaStep dropSchema(Schema schema) {
return dsl().dropSchema(schema);
}
/**
* The <code>DROP SCHEMA IF EXISTS</code> statement.
*
* @see DSLContext#dropSchemaIfExists(String)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static org.jooq.DropSchemaStep dropSchemaIfExists(String schema) {
return dsl().dropSchemaIfExists(schema);
}
/**
* The <code>DROP SCHEMA IF EXISTS</code> statement.
*
* @see DSLContext#dropSchemaIfExists(Name)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static org.jooq.DropSchemaStep dropSchemaIfExists(Name schema) {
return dsl().dropSchemaIfExists(schema);
}
/**
* The <code>DROP SCHEMA IF EXISTS</code> statement.
*
* @see DSLContext#dropSchemaIfExists(Schema)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static org.jooq.DropSchemaStep dropSchemaIfExists(Schema schema) {
return dsl().dropSchemaIfExists(schema);
}
/**
@ -8129,66 +8247,6 @@ public class DSL {
return dsl().alterTableIfExists(table);
}
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSLContext#alterSchema(String)
*/
@Support({ H2, HSQLDB, POSTGRES })
public static AlterSchemaStep alterSchema(String schema) {
return dsl().alterSchema(schema);
}
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSLContext#alterSchema(Name)
*/
@Support({ H2, HSQLDB, POSTGRES })
public static AlterSchemaStep alterSchema(Name schema) {
return dsl().alterSchema(schema);
}
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSLContext#alterSchema(Schema)
*/
@Support({ H2, HSQLDB, POSTGRES })
public static AlterSchemaStep alterSchema(Schema schema) {
return dsl().alterSchema(schema);
}
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSLContext#alterSchemaIfExists(String)
*/
@Support({ H2 })
public static AlterSchemaStep alterSchemaIfExists(String schema) {
return dsl().alterSchemaIfExists(schema);
}
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSLContext#alterSchemaIfExists(Name)
*/
@Support({ H2 })
public static AlterSchemaStep alterSchemaIfExists(Name schema) {
return dsl().alterSchemaIfExists(schema);
}
/**
* Create a new DSL <code>ALTER SCHEMA</code> statement.
*
* @see DSLContext#alterSchemaIfExists(Schema)
*/
@Support({ H2 })
public static AlterSchemaStep alterSchemaIfExists(Schema schema) {
return dsl().alterSchemaIfExists(schema);
}
/**
* Create a new DSL <code>ALTER VIEW</code> statement.
*
@ -8309,66 +8367,6 @@ public class DSL {
return dsl().alterIndexIfExists(index);
}
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSLContext#dropSchema(String)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static DropSchemaStep dropSchema(String schema) {
return dsl().dropSchema(schema);
}
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSLContext#dropSchema(Name)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static DropSchemaStep dropSchema(Name schema) {
return dsl().dropSchema(schema);
}
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSLContext#dropSchema(Schema)
*/
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static DropSchemaStep dropSchema(Schema schema) {
return dsl().dropSchema(schema);
}
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSLContext#dropSchemaIfExists(String)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static DropSchemaStep dropSchemaIfExists(String schema) {
return dsl().dropSchemaIfExists(schema);
}
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSLContext#dropSchemaIfExists(Name)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static DropSchemaStep dropSchemaIfExists(Name schema) {
return dsl().dropSchemaIfExists(schema);
}
/**
* Create a new DSL <code>DROP SCHEMA</code> statement.
*
* @see DSLContext#dropSchemaIfExists(Schema)
*/
@Support({ H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static DropSchemaStep dropSchemaIfExists(Schema schema) {
return dsl().dropSchemaIfExists(schema);
}
/**
* Create a new DSL <code>DROP VIEW</code> statement.
*

View File

@ -94,7 +94,6 @@ import javax.xml.parsers.SAXParserFactory;
import org.jooq.AlterIndexOnStep;
import org.jooq.AlterIndexStep;
import org.jooq.AlterSchemaStep;
import org.jooq.AlterSequenceStep;
import org.jooq.AlterTableStep;
import org.jooq.AlterTypeStep;
@ -128,7 +127,6 @@ import org.jooq.DeleteQuery;
import org.jooq.DeleteUsingStep;
import org.jooq.Domain;
import org.jooq.DropIndexOnStep;
import org.jooq.DropSchemaStep;
import org.jooq.DropSequenceFinalStep;
import org.jooq.DropTableStep;
import org.jooq.DropTypeStep;
@ -3068,6 +3066,36 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
return new AlterDomainImpl<>(configuration(), domain, true);
}
@Override
public org.jooq.AlterSchemaStep alterSchema(String schema) {
return new AlterSchemaImpl(configuration(), DSL.schema(schema), false);
}
@Override
public org.jooq.AlterSchemaStep alterSchema(Name schema) {
return new AlterSchemaImpl(configuration(), DSL.schema(schema), false);
}
@Override
public org.jooq.AlterSchemaStep alterSchema(Schema schema) {
return new AlterSchemaImpl(configuration(), schema, false);
}
@Override
public org.jooq.AlterSchemaStep alterSchemaIfExists(String schema) {
return new AlterSchemaImpl(configuration(), DSL.schema(schema), true);
}
@Override
public org.jooq.AlterSchemaStep alterSchemaIfExists(Name schema) {
return new AlterSchemaImpl(configuration(), DSL.schema(schema), true);
}
@Override
public org.jooq.AlterSchemaStep alterSchemaIfExists(Schema schema) {
return new AlterSchemaImpl(configuration(), schema, true);
}
@Override
public org.jooq.DropDatabaseFinalStep dropDatabase(String database) {
return new DropDatabaseImpl(configuration(), DSL.catalog(database), false);
@ -3128,6 +3156,36 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
return new DropDomainImpl(configuration(), domain, true);
}
@Override
public org.jooq.DropSchemaStep dropSchema(String schema) {
return new DropSchemaImpl(configuration(), DSL.schema(schema), false);
}
@Override
public org.jooq.DropSchemaStep dropSchema(Name schema) {
return new DropSchemaImpl(configuration(), DSL.schema(schema), false);
}
@Override
public org.jooq.DropSchemaStep dropSchema(Schema schema) {
return new DropSchemaImpl(configuration(), schema, false);
}
@Override
public org.jooq.DropSchemaStep dropSchemaIfExists(String schema) {
return new DropSchemaImpl(configuration(), DSL.schema(schema), true);
}
@Override
public org.jooq.DropSchemaStep dropSchemaIfExists(Name schema) {
return new DropSchemaImpl(configuration(), DSL.schema(schema), true);
}
@Override
public org.jooq.DropSchemaStep dropSchemaIfExists(Schema schema) {
return new DropSchemaImpl(configuration(), schema, true);
}
@Override
@ -3730,36 +3788,6 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
return new AlterTableImpl(configuration(), table, true);
}
@Override
public AlterSchemaStep alterSchema(String schema) {
return alterSchema(name(schema));
}
@Override
public AlterSchemaStep alterSchema(Name schema) {
return alterSchema(schema(schema));
}
@Override
public AlterSchemaStep alterSchema(Schema schema) {
return new AlterSchemaImpl(configuration(), schema);
}
@Override
public AlterSchemaStep alterSchemaIfExists(String schema) {
return alterSchemaIfExists(name(schema));
}
@Override
public AlterSchemaStep alterSchemaIfExists(Name schema) {
return alterSchemaIfExists(schema(schema));
}
@Override
public AlterSchemaStep alterSchemaIfExists(Schema schema) {
return new AlterSchemaImpl(configuration(), schema, true);
}
@Override
public AlterViewStep alterView(String table) {
return alterView(name(table));
@ -3820,36 +3848,6 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
return new AlterIndexImpl(configuration(), index, true);
}
@Override
public DropSchemaStep dropSchema(String schema) {
return dropSchema(name(schema));
}
@Override
public DropSchemaStep dropSchema(Name schema) {
return dropSchema(schema(schema));
}
@Override
public DropSchemaStep dropSchema(Schema schema) {
return new DropSchemaImpl(configuration(), schema);
}
@Override
public DropSchemaStep dropSchemaIfExists(String schema) {
return dropSchemaIfExists(name(schema));
}
@Override
public DropSchemaStep dropSchemaIfExists(Name schema) {
return dropSchemaIfExists(schema(schema));
}
@Override
public DropSchemaStep dropSchemaIfExists(Schema schema) {
return new DropSchemaImpl(configuration(), schema, true);
}
@Override
public DropViewFinalStep dropView(String view) {
return dropView(name(view));

View File

@ -37,50 +37,86 @@
*/
package org.jooq.impl;
import static org.jooq.Clause.DROP_SCHEMA;
import static org.jooq.Clause.DROP_SCHEMA_SCHEMA;
// ...
// ...
// ...
import static org.jooq.SQLDialect.DERBY;
import static org.jooq.SQLDialect.FIREBIRD;
// ...
// ...
// ...
// ...
// ...
import static org.jooq.impl.Keywords.K_CASCADE;
import static org.jooq.impl.Keywords.K_DATABASE;
import static org.jooq.impl.Keywords.K_DROP;
import static org.jooq.impl.Keywords.K_IF_EXISTS;
import static org.jooq.impl.Keywords.K_RESTRICT;
import static org.jooq.impl.Keywords.K_SCHEMA;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.SQLDialect.*;
import java.util.Set;
import org.jooq.Clause;
import org.jooq.Configuration;
import org.jooq.Context;
import org.jooq.DropSchemaFinalStep;
import org.jooq.DropSchemaStep;
// ...
import org.jooq.SQLDialect;
import org.jooq.Schema;
import org.jooq.*;
import org.jooq.impl.*;
import java.util.*;
/**
* @author Lukas Eder
* The <code>DROP SCHEMA IF EXISTS</code> statement.
*/
final class DropSchemaImpl extends AbstractRowCountQuery implements
@SuppressWarnings({ "unused" })
final class DropSchemaImpl
extends
AbstractRowCountQuery
implements
DropSchemaStep,
DropSchemaFinalStep
{
private static final long serialVersionUID = 1L;
// Cascading interface implementations for DROP SCHEMA behaviour
DropSchemaStep {
private final Schema schema;
private final boolean ifExists;
private Boolean cascade;
DropSchemaImpl(
Configuration configuration,
Schema schema,
boolean ifExists
) {
this(
configuration,
schema,
ifExists,
null
);
}
DropSchemaImpl(
Configuration configuration,
Schema schema,
boolean ifExists,
Boolean cascade
) {
super(configuration);
/**
* Generated UID
*/
private static final long serialVersionUID = 8904572826501186329L;
private static final Clause[] CLAUSES = { DROP_SCHEMA };
this.schema = schema;
this.ifExists = ifExists;
this.cascade = cascade;
}
final Schema $schema() { return schema; }
final boolean $ifExists() { return ifExists; }
final Boolean $cascade() { return cascade; }
// -------------------------------------------------------------------------
// XXX: DSL API
// -------------------------------------------------------------------------
@Override
public final DropSchemaImpl cascade() {
this.cascade = true;
return this;
}
@Override
public final DropSchemaImpl restrict() {
this.cascade = false;
return this;
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
private static final Clause[] CLAUSES = { Clause.DROP_SCHEMA };
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS = SQLDialect.supportedBy(DERBY, FIREBIRD);
private static final Set<SQLDialect> REQUIRES_RESTRICT = SQLDialect.supportedBy(DERBY);
@ -89,45 +125,6 @@ final class DropSchemaImpl extends AbstractRowCountQuery implements
private final Schema schema;
private final boolean ifExists;
private boolean cascade;
DropSchemaImpl(Configuration configuration, Schema schema) {
this(configuration, schema, false);
}
DropSchemaImpl(Configuration configuration, Schema schema, boolean ifExists) {
super(configuration);
this.schema = schema;
this.ifExists = ifExists;
}
final Schema $schema() { return schema; }
final boolean $ifExists() { return ifExists; }
final boolean $cascade() { return cascade; }
// ------------------------------------------------------------------------
// XXX: DSL API
// ------------------------------------------------------------------------
@Override
public final DropSchemaFinalStep cascade() {
cascade = true;
return this;
}
@Override
public final DropSchemaFinalStep restrict() {
cascade = false;
return this;
}
// ------------------------------------------------------------------------
// XXX: QueryPart API
// ------------------------------------------------------------------------
private final boolean supportsIfExists(Context<?> ctx) {
return !NO_SUPPORT_IF_EXISTS.contains(ctx.family());
}
@ -145,7 +142,7 @@ final class DropSchemaImpl extends AbstractRowCountQuery implements
}
private void accept0(Context<?> ctx) {
ctx.start(DROP_SCHEMA_SCHEMA)
ctx.start(Clause.DROP_SCHEMA_SCHEMA)
.visit(K_DROP);
@ -165,7 +162,7 @@ final class DropSchemaImpl extends AbstractRowCountQuery implements
else if (REQUIRES_RESTRICT.contains(ctx.family()))
ctx.sql(' ').visit(K_RESTRICT);
ctx.end(DROP_SCHEMA_SCHEMA);
ctx.end(Clause.DROP_SCHEMA_SCHEMA);
}
@ -173,4 +170,6 @@ final class DropSchemaImpl extends AbstractRowCountQuery implements
public final Clause[] clauses(Context<?> ctx) {
return CLAUSES;
}
}