use of org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult 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.sqlfile.DfSqlFileFireResult in project dbflute-core by dbflute.
the class DfCreateSchemaProcess method createSchema.
// ===================================================================================
// Create Schema
// =============
protected DfSqlFileFireResult createSchema(DfRunnerInformation runInfo) {
_log.info("");
_log.info("* * * * * * * * *");
_log.info("* *");
_log.info("* Create Schema *");
_log.info("* *");
_log.info("* * * * * * * * *");
final long before = System.currentTimeMillis();
final DfSqlFileFireMan fireMan = new DfSqlFileFireMan();
fireMan.setExecutorName("Create Schema");
final DfSqlFileFireResult result = fireMan.fire(getSqlFileRunner(runInfo), getReplaceSchemaSqlFileList());
destroyChangeUserConnection();
final long after = System.currentTimeMillis();
_createSchemaPerformanceView = DfTraceViewUtil.convertToPerformanceView(after - before);
return result;
}
use of org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult in project dbflute-core by dbflute.
the class DfTakeFinallyProcess method createFailureFireResult.
protected DfSqlFileFireResult createFailureFireResult(DfTakeFinallyAssertionFailureException e, DfSqlFileFireResult originalResult) {
final DfSqlFileFireResult fireResult = new DfSqlFileFireResult();
fireResult.setExistsError(true);
fireResult.setResultMessage("{Take Finally}: *asserted");
final StringBuilder sb = new StringBuilder();
final String detailMessage = originalResult != null ? originalResult.getDetailMessage() : null;
if (detailMessage != null) {
sb.append(detailMessage).append(ln());
} else {
// means abort
final int fileListSize = _executedSqlFileList.size();
int index = 0;
for (File executedSqlFile : _executedSqlFileList) {
final String pureFileName = Srl.substringLastRear(executedSqlFile.getPath(), "/");
if (index == fileListSize - 1) {
// last loop
sb.append("x ");
} else {
sb.append("o ");
}
sb.append(pureFileName).append(ln());
++index;
}
}
sb.append(" >> ").append(DfTypeUtil.toClassTitle(e));
sb.append(ln()).append(" (Look at the exception message: console or dbflute.log)");
fireResult.setDetailMessage(sb.toString());
return fireResult;
}
use of org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult 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.sqlfile.DfSqlFileFireResult 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