use of org.dbflute.helper.StringKeyMap 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);
}
}
use of org.dbflute.helper.StringKeyMap 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;
}
use of org.dbflute.helper.StringKeyMap in project dbflute-core by dbflute.
the class DfStructExtractorOracle method extractStructInfoMap.
// ===================================================================================
// Extract
// =======
/**
* Extract the map of struct info. <br>
* The info is so simple, for example, no nested info.
* And this sets type name and attributes only.
* @param unifiedSchema The unified schema. (NotNull)
* @return The map of struct info. {key = schema.struct-type-name} (NotNull)
*/
public StringKeyMap<DfTypeStructInfo> extractStructInfoMap(UnifiedSchema unifiedSchema) {
final List<Map<String, String>> resultList = selectStructAttribute(unifiedSchema);
final StringKeyMap<DfTypeStructInfo> structInfoMap = StringKeyMap.createAsFlexibleOrdered();
for (Map<String, String> map : resultList) {
final String typeName = DfTypeStructInfo.generateTypeName(unifiedSchema, map.get("TYPE_NAME"));
DfTypeStructInfo info = structInfoMap.get(typeName);
if (info == null) {
info = new DfTypeStructInfo(unifiedSchema, typeName);
structInfoMap.put(typeName, info);
}
final DfColumnMeta attributeInfo = new DfColumnMeta();
final String attrName = map.get("ATTR_NAME");
if (Srl.is_Null_or_TrimmedEmpty(attrName)) {
continue;
}
attributeInfo.setColumnName(attrName);
final String dbTypeName;
{
// ARRAY and STRUCT only
final String attrTypeOwner = map.get("ATTR_TYPE_OWNER");
final String attrTypeName = map.get("ATTR_TYPE_NAME");
dbTypeName = Srl.connectPrefix(attrTypeName, attrTypeOwner, ".");
}
attributeInfo.setDbTypeName(dbTypeName);
final String length = map.get("LENGTH");
if (Srl.is_NotNull_and_NotTrimmedEmpty(length)) {
// for example, varchar2
attributeInfo.setColumnSize(Integer.valueOf(length));
} else {
final String precision = map.get("PRECISION");
if (Srl.is_NotNull_and_NotTrimmedEmpty(precision)) {
// for example, number
attributeInfo.setColumnSize(Integer.valueOf(precision));
}
}
final String scale = map.get("SCALE");
if (Srl.is_NotNull_and_NotTrimmedEmpty(scale)) {
attributeInfo.setDecimalDigits(Integer.valueOf(scale));
}
info.putAttributeInfo(attributeInfo);
}
return structInfoMap;
}
Aggregations