IF Commons GitHub

sql/physical/express

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0007-physical FR-003, 0007-physical FR-005, 0007-physical FR-007

How a logical schema is written (commons data 0007-physical): the names of its tables, columns and constraints as a case style writes them, and the text of what goes into a table (a column with its type, nullability and default, a foreign key, a unique, a check). bind makes CREATE TABLE of them and the lifecycle makes ALTER TABLE of them, so that a column is written one way wherever it is written.

Source: commons/data/sql/physical/express.ts

0 of 4 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Expressorinterfaceno test imports it
interface Expressor

What writes the parts of a table.

MemberTypeWhat it is
list(words: readonly Words[]) => stringA list of columns, each written and quoted.
defaultOf(d: LogicalDefault) => string
checkOf(c: Check) => string | undefinedThe text of a check's condition, or none where the dialect cannot say it (an error is then added).
columnLine(t: Table, c: Column, inlineKey?: boolean | undefined) => stringA column as a line of CREATE TABLE or of ADD COLUMN: its name, type, NOT NULL, default and, where it is the whole key and inlineKey is true, PRIMARY KEY.
fkClause(f: ForeignKey) => string
uniqueClause(u: Unique) => string
checkClause(c: Check) => string | undefined
expressorfunctionno test imports it
function expressor(dialect: Dialect, naming: Naming, names: Names, errors: PhysicalError[]): Expressor

The writer of the parts of a table.

ParameterWhat it is
dialectthe dialect
namingthe case styles
namesthe written names
errorswhere what the dialect cannot express is added

Returns: the writer

Namesinterfaceno test imports it
interface Names extends Written

The names of a schema as they are written, once, with what is wrong with them.

MemberTypeWhat it is
qualifierstring | undefinedThe schema tables are qualified by, where the dialect has schemas and a schema was given.
refWords(table: Words) => stringThe reference to a table by the words of its name.
tablesReadonlyMap<LogicalId, string>
columnsReadonlyMap<LogicalId, string>
constraintsReadonlyMap<LogicalId, string>
ref(id: LogicalId) => stringThe reference to a table of the schema, quoted and qualified (0013-sql-qualified-names FR-004).
qualify(name: string) => stringThe reference to a table of an extension, by the bare name it is written by: qualified, or with the schema's words added where the dialect has no schemas.
tableName(name: string) => stringThe name a table of an extension is written by once the schema's words are added where the dialect has no schemas.
table(id: LogicalId) => string | undefined
column(id: LogicalId) => string | undefined
constraint(id: LogicalId) => string | undefined
writeNamesfunctionno test imports it
function writeNames(schema: LogicalSchema, dialect: Dialect, naming: Naming, errors: PhysicalError[], inSchema?: string | undefined): Names

Writes every name of a schema, and says which are too long or alike.

ParameterWhat it is
schemathe logical schema
dialectthe dialect, for the longest a name may be
namingthe case styles
errorswhere what is wrong is added
inSchemathe schema the tables are in: qualified where the dialect has schemas, else its words come first in each table's name

Returns: the names

Titles, headings, exports, tables, columns and requirements. Esc closes.