Search in sources :

Example 1 with Select

use of com.wplatform.ddal.command.dml.Select in project jdbc-shards by wplatform.

the class ExpressionColumn method updateAggregate.

@Override
public void updateAggregate(Session session) {
    Value now = columnResolver.getValue(column);
    Select select = columnResolver.getSelect();
    if (select == null) {
        throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());
    }
    HashMap<Expression, Object> values = select.getCurrentGroup();
    if (values == null) {
        // this is a different level (the enclosing query)
        return;
    }
    Value v = (Value) values.get(this);
    if (v == null) {
        values.put(this, now);
    } else {
        if (!database.areEqual(now, v)) {
            throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());
        }
    }
}
Also used : Value(com.wplatform.ddal.value.Value) Select(com.wplatform.ddal.command.dml.Select)

Example 2 with Select

use of com.wplatform.ddal.command.dml.Select in project jdbc-shards by wplatform.

the class ExpressionColumn method getValue.

@Override
public Value getValue(Session session) {
    Select select = columnResolver.getSelect();
    if (select != null) {
        HashMap<Expression, Object> values = select.getCurrentGroup();
        if (values != null) {
            Value v = (Value) values.get(this);
            if (v != null) {
                return v;
            }
        }
    }
    Value value = columnResolver.getValue(column);
    if (value == null) {
        columnResolver.getValue(column);
        throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());
    }
    return value;
}
Also used : Select(com.wplatform.ddal.command.dml.Select) Value(com.wplatform.ddal.value.Value)

Aggregations

Select (com.wplatform.ddal.command.dml.Select)2 Value (com.wplatform.ddal.value.Value)2