Search in sources :

Example 21 with DfProcedureMeta

use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.

the class DfProcedureExtractor method filterByProperty.

// -----------------------------------------------------
// Filter by Property
// ------------------
protected List<DfProcedureMeta> filterByProperty(List<DfProcedureMeta> procedureList) {
    if (_suppressFilterByProperty) {
        return procedureList;
    }
    final DfOutsideSqlProperties prop = getOutsideSqlProperties();
    final List<DfProcedureMeta> resultList = new ArrayList<DfProcedureMeta>();
    log("...Filtering procedures by the property: before=" + procedureList.size());
    int passedCount = 0;
    for (DfProcedureMeta meta : procedureList) {
        if (isTargetByProperty(meta, prop)) {
            resultList.add(meta);
        } else {
            ++passedCount;
        }
    }
    if (passedCount == 0) {
        log(" -> All procedures are target: count=" + procedureList.size());
    }
    return resultList;
}
Also used : DfOutsideSqlProperties(org.dbflute.properties.DfOutsideSqlProperties) ArrayList(java.util.ArrayList) DfProcedureMeta(org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)

Example 22 with DfProcedureMeta

use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.

the class DfSchemaInitializerJdbc method dropProcedure.

// ===================================================================================
// Drop Procedure
// ==============
protected void dropProcedure(Connection conn, List<DfTableMeta> tableMetaList) {
    final DfProcedureExtractor handler = new DfProcedureExtractor();
    handler.suppressAdditionalSchema();
    handler.suppressLogging();
    final List<DfProcedureMeta> procedureList;
    try {
        procedureList = handler.getPlainProcedureList(_dataSource, _unifiedSchema);
    } catch (SQLException e) {
        String msg = "Failed to get procedure meta data: " + _unifiedSchema;
        throw new SQLFailureException(msg, e);
    }
    callbackDropProcedureByJdbc(conn, procedureList, createDropProcedureByJdbcCallback());
}
Also used : SQLException(java.sql.SQLException) DfProcedureExtractor(org.dbflute.logic.jdbc.metadata.basic.DfProcedureExtractor) DfProcedureMeta(org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta) SQLFailureException(org.dbflute.exception.SQLFailureException)

Example 23 with DfProcedureMeta

use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.

the class DfSchemaXmlSerializer method extractProcedureMap.

protected Map<String, DfProcedureMeta> extractProcedureMap() {
    final DfProcedureExtractor procedureExtractor = createProcedureExtractor();
    Map<String, DfProcedureMeta> procedureMap = null;
    try {
        procedureMap = procedureExtractor.getAvailableProcedureMap(_dataSource);
    } catch (SQLException continued) {
        // because of supplement
        _log.info("*Failed to get procedure map: " + continued.getMessage());
    } catch (RuntimeException continued) {
        // because of supplement
        _log.info("*Failed to get procedure map: " + continued.getMessage());
    }
    return procedureMap;
}
Also used : SQLException(java.sql.SQLException) DfProcedureExtractor(org.dbflute.logic.jdbc.metadata.basic.DfProcedureExtractor) DfProcedureMeta(org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)

Example 24 with DfProcedureMeta

use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.

the class DfSchemaXmlSerializer method processProcedure.

protected void processProcedure(Connection conn, DatabaseMetaData metaData) throws SQLException {
    _log.info("...Extracting procedures");
    final Map<String, DfProcedureMeta> procedureMap = extractProcedureMap();
    if (procedureMap == null) {
        return;
    }
    _log.info("...Processing procedures: " + procedureMap.size());
    final Element procedureGroupElement = _doc.createElement("procedureGroup");
    for (Entry<String, DfProcedureMeta> entry : procedureMap.entrySet()) {
        final DfProcedureMeta procedureMeta = entry.getValue();
        doProcessProcedure(procedureGroupElement, procedureMeta);
    }
    _databaseNode.appendChild(procedureGroupElement);
}
Also used : Element(org.w3c.dom.Element) DfProcedureMeta(org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)

Aggregations

DfProcedureMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)24 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)8 SQLException (java.sql.SQLException)5 DfProcedureColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta)5 ArrayList (java.util.ArrayList)4 DfOutsideSqlProperties (org.dbflute.properties.DfOutsideSqlProperties)4 SQLFailureException (org.dbflute.exception.SQLFailureException)3 DfProcedureExtractor (org.dbflute.logic.jdbc.metadata.basic.DfProcedureExtractor)3 Connection (java.sql.Connection)2 ResultSet (java.sql.ResultSet)2 Statement (java.sql.Statement)2 List (java.util.List)2 DfProcedureSynonymMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureSynonymMeta)2 DfProcedureNativeTranslatorOracle (org.dbflute.logic.jdbc.metadata.procedure.DfProcedureNativeTranslatorOracle)2 DatabaseMetaData (java.sql.DatabaseMetaData)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Entry (java.util.Map.Entry)1 DfProcedureArgumentInfo (org.dbflute.logic.jdbc.metadata.info.DfProcedureArgumentInfo)1 DfProcedureColumnType (org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta.DfProcedureColumnType)1