Java 类org.jooq.conf.StatementType 实例源码

项目:killbill-analytics-plugin    文件:SqlReportDataExtractor.java   
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();
}
项目:java-persistence-frameworks-comparison    文件:DbTestsApplication.java   
@Bean
@Qualifier("static-statement-jooq-settings")
public Settings jooqStaticStatementSettings() {
    Settings ret = jooqSettings();
    ret.withStatementType(StatementType.STATIC_STATEMENT);
    return ret;
}
项目:ninja-jooq    文件:NinjaJooqLifecycle.java   
/**
 * 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);
}
项目:ninja-jooq    文件:NinjaJooqLifecycle.java   
/**
 * 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);
}