use of org.dbflute.helper.jdbc.DfRunnerInformation in project dbflute-core by dbflute.
the class DfAbstractReplaceSchemaProcess method createRunnerInformation.
// ===================================================================================
// SQL File Runner
// ===============
protected DfRunnerInformation createRunnerInformation() {
final DfRunnerInformation runInfo = new DfRunnerInformation();
final DfDatabaseProperties prop = getDatabaseProperties();
runInfo.setDriver(prop.getDatabaseDriver());
runInfo.setUrl(prop.getDatabaseUrl());
runInfo.setUser(prop.getDatabaseUser());
runInfo.setPassword(prop.getDatabasePassword());
runInfo.setEncoding(getSqlFileEncoding());
// save break cause to prepare messages
runInfo.setBreakCauseThrow(false);
runInfo.setErrorContinue(isErrorContinue());
if (isRollbackTransaction()) {
// basically take-assert
runInfo.setAutoCommit(false);
runInfo.setRollbackOnly(true);
} else {
// mainly here
runInfo.setAutoCommit(true);
runInfo.setRollbackOnly(false);
}
runInfo.setSuppressLoggingSql(isSuppressLoggingReplaceSql());
// use delimiter from ReplaceSchema properties
runInfo.setDelimiter(getSqlDelimiter());
return runInfo;
}
use of org.dbflute.helper.jdbc.DfRunnerInformation in project dbflute-core by dbflute.
the class DfCreateSchemaProcess method execute.
// ===================================================================================
// Execute
// =======
public DfCreateSchemaFinalInfo execute() {
final long before = System.currentTimeMillis();
checkBeforeInitialize();
initializeSchema();
final DfRunnerInformation runInfo = createRunnerInformation();
final DfSqlFileFireResult fireResult = createSchema(runInfo);
final long after = System.currentTimeMillis();
_processPerformanceMillis = after - before;
return createFinalInfo(fireResult);
}
use of org.dbflute.helper.jdbc.DfRunnerInformation in project dbflute-core by dbflute.
the class DfTakeFinallyProcess method execute.
// ===================================================================================
// Execute
// =======
public DfTakeFinallyFinalInfo execute() {
final long before = System.currentTimeMillis();
final DfRunnerInformation runInfo = createRunnerInformation();
DfSqlFileFireResult fireResult = null;
DfTakeFinallyAssertionFailureException assertionEx = null;
try {
fireResult = takeFinally(runInfo);
if (_continueIfAssetionFailure && !_continuedExList.isEmpty()) {
// override result with saved exceptions
// this message uses the first exception
fireResult = createFailureFireResult(_continuedExList.get(0), fireResult);
}
} catch (DfTakeFinallyAssertionFailureException e) {
// if take-assert, the exception does not thrown
fireResult = createFailureFireResult(e, null);
assertionEx = e;
}
final DfTakeFinallyFinalInfo finalInfo = createFinalInfo(fireResult, assertionEx);
if (!finalInfo.isFailure()) {
// because it might fail to create sequence
incrementSequenceToDataMax();
}
final long after = System.currentTimeMillis();
final long processPerformanceMillis = after - before;
finalInfo.setProcessPerformanceMillis(processPerformanceMillis);
return finalInfo;
}
use of org.dbflute.helper.jdbc.DfRunnerInformation in project dbflute-core by dbflute.
the class DfAbstractRepsProcess method createRunnerInformation.
// ===================================================================================
// SQL File Runner
// ===============
protected DfRunnerInformation createRunnerInformation() {
final DfRunnerInformation runInfo = new DfRunnerInformation();
final DfDatabaseProperties prop = getDatabaseProperties();
runInfo.setDriver(prop.getDatabaseDriver());
runInfo.setUrl(prop.getDatabaseUrl());
runInfo.setUser(prop.getDatabaseUser());
runInfo.setPassword(prop.getDatabasePassword());
runInfo.setEncoding(getSqlFileEncoding());
// save break cause to prepare messages
runInfo.setBreakCauseThrow(false);
runInfo.setErrorContinue(isErrorContinue());
if (isRollbackTransaction()) {
// basically take-assert
runInfo.setAutoCommit(false);
runInfo.setRollbackOnly(true);
} else {
// mainly here
runInfo.setAutoCommit(true);
runInfo.setRollbackOnly(false);
}
runInfo.setSuppressLoggingSql(isSuppressLoggingReplaceSql());
// use delimiter from ReplaceSchema properties
runInfo.setDelimiter(getSqlDelimiter());
return runInfo;
}
use of org.dbflute.helper.jdbc.DfRunnerInformation in project dbflute-core by dbflute.
the class DfAlterCheckProcess method executeAlterSql.
// -----------------------------------------------------
// Alter Fire
// ----------
protected void executeAlterSql(DfAlterCheckFinalInfo finalInfo) {
List<File> alterSqlFileList = findMigrationAlterSqlFileList();
if (alterSqlFileList.isEmpty()) {
_unreleasedAlterAgent.restoreUnreleasedAlterSql();
alterSqlFileList = findMigrationAlterSqlFileList();
if (alterSqlFileList.isEmpty()) {
createEmptyAlterSqlFileIfNotExists();
alterSqlFileList = findMigrationAlterSqlFileList();
if (alterSqlFileList.isEmpty()) {
// no way
throwAlterCheckAlterSqlNotFoundException();
}
}
}
final DfRunnerInformation runInfo = createRunnerInformation();
final DfSqlFileFireMan fireMan = createSqlFileFireMan();
final DfSqlFileRunner runner = createSqlFileRunner(runInfo);
finalInfo.addAlterSqlFileAll(alterSqlFileList);
try {
final DfSqlFileFireResult result = fireMan.fire(runner, alterSqlFileList);
reflectAlterResultToFinalInfo(finalInfo, result);
} catch (DfTakeFinallyAssertionFailureException e) {
handleTakeFinallyAssertionFailureException(finalInfo, e);
}
}
Aggregations