Search in sources :

Example 1 with Constant

use of com.wplatform.ddal.dbobject.schema.Constant in project jdbc-shards by wplatform.

the class ExpressionColumn method optimize.

@Override
public Expression optimize(Session session) {
    if (columnResolver == null) {
        Schema schema = session.getDatabase().findSchema(tableAlias == null ? session.getCurrentSchemaName() : tableAlias);
        if (schema != null) {
            Constant constant = schema.findConstant(columnName);
            if (constant != null) {
                return constant.getValue();
            }
        }
        String name = columnName;
        if (tableAlias != null) {
            name = tableAlias + "." + name;
            if (schemaName != null) {
                name = schemaName + "." + name;
            }
        }
        throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, name);
    }
    return columnResolver.optimize(this, column);
}
Also used : Constant(com.wplatform.ddal.dbobject.schema.Constant) Schema(com.wplatform.ddal.dbobject.schema.Schema)

Aggregations

Constant (com.wplatform.ddal.dbobject.schema.Constant)1 Schema (com.wplatform.ddal.dbobject.schema.Schema)1