public class SelectScope extends AbstractScope
| Modifier and Type | Class and Description |
|---|---|
static class |
SelectScope.UsingMerge
One {@code JOIN ...
|
node, parent, scopeType| Constructor and Description |
|---|
SelectScope(IScope parent,
TParseTreeNode node) |
| Modifier and Type | Method and Description |
|---|---|
void |
addUsingMerge(SelectScope.UsingMerge merge)
Records a JOIN USING merge of this scope.
|
SelectScope.UsingMerge |
findCoveringMerge(EDbVendor vendor,
String columnName,
List<TTable> candidateTables)
The merge that covers this column name and EVERY one of the given relations, or null.
|
SelectScope.UsingMerge |
findCoveringMerge(IdentifierService names,
String columnName,
List<TTable> candidateTables)
findCoveringMerge(gudusoft.gsqlparser.EDbVendor, String, java.util.List) with the
column names compared under one analysis's identifier rules (a configured profile). |
FromScope |
getFromScope() |
INamespace |
getSelectListNamespace() |
List<INamespace> |
getVisibleNamespaces()
The namespaces a name in this scope can see: the scope's own, then those of its lookup parent, as
AbstractScope.resolve(java.util.List<java.lang.String>, gudusoft.gsqlparser.resolver2.matcher.INameMatcher, boolean, gudusoft.gsqlparser.resolver2.scope.IResolved) walks them. |
IScope |
getWhereScope() |
void |
resolve(List<String> names,
INameMatcher matcher,
boolean deep,
IResolved resolved)
Resolve a name within this SELECT scope.
|
INamespace |
resolveTable(String tableName)
Default implementation: delegate to parent
|
void |
setFromScope(FromScope fromScope) |
void |
setSelectListNamespace(INamespace namespace) |
void |
setWhereScope(IScope whereScope) |
String |
toString() |
addAllDistinct, addChild, addOwnNamespaces, fullyQualify, getChildren, getLookupParent, getNode, getParent, getScopeType, isWithin, setLookupParentpublic SelectScope(IScope parent, TParseTreeNode node)
public void setFromScope(FromScope fromScope)
public FromScope getFromScope()
public void setWhereScope(IScope whereScope)
public IScope getWhereScope()
public void setSelectListNamespace(INamespace namespace)
public INamespace getSelectListNamespace()
public INamespace resolveTable(String tableName)
AbstractScoperesolveTable in interface IScoperesolveTable in class AbstractScopetableName - Table name or aliaspublic List<INamespace> getVisibleNamespaces()
AbstractScopeAbstractScope.resolve(java.util.List<java.lang.String>, gudusoft.gsqlparser.resolver2.matcher.INameMatcher, boolean, gudusoft.gsqlparser.resolver2.scope.IResolved) walks them. A non-lateral derived table or CTE body hides its owner's FROM scope by a
lookup parent (ScopeBuilder.setLookupParent), so the structural parent is not followed here either
(Mantis 4820, Codex review).getVisibleNamespaces in interface IScopegetVisibleNamespaces in class AbstractScopepublic void resolve(List<String> names, INameMatcher matcher, boolean deep, IResolved resolved)
resolve in interface IScoperesolve in class AbstractScopenames - Name parts (e.g., ["schema", "table", "column"])matcher - Name matcher for case sensitivity rulesdeep - Whether to recursively resolve into record fieldsresolved - Callback to collect all matchespublic String toString()
toString in class AbstractScopepublic void addUsingMerge(SelectScope.UsingMerge merge)
public SelectScope.UsingMerge findCoveringMerge(EDbVendor vendor, String columnName, List<TTable> candidateTables)
Requiring the merge to cover every candidate is what keeps a third relation carrying the same name from being swallowed: those candidates are not merged with anything and the reference really is ambiguous.
public SelectScope.UsingMerge findCoveringMerge(IdentifierService names, String columnName, List<TTable> candidateTables)
findCoveringMerge(gudusoft.gsqlparser.EDbVendor, String, java.util.List) with the
column names compared under one analysis's identifier rules (a configured profile).