StatementScope class

A scope used by statements.

Tables added from FROM clauses are added to resultSets, CTEs are added to additionalKnownTables.

This is the scope most commonly used, but specific nodes may be attached to a different scope in case they have limited visibility. For instance,

  • foreign key clauses are wrapped in a SingleTableReferenceScope because they can't see unqualified columns of the overal scope.
  • subquery expressions can see parent tables and columns, but their columns aren't visible in the parent statement. This is implemented by wrapping them in a StatementScope as well.
  • subqueries appearing in a FROM clause can't see outer columns and tables. These statements are also wrapped in a StatementScope, but a SourceScope is inserted as an intermediate scope to prevent the inner scope from seeing the outer columns.
Inheritance

Constructors

StatementScope(ReferenceScope parent)
StatementScope.forStatement(RootScope root, Statement statement)
factory

Properties

additionalKnownTables Map<String, ResultSet>
Additional tables (that haven't necessarily been added in a FROM clause that are only visible in this scope).
final
allAvailableResultSets Iterable<ResultSetAvailableInStatement>
All result sets available in this and parent scopes.
no setter
expansionOfStarColumn List<Column>?
All columns that a (unqualified) * in a select statement or function call argument would expand to.
getter/setter pairoverride-getter
hashCode int
The hash code for this object.
no setterinherited
namedResultColumns List<Column>
For select statements, additional columns available under a name because there were added after the SELECT.
final
parent ReferenceScope
final
resultSetAvailableToChildScopes Iterable<ResultSetAvailableInStatement>
All available result sets that can also be seen in child scopes.
no setteroverride
resultSets Map<String?, ResultSetAvailableInStatement>
Result sets that were added through a FROM clause and are now available in this scope.
final
rootScope RootScope
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
windowDeclarations Map<String, NamedWindowDeclaration>
final

Methods

addAlias(AstNode origin, ResultSet resultSet, String alias, {bool canUseUnqualifiedColumns = true}) → void
Registers a ResultSetAvailableInStatement to a TableAlias for the given resultSet.
override
addResolvedResultSet(String? name, ResultSetAvailableInStatement resultSet) → void
Adds an added result set to this scope.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveResultSetForReference(String name) ResultSetAvailableInStatement?
Attempts to find a result set that has been added to this scope, for instance because it was introduced in a FROM clause.
override
resolveResultSetToAdd(String name) ResultSet?
Attempts to find a result set that can be added to a scope.
override
resolveUnqualifiedReference(String columnName, {bool allowReferenceToResultColumn = false}) List<Column>
Attempts to resolve an unqualified reference from a columnName.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

cast(ReferenceScope other) StatementScope