JoinModel class

Tracks table references that must be non-nullable in a query row.

This is used to determine the nullability of column references. For instance, consider the following query:

SELECT foo.x, bar.y FROM foo
  LEFT OUTER JOIN bar ON ...

Clearly, foo.x is non-nullable in the result if x is a non-nullable column in foo. We can't say the same thing about bar.y though: Even if the column is declared to be NOT NULL, bar might be nullable in this query.

A JoinModel is attached to each basic SelectStatement. You can obtain the model for any ast node via JoinModel.of. It will lookup the model from the enclosing SelectStatement, if there is one.

If a Reference refers to a table that's in JoinModel.nonNullable and the resolved column is non-nullable, we can assume that the reference is going to be non-nullable too.

At the moment, we consider the following tables to be JoinModel.nonNullable:

  • the "primary" table of a select statement (foo in the example above)
  • inner, cross, regular (no keyword, comma) joins

In the future, we'll also consider foreign key constraints.

Properties

hashCode int
The hash code for this object.
no setterinherited
nonNullable List<ResultSetAvailableInStatement>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

availableColumnIsNullable(AvailableColumn column) bool
Returns whether an AvailableColumn is nullable from the perspective of this join model by checking whether it comes from an outer join.
isNullableTable(ResultSet resultSet) bool
Checks whether the result set is nullable in the surrounding select statement.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
referenceIsNullable(Reference reference) bool?
Computes whether the element the reference is pointing to is nullable from the perspective of this join model.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

of(AstNode node) JoinModel?