Move more statements to the API generator

This commit is contained in:
Lukas Eder 2020-12-11 17:33:36 +01:00
parent 6474f8b663
commit 97d6073645
6 changed files with 306 additions and 228 deletions

View File

@ -9127,73 +9127,6 @@ public interface DSLContext extends Scope {
@NotNull
Queries ddl(Collection<? extends Table<?>> tables, DDLExportConfiguration configuration);
// -------------------------------------------------------------------------
// XXX Session Statements
// -------------------------------------------------------------------------
/**
* Set the current catalog to a new value.
*
* @see DSL#catalog(Name)
*/
@NotNull
@Support({ MARIADB, MYSQL })
RowCountQuery setCatalog(String catalog);
/**
* Set the current catalog to a new value.
*
* @see DSL#catalog(Name)
*/
@NotNull
@Support({ MARIADB, MYSQL })
RowCountQuery setCatalog(Name catalog);
/**
* Set the current catalog to a new value.
*/
@NotNull
@Support({ MARIADB, MYSQL })
RowCountQuery setCatalog(Catalog catalog);
/**
* Set the current schema to a new value.
*
* @see DSL#schema(Name)
* @see DSL#setSchema(String)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
RowCountQuery setSchema(String schema);
/**
* Set the current schema to a new value.
*
* @see DSL#schema(Name)
* @see DSL#setSchema(Name)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
RowCountQuery setSchema(Name schema);
/**
* Set the current schema to a new value.
*
* @see DSL#setSchema(Schema)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
RowCountQuery setSchema(Schema schema);
/**
* Set a vendor specific flag to a new value.
*
* @see DSL#set(Name, Param)
*/
@NotNull
@Support({ MYSQL })
RowCountQuery set(Name name, Param<?> param);
// -------------------------------------------------------------------------
// XXX DDL Statements
// -------------------------------------------------------------------------
@ -9875,6 +9808,83 @@ public interface DSLContext extends Scope {
@Support({ HSQLDB, POSTGRES })
RevokeOnStep revokeGrantOptionFor(Collection<? extends Privilege> privileges);
/**
* The <code>SET</code> statement.
* <p>
* Set a vendor specific flag to a new value.
*
* @see DSL#set(Name,Param)
*/
@NotNull
@Support({ MYSQL })
RowCountQuery set(Name name, Param<?> value);
/**
* The <code>SET CATALOG</code> statement.
* <p>
* Set the current catalog to a new value.
*
* @see DSL#setCatalog(String)
*/
@NotNull
@Support({ MARIADB, MYSQL })
RowCountQuery setCatalog(String catalog);
/**
* The <code>SET CATALOG</code> statement.
* <p>
* Set the current catalog to a new value.
*
* @see DSL#setCatalog(Name)
*/
@NotNull
@Support({ MARIADB, MYSQL })
RowCountQuery setCatalog(Name catalog);
/**
* The <code>SET CATALOG</code> statement.
* <p>
* Set the current catalog to a new value.
*
* @see DSL#setCatalog(Catalog)
*/
@NotNull
@Support({ MARIADB, MYSQL })
RowCountQuery setCatalog(Catalog catalog);
/**
* The <code>SET SCHEMA</code> statement.
* <p>
* Set the current schema to a new value.
*
* @see DSL#setSchema(String)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
RowCountQuery setSchema(String schema);
/**
* The <code>SET SCHEMA</code> statement.
* <p>
* Set the current schema to a new value.
*
* @see DSL#setSchema(Name)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
RowCountQuery setSchema(Name schema);
/**
* The <code>SET SCHEMA</code> statement.
* <p>
* Set the current schema to a new value.
*
* @see DSL#setSchema(Schema)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
RowCountQuery setSchema(Schema schema);
/**

View File

@ -7065,87 +7065,6 @@ public class DSL {
return constraint().check(condition);
}
// -------------------------------------------------------------------------
// XXX Session Statements
// -------------------------------------------------------------------------
/**
* Set the current catalog to a new value.
*
* @see DSL#catalog(Name)
*/
@NotNull
@Support({ MARIADB, MYSQL })
public static RowCountQuery setCatalog(String catalog) {
return dsl().setCatalog(catalog);
}
/**
* Set the current catalog to a new value.
*
* @see DSL#catalog(Name)
*/
@NotNull
@Support({ MARIADB, MYSQL })
public static RowCountQuery setCatalog(Name catalog) {
return dsl().setCatalog(catalog);
}
/**
* Set the current catalog to a new value.
*/
@NotNull
@Support({ MARIADB, MYSQL })
public static RowCountQuery setCatalog(Catalog catalog) {
return dsl().setCatalog(catalog);
}
/**
* Set the current schema to a new value.
*
* @see DSL#schema(Name)
* @see DSLContext#setSchema(String)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static RowCountQuery setSchema(String schema) {
return dsl().setSchema(schema);
}
/**
* Set the current schema to a new value.
*
* @see DSL#schema(Name)
* @see DSLContext#setSchema(Name)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static RowCountQuery setSchema(Name schema) {
return dsl().setSchema(schema);
}
/**
* Set the current schema to a new value.
*
* @see DSLContext#setSchema(Schema)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static RowCountQuery setSchema(Schema schema) {
return dsl().setSchema(schema);
}
/**
* Set a vendor specific flag to a new value.
*
* @see DSLContext#set(Name, Param)
*/
@NotNull
@Support({ MYSQL })
public static RowCountQuery set(Name name, Param<?> param) {
return dsl().set(name, param);
}
// -------------------------------------------------------------------------
// XXX DDL Statements
// -------------------------------------------------------------------------
@ -7977,6 +7896,97 @@ public class DSL {
return dsl().revokeGrantOptionFor(privileges);
}
/**
* The <code>SET</code> statement.
* <p>
* Set a vendor specific flag to a new value.
*
* @see DSLContext#set(Name,Param)
*/
@NotNull
@Support({ MYSQL })
public static org.jooq.RowCountQuery set(Name name, Param<?> value) {
return dsl().set(name, value);
}
/**
* The <code>SET CATALOG</code> statement.
* <p>
* Set the current catalog to a new value.
*
* @see DSLContext#setCatalog(String)
*/
@NotNull
@Support({ MARIADB, MYSQL })
public static org.jooq.RowCountQuery setCatalog(String catalog) {
return dsl().setCatalog(catalog);
}
/**
* The <code>SET CATALOG</code> statement.
* <p>
* Set the current catalog to a new value.
*
* @see DSLContext#setCatalog(Name)
*/
@NotNull
@Support({ MARIADB, MYSQL })
public static org.jooq.RowCountQuery setCatalog(Name catalog) {
return dsl().setCatalog(catalog);
}
/**
* The <code>SET CATALOG</code> statement.
* <p>
* Set the current catalog to a new value.
*
* @see DSLContext#setCatalog(Catalog)
*/
@NotNull
@Support({ MARIADB, MYSQL })
public static org.jooq.RowCountQuery setCatalog(Catalog catalog) {
return dsl().setCatalog(catalog);
}
/**
* The <code>SET SCHEMA</code> statement.
* <p>
* Set the current schema to a new value.
*
* @see DSLContext#setSchema(String)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static org.jooq.RowCountQuery setSchema(String schema) {
return dsl().setSchema(schema);
}
/**
* The <code>SET SCHEMA</code> statement.
* <p>
* Set the current schema to a new value.
*
* @see DSLContext#setSchema(Name)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static org.jooq.RowCountQuery setSchema(Name schema) {
return dsl().setSchema(schema);
}
/**
* The <code>SET SCHEMA</code> statement.
* <p>
* Set the current schema to a new value.
*
* @see DSLContext#setSchema(Schema)
*/
@NotNull
@Support({ DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static org.jooq.RowCountQuery setSchema(Schema schema) {
return dsl().setSchema(schema);
}
/**

View File

@ -3337,6 +3337,41 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
return new RevokeImpl(configuration(), privileges, true);
}
@Override
public org.jooq.RowCountQuery set(Name name, Param<?> value) {
return new SetCommand(configuration(), name, value);
}
@Override
public org.jooq.RowCountQuery setCatalog(String catalog) {
return new SetCatalog(configuration(), DSL.catalog(DSL.name(catalog)));
}
@Override
public org.jooq.RowCountQuery setCatalog(Name catalog) {
return new SetCatalog(configuration(), DSL.catalog(catalog));
}
@Override
public org.jooq.RowCountQuery setCatalog(Catalog catalog) {
return new SetCatalog(configuration(), catalog);
}
@Override
public org.jooq.RowCountQuery setSchema(String schema) {
return new SetSchema(configuration(), DSL.schema(DSL.name(schema)));
}
@Override
public org.jooq.RowCountQuery setSchema(Name schema) {
return new SetSchema(configuration(), DSL.schema(schema));
}
@Override
public org.jooq.RowCountQuery setSchema(Schema schema) {
return new SetSchema(configuration(), schema);
}
@Override
@ -3418,41 +3453,6 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
// XXX DDL Statements
// -------------------------------------------------------------------------
@Override
public RowCountQuery setCatalog(String catalog) {
return setCatalog(name(catalog));
}
@Override
public RowCountQuery setCatalog(Name catalog) {
return setCatalog(catalog(catalog));
}
@Override
public RowCountQuery setCatalog(Catalog catalog) {
return new SetCatalog(configuration(), catalog);
}
@Override
public RowCountQuery setSchema(String schema) {
return setSchema(name(schema));
}
@Override
public RowCountQuery setSchema(Name schema) {
return setSchema(schema(schema));
}
@Override
public RowCountQuery setSchema(Schema schema) {
return new SetSchema(configuration(), schema);
}
@Override
public RowCountQuery set(Name name, Param<?> param) {
return new SetCommand(configuration(), name, param);
}
@Override
public CommentOnIsStep commentOnTable(String tableName) {
return commentOnTable(name(tableName));

View File

@ -37,28 +37,51 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Keywords.K_CATALOG;
import static org.jooq.impl.Keywords.K_SET;
import static org.jooq.impl.Keywords.K_USE;
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.*;
import org.jooq.impl.*;
import java.util.*;
import org.jooq.Catalog;
import org.jooq.Configuration;
import org.jooq.Context;
/**
* @author Lukas Eder
* The <code>SET CATALOG</code> statement.
*/
final class SetCatalog extends AbstractRowCountQuery {
@SuppressWarnings({ "unused" })
final class SetCatalog
extends
AbstractRowCountQuery
{
private static final long serialVersionUID = -3996953205762741746L;
private final Catalog catalog;
private static final long serialVersionUID = 1L;
SetCatalog(Configuration configuration, Catalog catalog) {
private final Catalog catalog;
SetCatalog(
Configuration configuration,
Catalog catalog
) {
super(configuration);
this.catalog = catalog;
}
final Catalog $catalog() { return catalog; }
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
switch (ctx.family()) {
@ -90,4 +113,6 @@ final class SetCatalog extends AbstractRowCountQuery {
break;
}
}
}

View File

@ -37,29 +37,40 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Keywords.K_SET;
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.*;
import org.jooq.impl.*;
import java.util.*;
import org.jooq.Configuration;
import org.jooq.Context;
import org.jooq.Name;
import org.jooq.Param;
/**
* A <code>SET</code> command.
*
* @author Lukas Eder
* The <code>SET</code> statement.
*/
final class SetCommand extends AbstractRowCountQuery {
@SuppressWarnings({ "rawtypes", "unused" })
final class SetCommand
extends
AbstractRowCountQuery
{
/**
* Generated UID
*/
private static final long serialVersionUID = -6018875346107141474L;
private static final long serialVersionUID = 1L;
private final Name name;
private final Param<?> value;
private final Name name;
private final Param<?> value;
SetCommand(Configuration configuration, Name name, Param<?> value) {
SetCommand(
Configuration configuration,
Name name,
Param<?> value
) {
super(configuration);
this.name = name;
@ -69,12 +80,16 @@ final class SetCommand extends AbstractRowCountQuery {
final Name $name() { return name; }
final Param<?> $value() { return value; }
// ------------------------------------------------------------------------
// -------------------------------------------------------------------------
// XXX: QueryPart API
// ------------------------------------------------------------------------
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
ctx.visit(K_SET).sql(' ').visit(name).sql(" = ").visit(value);
}
}

View File

@ -37,28 +37,38 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Keywords.K_ALTER;
import static org.jooq.impl.Keywords.K_CURRENT_SCHEMA;
import static org.jooq.impl.Keywords.K_DATABASE;
import static org.jooq.impl.Keywords.K_SCHEMA;
import static org.jooq.impl.Keywords.K_SEARCH_PATH;
import static org.jooq.impl.Keywords.K_SESSION;
import static org.jooq.impl.Keywords.K_SET;
import static org.jooq.impl.Keywords.K_USE;
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.*;
import org.jooq.impl.*;
import java.util.*;
import org.jooq.Configuration;
import org.jooq.Context;
import org.jooq.Schema;
/**
* @author Lukas Eder
* The <code>SET SCHEMA</code> statement.
*/
final class SetSchema extends AbstractRowCountQuery {
@SuppressWarnings({ "unused" })
final class SetSchema
extends
AbstractRowCountQuery
{
private static final long serialVersionUID = -3996953205762741746L;
private final Schema schema;
private static final long serialVersionUID = 1L;
SetSchema(Configuration configuration, Schema schema) {
private final Schema schema;
SetSchema(
Configuration configuration,
Schema schema
) {
super(configuration);
this.schema = schema;
@ -66,6 +76,12 @@ final class SetSchema extends AbstractRowCountQuery {
final Schema $schema() { return schema; }
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
switch (ctx.family()) {
@ -104,4 +120,6 @@ final class SetSchema extends AbstractRowCountQuery {
break;
}
}
}