本文整理汇总了Java中org.jooq.SQLDialect.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java SQLDialect.valueOf方法的具体用法?Java SQLDialect.valueOf怎么用?Java SQLDialect.valueOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jooq.SQLDialect
的用法示例。
在下文中一共展示了SQLDialect.valueOf方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dsl
import org.jooq.SQLDialect; //导入方法依赖的package包/类
@Bean
@Autowired
public DSLContext dsl(DataSource dataSource) {
try {
SQLDialect.valueOf(dialect);
} catch (IllegalArgumentException iae) {
System.err.println("Cannot parse sql dialect: "+dialect);
throw iae;
}
Settings dslSettings = null;
if ("true".equals(System.getProperty(JOOQ_DEBUG_PROPERTY))) {
dslSettings = new Settings()
.withRenderFormatted(true)
.withExecuteLogging(true);
}
return DSL.using(
dataSource,
SQLDialect.valueOf(dialect),
dslSettings);
}
示例2: configure
import org.jooq.SQLDialect; //导入方法依赖的package包/类
@SuppressWarnings( "deprecation" )
@Override
public void configure(Context context) {
// DBCP 초기화
ConnectionManager.instance.initialize( context );
this.batchsize = context.getInteger(CONF_BATCH_SIZE, DEFAULT_BATCH_SIZE);
this.sqlDialect = SQLDialect.valueOf(context.getString(CONF_SQL_DIALECT).toUpperCase(Locale.ENGLISH));
final String sql = context.getString(CONF_SQL);
if (sql == null) {
Connection connection = null;
try {
// Table 정보 매핑
connection = ConnectionManager.instance.getConnection();
final DSLContext create = DSL.using(connection, sqlDialect);
this.queryGenerator = new MappingQueryGenerator(create, context.getString(CONF_TABLE));
} catch (SQLException ex) {
throw new JDBCSinkException(ex);
} finally {
JDBCUtils.safeClose( connection );
}
} else {
this.queryGenerator = new TemplateQueryGenerator(sqlDialect, sql);
}
this.sinkCounter = new SinkCounter(this.getName());
}
示例3: getSQLDialect
import org.jooq.SQLDialect; //导入方法依赖的package包/类
private static SQLDialect getSQLDialect(String name) {
String prop = "db." + name + ".database";
String database = ArchaiusUtil.getString(prop).get();
if (database == null) {
throw new IllegalStateException("Failed to find config for [" + prop + "]");
}
try {
return SQLDialect.valueOf(database.trim().toUpperCase());
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid SQLDialect [" + database.toUpperCase() + "]", e);
}
}
示例4: init
import org.jooq.SQLDialect; //导入方法依赖的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()])));
}
}
示例5: init
import org.jooq.SQLDialect; //导入方法依赖的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()])));
}
}
示例6: configuration
import org.jooq.SQLDialect; //导入方法依赖的package包/类
@Bean(name="presets-jooq-configuration") @Inject
public DefaultConfiguration configuration(@Named("presets-connection-provider") DataSourceConnectionProvider provider) {
DefaultConfiguration jooqConfiguration = new DefaultConfiguration();
jooqConfiguration.set(provider);
// jooqConfiguration.set(new DefaultExecuteListenerProvider(
// jooqToSpringExceptionTransformer()
// ));
String sqlDialectName = environment.getProperty(MEV_PRESETS_PROPERTY_PREFIX+"jooq.sql.dialect");
SQLDialect dialect = SQLDialect.valueOf(sqlDialectName);
jooqConfiguration.set(dialect);
return jooqConfiguration;
}
示例7: startServer
import org.jooq.SQLDialect; //导入方法依赖的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);
}
示例8: findSQLDialect
import org.jooq.SQLDialect; //导入方法依赖的package包/类
private static SQLDialect findSQLDialect(Properties config) {
return SQLDialect.valueOf(config.getProperty("jooq.dialect"));
}