public void RestoreOriginalState(AggregateUpdateQueue queue) { if (queue != null) { m_activeAggregates = queue.OriginalState; } }
private AggregateUpdateQueue HandleNewBuckets(BucketedDataAggregateObjs aggBuckets, bool canMergeActiveAggs) { bool flag = aggBuckets == null || aggBuckets.Buckets.Count == 0; if (canMergeActiveAggs && flag) { return(null); } AggregateUpdateQueue aggregateUpdateQueue = new AggregateUpdateQueue(m_activeAggregates); AggregateUpdateCollection aggregateUpdateCollection = null; if (canMergeActiveAggs) { aggregateUpdateCollection = m_activeAggregates; } m_activeAggregates = null; if (flag) { return(aggregateUpdateQueue); } for (int i = 0; i < aggBuckets.Buckets.Count; i++) { AggregateBucket <Microsoft.ReportingServices.ReportIntermediateFormat.DataAggregateObj> aggregateBucket = aggBuckets.Buckets[i]; AggregateUpdateCollection aggregateUpdateCollection2 = new AggregateUpdateCollection(aggregateBucket); if (aggregateUpdateCollection != null) { if (aggregateUpdateCollection.Level == aggregateBucket.Level) { aggregateUpdateCollection2.LinkedCollection = aggregateUpdateCollection; aggregateUpdateCollection = null; } else if (aggregateUpdateCollection.Level < aggregateBucket.Level) { aggregateUpdateCollection2 = aggregateUpdateCollection; i--; aggregateUpdateCollection = null; } } if (m_activeAggregates == null) { m_activeAggregates = aggregateUpdateCollection2; } else { aggregateUpdateQueue.Enqueue(aggregateUpdateCollection2); } } if (aggregateUpdateCollection != null) { aggregateUpdateQueue.Enqueue(aggregateUpdateCollection); } return(aggregateUpdateQueue); }
public bool AdvanceQueue(AggregateUpdateQueue queue) { if (queue == null) { return(false); } if (queue.Count == 0) { RestoreOriginalState(queue); return(false); } m_activeAggregates = queue.Dequeue(); return(true); }
internal override bool SortAndFilter(AggregateUpdateContext aggContext) { SetupEnvironment(); if (m_userSortTargetInfo != null) { m_userSortTargetInfo.EnterProcessUserSortPhase(m_odpContext); } bool num = base.DataRegionDef.ProcessingInnerGrouping == Microsoft.ReportingServices.ReportIntermediateFormat.DataRegion.ProcessingInnerGroupings.Column; IReference <RuntimeMemberObj>[] array = num ? m_outerGroupings : m_innerGroupings; IReference <RuntimeMemberObj>[] array2 = num ? m_innerGroupings : m_outerGroupings; int rowDomainScopeCount = base.DataRegionDef.RowDomainScopeCount; int columnDomainScopeCount = base.DataRegionDef.ColumnDomainScopeCount; DomainScopeContext domainScopeContext = base.OdpContext.DomainScopeContext; AggregateUpdateQueue workQueue = null; if (m_odpContext.HasSecondPassOperation(SecondPassOperations.FilteringOrAggregatesOrDomainScope)) { workQueue = RuntimeDataRegionObj.AggregateOfAggregatesStart(aggContext, this, m_dataRegionDef.DataScopeInfo, m_aggregatesOfAggregates, AggregateUpdateFlags.Both, needsSetupEnvironment: false); if (rowDomainScopeCount > 0) { domainScopeContext.AddDomainScopes(array, array.Length - rowDomainScopeCount); } if (columnDomainScopeCount > 0) { domainScopeContext.AddDomainScopes(array2, array2.Length - columnDomainScopeCount); } } Traverse(ProcessingStages.SortAndFilter, aggContext); base.SortAndFilter(aggContext); if (m_odpContext.HasSecondPassOperation(SecondPassOperations.FilteringOrAggregatesOrDomainScope)) { RuntimeDataRegionObj.AggregatesOfAggregatesEnd(this, aggContext, workQueue, m_dataRegionDef.DataScopeInfo, m_aggregatesOfAggregates, updateAggsIfNeeded: true); if (rowDomainScopeCount > 0) { domainScopeContext.RemoveDomainScopes(array, array.Length - rowDomainScopeCount); } if (columnDomainScopeCount > 0) { domainScopeContext.RemoveDomainScopes(array2, array2.Length - columnDomainScopeCount); } } if (m_userSortTargetInfo != null) { m_userSortTargetInfo.LeaveProcessUserSortPhase(m_odpContext); } return(true); }
public AggregateUpdateQueue RegisterRunningValuesToUpdate(AggregateUpdateQueue workQueue, List <Microsoft.ReportingServices.ReportIntermediateFormat.RunningValueInfo> runningValues) { if (runningValues == null || runningValues.Count == 0) { return(workQueue); } if (workQueue == null) { workQueue = new AggregateUpdateQueue(m_activeAggregates); AggregateUpdateCollection aggregateUpdateCollection = new AggregateUpdateCollection(runningValues); aggregateUpdateCollection.LinkedCollection = m_activeAggregates; m_activeAggregates = aggregateUpdateCollection; } else { m_activeAggregates.MergeRunningValues(runningValues); } return(workQueue); }
internal static AggregateUpdateQueue AggregateOfAggregatesStart(AggregateUpdateContext aggContext, IDataRowHolder scope, DataScopeInfo dataScopeInfo, BucketedDataAggregateObjs aggregatesOfAggregates, AggregateUpdateFlags updateFlags, bool needsSetupEnvironment) { if (dataScopeInfo == null) { return(null); } AggregateUpdateQueue result = null; if (aggContext.Mode == AggregateMode.Aggregates) { if (dataScopeInfo.NeedsSeparateAofAPass) { result = aggContext.ReplaceAggregatesToUpdate(aggregatesOfAggregates); } else { result = aggContext.RegisterAggregatesToUpdate(aggregatesOfAggregates); if (updateFlags != 0) { UpdateAggregatesAtScope(aggContext, scope, dataScopeInfo, updateFlags, needsSetupEnvironment); } } } else if (aggContext.Mode == AggregateMode.PostSortAggregates) { result = aggContext.RegisterAggregatesToUpdate(aggregatesOfAggregates); result = aggContext.RegisterRunningValuesToUpdate(result, dataScopeInfo.RunningValuesOfAggregates); if (updateFlags != 0) { UpdateAggregatesAtScope(aggContext, scope, dataScopeInfo, updateFlags, needsSetupEnvironment); } } else { Global.Tracer.Assert(condition: false, "Unknown AggregateMode for AggregateOfAggregatesStart"); } return(result); }
internal override void CalculateRunningValues(Dictionary <string, IReference <RuntimeGroupRootObj> > groupCol, IReference <RuntimeGroupRootObj> lastGroup, AggregateUpdateContext aggContext) { if (m_dataRegionDef.RunningValues != null && m_runningValues == null && m_previousValues == null) { AddRunningValues(m_odpContext, m_dataRegionDef.RunningValues, ref m_runningValues, ref m_previousValues, groupCol, lastGroup); } if (m_dataRegionDef.DataScopeInfo != null) { List <string> runningValuesInGroup = null; List <string> previousValuesInGroup = null; AddRunningValues(m_odpContext, m_dataRegionDef.DataScopeInfo.RunningValuesOfAggregates, ref runningValuesInGroup, ref previousValuesInGroup, groupCol, lastGroup); } bool flag = m_dataRows != null && FlagUtils.HasFlag(m_dataAction, DataActions.PostSortAggregates); AggregateUpdateQueue workQueue = RuntimeDataRegionObj.AggregateOfAggregatesStart(aggContext, this, m_dataRegionDef.DataScopeInfo, m_postSortAggregatesOfAggregates, flag ? AggregateUpdateFlags.ScopedAggregates : AggregateUpdateFlags.Both, needsSetupEnvironment: true); if (flag) { DataActions dataActions = DataActions.PostSortAggregates; if (aggContext.LastScopeNeedsRowAggregateProcessing()) { dataActions |= DataActions.PostSortAggregatesOfAggregates; } ReadRows(dataActions, aggContext); m_dataRows = null; } int num = (m_outerGroupings != null) ? m_outerGroupings.Length : 0; if (num == 0) { if (m_innerGroupings != null) { for (int i = 0; i < m_innerGroupings.Length; i++) { IReference <RuntimeMemberObj> reference = m_innerGroupings[i]; using (reference.PinValue()) { reference.Value().CalculateRunningValues(groupCol, lastGroup, aggContext); } } } } else { for (int j = 0; j < num; j++) { IReference <RuntimeMemberObj> reference2 = m_outerGroupings[j]; bool flag2; using (reference2.PinValue()) { RuntimeMemberObj runtimeMemberObj = reference2.Value(); runtimeMemberObj.CalculateRunningValues(groupCol, lastGroup, aggContext); flag2 = (runtimeMemberObj.GroupRoot == null); } if (!flag2 || m_innerGroupings == null) { continue; } for (int k = 0; k < m_innerGroupings.Length; k++) { IReference <RuntimeMemberObj> reference3 = m_innerGroupings[k]; using (reference3.PinValue()) { RuntimeMemberObj runtimeMemberObj2 = reference3.Value(); runtimeMemberObj2.PrepareCalculateRunningValues(); runtimeMemberObj2.CalculateRunningValues(groupCol, lastGroup, aggContext); } } } } CalculateRunningValuesForTopLevelStaticContents(groupCol, lastGroup, aggContext); RuntimeDataRegionObj.AggregatesOfAggregatesEnd(this, aggContext, workQueue, m_dataRegionDef.DataScopeInfo, m_postSortAggregatesOfAggregates, updateAggsIfNeeded: true); CalculateDRPreviousAggregates(); RuntimeRICollection.StoreRunningValues(m_odpContext.ReportObjectModel.AggregatesImpl, m_dataRegionDef.RunningValues, ref m_runningValueValues); if (m_dataRegionDef.DataScopeInfo != null) { RuntimeRICollection.StoreRunningValues(m_odpContext.ReportObjectModel.AggregatesImpl, m_dataRegionDef.DataScopeInfo.RunningValuesOfAggregates, ref m_runningValueOfAggregateValues); } }
internal static void AggregatesOfAggregatesEnd(IScope scopeObj, AggregateUpdateContext aggContext, AggregateUpdateQueue workQueue, DataScopeInfo dataScopeInfo, BucketedDataAggregateObjs aggregatesOfAggregates, bool updateAggsIfNeeded) { if (dataScopeInfo == null) { return; } if (updateAggsIfNeeded) { while (aggContext.AdvanceQueue(workQueue)) { scopeObj.UpdateAggregates(aggContext); } } aggContext.RestoreOriginalState(workQueue); if (aggContext.Mode == AggregateMode.Aggregates && dataScopeInfo.NeedsSeparateAofAPass && updateAggsIfNeeded) { scopeObj.UpdateAggregates(aggContext); } }