Search in sources :

Example 11 with DfTypeArrayInfo

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

the class DfProcedureSupplementExtractorOracle method doResolveStructAttributeInfo.

protected void doResolveStructAttributeInfo(UnifiedSchema unifiedSchema, StringKeyMap<DfTypeStructInfo> structInfoMap, StringKeyMap<DfTypeArrayInfo> flatArrayInfoMap, DfTypeStructInfo structInfo, DfColumnMeta columnInfo) {
    final String attrTypeName = columnInfo.getDbTypeName();
    final DfTypeArrayInfo arrayInfo = doResolveStructAttributeArray(structInfoMap, flatArrayInfoMap, attrTypeName);
    if (arrayInfo != null) {
        // array attribute
        columnInfo.setTypeArrayInfo(arrayInfo);
    }
    final DfTypeStructInfo nestedStructInfo = structInfoMap.get(attrTypeName);
    if (nestedStructInfo != null) {
        // nested struct
        columnInfo.setTypeStructInfo(nestedStructInfo);
    }
    // for default mapping type
    columnInfo.setProcedureParameter(true);
}
Also used : DfTypeStructInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo)

Example 12 with DfTypeArrayInfo

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

the class DfArrayExtractorOracle method doExtractFlatArrayInfoSecondMap.

// ===================================================================================
// Second Array Info
// =================
protected StringKeyMap<DfTypeArrayInfo> doExtractFlatArrayInfoSecondMap(UnifiedSchema unifiedSchema) {
    final StringKeyMap<DfTypeArrayInfo> flatArrayInfoMap = StringKeyMap.createAsFlexibleOrdered();
    final List<DfProcedureArgumentInfo> argInfoList = extractProcedureArgumentInfoList(unifiedSchema);
    for (int i = 0; i < argInfoList.size(); i++) {
        final DfProcedureArgumentInfo argInfo = argInfoList.get(i);
        final String argumentName = argInfo.getArgumentName();
        if (Srl.is_Null_or_TrimmedEmpty(argumentName)) {
            continue;
        }
        final String dataType = argInfo.getDataType();
        if (!isDataTypeArray(dataType)) {
            continue;
        }
        final String typeName = argInfo.getTypeName();
        if (Srl.is_Null_or_TrimmedEmpty(typeName)) {
            continue;
        }
        setupFlatArrayInfo(flatArrayInfoMap, argInfoList, argInfo, i);
    }
    final StringSet allArrayTypeSet = extractSimpleArrayNameSet(unifiedSchema);
    for (String allArrayTypeName : allArrayTypeSet) {
        if (!flatArrayInfoMap.containsKey(allArrayTypeName)) {
            final DfTypeArrayInfo arrayInfo = new DfTypeArrayInfo(unifiedSchema, allArrayTypeName);
            // the way to get the info is also unknown
            arrayInfo.setElementType("Unknown");
            flatArrayInfoMap.put(allArrayTypeName, arrayInfo);
        }
    }
    return flatArrayInfoMap;
}
Also used : StringSet(org.dbflute.helper.StringSet) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo) DfProcedureArgumentInfo(org.dbflute.logic.jdbc.metadata.info.DfProcedureArgumentInfo)

Example 13 with DfTypeArrayInfo

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

the class DfArrayExtractorOracle method setupFlatArrayInfo.

protected void setupFlatArrayInfo(StringKeyMap<DfTypeArrayInfo> flatArrayInfoMap, List<DfProcedureArgumentInfo> argInfoList, DfProcedureArgumentInfo argInfo, int index) {
    final UnifiedSchema owner = UnifiedSchema.createAsDynamicSchema(null, argInfo.getTypeOwner());
    final String realTypeName = buildArrayTypeName(argInfo);
    final DfTypeArrayInfo arrayInfo = new DfTypeArrayInfo(owner, realTypeName);
    final boolean nestedArray = reflectArrayElementType(argInfoList, index, arrayInfo);
    flatArrayInfoMap.put(realTypeName, arrayInfo);
    if (nestedArray) {
        final int nextIndex = (index + 1);
        final DfProcedureArgumentInfo nextArgInfo = argInfoList.get(nextIndex);
        // recursive call
        setupFlatArrayInfo(flatArrayInfoMap, argInfoList, nextArgInfo, nextIndex);
    }
}
Also used : UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo) DfProcedureArgumentInfo(org.dbflute.logic.jdbc.metadata.info.DfProcedureArgumentInfo)

Example 14 with DfTypeArrayInfo

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

the class DfArrayExtractorOracle method doExtractFlatArrayInfoFirstMap.

// ===================================================================================
// First Array Info
// ================
protected StringKeyMap<DfTypeArrayInfo> doExtractFlatArrayInfoFirstMap(UnifiedSchema unifiedSchema) {
    final List<Map<String, String>> resultList = selectFirstArray(unifiedSchema);
    final StringKeyMap<DfTypeArrayInfo> arrayTypeMap = StringKeyMap.createAsFlexibleOrdered();
    for (Map<String, String> map : resultList) {
        final String typeName = buildArrayTypeName(map.get("TYPE_NAME"), unifiedSchema);
        final DfTypeArrayInfo arrayInfo = new DfTypeArrayInfo(unifiedSchema, typeName);
        // ARRAY and STRUCT only
        final String elementTypeOwner = map.get("ELEM_TYPE_OWNER");
        final String elementTypeName = map.get("ELEM_TYPE_NAME");
        final String elementType = Srl.connectPrefix(elementTypeName, elementTypeOwner, ".");
        arrayInfo.setElementType(elementType);
        arrayTypeMap.put(typeName, arrayInfo);
    }
    return arrayTypeMap;
}
Also used : DfTypeArrayInfo(org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap)

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