2using System.Collections.Generic;
3using System.Threading.Tasks;
43 KeyValuePair<VariableReference, bool>[] Order,
ScriptNode Node)
46 KeyValuePair<VariableReference, bool>[] LeftOrder = await
Reduce(this.
Left, Order);
52 e =
new LeftOuterJoinEnumerator(e, this.
Left.
Name,
this.Right,
this.Right.Name, Generic, RightWhere,
Variables,
this.Flipped);
60 if (Top !=
int.MaxValue)
72 private readonly
string leftName;
73 private readonly
string rightName;
74 private readonly
bool hasLeftName;
75 private readonly
bool flipped;
76 private readonly
bool generic;
77 private bool rightFirst;
87 this.leftName = LeftName;
88 this.rightName = RightName;
89 this.rightSource = RightSource;
90 this.generic = Generic;
93 this.hasLeftName = !
string.IsNullOrEmpty(this.leftName);
97 public object Current => this.current;
99 public bool MoveNext()
101 return this.MoveNextAsync().Result;
104 public async Task<bool> MoveNextAsync()
108 if (!(this.right is
null))
110 bool First = this.rightFirst;
111 this.rightFirst =
false;
116 this.current =
new JoinedObject(this.right.Current,
this.rightName,
this.left.Current,
this.leftName);
118 this.current =
new JoinedObject(this.left.Current,
this.leftName,
this.right.Current,
this.rightName);
128 if (this.defaultRight is
null)
130 this.defaultRight =
new GenericObject(this.rightSource.CollectionName,
131 typeof(
GenericObject).FullName, Guid.Empty,
new KeyValuePair<string, object>[0]);
135 this.current =
new JoinedObject(this.defaultRight, this.rightName, this.left.Current,
this.leftName);
137 this.current =
new JoinedObject(this.left.Current,
this.leftName,
this.defaultRight,
this.rightName);
144 if (!await this.left.MoveNextAsync())
147 if (this.leftVariables is
null)
148 this.leftVariables =
new ObjectProperties(this.left.Current,
this.variables);
150 this.leftVariables.Object = this.left.Current;
152 if (this.hasLeftName)
153 this.leftVariables[this.leftName] = this.left.Current;
155 this.right = await this.rightSource.Find(0,
int.MaxValue, this.
generic, this.conditions, this.leftVariables,
156 null, this.conditions);
158 this.rightFirst =
true;
Generic object. Contains a sequence of properties.
Base class for all nodes in a parsed script tree.
Enumerator that only returns elements matching a set of conditions.
Enumerator that limits the return set to a maximum number of records.
Enumerator that skips a given number of result records.
Represents a joined object.
Abstract base classes of joined sources.
ScriptNode Conditions
Conditions for join.
ScriptNode Combine(ScriptNode Where, ScriptNode On)
Combines one or two restrictions.
IDataSource Left
Left source
static async Task< ScriptNode > Reduce(IDataSource Source, ScriptNode Where)
Reduces a where clause to fit the current data source.
IDataSource Right
Right source
Data source formed through an LEFT [OUTER] JOIN of two sources.
LeftOuterJoinedSource(IDataSource Left, IDataSource Right, ScriptNode Conditions)
Data source formed through an LEFT [OUTER] JOIN of two sources.
override async Task< IResultSetEnumerator > Find(int Offset, int Top, bool Generic, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Finds objects matching filter conditions in Where .
virtual bool Flipped
If sources should be flipped in the JoinedObject instances created.
Task< bool > MoveNextAsync()
Advances the enumerator to the next element of the collection.
Interface for result-set enumerators.
Interface for data sources that can be used in SQL statements.
Task< IResultSetEnumerator > Find(int Offset, int Top, bool Generic, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Finds objects matching filter conditions in Where .
string Name
Collection name or alias.