public class OrderByScope extends AbstractScope
Visibility rules: - Can access SELECT list columns (by name or alias) - Can access SELECT list positional references (ORDER BY 1, 2, etc.) - In some databases, can also access columns from FROM clause directly - Can reference aggregate functions in SELECT list
Example:
SELECT department, COUNT(*) as emp_count
FROM employees
GROUP BY department
ORDER BY emp_count DESC, -- Can use SELECT list alias
department ASC, -- Can use SELECT list column
1 -- Can use positional reference
The ORDER BY scope primarily delegates to SELECT scope, but may also access FROM scope depending on database vendor.
node, parent, scopeType| Constructor and Description |
|---|
OrderByScope(IScope parent,
TOrderBy orderByNode) |
| Modifier and Type | Method and Description |
|---|---|
IScope |
getFromScope()
Get the FROM scope.
|
TOrderBy |
getOrderByNode() |
IScope |
getSelectScope()
Get the SELECT scope.
|
void |
setFromScope(IScope fromScope)
Set the FROM 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 OrderByScope(IScope parent, TOrderBy orderByNode)
public void setSelectScope(IScope selectScope)
selectScope - the SELECT scopepublic void setFromScope(IScope fromScope)
fromScope - the FROM scopepublic IScope getSelectScope()
public IScope getFromScope()
public TOrderBy getOrderByNode()
public String toString()
toString in class AbstractScope