Class MergeScope
Object
gudusoft.gsqlparser.resolver2.scope.AbstractScope
gudusoft.gsqlparser.resolver2.scope.MergeScope
- All Implemented Interfaces:
IScope
Scope for MERGE statement.
Contains:
- Target table (MERGE INTO table)
- Source table/subquery (USING clause)
- ON clause condition
- WHEN MATCHED/NOT MATCHED clauses
Example:
MERGE INTO archive ar
USING (SELECT activity, description FROM activities) ac
ON (ar.activity = ac.activity)
WHEN MATCHED THEN UPDATE SET description = ac.description
WHEN NOT MATCHED THEN INSERT (activity, description) VALUES (ac.activity, ac.description)
Resolution strategy:
- All column references resolve from target table or source table/subquery
- Qualified names (ar.col, ac.col) resolve to specific table
- Unqualified names search all visible tables
-
Field Summary
Fields inherited from class gudusoft.gsqlparser.resolver2.scope.AbstractScope
node, parent, scopeType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDefault implementation: delegate to parentvoidresolve(List<String> names, INameMatcher matcher, boolean deep, IResolved resolved) Resolve a name within this MERGE scope.resolveTable(String tableName) Default implementation: delegate to parentvoidsetFromScope(FromScope fromScope) toString()Methods inherited from class gudusoft.gsqlparser.resolver2.scope.AbstractScope
addChild, fullyQualify, getChildren, getNode, getParent, getScopeType, isWithin
-
Constructor Details
-
MergeScope
-
-
Method Details
-
setFromScope
-
getFromScope
-
getMergeStatement
-
resolveTable
Description copied from class:AbstractScopeDefault implementation: delegate to parent- Specified by:
resolveTablein interfaceIScope- Overrides:
resolveTablein classAbstractScope- Parameters:
tableName- Table name or alias- Returns:
- Namespace if found, null otherwise
-
getVisibleNamespaces
Description copied from class:AbstractScopeDefault implementation: delegate to parent- Specified by:
getVisibleNamespacesin interfaceIScope- Overrides:
getVisibleNamespacesin classAbstractScope- Returns:
- List of visible namespaces
-
resolve
Resolve a name within this MERGE scope. Resolution strategy: 1. For qualified names (t.col): find table t in FROM scope, then resolve col 2. For unqualified names (col): search all visible namespaces in FROM scope 3. Delegate to parent for names not found locally- Specified by:
resolvein interfaceIScope- Overrides:
resolvein classAbstractScope- Parameters:
names- 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 matches
-
toString
- Overrides:
toStringin classAbstractScope
-