Search in sources :

Example 1 with DfSqlFileFireResult

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);
}
Also used : DfSqlFileFireResult(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult) DfRunnerInformation(org.dbflute.helper.jdbc.DfRunnerInformation)

Example 2 with DfSqlFileFireResult

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;
}
Also used : DfSqlFileFireMan(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan) DfSqlFileFireResult(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult)

Example 3 with DfSqlFileFireResult

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;
}
Also used : DfSqlFileFireResult(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult) File(java.io.File)

Example 4 with DfSqlFileFireResult

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;
}
Also used : DfTakeFinallyAssertionFailureException(org.dbflute.exception.DfTakeFinallyAssertionFailureException) DfTakeFinallyFinalInfo(org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo) DfSqlFileFireResult(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult) DfRunnerInformation(org.dbflute.helper.jdbc.DfRunnerInformation)

Example 5 with DfSqlFileFireResult

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);
    }
}
Also used : DfTakeFinallyAssertionFailureException(org.dbflute.exception.DfTakeFinallyAssertionFailureException) DfSqlFileFireMan(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan) DfSqlFileFireResult(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult) DfSqlFileRunner(org.dbflute.helper.jdbc.sqlfile.DfSqlFileRunner) File(java.io.File) DfRunnerInformation(org.dbflute.helper.jdbc.DfRunnerInformation)

Aggregations

DfSqlFileFireResult (org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult)8 File (java.io.File)4 DfRunnerInformation (org.dbflute.helper.jdbc.DfRunnerInformation)4 DfSqlFileFireMan (org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan)4 DfTakeFinallyAssertionFailureException (org.dbflute.exception.DfTakeFinallyAssertionFailureException)3 DfSqlFileRunner (org.dbflute.helper.jdbc.sqlfile.DfSqlFileRunner)2 SQLException (java.sql.SQLException)1 DfSqlFileRunnerResult (org.dbflute.helper.jdbc.sqlfile.DfSqlFileRunnerResult)1 ErrorContinuedSql (org.dbflute.helper.jdbc.sqlfile.DfSqlFileRunnerResult.ErrorContinuedSql)1 DfTakeFinallyFinalInfo (org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo)1 DfSpecifiedSqlFile (org.dbflute.task.bs.assistant.DfSpecifiedSqlFile)1