public final class IdentityNameList extends Object
DisplayNamePolicy.
The listings used to de-duplicate rendered strings case-insensitively. Rendered text has already lost what decides identity, so that was wrong in both directions:
Sales and SALES are two tables, yet only one reached the list —
a silently missing table;Sales, SALES and "SALES" are one
table, yet the quoted spelling printed as a second row.Identity comes from the unified name service (IdentifierService), per vendor and
per object type — BigQuery tables compare case-sensitively while its columns do not, so the
caller states the type and nothing here guesses it from text.
| Constructor and Description |
|---|
IdentityNameList(EDbVendor vendor,
DisplayNamePolicy policy) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String rendered,
String lexical,
ESQLDataObjectType objectType,
String decoration,
boolean definitionSite,
String catalogRendered)
Record one occurrence of a name.
|
void |
addOpaque(String rendered)
Record a line whose identity the caller cannot state (a synthesized or composite line).
|
void |
clear() |
boolean |
isEmpty() |
static String |
renderCatalogTableName(EDbVendor vendor,
TSQLEnv sqlEnv,
TObjectName tableName,
DisplayNameMode mode,
SqlNameGenerator.QuotePolicy quotePolicy)
How a listing prints the catalog's stored name for a table, or null when there is no
catalog entry.
|
List<String> |
resolve(DisplayNameMode mode)
The lines to print: exactly ONE per object in every mode, sorted case-insensitively as
the listings always were.
|
public IdentityNameList(EDbVendor vendor, DisplayNamePolicy policy)
public void clear()
public boolean isEmpty()
public void add(String rendered, String lexical, ESQLDataObjectType objectType, String decoration, boolean definitionSite, String catalogRendered)
rendered - the text the listing would print for this occurrence, decorations
includedlexical - the name as written in SQL (may be qualified); identity is derived
from this, never from renderedobjectType - syntactic role of lexicaldecoration - any suffix the listing appended ("(tetSelect)"); two
occurrences of one object under different decorations are
different lines. May be null.definitionSite - true when this occurrence is where the object is definedcatalogRendered - how the listing would print the catalog's stored name for this
object, or null when no catalog metadata is knownpublic static String renderCatalogTableName(EDbVendor vendor, TSQLEnv sqlEnv, TObjectName tableName, DisplayNameMode mode, SqlNameGenerator.QuotePolicy quotePolicy)
Only an unqualified reference is answered: a stored leaf name says nothing about how
the qualifiers should be spelled, and none are invented. Under
DisplayNameMode.SQL_RENDER the stored name is written back as SQL by
SqlNameGenerator, delimited only when it must be.
public void addOpaque(String rendered)
public List<String> resolve(DisplayNameMode mode)
A DisplayNameMode decides HOW a name is written and a
DisplayNamePolicy decides WHICH occurrence supplies the spelling; the two are
orthogonal and no mode is exempt from the policy. DisplayNameMode.SQL_RENDER
therefore prints the policy-chosen occurrence with its SQL delimiters kept, rather than
one row per spelling: a listing row stands for an object, and how an object with several
spellings is shown is the policy's question, not the mode's.
mode - accepted for symmetry with the writers; the rendering was already applied
when each occurrence was added