public final class CatalogNameGrammar extends Object
A resolved IDENTITY and a LOOKUP are different languages. A lookup may omit levels — t,
s.t and db..t are all normal. An identity may not: every level its topology
declares must be named, because an unresolved level inside a key silently binds to whatever the
session default happened to be, and then collides with the same name in another schema.
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isObjectKind(CatalogObjectKind kind)
Whether a kind may be carried by an OBJECT component.
|
static boolean |
isRelation(CatalogObjectKind kind)
Whether this kind owns columns.
|
static boolean |
mayContainObject(CatalogObjectKind container,
CatalogObjectKind child)
Whether
container may directly contain child as an object — the ONE transition
table, shared by resolved identities and lookups so the two cannot disagree about what nests. |
static CatalogParentConstraint |
nestedParentFamilyFor(CatalogObjectKind childKind)
The family a NESTED object of this kind must have as its parent.
|
static CatalogParentConstraint |
parentConstraintFor(CatalogObjectKind childKind)
Deprecated.
renamed to
nestedParentFamilyFor(gudusoft.gsqlparser.catalog.runtime.CatalogObjectKind), which says what it actually answers. |
static void |
validateLookup(List<CatalogLookupName.Slot> slots,
CatalogObjectKind terminalKind,
CatalogHierarchy hierarchy,
String databaseLink,
IdentifierInputForm linkForm,
CatalogParentConstraint parentConstraint)
Validates a LOOKUP.
|
static void |
validateResolvedIdentity(List<IdentifierComponentRole> roles,
List<CatalogObjectKind> kinds,
CatalogObjectKind terminalKind,
CatalogHierarchy hierarchy)
Validates a RESOLVED identity: legal roles, legal nesting, and COMPLETE against the declared
topology.
|
public static boolean isRelation(CatalogObjectKind kind)
public static boolean isObjectKind(CatalogObjectKind kind)
public static boolean mayContainObject(CatalogObjectKind container, CatalogObjectKind child)
container may directly contain child as an object — the ONE transition
table, shared by resolved identities and lookups so the two cannot disagree about what nests.public static CatalogParentConstraint nestedParentFamilyFor(CatalogObjectKind childKind)
This does not decide whether the object IS nested. That is a property of
the name's shape, not of the kind: a FUNCTION may sit directly in a schema or inside a package,
and an INDEX may be named at schema level or under its relation. An earlier version used this
method to decide existence, which rejected every schema-level function and — because a TABLE
is not a "child kind" — accepted PACKAGE.TABLE without ever examining the extra
component.
@Deprecated public static CatalogParentConstraint parentConstraintFor(CatalogObjectKind childKind)
nestedParentFamilyFor(gudusoft.gsqlparser.catalog.runtime.CatalogObjectKind), which says what it actually answers.public static void validateResolvedIdentity(List<IdentifierComponentRole> roles, List<CatalogObjectKind> kinds, CatalogObjectKind terminalKind, CatalogHierarchy hierarchy)
roles - one role per component, outermost firstkinds - the entity kind at each position; null except at OBJECT positionsterminalKind - what the name denotes as a wholehierarchy - which container levels the namespace HAS — declared by the caller, because
the component list cannot distinguish "this dialect has no schema" from
"the schema was not resolved"IllegalArgumentException - naming the first rule brokenpublic static void validateLookup(List<CatalogLookupName.Slot> slots, CatalogObjectKind terminalKind, CatalogHierarchy hierarchy, String databaseLink, IdentifierInputForm linkForm, CatalogParentConstraint parentConstraint)
The previous version of this method received only a list of slot STATES, so it could check
nothing but "is something present" — it admitted a schema before a catalog, a duplicate
catalog, OBJECT(TABLE) under terminal PROCEDURE, and an omitted terminal.
slots - the slots, outermost firstterminalKind - what is being looked forhierarchy - the declared topologydatabaseLink - the link text, or nulllinkForm - the link's provenance; required when the link is present