protected override void InternalBindingTraversal(Plan plan, PlanNodeVisitor visitor) { #if USEVISIT Nodes[0] = visitor.Visit(plan, Nodes[0]); Nodes[1] = visitor.Visit(plan, Nodes[1]); #else LeftTableNode.BindingTraversal(plan, visitor); RightTableNode.BindingTraversal(plan, visitor); #endif plan.Symbols.PushWindow(0); try { plan.EnterRowContext(); try { #if USENAMEDROWVARIABLES plan.Symbols.Push(new Symbol(Keywords.Left, LeftTableNode.DataType.RowType)); #else APlan.Symbols.Push(new Symbol(String.Empty, LeftTableNode.DataType.CreateRowType(Keywords.Left))); #endif try { #if USENAMEDROWVARIABLES plan.Symbols.Push(new Symbol(Keywords.Right, RightTableNode.DataType.RowType)); #else APlan.Symbols.Push(new Symbol(String.Empty, RightTableNode.DataType.CreateRowType(Keywords.Right))); #endif try { #if USEVISIT _rowEqualNode = visitor.Visit(plan, _rowEqualNode); #else RowEqualNode.BindingTraversal(plan, visitor); #endif } finally { plan.Symbols.Pop(); } } finally { plan.Symbols.Pop(); } } finally { plan.ExitRowContext(); } } finally { plan.Symbols.PopWindow(); } }
public override object InternalExecute(Program program) { object leftValue = Nodes[0].Execute(program); object rightValue = Nodes[1].Execute(program); #if NILPROPOGATION if ((leftValue == null) || (rightValue == null)) { return(null); } #endif if (_comparisonNode != null) { program.Stack.PushWindow(0); try { program.Stack.Push(leftValue); try { program.Stack.Push(rightValue); try { return(_comparisonNode.Execute(program)); } finally { program.Stack.Pop(); } } finally { program.Stack.Pop(); } } finally { program.Stack.PopWindow(); } } else { RowEqualNode node = new RowEqualNode(); node.Nodes.Add(new ValueNode(((IRow)leftValue).DataType, leftValue)); node.Nodes.Add(new ValueNode(((IRow)rightValue).DataType, rightValue)); node.DetermineDataType(program.Plan); return(node.Execute(program)); } }
protected bool IsSuperset(Program program, ITable leftTable, ITable rightTable) { Row leftRow = new Row(program.ValueManager, LeftTableNode.DataType.RowType); try { Row rightRow = new Row(program.ValueManager, RightTableNode.DataType.RowType); try { if (rightTable.Supports(CursorCapability.BackwardsNavigable)) { rightTable.First(); } else { rightTable.Reset(); } while (rightTable.Next()) { rightTable.Select(rightRow); bool hasRow = false; if (leftTable.Supports(CursorCapability.BackwardsNavigable)) { leftTable.First(); } else { leftTable.Reset(); } while (leftTable.Next()) { leftTable.Select(leftRow); program.Stack.PushWindow(0); try { program.Stack.Push(leftRow); try { program.Stack.Push(rightRow); try { object result = RowEqualNode.Execute(program); if ((result != null) && (bool)result) { hasRow = true; break; } } finally { program.Stack.Pop(); } } finally { program.Stack.Pop(); } } finally { program.Stack.PopWindow(); } } if (!hasRow) { return(false); } } return(true); } finally { rightRow.Dispose(); } } finally { leftRow.Dispose(); } }