Beispiel #1
0
        protected void InternalInsertRight(Program program, IRow oldRow, IRow newRow, BitArray valueFlags, bool uncheckedValue)
        {
            switch (PropagateInsertRight)
            {
            case PropagateAction.True:
                RightNode.Insert(program, oldRow, newRow, valueFlags, uncheckedValue);
                break;

            case PropagateAction.Ensure:
            case PropagateAction.Ignore:
                using (Row rightRow = new Row(program.ValueManager, RightNode.DataType.RowType))
                {
                    newRow.CopyTo(rightRow);
                    using (IRow currentRow = RightNode.Select(program, rightRow))
                    {
                        if (currentRow != null)
                        {
                            if (PropagateInsertRight == PropagateAction.Ensure)
                            {
                                RightNode.Update(program, currentRow, newRow, valueFlags, false, uncheckedValue);
                            }
                        }
                        else
                        {
                            RightNode.Insert(program, oldRow, newRow, valueFlags, uncheckedValue);
                        }
                    }
                }
                break;
            }
        }
Beispiel #2
0
        protected override void InternalExecuteUpdate(Program program, IRow oldRow, IRow newRow, BitArray valueFlags, bool checkConcurrency, bool uncheckedValue)
        {
            if (PropagateUpdateLeft && PropagateUpdateRight && EnforcePredicate)
            {
                // Attempt to update the row in the left node
                try
                {
                    if (PropagateUpdateLeft)
                    {
                        using (IRow leftRow = LeftNode.FullSelect(program, oldRow))
                        {
                            if (leftRow != null)
                            {
                                LeftNode.Delete(program, oldRow, checkConcurrency, uncheckedValue);
                            }
                        }

                        LeftNode.Insert(program, oldRow, newRow, valueFlags, uncheckedValue);
                    }
                }
                catch (DataphorException exception)
                {
                    if ((exception.Severity == ErrorSeverity.User) || (exception.Severity == ErrorSeverity.Application))
                    {
                        if (PropagateUpdateRight)
                        {
                            using (IRow rightRow = RightNode.FullSelect(program, oldRow))
                            {
                                if (rightRow != null)
                                {
                                    RightNode.Delete(program, oldRow, checkConcurrency, uncheckedValue);
                                }
                            }

                            RightNode.Insert(program, oldRow, newRow, valueFlags, uncheckedValue);
                        }
                        return;
                    }
                    throw;
                }

                // Attempt to update the row in the right node
                try
                {
                    if (PropagateUpdateRight)
                    {
                        using (IRow rightRow = RightNode.FullSelect(program, oldRow))
                        {
                            if (rightRow != null)
                            {
                                RightNode.Delete(program, oldRow, checkConcurrency, uncheckedValue);
                            }
                        }

                        RightNode.Insert(program, oldRow, newRow, valueFlags, uncheckedValue);
                    }
                }
                catch (DataphorException exception)
                {
                    if ((exception.Severity != ErrorSeverity.User) && (exception.Severity != ErrorSeverity.Application))
                    {
                        throw;
                    }
                }
            }
            else
            {
                if (PropagateUpdateLeft)
                {
                    LeftNode.Update(program, oldRow, newRow, valueFlags, checkConcurrency, uncheckedValue);
                }

                if (PropagateUpdateRight)
                {
                    RightNode.Update(program, oldRow, newRow, valueFlags, checkConcurrency, uncheckedValue);
                }
            }
        }