Search in sources :

Example 1 with DfTypeStructInfo

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

the class DfProcedurePmbSetupper method doProcessArrayProperty.

// -----------------------------------------------------
// Array Property
// --------------
protected String doProcessArrayProperty(DfTypeArrayInfo arrayInfo, ProcedurePropertyInfo propertyInfo) {
    final String propertyType;
    if (arrayInfo.hasNestedArray()) {
        // array in array
        final DfTypeArrayInfo nestedArrayInfo = arrayInfo.getNestedArrayInfo();
        // recursive call
        final String nestedType = doProcessArrayProperty(nestedArrayInfo, propertyInfo);
        propertyType = getGenericListClassName(nestedType);
    } else if (arrayInfo.hasElementStructInfo()) {
        // struct in array
        final DfTypeStructInfo structInfo = arrayInfo.getElementStructInfo();
        propertyType = doProcessStructProperty(structInfo, propertyInfo);
    } else {
        // scalar in array
        final String dbTypeName = arrayInfo.getElementType();
        propertyType = findPlainPropertyType(Types.OTHER, dbTypeName, null, null);
    }
    arrayInfo.setElementJavaNative(propertyType);
    return propertyType;
}
Also used : DfTypeStructInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo)

Example 2 with DfTypeStructInfo

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

the class DfProcedureExtractor method doSetupGreatWallOracle.

// ===================================================================================
// Great Wall
// ==========
protected void doSetupGreatWallOracle(StringKeyMap<DfTypeArrayInfo> parameterArrayInfoMap, StringKeyMap<DfTypeStructInfo> structInfoMap, List<DfProcedureMeta> metaInfoList, DfProcedureSupplementExtractorOracle extractor) {
    final Set<String> resolvedArrayDispSet = new LinkedHashSet<String>();
    final Set<String> resolvedStructDispSet = new LinkedHashSet<String>();
    for (DfProcedureMeta metaInfo : metaInfoList) {
        final String catalog = metaInfo.getProcedureCatalog();
        final String procedureName = metaInfo.getProcedureName();
        final List<DfProcedureColumnMeta> columnList = metaInfo.getProcedureColumnList();
        for (DfProcedureColumnMeta columnInfo : columnList) {
            final String columnName = columnInfo.getColumnName();
            final String key = extractor.generateParameterInfoMapKey(catalog, procedureName, columnName);
            // Array
            final DfTypeArrayInfo arrayInfo = parameterArrayInfoMap.get(key);
            if (arrayInfo != null) {
                resolvedArrayDispSet.add(arrayInfo.toString());
                columnInfo.setTypeArrayInfo(arrayInfo);
            }
            // Struct
            final String dbTypeName = columnInfo.getDbTypeName();
            final DfTypeStructInfo structInfo = structInfoMap.get(dbTypeName);
            if (structInfo != null) {
                resolvedStructDispSet.add(structInfo.toString());
                columnInfo.setTypeStructInfo(structInfo);
            }
        }
    }
    if (!resolvedArrayDispSet.isEmpty()) {
        log("Array related to parameter: " + resolvedArrayDispSet.size());
        for (String arrayInfo : resolvedArrayDispSet) {
            log("  " + arrayInfo);
        }
    }
    if (!resolvedStructDispSet.isEmpty()) {
        log("Struct related to parameter: " + resolvedStructDispSet.size());
        for (String structInfo : resolvedStructDispSet) {
            log("  " + structInfo);
        }
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) DfProcedureColumnMeta(org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta) DfTypeStructInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo) DfProcedureMeta(org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo)

Example 3 with DfTypeStructInfo

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

the class DfProcedureExtractor method doResolveAssistInfoOracleToDBLink.

protected void doResolveAssistInfoOracleToDBLink(DfSchemaSource dataSource, List<DfProcedureMeta> metaInfoList, String dbLinkName) {
    final DfProcedureSupplementExtractorOracle extractor = getSupplementExtractorOracle(dataSource);
    // Overload
    final Map<String, Integer> overloadInfoMapMap = extractor.extractParameterOverloadInfoToDBLinkMap(dbLinkName);
    doSetupOverloadInfoOracleToDBLink(overloadInfoMapMap, metaInfoList, extractor);
    // GreatWall
    // DBLink procedure's GreatWalls are unsupported yet
    // final StringKeyMap<DfTypeArrayInfo> parameterArrayInfoMap = extractor.extractParameterArrayInfoToDBLinkMap();
    // final StringKeyMap<DfTypeStructInfo> structInfoMap = extractor.extractStructInfoToDBLinkMap();
    // empty
    final StringKeyMap<DfTypeArrayInfo> parameterArrayInfoMap = StringKeyMap.createAsFlexible();
    // empty
    final StringKeyMap<DfTypeStructInfo> structInfoMap = StringKeyMap.createAsFlexible();
    doSetupGreatWallOracle(parameterArrayInfoMap, structInfoMap, metaInfoList, extractor);
}
Also used : DfTypeStructInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo) DfProcedureSupplementExtractorOracle(org.dbflute.logic.jdbc.metadata.procedure.DfProcedureSupplementExtractorOracle)

Example 4 with DfTypeStructInfo

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

the class DfProcedureExtractor method doResolveAssistInfoOracle.

// -----------------------------------------------------
// Oracle
// ------
protected void doResolveAssistInfoOracle(DfSchemaSource dataSource, List<DfProcedureMeta> metaInfoList) {
    final UnifiedSchema mainSchema = dataSource.getSchema();
    final List<UnifiedSchema> additionalSchemaList = getDatabaseProperties().getAdditionalSchemaList();
    // overload
    final DfProcedureSupplementExtractorOracle extractor = getSupplementExtractorOracle(dataSource);
    final Map<UnifiedSchema, Map<String, Integer>> overloadInfoMapMap = newHashMap();
    overloadInfoMapMap.put(mainSchema, extractor.extractParameterOverloadInfoMap(mainSchema));
    for (UnifiedSchema additionalSchema : additionalSchemaList) {
        overloadInfoMapMap.put(additionalSchema, extractor.extractParameterOverloadInfoMap(additionalSchema));
    }
    doSetupOverloadInfoOracle(overloadInfoMapMap, metaInfoList, extractor);
    // great wall
    // get all available schema's info to use other schema's type
    // same-name type between schema is unsupported
    final StringKeyMap<DfTypeArrayInfo> arrayInfoMap = extractor.extractParameterArrayInfoMap(mainSchema);
    for (UnifiedSchema additionalSchema : additionalSchemaList) {
        arrayInfoMap.putAll(extractor.extractParameterArrayInfoMap(additionalSchema));
    }
    final StringKeyMap<DfTypeStructInfo> structInfoMap = extractor.extractStructInfoMap(mainSchema);
    for (UnifiedSchema additionalSchema : additionalSchemaList) {
        structInfoMap.putAll(extractor.extractStructInfoMap(additionalSchema));
    }
    doSetupGreatWallOracle(arrayInfoMap, structInfoMap, metaInfoList, extractor);
    // source info
    // can get parameter definition code from Oracle
    final boolean reflectParamsToHash = false;
    doSetupSourceInfo(dataSource, metaInfoList, extractor, mainSchema, reflectParamsToHash);
    for (UnifiedSchema additionalSchema : additionalSchemaList) {
        doSetupSourceInfo(dataSource, metaInfoList, extractor, additionalSchema, reflectParamsToHash);
    }
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DfTypeStructInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo) DfProcedureSupplementExtractorOracle(org.dbflute.logic.jdbc.metadata.procedure.DfProcedureSupplementExtractorOracle) HashMap(java.util.HashMap) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap)

Example 5 with DfTypeStructInfo

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

the class DfProcedureSupplementExtractorOracle method findParameterStructInfoMap.

protected StringKeyMap<DfTypeStructInfo> findParameterStructInfoMap(UnifiedSchema unifiedSchema) {
    StringKeyMap<DfTypeStructInfo> structInfoMap = _structInfoMapMap.get(unifiedSchema);
    if (structInfoMap != null) {
        return structInfoMap;
    }
    // initialize per schema
    final DfStructExtractorOracle extractor = new DfStructExtractorOracle(_dataSource, _suppressLogging);
    structInfoMap = extractor.extractStructInfoMap(unifiedSchema);
    // set up struct attribute's additional info
    resolveStructAttributeInfo(unifiedSchema, structInfoMap);
    log("Struct Info: " + unifiedSchema);
    for (DfTypeStructInfo structInfo : structInfoMap.values()) {
        log("  " + structInfo.toString());
    }
    _structInfoMapMap.put(unifiedSchema, structInfoMap);
    return _structInfoMapMap.get(unifiedSchema);
}
Also used : DfStructExtractorOracle(org.dbflute.logic.jdbc.metadata.various.struct.DfStructExtractorOracle) DfTypeStructInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo)

Aggregations

DfTypeStructInfo (org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo)11 DfTypeArrayInfo (org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo)9 Map (java.util.Map)2 StringKeyMap (org.dbflute.helper.StringKeyMap)2 DfColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfColumnMeta)2 DfProcedureSupplementExtractorOracle (org.dbflute.logic.jdbc.metadata.procedure.DfProcedureSupplementExtractorOracle)2 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)1 DfProcedureColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta)1 DfProcedureMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)1 DfStructExtractorOracle (org.dbflute.logic.jdbc.metadata.various.struct.DfStructExtractorOracle)1