Class HavingScope
Object
gudusoft.gsqlparser.resolver2.scope.AbstractScope
gudusoft.gsqlparser.resolver2.scope.HavingScope
- All Implemented Interfaces:
IScope
Scope for HAVING clause.
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)
-
Field Summary
Fields inherited from class gudusoft.gsqlparser.resolver2.scope.AbstractScope
node, parent, scopeType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the GROUP BY scope.Get the SELECT scope.voidsetGroupByScope(IScope groupByScope) Set the GROUP BY 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
-
HavingScope
-
-
Method Details
-
setGroupByScope
Set the GROUP BY scope for column resolution. HAVING can reference columns that appear in GROUP BY.- Parameters:
groupByScope- the GROUP BY scope
-
setSelectScope
Set the SELECT scope for alias resolution. HAVING can reference SELECT list aliases in some databases.- Parameters:
selectScope- the SELECT scope
-
getGroupByScope
Get the GROUP BY scope.- Returns:
- the GROUP BY scope, or null if not set
-
getSelectScope
Get the SELECT scope.- Returns:
- the SELECT scope, or null if not set
-
getHavingCondition
-
toString
- Overrides:
toStringin classAbstractScope
-