Search in sources :

Example 16 with StatementConfig

use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.

the class InsertOption method createStatementConfig.

protected StatementConfig createStatementConfig(StatementConfigCall<StatementConfig> configCall) {
    if (configCall == null) {
        throw new IllegalArgumentException("The argument 'confLambda' should not be null.");
    }
    final StatementConfig config = newStatementConfig();
    configCall.callback(config);
    return config;
}
Also used : StatementConfig(org.dbflute.jdbc.StatementConfig)

Example 17 with StatementConfig

use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.

the class TnStatementFactoryImplTest method test_getActualStatementConfig_overrideDefault.

// ===================================================================================
//       OverrideDefault
// ===============
public void test_getActualStatementConfig_overrideDefault() throws Exception {
    // ## Arrange ##
    TnStatementFactoryImpl impl = new TnStatementFactoryImpl();
    {
        StatementConfig defaultConfig = new StatementConfig();
        defaultConfig.queryTimeout(10).fetchSize(20).maxRows(30);
        impl.setDefaultStatementConfig(defaultConfig);
    }
    StatementConfig config = new StatementConfig();
    config.queryTimeout(1).fetchSize(2).maxRows(3);
    // ## Act ##
    StatementConfig actual = impl.getActualStatementConfig(config);
    // ## Assert ##
    assertNotNull(actual);
    assertEquals(1, actual.getQueryTimeout());
    assertEquals(2, actual.getFetchSize());
    assertEquals(3, actual.getMaxRows());
}
Also used : StatementConfig(org.dbflute.jdbc.StatementConfig)

Example 18 with StatementConfig

use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.

the class TnStatementFactoryImplTest method test_getResultSetType_overrideDefault.

public void test_getResultSetType_overrideDefault() throws Exception {
    // ## Arrange ##
    TnStatementFactoryImpl impl = new TnStatementFactoryImpl();
    StatementConfig defaultConfig = new StatementConfig();
    defaultConfig.typeScrollSensitive();
    impl.setDefaultStatementConfig(defaultConfig);
    StatementConfig config = new StatementConfig();
    config.typeScrollInsensitive();
    // ## Act ##
    int resultSetType = impl.getResultSetType(config);
    // ## Assert ##
    assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, resultSetType);
}
Also used : StatementConfig(org.dbflute.jdbc.StatementConfig)

Example 19 with StatementConfig

use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.

the class TnStatementFactoryImplTest method test_getActualStatementConfig_suppressDefault.

// ===================================================================================
//       SuppressDefault
// ===============
public void test_getActualStatementConfig_suppressDefault() throws Exception {
    // ## Arrange ##
    TnStatementFactoryImpl impl = new TnStatementFactoryImpl();
    {
        StatementConfig defaultConfig = new StatementConfig();
        defaultConfig.queryTimeout(10).fetchSize(20).maxRows(30);
        impl.setDefaultStatementConfig(defaultConfig);
    }
    StatementConfig config = new StatementConfig();
    config.suppressDefault();
    config.fetchSize(2);
    // ## Act ##
    StatementConfig actual = impl.getActualStatementConfig(config);
    // ## Assert ##
    assertNotNull(actual);
    assertEquals(null, actual.getQueryTimeout());
    assertEquals(2, actual.getFetchSize());
    assertEquals(null, actual.getMaxRows());
}
Also used : StatementConfig(org.dbflute.jdbc.StatementConfig)

Example 20 with StatementConfig

use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.

the class TnStatementFactoryImplTest method test_getActualStatementConfig_request.

public void test_getActualStatementConfig_request() throws Exception {
    // ## Arrange ##
    TnStatementFactoryImpl impl = new TnStatementFactoryImpl();
    StatementConfig config = new StatementConfig();
    config.queryTimeout(1).fetchSize(2).maxRows(3);
    // ## Act ##
    StatementConfig actual = impl.getActualStatementConfig(config);
    // ## Assert ##
    assertNotNull(actual);
    assertEquals(1, actual.getQueryTimeout());
    assertEquals(2, actual.getFetchSize());
    assertEquals(3, actual.getMaxRows());
}
Also used : StatementConfig(org.dbflute.jdbc.StatementConfig)

Aggregations

StatementConfig (org.dbflute.jdbc.StatementConfig)29 BehaviorCommand (org.dbflute.bhv.core.BehaviorCommand)6 CallableStatement (java.sql.CallableStatement)1 PreparedStatement (java.sql.PreparedStatement)1 ConditionBean (org.dbflute.cbean.ConditionBean)1 OutsideSqlContext (org.dbflute.outsidesql.OutsideSqlContext)1