use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImplTest method test_getActualStatementConfig_defaultMerge_defaultAll.
// ===================================================================================
// DefaultMerge
// ============
public void test_getActualStatementConfig_defaultMerge_defaultAll() 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.fetchSize(2);
// ## Act ##
StatementConfig actual = impl.getActualStatementConfig(config);
// ## Assert ##
assertNotNull(actual);
assertEquals(10, actual.getQueryTimeout());
assertEquals(2, actual.getFetchSize());
assertEquals(30, actual.getMaxRows());
}
use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImplTest method test_getResultSetType_request.
public void test_getResultSetType_request() throws Exception {
// ## Arrange ##
TnStatementFactoryImpl impl = new TnStatementFactoryImpl();
StatementConfig config = new StatementConfig();
config.typeScrollInsensitive();
// ## Act ##
int resultSetType = impl.getResultSetType(config);
// ## Assert ##
assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, resultSetType);
}
use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImplTest method test_getActualStatementConfig_cursorSelectFetchSize_cursor_merged.
public void test_getActualStatementConfig_cursorSelectFetchSize_cursor_merged() throws Exception {
// ## Arrange ##
TnStatementFactoryImpl impl = new TnStatementFactoryImpl() {
@Override
protected boolean isSelectCursorFetchSizeCommand(BehaviorCommand<?> command) {
return true;
}
};
{
StatementConfig defaultConfig = new StatementConfig();
defaultConfig.queryTimeout(10).fetchSize(20).maxRows(30);
impl.setDefaultStatementConfig(defaultConfig);
}
impl.setCursorSelectFetchSize(200);
StatementConfig config = new StatementConfig();
config.queryTimeout(1);
// ## Act ##
StatementConfig actual = impl.getActualStatementConfig(config);
// ## Assert ##
assertNotNull(actual);
assertEquals(1, actual.getQueryTimeout());
assertEquals(200, actual.getFetchSize());
assertEquals(30, actual.getMaxRows());
}
use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImpl method findStatementConfigOnThread.
// -----------------------------------------------------
// StatementConfig
// ---------------
protected StatementConfig findStatementConfigOnThread() {
final StatementConfig config;
if (ConditionBeanContext.isExistConditionBeanOnThread()) {
final ConditionBean cb = ConditionBeanContext.getConditionBeanOnThread();
config = cb.getStatementConfig();
} else if (OutsideSqlContext.isExistOutsideSqlContextOnThread()) {
final OutsideSqlContext context = OutsideSqlContext.getOutsideSqlContextOnThread();
config = context.getStatementConfig();
} else {
// update or no exist
config = InternalMapContext.getUpdateStatementConfig();
}
return config;
}
use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImpl method getActualStatementConfig.
protected StatementConfig getActualStatementConfig(StatementConfig config) {
final StatementConfig defaultConfig = getActualDefaultConfig(config);
final Integer queryTimeout = getActualQueryTimeout(config, defaultConfig);
final Integer fetchSize = getActualFetchSize(config, defaultConfig);
final Integer maxRows = getActualMaxRows(config, defaultConfig);
if (queryTimeout == null && fetchSize == null && maxRows == null) {
return null;
}
final StatementConfig actualConfig = new StatementConfig();
actualConfig.queryTimeout(queryTimeout).fetchSize(fetchSize).maxRows(maxRows);
return actualConfig;
}
Aggregations