Class OrderByScope
Object
gudusoft.gsqlparser.resolver2.scope.AbstractScope
gudusoft.gsqlparser.resolver2.scope.OrderByScope
- All Implemented Interfaces:
IScope
Scope for ORDER BY clause.
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.
-
Field Summary
Fields inherited from class gudusoft.gsqlparser.resolver2.scope.AbstractScope
node, parent, scopeType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the FROM scope.Get the SELECT scope.voidsetFromScope(IScope fromScope) Set the FROM scope for column resolution.voidsetSelectScope(IScope selectScope) Set the SELECT scope for alias resolution.toString()Methods inherited from class gudusoft.gsqlparser.resolver2.scope.AbstractScope
addChild, fullyQualify, getChildren, getNode, getParent, getScopeType, getVisibleNamespaces, isWithin, resolve, resolveTable
-
Constructor Details
-
OrderByScope
-
-
Method Details
-
setSelectScope
Set the SELECT scope for alias resolution. ORDER BY can reference SELECT list columns and aliases.- Parameters:
selectScope- the SELECT scope
-
setFromScope
Set the FROM scope for column resolution. In some databases, ORDER BY can reference FROM clause columns directly.- Parameters:
fromScope- the FROM scope
-
getSelectScope
Get the SELECT scope.- Returns:
- the SELECT scope, or null if not set
-
getFromScope
Get the FROM scope.- Returns:
- the FROM scope, or null if not set
-
getOrderByNode
-
toString
- Overrides:
toStringin classAbstractScope
-