Search in sources :

Example 6 with DfRunnerInformation

use of org.dbflute.helper.jdbc.DfRunnerInformation in project dbflute-core by dbflute.

the class DfCraftDiffAssertSqlFire method createRunnerInformation.

// ===================================================================================
// Runner Information
// ==================
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());
    runInfo.setBreakCauseThrow(true);
    runInfo.setErrorContinue(false);
    runInfo.setAutoCommit(false);
    runInfo.setRollbackOnly(true);
    runInfo.setSuppressLoggingSql(false);
    return runInfo;
}
Also used : DfDatabaseProperties(org.dbflute.properties.DfDatabaseProperties) DfRunnerInformation(org.dbflute.helper.jdbc.DfRunnerInformation)

Example 7 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 = getMigrationAlterSqlFileList();
    if (alterSqlFileList.isEmpty()) {
        restoreLatestCheckedAlterSql();
        alterSqlFileList = getMigrationAlterSqlFileList();
        if (alterSqlFileList.isEmpty()) {
            createEmptyAlterSqlFileIfNotExists();
            alterSqlFileList = getMigrationAlterSqlFileList();
            if (alterSqlFileList.isEmpty()) {
                // no way
                throwAlterCheckAlterSqlNotFoundException();
            }
        }
    }
    final DfRunnerInformation runInfo = createRunnerInformation();
    final DfSqlFileFireMan fireMan = createSqlFileFireMan();
    fireMan.setExecutorName("Alter Schema");
    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)

Example 8 with DfRunnerInformation

use of org.dbflute.helper.jdbc.DfRunnerInformation in project dbflute-core by dbflute.

the class DfCraftDiffAssertSqlFire method fire.

// ===================================================================================
// SQL Fire
// ========
/**
 * Fire the SQLs for assertion.
 * @param tableList The list of table meta, e.g. to auto-generate SQL for table-equals. (NotNull)
 */
public void fire(List<DfTableMeta> tableList) {
    final List<File> craftSqlFileList = getCraftSqlFileList();
    if (craftSqlFileList.isEmpty()) {
        return;
    }
    final DfRunnerInformation runInfo = createRunnerInformation();
    final DfSqlFileFireMan fireMan = new DfSqlFileFireMan();
    fireMan.setExecutorName("Craft Diff");
    // result file is ignored because of break cause
    final DfCraftDiffAssertProvider provider = createAssertProvider(tableList);
    fireMan.fire(getSqlFileRunner4CraftDiff(runInfo, provider), craftSqlFileList);
}
Also used : DfSqlFileFireMan(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan) File(java.io.File) DfRunnerInformation(org.dbflute.helper.jdbc.DfRunnerInformation)

Example 9 with DfRunnerInformation

use of org.dbflute.helper.jdbc.DfRunnerInformation in project dbflute-core by dbflute.

the class DfOutsideSqlTestTask method doExecute.

// ===================================================================================
// Execute
// =======
@Override
protected void doExecute() {
    final DfRunnerInformation runInfo = createRunnerInformation();
    final DfSqlFileFireMan fireMan = createSqlFileFireMan();
    final List<File> sqlFileList = getTargetSqlFileList();
    _fireResult = fireMan.fire(getSqlFileRunner(runInfo), sqlFileList);
    handleSqlFileFailure(_fireResult, sqlFileList);
}
Also used : DfSqlFileFireMan(org.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan) DfRunnerInformation(org.dbflute.helper.jdbc.DfRunnerInformation) File(java.io.File) DfSpecifiedSqlFile(org.dbflute.task.bs.assistant.DfSpecifiedSqlFile)

Example 10 with DfRunnerInformation

use of org.dbflute.helper.jdbc.DfRunnerInformation in project dbflute-core by dbflute.

the class DfOutsideSqlTestTask method createRunnerInformation.

protected DfRunnerInformation createRunnerInformation() {
    final DfRunnerInformation runInfo = new DfRunnerInformation();
    runInfo.setDriver(getDriver());
    runInfo.setUrl(getUrl());
    runInfo.setUser(getUser());
    runInfo.setPassword(getPassword());
    runInfo.setBreakCauseThrow(isBreakCauseThrow());
    runInfo.setErrorContinue(isErrorContinue());
    runInfo.setAutoCommit(isAutoCommit());
    runInfo.setRollbackOnly(isRollbackOnly());
    runInfo.setIgnoreTxError(isIgnoreTxError());
    customizeRunnerInformation(runInfo);
    return runInfo;
}
Also used : 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