public enum SnowflakeUseTarget extends Enum<SnowflakeUseTarget>
USE switches — MantisBT 4677.
Snowflake makes the object keyword optional on both sides, so
USE a and USE a.b must be told apart without one. The rule
comes from the USE SCHEMA reference: "The SCHEMA keyword is optional if
the schema name is fully qualified (in the form of db_name.schema_name)".
Combined with USE DATABASE's own optional keyword:
Why this lives in one class. Two independent code paths need the
answer: the statement splitter picks the statement class before
parsing, and the grammar action stamps the EDbObjectType that drives
TUseDatabase.isSchema() and resolver2's DatabaseContextTracker.
Two separate implementations drifted apart twice during this fix (once via a
part-count that is never populated, once on the IDENTIFIER(...)
form), and a disagreement is invisible through the public API — the class
says one thing, the node says another, and nothing reports it. Both callers
now pass the same evidence (the token list plus the position of the
USE token) to of(gudusoft.gsqlparser.TSourceTokenList, int), so there is exactly one rule.
| Modifier and Type | Method and Description |
|---|---|
static SnowflakeUseTarget |
of(TSourceTokenList tokens,
int usePos)
Classify a keyword-less
USE. |
static SnowflakeUseTarget |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SnowflakeUseTarget[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SnowflakeUseTarget DATABASE
public static final SnowflakeUseTarget SCHEMA
public static SnowflakeUseTarget[] values()
for (SnowflakeUseTarget c : SnowflakeUseTarget.values()) System.out.println(c);
public static SnowflakeUseTarget valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static SnowflakeUseTarget of(TSourceTokenList tokens, int usePos)
USE. Callers must have already ruled out
the explicit forms (USE DATABASE/SCHEMA/ROLE/WAREHOUSE ...).