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);
}