public class TSQLResolver2 extends Object
TSQLResolver2 resolver = new TSQLResolver2(context, statements); boolean success = resolver.resolve(); ResolutionStatistics stats = resolver.getStatistics();Phase 1 capabilities: - Basic SELECT statement resolution - Table and subquery namespaces - Qualified and unqualified column references - FROM clause scope management Phase 2 capabilities: - JOIN scope handling with nullable semantics - CTE (WITH clause) resolution - Iterative resolution framework (auto-converges after first pass if no iteration needed) Future phases will add: - Evidence-based inference - Star column expansion
| Constructor and Description |
|---|
TSQLResolver2(gudusoft.gsqlparser.compiler.TContext context,
TStatementList statements)
Create resolver with default configuration
|
TSQLResolver2(gudusoft.gsqlparser.compiler.TContext context,
TStatementList statements,
TSQLResolverConfig config)
Create resolver with custom configuration
|
| Modifier and Type | Method and Description |
|---|---|
TSQLResolverConfig |
getConfig()
Get the configuration
|
ResolutionContext |
getContext()
Get the resolution context (for advanced queries)
|
ConvergenceDetector |
getConvergenceDetector()
Get the convergence detector (for iterative resolution analysis)
|
String |
getEnhancementReport()
Get a detailed enhancement report.
|
static String |
getGlobalPerformanceTimings()
Get global performance timing breakdown for profiling across all resolve() calls.
|
GlobalScope |
getGlobalScope()
Get the global scope
|
static String |
getLegacySyncTimings()
Get detailed legacy sync timing breakdown.
|
NamespaceEnhancer |
getNamespaceEnhancer()
Get the namespace enhancer for external access to enhancement history.
|
List<ResolutionPass> |
getPassHistory()
Get the pass history (for iterative resolution analysis)
|
String |
getPerformanceTimings()
Get performance timing breakdown for profiling.
|
IResolutionResult |
getResult()
Get the resolution result access interface.
|
ScopeBuildResult |
getScopeBuildResult()
Get the scope build result (for testing and analysis)
|
TSQLEnv |
getSqlEnv()
Get the TSQLEnv used for table metadata lookup.
|
TStatementList |
getStatements()
Get the SQL statements being resolved.
|
ResolutionStatistics |
getStatistics()
Get resolution statistics
|
Set<TTable> |
getVirtualTriggerTables()
Get the set of virtual trigger tables (deleted/inserted in SQL Server triggers).
|
static void |
resetGlobalTimings()
Reset global timing accumulators.
|
boolean |
resolve()
Perform resolution on all SQL statements
|
void |
setSqlEnv(TSQLEnv sqlEnv)
Set the TSQLEnv to use for table metadata lookup.
|
public TSQLResolver2(gudusoft.gsqlparser.compiler.TContext context, TStatementList statements)
public TSQLResolver2(gudusoft.gsqlparser.compiler.TContext context, TStatementList statements, TSQLResolverConfig config)
public void setSqlEnv(TSQLEnv sqlEnv)
sqlEnv - the SQL environment containing table metadatapublic TSQLEnv getSqlEnv()
public Set<TTable> getVirtualTriggerTables()
public TStatementList getStatements()
public static void resetGlobalTimings()
public static String getGlobalPerformanceTimings()
public String getPerformanceTimings()
public boolean resolve()
public NamespaceEnhancer getNamespaceEnhancer()
public String getEnhancementReport()
public static String getLegacySyncTimings()
public ResolutionStatistics getStatistics()
public ResolutionContext getContext()
public GlobalScope getGlobalScope()
public TSQLResolverConfig getConfig()
public List<ResolutionPass> getPassHistory()
public ConvergenceDetector getConvergenceDetector()
public ScopeBuildResult getScopeBuildResult()
public IResolutionResult getResult()
Usage example:
TSQLResolver2 resolver = new TSQLResolver2(null, parser.sqlstatements);
resolver.resolve();
IResolutionResult result = resolver.getResult();
for (TCustomSqlStatement stmt : parser.sqlstatements) {
for (TTable table : result.getTables(stmt)) {
System.out.println("Table: " + table.getFullName());
for (TObjectName col : result.getColumnsForTable(stmt, table)) {
System.out.println(" Column: " + col.getColumnNameOnly());
}
}
}
IllegalStateException - if resolve() has not been called