Search in sources :

Example 6 with DfProcedureSourceInfo

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

the class DfProcedureSupplementExtractorPostgreSQL method doExtractProcedureSourceInfo.

// ===================================================================================
// Source Info
// ===========
@Override
protected Map<String, DfProcedureSourceInfo> doExtractProcedureSourceInfo(UnifiedSchema unifiedSchema) {
    final List<Map<String, String>> sourceList = selectProcedureSourceList(unifiedSchema);
    final Map<String, DfProcedureSourceInfo> resultMap = StringKeyMap.createAsFlexibleOrdered();
    for (Map<String, String> sourceMap : sourceList) {
        final String name = sourceMap.get("routine_name");
        if (name == null) {
            // just in case
            continue;
        }
        final DfProcedureSourceInfo sourceInfo = new DfProcedureSourceInfo();
        // 'routine_definition' has body part only
        // it uses same way as MySQL about parameter info for simple
        final String body = sourceMap.get("routine_definition");
        if (body == null) {
            continue;
        }
        sourceInfo.setSourceCode(body);
        // body part only
        sourceInfo.setSourceLine(calculateSourceLine(body));
        sourceInfo.setSourceSize(calculateSourceSize(body));
        resultMap.put(name, sourceInfo);
    }
    return resultMap;
}
Also used : DfProcedureSourceInfo(org.dbflute.logic.jdbc.metadata.info.DfProcedureSourceInfo) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap)

Example 7 with DfProcedureSourceInfo

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

the class DfProcedureSupplementExtractorDB2 method doExtractProcedureSourceInfo.

// ===================================================================================
// Source Info
// ===========
@Override
protected Map<String, DfProcedureSourceInfo> doExtractProcedureSourceInfo(UnifiedSchema unifiedSchema) {
    final List<Map<String, String>> sourceList = selectProcedureSourceList(unifiedSchema);
    final Map<String, DfProcedureSourceInfo> resultMap = StringKeyMap.createAsFlexibleOrdered();
    for (Map<String, String> sourceMap : sourceList) {
        final String name = sourceMap.get("ROUTINENAME");
        if (name == null) {
            // just in case
            continue;
        }
        final DfProcedureSourceInfo sourceInfo = new DfProcedureSourceInfo();
        // full text (null allowed)
        final String body = sourceMap.get("TEXT");
        if (body == null) {
            continue;
        }
        sourceInfo.setSourceCode(body);
        sourceInfo.setSourceLine(calculateSourceLine(body));
        sourceInfo.setSourceSize(calculateSourceSize(body));
        resultMap.put(name, sourceInfo);
    }
    return resultMap;
}
Also used : DfProcedureSourceInfo(org.dbflute.logic.jdbc.metadata.info.DfProcedureSourceInfo) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap)

Aggregations

DfProcedureSourceInfo (org.dbflute.logic.jdbc.metadata.info.DfProcedureSourceInfo)7 Map (java.util.Map)4 StringKeyMap (org.dbflute.helper.StringKeyMap)4 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)2 DfProcedureMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)1 Element (org.w3c.dom.Element)1