public final class CatalogBackedCatalogProvider extends Object implements ICatalogProvider
ICatalogProvider hook to a new-world
CatalogRuntime. Plan §5.3 / §8.3.
Read path: findObject(java.lang.String, java.lang.String, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType) delegates to the wrapped provider first; on miss it asks
the runtime resolver, materializes the hit via CatalogEntryToSQLEnvMapper, writes
the resulting TSQLSchemaObject into the delegate's overlay so subsequent lookups
within the same parse never re-cross the bridge, and returns it. On miss-after-runtime
the method returns null (preserves today's "missing object" semantics).
Write path: addObject(gudusoft.gsqlparser.sqlenv.TSQLSchemaObject) writes straight to the delegate. DDL discovered
mid-parse and temp-table registrations therefore go to the existing legacy overlay
(the CatalogStoreProvider default for a TSQLEnv); they never touch the
immutable CatalogSnapshot owned by the runtime — the runtime overlay stays
untouched here on purpose, the bridge's job is to feed the legacy lookup path.
All other ICatalogProvider methods delegate verbatim to the wrapped provider.
Construction validates that the runtime, delegate, mapper and target env are non-null.
Lookups silently return null on null arguments to mirror the legacy contract:
TSQLEnv.doSearchSchemaObject only invokes the provider when at least three
normalized segments are present, but defensive null handling here matches the rest of
the ICatalogProvider contract.
| Constructor and Description |
|---|
CatalogBackedCatalogProvider(CatalogRuntime runtime,
ICatalogProvider delegate,
CatalogEntryToSQLEnvMapper mapper,
TSQLEnv targetEnv) |
CatalogBackedCatalogProvider(CatalogRuntime runtime,
ICatalogProvider delegate,
CatalogEntryToSQLEnvMapper mapper,
TSQLEnv targetEnv,
IdentifierConfig identifierConfig)
Convenience constructor without a diagnostic sink.
|
CatalogBackedCatalogProvider(CatalogRuntime runtime,
ICatalogProvider delegate,
CatalogEntryToSQLEnvMapper mapper,
TSQLEnv targetEnv,
IdentifierConfig identifierConfig,
CatalogDiagnosticSink diagnosticSink)
Construct a bridge provider with an explicit
IdentifierConfig and an
optional CatalogDiagnosticSink. |
| Modifier and Type | Method and Description |
|---|---|
void |
addObject(TSQLSchemaObject object)
添加 schema 对象
|
void |
clear()
清空所有对象
|
TSQLCatalog |
createCatalog(String catalogName)
创建 catalog(已存在则返回现有)
|
TSQLSchemaObject |
findObject(String catalog,
String schema,
String objectName,
ESQLDataObjectType type)
查找 schema 对象(全限定名查找)
|
List<TSQLCatalog> |
getAllCatalogs()
获取所有 catalog
|
TSQLCatalog |
getCatalog(String catalogName)
获取 catalog(不存在返回 null)
|
String |
getDefaultCatalogName()
获取默认 catalog 名称
|
boolean |
removeObject(TSQLSchemaObject object)
移除 schema 对象
|
void |
setDefaultCatalogName(String name)
设置默认 catalog 名称
|
int |
size()
获取对象总数
|
public CatalogBackedCatalogProvider(CatalogRuntime runtime, ICatalogProvider delegate, CatalogEntryToSQLEnvMapper mapper, TSQLEnv targetEnv)
public CatalogBackedCatalogProvider(CatalogRuntime runtime, ICatalogProvider delegate, CatalogEntryToSQLEnvMapper mapper, TSQLEnv targetEnv, IdentifierConfig identifierConfig)
CatalogBackedCatalogProvider(CatalogRuntime, ICatalogProvider,
CatalogEntryToSQLEnvMapper, TSQLEnv, IdentifierConfig, CatalogDiagnosticSink)
with diagnosticSink=null.public CatalogBackedCatalogProvider(CatalogRuntime runtime, ICatalogProvider delegate, CatalogEntryToSQLEnvMapper mapper, TSQLEnv targetEnv, IdentifierConfig identifierConfig, CatalogDiagnosticSink diagnosticSink)
IdentifierConfig and an
optional CatalogDiagnosticSink. When identifierConfig is
null the bridge falls back to IdentifierConfig.defaultsFor(EDbVendor);
non-null configs are honored so snapshot keys built under (e.g.) MySQL
lower_case_table_names=2 or MSSQL collation overrides match at lookup time.
Diagnostics emitted by the runtime resolver (fetch-cap WARNs/ERRORs, partial
results, fetch failures) are forwarded to diagnosticSink when configured.
The ICatalogProvider.findObject(java.lang.String, java.lang.String, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType) contract still returns null on
miss (no behavior change for legacy callers), but a configured sink lets a
caller observe what the runtime saw — required for plan §10.6 fetch-cap
diagnostics to be visible at the bridge layer.
public TSQLCatalog getCatalog(String catalogName)
ICatalogProvidergetCatalog in interface ICatalogProvidercatalogName - catalog 名称public TSQLCatalog createCatalog(String catalogName)
ICatalogProvidercreateCatalog in interface ICatalogProvidercatalogName - catalog 名称public List<TSQLCatalog> getAllCatalogs()
ICatalogProvidergetAllCatalogs in interface ICatalogProviderpublic String getDefaultCatalogName()
ICatalogProvidergetDefaultCatalogName in interface ICatalogProviderpublic void setDefaultCatalogName(String name)
ICatalogProvidersetDefaultCatalogName in interface ICatalogProvidername - 默认 catalog 名称public TSQLSchemaObject findObject(String catalog, String schema, String objectName, ESQLDataObjectType type)
ICatalogProviderfindObject in interface ICatalogProvidercatalog - catalog 名称schema - schema 名称objectName - 对象名称type - 对象类型public void addObject(TSQLSchemaObject object)
ICatalogProvideraddObject in interface ICatalogProviderobject - schema 对象public boolean removeObject(TSQLSchemaObject object)
ICatalogProviderremoveObject in interface ICatalogProviderobject - schema 对象public void clear()
ICatalogProviderclear in interface ICatalogProviderpublic int size()
ICatalogProvidersize in interface ICatalogProvider