Search in sources :

Example 26 with DfProcedureColumnMeta

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

the class DfSchemaInitializerPostgreSQL method buildProcedureArgExpression.

protected String buildProcedureArgExpression(DfProcedureMeta metaInfo) {
    final List<DfProcedureColumnMeta> metaInfoList = metaInfo.getProcedureColumnList();
    final StringBuilder sb = new StringBuilder();
    for (DfProcedureColumnMeta columnMetaInfo : metaInfoList) {
        final String dbTypeName = columnMetaInfo.getDbTypeName();
        final String columnName = columnMetaInfo.getColumnName();
        final DfProcedureColumnType columnType = columnMetaInfo.getProcedureColumnType();
        if (DfProcedureColumnType.procedureColumnReturn.equals(columnType)) {
            continue;
        }
        if (sb.length() > 0) {
            sb.append(", ");
        }
        sb.append(columnName);
        if (DfProcedureColumnType.procedureColumnIn.equals(columnType)) {
            sb.append(" in ");
        } else if (DfProcedureColumnType.procedureColumnOut.equals(columnType)) {
            sb.append(" out ");
        } else if (DfProcedureColumnType.procedureColumnInOut.equals(columnType)) {
            sb.append(" inout ");
        } else {
            sb.append(" ");
        }
        sb.append(dbTypeName);
    }
    return sb.toString();
}
Also used : DfProcedureColumnMeta(org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta) DfProcedureColumnType(org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta.DfProcedureColumnType)

Example 27 with DfProcedureColumnMeta

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

the class DfSql2EntityTask method showParameterBean.

protected void showParameterBean() {
    _log.info("* * * * * * * * *");
    _log.info("* ParameterBean *");
    _log.info("* * * * * * * * *");
    final StringBuilder logSb = new StringBuilder();
    final Map<String, DfPmbMetaData> pmbMetaDataMap = _sql2entityMeta.getPmbMetaDataMap();
    for (Entry<String, DfPmbMetaData> pmbEntry : pmbMetaDataMap.entrySet()) {
        final DfPmbMetaData pmbMetaData = pmbEntry.getValue();
        logSb.append(pmbMetaData.getClassName());
        if (pmbMetaData.hasSuperClassDefinition()) {
            logSb.append(" extends ").append(pmbMetaData.getSuperClassName());
        }
        if (pmbMetaData.isRelatedToProcedure()) {
            logSb.append(" (procedure");
            if (pmbMetaData.isProcedureRefCustomizeEntity()) {
                logSb.append(" with customize-entity");
            }
            logSb.append(")").append(ln());
            final Map<String, DfProcedureColumnMeta> propertyNameColumnInfoMap = pmbMetaData.getPropertyNameColumnInfoMap();
            for (Entry<String, DfProcedureColumnMeta> columnEntry : propertyNameColumnInfoMap.entrySet()) {
                final DfProcedureColumnMeta columnInfo = columnEntry.getValue();
                logSb.append("  ").append(columnInfo.getColumnNameDisp());
                logSb.append(ln());
            }
        } else {
            if (pmbMetaData.isTypedParameterBean()) {
                logSb.append(" ").append(pmbMetaData.buildTypedDisp());
            }
            logSb.append(ln());
            final Map<String, String> propertyNameTypeMap = pmbMetaData.getPropertyNameTypeMap();
            final Map<String, String> propertyOptionMap = pmbMetaData.getPropertyNameOptionMap();
            for (Entry<String, String> propEntry : propertyNameTypeMap.entrySet()) {
                final String propertyName = propEntry.getKey();
                final String propertyType = propEntry.getValue();
                logSb.append("  ").append(propertyType).append(" ").append(propertyName);
                final String optionDef = propertyOptionMap.get(propertyName);
                if (Srl.is_NotNull_and_NotTrimmedEmpty(optionDef)) {
                    logSb.append(":").append(optionDef);
                }
                logSb.append(ln());
            }
        }
        logSb.append(ln());
    }
    if (logSb.length() > 0) {
        _log.info(ln() + logSb.toString().trim());
    }
}
Also used : DfProcedureColumnMeta(org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta) DfPmbMetaData(org.dbflute.logic.sql2entity.pmbean.DfPmbMetaData)

Aggregations

DfProcedureColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta)27 DfProcedureColumnType (org.dbflute.logic.jdbc.metadata.info.DfProcedureColumnMeta.DfProcedureColumnType)5 DfProcedureMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta)5 LinkedHashSet (java.util.LinkedHashSet)2 DfProcedureNotParamResultMeta (org.dbflute.logic.jdbc.metadata.info.DfProcedureNotParamResultMeta)2 CallableStatement (java.sql.CallableStatement)1 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 HashSet (java.util.HashSet)1 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)1 DfProcedureExecutionMetaGettingFailureException (org.dbflute.exception.DfProcedureExecutionMetaGettingFailureException)1 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1 DfColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfColumnMeta)1 DfProcedureArgumentInfo (org.dbflute.logic.jdbc.metadata.info.DfProcedureArgumentInfo)1 DfProcedureType (org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta.DfProcedureType)1 DfTypeArrayInfo (org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo)1 DfTypeStructInfo (org.dbflute.logic.jdbc.metadata.info.DfTypeStructInfo)1 DfPmbMetaData (org.dbflute.logic.sql2entity.pmbean.DfPmbMetaData)1 DfOutsideSqlProperties (org.dbflute.properties.DfOutsideSqlProperties)1