コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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();
            }
        }