Beispiel #1
0
        protected void ValidatePredicate(Program program, IRow row)
        {
            if (EnforcePredicate)
            {
                bool rightNodeValid = false;
                try
                {
                    RightNode.Insert(program, null, row, null, false);
                    rightNodeValid = true;
                    RightNode.Delete(program, row, false, false);
                }
                catch (DataphorException exception)
                {
                    if ((exception.Severity != ErrorSeverity.User) && (exception.Severity != ErrorSeverity.Application))
                    {
                        throw;
                    }
                }

                if (rightNodeValid)
                {
                    throw new RuntimeException(RuntimeException.Codes.RowViolatesDifferencePredicate, ErrorSeverity.User);
                }
            }
        }
Beispiel #2
0
        protected override void InternalExecuteDelete(Program program, IRow row, bool checkConcurrency, bool uncheckedValue)
        {
            if (PropagateDeleteLeft)
            {
                using (IRow leftRow = LeftNode.FullSelect(program, row))
                {
                    if (leftRow != null)
                    {
                        LeftNode.Delete(program, row, checkConcurrency, uncheckedValue);
                    }
                }
            }

            if (PropagateDeleteRight)
            {
                using (IRow rightRow = RightNode.FullSelect(program, row))
                {
                    if (rightRow != null)
                    {
                        RightNode.Delete(program, row, checkConcurrency, uncheckedValue);
                    }
                }
            }
        }
Beispiel #3
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);
                }
            }
        }