public final class SqlBinding extends Object
Plan §5.3 / §7.3 S17: third-party consumers (SQL Guard, lineage,
lint, IDE) that just want a BindingResult for a single SQL
snippet can call resolve(String, EDbVendor, TSQLEnv,
TSQLResolverConfig) instead of wiring a TGSqlParser themselves.
The façade is a thin convenience wrapper around the standard parse-and-resolve pipeline:
TGSqlParser for the requested vendor.TSQLEnv and TSQLResolverConfig
(or default empty config when null).EResolverType.RESOLVER2) so the binding
post-pass has its required substrate.TGSqlParser.parse() exactly once. Resolver2
is auto-invoked from inside parse() per the project
contract (CLAUDE.md §"TSQLResolver2 is Automatically Invoked"). The
façade never calls resolver.resolve() again —
doing so would double-mutate the AST (plan §7.5 #2).BindingResult produced by the post-pass; on
syntax error, returns the empty result.If the supplied config does not enable any binding flag, the result
is non-null and empty — same as direct parser usage. To get diagnostics,
supply a config with at least
TSQLResolverConfig.setEmitBindingDiagnostics(boolean) on.
Thread-safety: stateless. Each call constructs its own parser.
| Modifier and Type | Method and Description |
|---|---|
static BindingResult |
resolve(String sql,
EDbVendor vendor,
TSQLEnv env,
TSQLResolverConfig config)
Parse and resolve
sql against the supplied vendor / catalog,
returning the binding result. |
public static BindingResult resolve(String sql, EDbVendor vendor, TSQLEnv env, TSQLResolverConfig config)
sql against the supplied vendor / catalog,
returning the binding result.sql - the SQL text; must not be nullvendor - the SQL dialect; must not be nullenv - catalog metadata supplied to the resolver. May be
null; in that case the parser is left without
authoritative metadata and most diagnostics will report
METADATA_UNAVAILABLE rather than
UNKNOWN_COLUMN (plan §5.5).config - resolver configuration. May be null; in that
case a default config is used (no binding diagnostics
will be emitted because all flags default off).BindingResult; never null, even when
parsing fails (returns BindingResult.empty()).