本文整理汇总了Java中org.jooq.conf.RenderNameStyle类的典型用法代码示例。如果您正苦于以下问题:Java RenderNameStyle类的具体用法?Java RenderNameStyle怎么用?Java RenderNameStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RenderNameStyle类属于org.jooq.conf包,在下文中一共展示了RenderNameStyle类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
public void setUp() throws Exception {
connection = DriverManager.getConnection("jdbc:hsqldb:mem:myDb");
context = DSL.using(connection, SQLDialect.HSQLDB, new Settings().withRenderNameStyle(
RenderNameStyle.AS_IS));
final List<Field<String>> fields = getFields();
context.createTable(relationName)
.columns(fields)
.execute();
try (InputStream in = resourceClass.getResourceAsStream(csvPath)) {
final Loader<Record> loader = context.loadInto(table(name(relationName)))
.loadCSV(in)
.fields(fields)
.execute();
assertThat(loader.errors()).isEmpty();
}
}
示例2: SqlReportDataExtractor
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
public SqlReportDataExtractor(final String tableName,
final ReportSpecification reportSpecification,
@Nullable final DateTime startDate,
@Nullable final DateTime endDate,
final SQLDialect sqlDialect,
final Long tenantRecordId) {
this.tableName = tableName;
this.reportSpecification = reportSpecification;
this.startDate = startDate;
this.endDate = endDate;
this.tenantRecordId = tenantRecordId;
final Settings settings = new Settings();
settings.withStatementType(StatementType.STATIC_STATEMENT);
settings.withRenderFormatted(true);
if (SQLDialect.H2.equals(sqlDialect)) {
settings.withRenderNameStyle(RenderNameStyle.AS_IS);
}
this.context = DSL.using(sqlDialect, settings);
setup();
}
示例3: jooqSettings
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
@Bean
@Primary
public Settings jooqSettings() {
Settings ret = new Settings();
ret.withRenderSchema(false);
ret.setRenderFormatted(true);
ret.setRenderNameStyle(RenderNameStyle.AS_IS);
return ret;
}
示例4: databaseAgnostic
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
public static DSLContext databaseAgnostic(DataSource dataSource) throws SQLException {
SQLDialect dialect;
try (Connection conn = dataSource.getConnection()) {
dialect = dialect(conn);
// See https://github.com/jOOQ/jOOQ/issues/4730
if (conn.getMetaData().getURL().startsWith("jdbc:pgsql:")) {
dialect = POSTGRES;
}
}
return DSL.using(dataSource, dialect,
new Settings()
.withRenderSchema(false)
.withRenderNameStyle(RenderNameStyle.AS_IS));
}
示例5: main
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
public static void main(String[] args) {
SQLDialect sqlDialect = args.length == 0 ? SQLDialect.HSQLDB : SQLDialect.POSTGRES; // SQLDialect.ORACLE
Settings settings = new Settings()
.withRenderFormatted(true)
.withRenderSchema(TRUE)
.withRenderNameStyle(RenderNameStyle.UPPER);
if (sqlDialect == SQLDialect.POSTGRES) {
String schema1Name = args[0];
String schema2Name = args[1];
settings.withRenderMapping(new RenderMapping()
.withSchemata(
new MappedSchema().withInput(SCHEMA1.getName()).withOutput(schema1Name),
new MappedSchema().withInput(SCHEMA2.getName()).withOutput(schema2Name)));
}
Configuration config = new DefaultConfiguration()
.set(sqlDialect)
.set(settings);
Configuration configuration = config;
DSLContext dsl = DSL.using(configuration);
System.out.println(
dsl.select(A.ID, A.FLAG)
.from(A)
.join(B).on(B.NAME.eq(A.NAME))
.toString());
}
示例6: dbSetting
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
private static Settings dbSetting(String name) {
String prop = "db." + name + ".database";
String database = ArchaiusUtil.getString(prop).get();
Settings settings = new Settings();
settings.setRenderSchema(false);
settings.setExecuteLogging(false);
String renderNameStyle = ArchaiusUtil.getString("db." + name + "." + database + ".render.name.style").get();
if (renderNameStyle != null) {
settings.setRenderNameStyle(RenderNameStyle.valueOf(renderNameStyle.trim().toUpperCase()));
}
return settings;
}
示例7: init
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
@PostConstruct
public void init() {
String prop = "db." + name + ".database";
String database = ArchaiusUtil.getString(prop).get();
if ( database == null ) {
throw new IllegalStateException("Failed to find config for [" + prop + "]");
}
try {
SQLDialect dialect = SQLDialect.valueOf(database.trim().toUpperCase());
set(dialect);
} catch ( IllegalArgumentException e ) {
throw new IllegalArgumentException("Invalid SQLDialect [" + database.toUpperCase() + "]", e);
}
if ( connectionProvider == null ) {
set(new AutoCommitConnectionProvider(dataSource));
} else {
set(connectionProvider);
}
settings.setRenderSchema(false);
String renderNameStyle = ArchaiusUtil.getString("db." + name + "." + database + ".render.name.style").get();
if ( renderNameStyle != null ) {
settings.setRenderNameStyle(RenderNameStyle.valueOf(renderNameStyle.trim().toUpperCase()));
}
set(settings);
if ( listeners != null && listeners.size() > 0 ) {
settings().setExecuteLogging(false);
set(DefaultExecuteListenerProvider.providers(listeners.toArray(new ExecuteListener[listeners.size()])));
}
}
示例8: getSettings
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
@Override
public Settings getSettings() {
if(dialect == SQLDialect.POSTGRES) {
return new Settings().withRenderNameStyle(RenderNameStyle.LOWER);
}
return updateSchema(dialect).map(s ->
new Settings()
.withRenderNameStyle(RenderNameStyle.LOWER)
.withRenderMapping(new RenderMapping()
.withSchemata(
new MappedSchema().withInput(Club.CLUB.getName())
.withOutput(s))))
.orElseGet(Settings::new);
}
示例9: init
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
@PostConstruct
public void init() {
String prop = "db." + name + ".database";
String database = ArchaiusUtil.getString(prop).get();
if ( database == null ) {
throw new IllegalStateException("Failed to find config for [" + prop + "]");
}
try {
SQLDialect dialect = SQLDialect.valueOf(database.trim().toUpperCase());
set(dialect);
} catch ( IllegalArgumentException e ) {
throw new IllegalArgumentException("Invalid SQLDialect [" + database.toUpperCase() + "]", e);
}
if ( connectionProvider == null ) {
set(new AutoCommitConnectionProvider(dataSource));
} else {
set(connectionProvider);
}
Settings settings = new Settings();
settings.setRenderSchema(false);
String renderNameStyle = ArchaiusUtil.getString("db." + name + "." + database + ".render.name.style").get();
if ( renderNameStyle != null ) {
settings.setRenderNameStyle(RenderNameStyle.valueOf(renderNameStyle.trim().toUpperCase()));
}
set(settings);
if ( listeners != null && listeners.size() > 0 ) {
settings().setExecuteLogging(false);
set(DefaultExecuteListenerProvider.providers(listeners.toArray(new ExecuteListener[listeners.size()])));
}
}
示例10: hsqldb
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
private DSLContext hsqldb(final Connection connection) {
final Settings settings = new Settings().withRenderNameStyle(RenderNameStyle.AS_IS);
return DSL.using(connection, SQLDialect.HSQLDB, settings);
}
示例11: startServer
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
/**
* This method reads the configuration properties from
* your application.conf file and configures jOOQ accordingly.
*
*/
public final void startServer(){
logger.info("Starting jOOQ Module.");
// Setup basic parameters
boolean renderSchema = ninjaProperties.getBooleanWithDefault(JOOQ_RENDER_SCHEMA, true);
//renderMapping
String renderNameStyleString = ninjaProperties.getWithDefault(JOOQ_RENDER_NAME_STYLE, "QUOTED");
RenderNameStyle renderNameStyle = RenderNameStyle.fromValue(renderNameStyleString);
String renderKeywordStyleString = ninjaProperties.getWithDefault(JOOQ_RENDER_KEYWORD_STYLE, "LOWER");
RenderKeywordStyle renderKeywordStyle = RenderKeywordStyle.valueOf(renderKeywordStyleString);
boolean renderFormatted = ninjaProperties.getBooleanWithDefault(JOOQ_RENDER_FORMATTED, false);
String statementTypeString = ninjaProperties.getWithDefault(JOOQ_STATEMENT_TYPE, "PREPARED_STATEMENT");
StatementType statementType = StatementType.valueOf(statementTypeString);
boolean executeLogging = ninjaProperties.getBooleanWithDefault(JOOQ_EXECUTE_LOGGING, true);
// Execute listeners
boolean executeWithOptimisticLocking = ninjaProperties
.getBooleanWithDefault(JOOQ_EXECUTE_WITH_OPTIMISTIC_LOCKING, true);
boolean attachRecords = ninjaProperties.getBooleanWithDefault(JOOQ_ATTACH_RECORDS, true);
String sqlDialectString = ninjaProperties.getWithDefault(JOOQ_SQL_DIALECT, "DEFAULT");
SQLDialect sqlDialect = SQLDialect.valueOf(sqlDialectString);
Settings settings = new Settings();
settings.setRenderSchema(renderSchema);
settings.setRenderNameStyle(renderNameStyle);
settings.setRenderKeywordStyle(renderKeywordStyle);
settings.setRenderFormatted(renderFormatted);
settings.setStatementType(statementType);
settings.setExecuteLogging(executeLogging);
settings.setExecuteWithOptimisticLocking(executeWithOptimisticLocking);
settings.setAttachRecords(attachRecords);
String connectionUrl = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_URL);
String connectionUsername = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_USERNAME);
String connectionPassword = ninjaProperties.getWithDefault(NinjaConstant.DB_CONNECTION_PASSWORD, "");
BasicDataSource connectionPool = new BasicDataSource();
connectionPool.setUrl(connectionUrl);
connectionPool.setUsername(connectionUsername);
connectionPool.setPassword(connectionPassword);
Configuration configuration = new DefaultConfiguration();
configuration.set(sqlDialect);
configuration.set(settings);
configuration.set(connectionPool);
dslContext = DSL.using(configuration);
}
示例12: withRenderNameStyle
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
public SelectBuilder<T> withRenderNameStyle(RenderNameStyle renderNameStyle) {
this.renderNameStyle = renderNameStyle;
return this;
}
示例13: getSettings
import org.jooq.conf.RenderNameStyle; //导入依赖的package包/类
protected Settings getSettings()
{
return new Settings().withRenderNameStyle( RenderNameStyle.QUOTED );
}