use of org.jooq.conf.Settings in project jOOQ by jOOQ.
the class Example_4_3_Settings method run.
@Test
public void run() {
Select<?> select = DSL.select().from(AUTHOR).where(AUTHOR.ID.eq(3));
Tools.title("A couple of settings at work - Formatting");
out.println(using(H2, new Settings().withRenderFormatted(false)).render(select));
out.println(using(H2, new Settings().withRenderFormatted(true)).render(select));
Tools.title("A couple of settings at work - Schema");
out.println(using(H2, new Settings().withRenderSchema(false)).render(select));
out.println(using(H2, new Settings().withRenderSchema(true)).render(select));
Tools.title("A couple of settings at work - Name case");
out.println(using(H2, new Settings().withRenderNameCase(RenderNameCase.AS_IS)).render(select));
out.println(using(H2, new Settings().withRenderNameCase(RenderNameCase.UPPER)).render(select));
out.println(using(H2, new Settings().withRenderNameCase(RenderNameCase.LOWER)).render(select));
Tools.title("A couple of settings at work - Name quoting");
out.println(using(H2, new Settings().withRenderQuotedNames(RenderQuotedNames.ALWAYS)).render(select));
out.println(using(H2, new Settings().withRenderQuotedNames(RenderQuotedNames.EXPLICIT_DEFAULT_QUOTED)).render(select));
out.println(using(H2, new Settings().withRenderQuotedNames(RenderQuotedNames.EXPLICIT_DEFAULT_UNQUOTED)).render(select));
out.println(using(H2, new Settings().withRenderQuotedNames(RenderQuotedNames.NEVER)).render(select));
Tools.title("A couple of settings at work - Keyword case");
out.println(using(H2, new Settings().withRenderKeywordCase(RenderKeywordCase.AS_IS)).render(select));
out.println(using(H2, new Settings().withRenderKeywordCase(RenderKeywordCase.LOWER)).render(select));
out.println(using(H2, new Settings().withRenderKeywordCase(RenderKeywordCase.UPPER)).render(select));
out.println(using(H2, new Settings().withRenderKeywordCase(RenderKeywordCase.PASCAL)).render(select));
Tools.title("A couple of settings at work - Mapping");
out.println(using(H2, new Settings().withRenderMapping(new RenderMapping().withSchemata(new MappedSchema().withInput("PUBLIC").withOutput("test").withTables(new MappedTable().withInput("AUTHOR").withOutput("test-author"))))).render(select));
}
use of org.jooq.conf.Settings in project curiostack by curioswitch.
the class DatabaseModule method dbContext.
@Provides
@Singleton
static DSLContext dbContext(DataSource dataSource, @ForDatabase ListeningExecutorService dbExecutor) {
Configuration configuration = new DefaultConfiguration().set(dbExecutor).set(SQLDialect.MYSQL).set(new Settings().withRenderSchema(false)).set(new DataSourceConnectionProvider(dataSource)).set(DatabaseUtil.sfmRecordMapperProvider());
DSLContext ctx = DSL.using(configuration);
// Eagerly trigger JOOQ classinit for better startup performance.
ctx.select().from("curio_server_framework_init").getSQL();
return ctx;
}
Aggregations