gizmodel/core/names
Quoted names that keep their case. The engine compares names after lowercasing them, so "Foo", "foo" and foo would be one name. A dialect that keeps the case of a quoted name (PostgreSQL: unquoted folds to lower; Oracle: to upper, stored lower here) spells each quoted name its folding cannot reach in a lowercase-stable form (SQL lexer, foldQuoted): NAME_MARK first, each uppercase letter X as NAME_UPPER and lower(X). Every other name keeps its text. decodeNames undoes it wherever a name is shown: result labels, catalogs, error texts.
import * as Names from "gizmodel/core/names";Functions
decodeNames
function decodeNames(text: string): stringtext with the encoded names in it shown as written ("Foo" for MARK NAME_UPPER f o o).
Effects: fail, alloc.
encodeName
function encodeName(text: string): stringThe lowercase-stable spelling of the quoted name text.
Effects: fail, alloc.
sameColumnName
function sameColumnName(stored: string, reference: string): boolWhether a column stored as STORED is the one a statement names as REFERENCE. Names compare without case. A quoted reference that keeps its case (encoded) also names a column that a case-insensitive dialect stored as written (a StarRocks copy's createdAt): SELECT, INSERT and UPDATE then read "createdAt" alike. PostgreSQL and Oracle store a plain name folded, so only a stored name with capitals, which no folding makes, is one.
Effects: fail, alloc.
Constants
NAME_MARK
const NAME_MARK = "\u0014"The first character of an encoded name (see decodeNames).