Exemple #1
0
        public override void HandleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QInfraOnAction(OnTriggerType.ON_DELETE, triggerEvents, matchingEvents);
            }

            if ((matchingEvents != null) && (matchingEvents.Length > 0))
            {
                foreach (EventBean @event in matchingEvents)
                {
                    TableStateInstance.DeleteEvent(@event);
                }

                // The on-delete listeners receive the events deleted, but only if there is interest
                if (parent.StatementResultService.IsMakeNatural || parent.StatementResultService.IsMakeSynthetic)
                {
                    EventBean[] posted = TableOnViewUtil.ToPublic(matchingEvents, parent.TableMetadata, triggerEvents, true, base.ExprEvaluatorContext);
                    UpdateChildren(posted, null);
                }
            }

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AInfraOnAction();
            }
        }
Exemple #2
0
        public override void HandleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QInfraOnAction(OnTriggerType.ON_UPDATE, triggerEvents, matchingEvents);
            }

            EventBean[] eventsPerStream = new EventBean[3];

            bool postUpdates = parent.StatementResultService.IsMakeNatural || parent.StatementResultService.IsMakeSynthetic;

            EventBean[] postedOld = null;
            if (postUpdates)
            {
                postedOld = TableOnViewUtil.ToPublic(matchingEvents, parent.TableMetadata, triggerEvents, false, base.ExprEvaluatorContext);
            }

            TableUpdateStrategy tableUpdateStrategy = parent.TableUpdateStrategy;

            foreach (EventBean triggerEvent in triggerEvents)
            {
                eventsPerStream[1] = triggerEvent;
                tableUpdateStrategy.UpdateTable(matchingEvents, TableStateInstance, eventsPerStream, exprEvaluatorContext);
            }

            // The on-delete listeners receive the events deleted, but only if there is interest
            if (postUpdates)
            {
                EventBean[] postedNew = TableOnViewUtil.ToPublic(matchingEvents, parent.TableMetadata, triggerEvents, true, base.ExprEvaluatorContext);
                UpdateChildren(postedNew, postedOld);
            }

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AInfraOnAction();
            }
        }