Search in sources :

Example 11 with SpecifiedColumn

use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.

the class HpDerivingSubQueryInfo method extractDerivingColumn.

// ===================================================================================
// Meta Provider
// =============
public SpecifiedColumn extractDerivingColumn() {
    final SqlClause subQuerySqlClause = _derivedReferrer.getSubQuerySqlClause();
    final SpecifiedColumn specifiedColumn = subQuerySqlClause.getSpecifiedColumnAsOne();
    if (specifiedColumn != null) {
        return specifiedColumn;
    }
    // nested
    return subQuerySqlClause.getSpecifiedDerivingColumnAsOne();
}
Also used : SqlClause(org.dbflute.cbean.sqlclause.SqlClause) SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn)

Example 12 with SpecifiedColumn

use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.

the class FunctionFilterOption method buildDreamCruiseTicketStatement.

protected String buildDreamCruiseTicketStatement(Object value) {
    final String bindPath;
    final SpecifiedColumn specifiedColumn = ((SpecifiedColumn) value);
    final String columnExp;
    if (_removeCalcAlias) {
        // e.g. VaryingUpdate
        columnExp = specifiedColumn.toColumnSqlName().toString();
    } else {
        // normally here
        columnExp = specifiedColumn.toColumnRealName().toString();
    }
    if (specifiedColumn.hasSpecifyCalculation()) {
        specifiedColumn.xinitSpecifyCalculation();
        final HpCalcSpecification<ConditionBean> calcSpecification = specifiedColumn.getSpecifyCalculation();
        if (_removeCalcAlias) {
            // e.g. VaryingUpdate
            bindPath = calcSpecification.buildStatementToSpecifidNameRemovedCalcAlias(columnExp);
        } else {
            // normally here
            bindPath = calcSpecification.buildStatementToSpecifidName(columnExp);
        }
    } else {
        bindPath = columnExp;
    }
    return bindPath;
}
Also used : SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn) ConditionBean(org.dbflute.cbean.ConditionBean)

Example 13 with SpecifiedColumn

use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.

the class ConditionKey method resolveCompoundColumn.

protected ColumnRealName resolveCompoundColumn(ColumnRealName baseRealName, ConditionOption option) {
    if (option == null || !option.hasCompoundColumn()) {
        return baseRealName;
    }
    if (!option.hasStringConnector()) {
        // basically no way
        String msg = "The option should have string connector when compound column is specified: " + option;
        throw new IllegalConditionBeanOperationException(msg);
    }
    final List<SpecifiedColumn> compoundColumnList = option.getCompoundColumnList();
    final List<ColumnRealName> realNameList = new ArrayList<ColumnRealName>();
    // already cipher
    realNameList.add(doResolveCompoundColumnOption(option, baseRealName));
    for (SpecifiedColumn specifiedColumn : compoundColumnList) {
        realNameList.add(doResolveCompoundColumnOption(option, doResolveCompoundColumnCipher(option, specifiedColumn)));
    }
    final OnQueryStringConnector stringConnector = option.getStringConnector();
    final String connected = stringConnector.connect(realNameList.toArray());
    return ColumnRealName.create(null, new ColumnSqlName(connected));
}
Also used : ColumnSqlName(org.dbflute.dbmeta.name.ColumnSqlName) IllegalConditionBeanOperationException(org.dbflute.exception.IllegalConditionBeanOperationException) ArrayList(java.util.ArrayList) SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn) ColumnRealName(org.dbflute.dbmeta.name.ColumnRealName) OnQueryStringConnector(org.dbflute.dbway.OnQueryStringConnector)

Example 14 with SpecifiedColumn

use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.

the class QueryDerivedReferrer method buildRightClauseDreamCruiseExp.

protected void buildRightClauseDreamCruiseExp(StringBuilder sb) {
    final SpecifiedColumn specifiedColumn = (SpecifiedColumn) _value;
    final String columnExp = specifiedColumn.toColumnRealName().toString();
    final String appended;
    if (specifiedColumn.hasSpecifyCalculation()) {
        specifiedColumn.xinitSpecifyCalculation();
        final HpCalcSpecification<ConditionBean> calcSpecification = specifiedColumn.getSpecifyCalculation();
        appended = calcSpecification.buildStatementToSpecifidName(columnExp);
    } else {
        appended = columnExp;
    }
    sb.append(appended);
}
Also used : SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn) ConditionBean(org.dbflute.cbean.ConditionBean)

Example 15 with SpecifiedColumn

use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.

the class AbstractConditionQuery method xcreateManualOrderSpecifiedColumn.

protected SpecifiedColumn xcreateManualOrderSpecifiedColumn(ConditionBean dreamCruiseCB) {
    final OrderByElement orderByLastElement = xgetSqlClause().getOrderByLastElement();
    final String aliasName = orderByLastElement.getAliasName();
    final String columnName = orderByLastElement.getColumnName();
    final ColumnInfo columnInfo = orderByLastElement.getColumnInfo();
    final boolean derived = orderByLastElement.isDerivedOrderBy();
    return new SpecifiedColumn(aliasName, columnInfo, dreamCruiseCB, columnName, derived);
}
Also used : ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) OrderByElement(org.dbflute.cbean.sqlclause.orderby.OrderByElement) SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn)

Aggregations

SpecifiedColumn (org.dbflute.cbean.dream.SpecifiedColumn)20 ColumnInfo (org.dbflute.dbmeta.info.ColumnInfo)7 ColumnSqlName (org.dbflute.dbmeta.name.ColumnSqlName)4 ConditionBean (org.dbflute.cbean.ConditionBean)3 SqlClause (org.dbflute.cbean.sqlclause.SqlClause)3 IllegalConditionBeanOperationException (org.dbflute.exception.IllegalConditionBeanOperationException)3 DBMeta (org.dbflute.dbmeta.DBMeta)2 ColumnRealName (org.dbflute.dbmeta.name.ColumnRealName)2 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)2 Method (java.lang.reflect.Method)1 LocalDate (java.time.LocalDate)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 CalculationType (org.dbflute.cbean.chelper.HpCalcElement.CalculationType)1 ColumnConversionOption (org.dbflute.cbean.coption.ColumnConversionOption)1 LikeSearchOption (org.dbflute.cbean.coption.LikeSearchOption)1 OrderByElement (org.dbflute.cbean.sqlclause.orderby.OrderByElement)1