當前位置: 首頁>>代碼示例>>Java>>正文


Java SQLDialect.valueOf方法代碼示例

本文整理匯總了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);
}
 
開發者ID:khartec,項目名稱:waltz,代碼行數:23,代碼來源:DIConfiguration.java

示例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());
   }
 
開發者ID:SoonhyukYoon,項目名稱:stratio-jdbc-sink-mariadb,代碼行數:30,代碼來源:JDBCSink.java

示例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);
    }
}
 
開發者ID:rancher,項目名稱:cattle,代碼行數:14,代碼來源:Bootstrap.java

示例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()])));
    }
}
 
開發者ID:cloudnautique,項目名稱:cloud-cattle,代碼行數:36,代碼來源:Configuration.java

示例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()])));
    }
}
 
開發者ID:ibuildthecloud,項目名稱:dstack,代碼行數:37,代碼來源:Configuration.java

示例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;
}
 
開發者ID:dfci-cccb,項目名稱:mev,代碼行數:16,代碼來源:PresetPersistenceConfiguration.java

示例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);
}
 
開發者ID:jschaf,項目名稱:ninja-jooq,代碼行數:63,代碼來源:NinjaJooqLifecycle.java

示例8: findSQLDialect

import org.jooq.SQLDialect; //導入方法依賴的package包/類
private static SQLDialect findSQLDialect(Properties config) {
    return SQLDialect.valueOf(config.getProperty("jooq.dialect"));
}
 
開發者ID:AveryRegier,項目名稱:club-tracker,代碼行數:4,代碼來源:ConfiguredConnector.java


注:本文中的org.jooq.SQLDialect.valueOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。