DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
NonCorrelatedAnyAllNode.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 
19 using Deveel.Data;
22 using Deveel.Data.Sql.Tables;
23 
24 namespace Deveel.Data.Sql.Query {
25  [Serializable]
27  public NonCorrelatedAnyAllNode(IQueryPlanNode left, IQueryPlanNode right, ObjectName[] leftColumnNames, SqlExpressionType subQueryType)
28  : base(left, right) {
29  LeftColumnNames = leftColumnNames;
30  SubQueryType = subQueryType;
31  }
32 
34  : base(data) {
35  LeftColumnNames = data.GetValue<ObjectName[]>("LeftColumns");
36  SubQueryType = (SqlExpressionType) data.GetInt32("SubQueryType");
37  }
38 
39  public ObjectName[] LeftColumnNames { get; private set; }
40 
41  public SqlExpressionType SubQueryType { get; private set; }
42 
43  public override ITable Evaluate(IRequest context) {
44  // Solve the left branch result
45  var leftResult = Left.Evaluate(context);
46  // Solve the right branch result
47  var rightResult = Right.Evaluate(context);
48 
49  // Solve the sub query on the left columns with the right plan and the
50  // given operator.
51  return leftResult.SelectAnyAllNonCorrelated(LeftColumnNames, SubQueryType, rightResult);
52  }
53 
54  protected override void GetData(SerializeData data) {
55  data.SetValue("LeftColumns", LeftColumnNames);
56  data.SetValue("SubQueryType", (int)SubQueryType);
57  }
58  }
59 }
Defines the contract to access the data contained into a table of a database.
Definition: ITable.cs:40
void SetValue(string key, Type type, object value)
Describes the name of an object within a database.
Definition: ObjectName.cs:44
SqlExpressionType
All the possible type of SqlExpression supported
A node element of a query plan tree. /summary>
Returns all the records in the left side of the join, even if the other side has no corresponding rec...
Returns all the records in the right side of the join, even if the other side has no corresponding re...
A IQueryPlanNode implementation that is a branch with two child nodes.
NonCorrelatedAnyAllNode(IQueryPlanNode left, IQueryPlanNode right, ObjectName[] leftColumnNames, SqlExpressionType subQueryType)