public class HavingScope extends AbstractScope
Visibility rules: - Can access GROUP BY columns - Can access aggregate functions - Can access SELECT list aliases (in some databases) - Cannot access non-aggregated columns not in GROUP BY
Example:
SELECT department, COUNT(*) as emp_count
FROM employees
GROUP BY department
HAVING COUNT(*) > 10 -- Can use aggregates
OR emp_count > 10 -- Can use SELECT list alias (database-dependent)
The HAVING scope has access to: - GROUP BY scope (for grouped columns) - SELECT scope (for SELECT list aliases, database-dependent)
node, parent, scopeType| Constructor and Description |
|---|
HavingScope(IScope parent,
TExpression havingCondition) |
| Modifier and Type | Method and Description |
|---|---|
IScope |
getGroupByScope()
Get the GROUP BY scope.
|
TExpression |
getHavingCondition() |
IScope |
getSelectScope()
Get the SELECT scope.
|
void |
setGroupByScope(IScope groupByScope)
Set the GROUP BY scope for column resolution.
|
void |
setSelectScope(IScope selectScope)
Set the SELECT scope for alias resolution.
|
String |
toString() |
addChild, fullyQualify, getChildren, getNode, getParent, getScopeType, getVisibleNamespaces, isWithin, resolve, resolveTablepublic HavingScope(IScope parent, TExpression havingCondition)
public void setGroupByScope(IScope groupByScope)
groupByScope - the GROUP BY scopepublic void setSelectScope(IScope selectScope)
selectScope - the SELECT scopepublic IScope getGroupByScope()
public IScope getSelectScope()
public TExpression getHavingCondition()
public String toString()
toString in class AbstractScope