use of org.dbflute.logic.replaceschema.dataassert.DfDataAssertProvider in project dbflute-core by dbflute.
the class DfAlterCheckProcess method createSqlFileRunner.
protected DfSqlFileRunner createSqlFileRunner(final DfRunnerInformation runInfo) {
final String loadType = getReplaceSchemaProperties().getRepsEnvType();
final DfDataAssertProvider dataAssertProvider = new DfDataAssertProvider(loadType);
final DfSqlFileRunnerExecute runnerExecute = new DfSqlFileRunnerExecute(runInfo, _dataSource);
runnerExecute.setDispatcher(new DfSqlFileRunnerDispatcher() {
public DfRunnerDispatchResult dispatch(File sqlFile, Statement st, String sql) throws SQLException {
final DfDataAssertHandler dataAssertHandler = dataAssertProvider.provideDataAssertHandler(sql);
if (dataAssertHandler == null) {
return DfRunnerDispatchResult.NONE;
}
dataAssertHandler.handle(sqlFile, st, sql);
return DfRunnerDispatchResult.DISPATCHED;
}
});
return runnerExecute;
}
use of org.dbflute.logic.replaceschema.dataassert.DfDataAssertProvider in project dbflute-core by dbflute.
the class DfAlterCheckProcess method createSqlFileRunner.
protected DfSqlFileRunner createSqlFileRunner(final DfRunnerInformation runInfo) {
final String loadType = getReplaceSchemaProperties().getRepsEnvType();
final DfDataAssertProvider dataAssertProvider = new DfDataAssertProvider(loadType);
final DfSqlFileRunnerExecute runnerExecute = new DfSqlFileRunnerExecute(runInfo, _dataSource);
runnerExecute.setDispatcher(new DfSqlFileRunnerDispatcher() {
public DfRunnerDispatchResult dispatch(File sqlFile, Statement st, String sql) throws SQLException {
final DfDataAssertHandler dataAssertHandler = dataAssertProvider.provideDataAssertHandler(sql);
if (dataAssertHandler == null) {
return DfRunnerDispatchResult.NONE;
}
dataAssertHandler.handle(sqlFile, st, sql);
return DfRunnerDispatchResult.DISPATCHED;
}
});
return runnerExecute;
}
use of org.dbflute.logic.replaceschema.dataassert.DfDataAssertProvider in project dbflute-core by dbflute.
the class DfTakeFinallyProcess method getSqlFileRunner4TakeFinally.
protected DfSqlFileRunner getSqlFileRunner4TakeFinally(final DfRunnerInformation runInfo) {
final DfReplaceSchemaProperties prop = getReplaceSchemaProperties();
final DfSqlFileRunnerExecute runnerExecute = new DfSqlFileRunnerExecute(runInfo, _dataSource) {
@Override
protected String filterSql(String sql) {
sql = super.filterSql(sql);
sql = prop.resolveFilterVariablesIfNeeds(sql);
return sql;
}
@Override
protected boolean isHandlingCommentOnLineSeparator() {
return true;
}
@Override
protected boolean isDbCommentLine(String line) {
final boolean commentLine = super.isDbCommentLine(line);
if (commentLine) {
return commentLine;
}
// for irregular pattern
return isDbCommentLineForIrregularPattern(line);
}
@Override
protected String getTerminator4Tool() {
return resolveTerminator4Tool();
}
@Override
protected boolean isTargetFile(String sql) {
return getReplaceSchemaProperties().isTargetRepsFile(sql);
}
};
final String loadType = getReplaceSchemaProperties().getRepsEnvType();
final DfDataAssertProvider dataAssertProvider = new DfDataAssertProvider(loadType);
runnerExecute.setDispatcher(new DfSqlFileRunnerDispatcher() {
public DfRunnerDispatchResult dispatch(File sqlFile, Statement st, String sql) throws SQLException {
final DfDataAssertHandler dataAssertHandler = dataAssertProvider.provideDataAssertHandler(sql);
if (dataAssertHandler == null) {
if (_skipIfNonAssetionSql) {
_log.info("*Skipped the statement because of not assertion SQL");
return DfRunnerDispatchResult.SKIPPED;
} else if (_restrictIfNonAssetionSql) {
throwTakeFinallyNonAssertionSqlFoundException(sqlFile, sql);
} else {
return DfRunnerDispatchResult.NONE;
}
}
try {
dataAssertHandler.handle(sqlFile, st, sql);
} catch (DfTakeFinallyAssertionFailureException e) {
handleAssertionFailureException(e);
}
return DfRunnerDispatchResult.DISPATCHED;
}
});
return runnerExecute;
}
Aggregations