Пример #1
0
        public override void HandleMatching(
            EventBean[] triggerEvents,
            EventBean[] matchingEvents)
        {
            agentInstanceContext.InstrumentationProvider.QInfraOnAction(
                OnTriggerType.ON_DELETE,
                triggerEvents,
                matchingEvents);

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

                // The on-delete listeners receive the events deleted, but only if there is interest
                var statementResultService = agentInstanceContext.StatementResultService;
                if (statementResultService.IsMakeNatural || statementResultService.IsMakeSynthetic) {
                    var posted = OnExprViewTableUtil.ToPublic(
                        matchingEvents,
                        tableInstance.Table,
                        triggerEvents,
                        true,
                        ExprEvaluatorContext);
                    Child.Update(posted, null);
                }
            }

            agentInstanceContext.InstrumentationProvider.AInfraOnAction();
        }
Пример #2
0
        public override void HandleMatching(
            EventBean[] triggerEvents,
            EventBean[] matchingEvents)
        {
            agentInstanceContext.InstrumentationProvider.QInfraOnAction(
                OnTriggerType.ON_UPDATE,
                triggerEvents,
                matchingEvents);

            var eventsPerStream = new EventBean[3];

            var statementResultService = agentInstanceContext.StatementResultService;
            var postUpdates = statementResultService.IsMakeNatural || statementResultService.IsMakeSynthetic;
            EventBean[] postedOld = null;
            if (postUpdates) {
                postedOld = OnExprViewTableUtil.ToPublic(
                    matchingEvents,
                    tableInstance.Table,
                    triggerEvents,
                    false,
                    ExprEvaluatorContext);
            }

            var tableUpdateStrategy = parent.TableUpdateStrategy;

            foreach (var triggerEvent in triggerEvents) {
                eventsPerStream[1] = triggerEvent;
                var matching = (IList<EventBean>) matchingEvents ?? EmptyList<EventBean>.Instance; 
                tableUpdateStrategy.UpdateTable(
                    matching, 
                    tableInstance, 
                    eventsPerStream,
                    agentInstanceContext);
            }

            // The on-delete listeners receive the events deleted, but only if there is interest
            if (postUpdates) {
                var postedNew = OnExprViewTableUtil.ToPublic(
                    matchingEvents,
                    tableInstance.Table,
                    triggerEvents,
                    true,
                    ExprEvaluatorContext);
                Child.Update(postedNew, postedOld);
            }

            agentInstanceContext.InstrumentationProvider.AInfraOnAction();
        }