[#6720] Refactor some internals to use Scope.dsl() or Configuration.dsl()

This commit is contained in:
lukaseder 2017-10-19 11:31:55 +02:00
parent 89cc320382
commit 5730c6e67f
4 changed files with 19 additions and 23 deletions

View File

@ -5305,16 +5305,14 @@ public class JavaGenerator extends AbstractGenerator {
if (scala) {
out.println(") : %s[%s] = {", Result.class, recordClassName);
out.tab(2).print("%s.using(%s).selectFrom(%s.call(",
DSL.class,
out.tab(2).print("%s.dsl().selectFrom(%s.call(",
configurationArgument,
// [#5765] To prevent name clashes, this identifier is not imported
getStrategy().getFullJavaIdentifier(function));
}
else {
out.println(") {");
out.tab(2).print("return %s.using(%s).selectFrom(%s.call(",
DSL.class,
out.tab(2).print("return %s.dsl().selectFrom(%s.call(",
configurationArgument,
// [#5765] To prevent name clashes, this identifier is not imported
getStrategy().getFullJavaIdentifier(function));

View File

@ -40,7 +40,6 @@ import static org.jooq.impl.DSL.param;
import java.sql.Connection;
import org.jooq.conf.Settings;
import org.jooq.impl.DSL;
import org.jooq.impl.DefaultConfiguration;
/**
@ -59,13 +58,13 @@ class SQLCatalogVersionProvider implements CatalogVersionProvider {
@Override
public String version(CatalogDefinition catalog) {
return "" +
DSL.using(
new DefaultConfiguration()
.set(connection)
.set(new Settings().withStatementType(STATIC_STATEMENT))
).fetchValue(
// [#2906] TODO Plain SQL statements do not yet support named parameters
sql.replace(":catalog_name", "?"), param("catalog_name", catalog.getInputName())
);
new DefaultConfiguration()
.set(connection)
.set(new Settings().withStatementType(STATIC_STATEMENT))
.dsl()
.fetchValue(
// [#2906] TODO Plain SQL statements do not yet support named parameters
sql.replace(":catalog_name", "?"), param("catalog_name", catalog.getInputName())
);
}
}

View File

@ -40,7 +40,6 @@ import static org.jooq.impl.DSL.param;
import java.sql.Connection;
import org.jooq.conf.Settings;
import org.jooq.impl.DSL;
import org.jooq.impl.DefaultConfiguration;
/**
@ -59,13 +58,13 @@ class SQLSchemaVersionProvider implements SchemaVersionProvider {
@Override
public String version(SchemaDefinition schema) {
return "" +
DSL.using(
new DefaultConfiguration()
.set(connection)
.set(new Settings().withStatementType(STATIC_STATEMENT))
).fetchValue(
// [#2906] TODO Plain SQL statements do not yet support named parameters
sql.replace(":schema_name", "?"), param("schema_name", schema.getInputName())
);
new DefaultConfiguration()
.set(connection)
.set(new Settings().withStatementType(STATIC_STATEMENT))
.dsl()
.fetchValue(
// [#2906] TODO Plain SQL statements do not yet support named parameters
sql.replace(":schema_name", "?"), param("schema_name", schema.getInputName())
);
}
}

View File

@ -94,7 +94,7 @@ public class SakilaReportService {
public void executeEnd(ExecuteContext ctx) {
Configuration config = ctx.configuration().derive();
config.settings().setRenderFormatted(true);
log.info("\n" + DSL.using(config).renderInlined(ctx.query()));
log.info("\n" + config.dsl().renderInlined(ctx.query()));
}
@Override