[jOOQ/jOOQ#9781] Add DSLContext.set(Name, Param<?>) for arbitrary set commands

This commit is contained in:
Lukas Eder 2020-02-03 09:43:38 +01:00
parent c3b81e6324
commit 178d36d16e
5 changed files with 25 additions and 4 deletions

View File

@ -8513,6 +8513,14 @@ public interface DSLContext extends Scope , AutoCloseable {
@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)
*/
@Support({ MYSQL })
RowCountQuery set(Name name, Param<?> param);
// -------------------------------------------------------------------------
// XXX DDL Statements
// -------------------------------------------------------------------------

View File

@ -6588,6 +6588,16 @@ public class DSL {
return dsl().setSchema(schema);
}
/**
* Set a vendor specific flag to a new value.
*
* @see DSLContext#set(Name, Param)
*/
@Support({ MYSQL })
public static RowCountQuery set(Name name, Param<?> param) {
return dsl().set(name, param);
}
// -------------------------------------------------------------------------
// XXX DDL Statements
// -------------------------------------------------------------------------

View File

@ -2898,6 +2898,11 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
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

@ -2028,9 +2028,7 @@ final class ParserImpl implements Parser {
// TODO: [#9780] Are there any possible syntaxes and data types?
parseIf(ctx, '=');
Object value = parseSignedIntegerIf(ctx);
// TODO: [#9781] Create public DSL API for this
return new SetCommand(ctx.dsl.configuration(), name, value != null ? inline(value) : inline(parseStringLiteral(ctx)));
return ctx.dsl.set(name, value != null ? inline(value) : inline(parseStringLiteral(ctx)));
}
// There are many SET commands in programs like sqlplus, which we'll simply ignore

View File

@ -49,7 +49,7 @@ import org.jooq.Param;
*
* @author Lukas Eder
*/
final class SetCommand extends AbstractQuery {
final class SetCommand extends AbstractRowCountQuery {
/**
* Generated UID