Search in sources :

Example 6 with DfTypeArrayInfo

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

the class DfProcedurePmbSetupper method doProcessGreatWallOfOracleType.

protected String doProcessGreatWallOfOracleType(String pmbName, DfProcedureColumnMeta column, ProcedurePropertyInfo propertyInfo) {
    final String propertyType;
    if (column.isOracleTreatedAsArray() && column.hasTypeArrayInfo()) {
        // here dbTypeName is "PL/SQL TABLE" or "TABLE" or "VARRAY"
        // (it's not useful for type mapping, so search like this)
        final DfTypeArrayInfo arrayInfo = column.getTypeArrayInfo();
        propertyType = getGenericListClassName(doProcessArrayProperty(arrayInfo, propertyInfo));
    } else if (column.isOracleStruct() && column.hasTypeStructInfo()) {
        final DfTypeStructInfo structInfo = column.getTypeStructInfo();
        propertyType = doProcessStructProperty(structInfo, propertyInfo);
    } else {
        propertyType = null;
    }
    return propertyType;
}
Also used : DfTypeStructInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo)

Example 7 with DfTypeArrayInfo

use of org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo 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 8 with DfTypeArrayInfo

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

the class DfProcedureSupplementExtractorOracle method doResolveStructAttributeArray.

protected DfTypeArrayInfo doResolveStructAttributeArray(StringKeyMap<DfTypeStructInfo> structInfoMap, StringKeyMap<DfTypeArrayInfo> flatArrayInfoMap, String attrTypeName) {
    if (!flatArrayInfoMap.containsKey(attrTypeName)) {
        return null;
    }
    final DfTypeArrayInfo foundInfo = flatArrayInfoMap.get(attrTypeName);
    final DfTypeArrayInfo typeArrayInfo = new DfTypeArrayInfo(foundInfo.getUnifiedSchema(), foundInfo.getTypeName());
    final String elementType = foundInfo.getElementType();
    typeArrayInfo.setElementType(elementType);
    if (flatArrayInfoMap.containsKey(elementType)) {
        // array in array in ...
        // recursive call
        final DfTypeArrayInfo nestedArrayInfo = doResolveStructAttributeArray(structInfoMap, flatArrayInfoMap, elementType);
        typeArrayInfo.setNestedArrayInfo(nestedArrayInfo);
    } else if (structInfoMap.containsKey(elementType)) {
        // struct in array in ...
        final DfTypeStructInfo elementStructInfo = structInfoMap.get(elementType);
        typeArrayInfo.setElementStructInfo(elementStructInfo);
    }
    return typeArrayInfo;
}
Also used : DfTypeStructInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo)

Example 9 with DfTypeArrayInfo

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

the class DfProcedureSupplementExtractorOracle method findFlatArrayInfoMap.

// ===================================================================================
// Flat Array Info
// ===============
protected StringKeyMap<DfTypeArrayInfo> findFlatArrayInfoMap(UnifiedSchema unifiedSchema) {
    StringKeyMap<DfTypeArrayInfo> flatArrayInfoMap = _flatArrayInfoMapMap.get(unifiedSchema);
    if (flatArrayInfoMap != null) {
        return flatArrayInfoMap;
    }
    final DfArrayExtractorOracle extractor = new DfArrayExtractorOracle(_dataSource, _suppressLogging);
    flatArrayInfoMap = extractor.extractFlatArrayInfoMap(unifiedSchema);
    _flatArrayInfoMapMap.put(unifiedSchema, flatArrayInfoMap);
    // all arrays are registered
    return _flatArrayInfoMapMap.get(unifiedSchema);
}
Also used : DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo) DfArrayExtractorOracle(org.dbflute.logic.jdbc.metadata.various.array.DfArrayExtractorOracle)

Example 10 with DfTypeArrayInfo

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

the class DfProcedureSupplementExtractorOracle method processArrayNestedElement.

protected void processArrayNestedElement(UnifiedSchema unifiedSchema, final StringKeyMap<DfTypeArrayInfo> flatArrayInfoMap, DfTypeArrayInfo arrayInfo) {
    // ARRAY element
    final DfTypeArrayInfo foundInfo = flatArrayInfoMap.get(arrayInfo.getElementType());
    if (foundInfo != null) {
        final DfTypeArrayInfo nestedInfo = new DfTypeArrayInfo(foundInfo.getUnifiedSchema(), foundInfo.getTypeName());
        nestedInfo.setElementType(foundInfo.getElementType());
        arrayInfo.setNestedArrayInfo(nestedInfo);
        // recursive call
        processArrayNestedElement(unifiedSchema, flatArrayInfoMap, nestedInfo);
    // *ARRAY type of additional schema is unsupported for now
    }
    // STRUCT element
    final StringKeyMap<DfTypeStructInfo> structInfoMap = findParameterStructInfoMap(unifiedSchema);
    final DfTypeStructInfo structInfo = structInfoMap.get(arrayInfo.getElementType());
    if (structInfo != null) {
        // the structInfo has already been resolved about nested objects
        arrayInfo.setElementStructInfo(structInfo);
    // *STRUCT type of additional schema is unsupported for now
    }
}
Also used : DfTypeStructInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo)

Aggregations

DfTypeArrayInfo (org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo)14 DfTypeStructInfo (org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo)9 DfProcedureArgumentInfo (org.dbflute.logic.jdbc.metadata.info.DfProcedureArgumentInfo)3 Map (java.util.Map)2 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)2 StringKeyMap (org.dbflute.helper.StringKeyMap)2 DfProcedureSupplementExtractorOracle (org.dbflute.logic.jdbc.metadata.procedure.DfProcedureSupplementExtractorOracle)2 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 StringSet (org.dbflute.helper.StringSet)1 DfColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfColumnMeta)1 DfProcedureColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta)1 DfProcedureMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)1 DfArrayExtractorOracle (org.dbflute.logic.jdbc.metadata.various.array.DfArrayExtractorOracle)1