Search in sources :

Example 1 with DfRunnerInformation

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

Example 2 with DfRunnerInformation

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

Example 3 with DfRunnerInformation

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;
}
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 4 with DfRunnerInformation

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

Example 5 with DfRunnerInformation

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);
    }
}
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

DfRunnerInformation (org.dbflute.helper.jdbc.DfRunnerInformation)11 DfSqlFileFireMan (org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan)5 File (java.io.File)4 DfSqlFileFireResult (org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireResult)4 DfTakeFinallyAssertionFailureException (org.dbflute.exception.DfTakeFinallyAssertionFailureException)3 DfSqlFileRunner (org.dbflute.helper.jdbc.sqlfile.DfSqlFileRunner)3 DfDatabaseProperties (org.dbflute.properties.DfDatabaseProperties)3 DfTakeFinallyFinalInfo (org.dbflute.logic.replaceschema.finalinfo.DfTakeFinallyFinalInfo)1 DfOutsideSqlPack (org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlPack)1 DfSpecifiedSqlFile (org.dbflute.task.bs.assistant.DfSpecifiedSqlFile)1