ParseState
class ParseState
| internal |
The definitions, identity lookups and issues of one parse.
Definitions are keyed by schema and name without joining them with a dot, which quoted names can contain.
Properties
| TableDefinition> | $tables | ||
| array<array-key, array<string, true>> | $tableNames | ||
| View> | $views | ||
| array<array-key, array<string, true>> | $viewNames | ||
| EnumType> | $enums | ||
| Domain> | $domains | ||
| array<array-key, array<string, true>> | $domainNames | ||
| array<string, array<string, true>> | $children | ||
| ColumnType> | $types | ||
| Issue> | $issues | ||
| TableReference> | $affectedRelations | ||
| TypeReference> | $affectedTypes | ||
| bool | $unknownImpact | Whether a statement may have changed relations or types without naming them, or changed how later statements resolve names. |
|
| string|null | $defaultSchema | The schema of unqualified relation names: SQLite's main database, or the one a MySQL USE statement selects. |
|
| array<string, array{bool, bool}> | $savedSqlModes | ||
| int | $offset | The start of the statement being parsed. |
Methods
Create the state for parsing the given SQL.
Record that the input alters, drops or renames a table or view, naming an unqualified one in the default schema.
Get the identity of a name, without its ASCII case where names compare case-insensitively.
Get the identity key of a schema-qualified name.
Remove a table definition and its inheritance and partition links.
Record that a stored table inherits from, or is a partition of, another stored table.
Remove a stored table's index with the given name.
Record the index names of a stored table after its indexes change.
Determine whether a stored table has an index with the given schema-qualified name.
Find the stored table with the given schema-qualified index name, when only one has it.
Get the keys of the stored tables with an index of the given name, in any schema.
Remove a view.
Find a domain by exact identity or a unique unqualified name.
Determine whether any schema object has been read.
Details
at line 92
__construct(string $sql, bool $caseInsensitive = false)
Create the state for parsing the given SQL.
at line 101
Issue
issue(string $message)
Create an issue located at the current statement.
at line 112
void
affect(TableReference $relation)
Record that the input alters, drops or renames a table or view, naming an unqualified one in the default schema.
at line 124
void
affectType(TypeReference $type)
Record that the input alters or drops a user type or domain.
at line 132
string
normalize(string $name)
Get the identity of a name, without its ASCII case where names compare case-insensitively.
at line 140
string
key(string|null $schema, string $name)
Get the identity key of a schema-qualified name.
at line 153
string
addTable(TableDefinition $table)
Add or replace a table definition and return its key.
at line 166
void
removeTable(string $key)
Remove a table definition and its inheritance and partition links.
at line 188
void
linkChild(string $parentKey, string $childKey)
Record that a stored table inherits from, or is a partition of, another stored table.
at line 197
void
addIndex(string $key, Index $index)
Add an index to a stored table.
at line 213
void
removeIndex(string $key, string $name)
Remove a stored table's index with the given name.
at line 231
void
refreshIndexNames(string $key)
Record the index names of a stored table after its indexes change.
at line 279
bool
hasIndex(string|null $schema, string $name)
Determine whether a stored table has an index with the given schema-qualified name.
at line 287
string|null
indexTableKey(string|null $schema, string $name)
Find the stored table with the given schema-qualified index name, when only one has it.
at line 299
array
indexTableKeys(string $name)
Get the keys of the stored tables with an index of the given name, in any schema.
at line 333
string|null
tableKey(TableReference $table)
Find a table by exact identity or a unique unqualified name.
at line 341
void
addView(View $view)
Add or replace a view.
at line 351
void
removeView(string $key)
Remove a view.
at line 359
string|null
viewKey(TableReference $view)
Find a view by exact identity or a unique unqualified name.
at line 367
string|null
domainKey(string|null $schema, string $name)
Find a domain by exact identity or a unique unqualified name.
at line 375
bool
hasDefinitions()
Determine whether any schema object has been read.