public class ResolutionContext extends Object
| Constructor and Description |
|---|
ResolutionContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all data (for reuse or testing)
|
void |
enableBindingTrace()
Enable per-
TObjectName binding-trace recording. |
Set<TTable> |
getAllReferencedTables()
Get all tables that have been referenced
|
List<TObjectName> |
getAmbiguousColumns()
Get all ambiguous columns
|
ResolutionResult |
getColumnResolutionResult(TObjectName objName)
Get the recorded resolution for a specific
TObjectName reference. |
List<TObjectName> |
getColumnsByName(String columnName)
Find all column references with a given name (for conflict detection).
|
BindingSkipReason |
getColumnSkipReason(TObjectName objName)
Get the skip-reason recorded for a specific
TObjectName reference. |
List<TObjectName> |
getExactMatches()
Get all exactly matched columns
|
List<TObjectName> |
getReferencesTo(TTable table)
Get all column references to a specific table.
|
List<TObjectName> |
getReferencesTo(TTable table,
String columnName)
Get all column references to a specific table.column.
|
ResolutionResult |
getResolution(TObjectName objName)
Get resolution result for a specific TObjectName
|
ResolutionStatistics |
getStatistics()
Get resolution statistics
|
int |
getTableReferenceCount(TTable table)
Get reference count for a specific table
|
List<TObjectName> |
getUnresolvedColumns()
Get all unresolved columns
|
boolean |
isBindingTraceEnabled() |
void |
recordColumnSkipReason(TObjectName objName,
BindingSkipReason reason)
Record an explicit binding-skip reason for a reference.
|
void |
registerResolution(TObjectName objName,
ResolutionResult result)
Register a resolution result.
|
void |
replaceResolution(TObjectName objName,
ResolutionResult result)
Register a resolution that CORRECTS one already registered for the same
reference, retracting the superseded bookkeeping first.
|
public ResolutionContext()
public void registerResolution(TObjectName objName, ResolutionResult result)
public void replaceResolution(TObjectName objName, ResolutionResult result)
registerResolution(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.resolver2.model.ResolutionResult) is purely additive: it overwrites the forward
map but appends to columnNameIndex, the status lists,
tableReferences and the counters. Calling it twice for one reference
therefore leaves the OLD binding visible — after a WHERE reference is
corrected from a table column to a SELECT-list alias,
getReferencesTo(oldTable) would still list it, it would appear twice
in getExactMatches(), and totalColumnReferences would
over-count. That makes the context disagree with TObjectName, and
resolver2's own data structures are supposed to be the single source of truth
(MantisBT 4659).
Safe to call when nothing was registered before — it degrades to a plain
registerResolution(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.resolver2.model.ResolutionResult).
public List<TObjectName> getReferencesTo(TTable table)
table - Target tablepublic List<TObjectName> getReferencesTo(TTable table, String columnName)
table - Target tablecolumnName - Target column namepublic List<TObjectName> getColumnsByName(String columnName)
public List<TObjectName> getExactMatches()
public List<TObjectName> getAmbiguousColumns()
public List<TObjectName> getUnresolvedColumns()
public int getTableReferenceCount(TTable table)
public Set<TTable> getAllReferencedTables()
public ResolutionStatistics getStatistics()
public ResolutionResult getResolution(TObjectName objName)
public void clear()
public void enableBindingTrace()
TObjectName binding-trace recording.
Allocates the identity-keyed trace and skip-reason maps on first call;
subsequent calls are no-ops. TSQLResolver2.resolve() flips this
on at the start of resolution when either emitBindingDiagnostics
or bindingIncludeSuccessfulReferences is set.
public boolean isBindingTraceEnabled()
true once enableBindingTrace() has been called
for this context.public ResolutionResult getColumnResolutionResult(TObjectName objName)
TObjectName reference.
Identity-keyed (two references with equal toString are kept
separate). Returns null when no resolution has been recorded for
this reference, including when the trace is disabled.
public BindingSkipReason getColumnSkipReason(TObjectName objName)
TObjectName reference.public void recordColumnSkipReason(TObjectName objName, BindingSkipReason reason)