internal void SetFields(FieldImpl[] fields, long streamOffset) { bool flag = m_referenced || streamOffset == DataFieldRow.UnInitializedStreamOffset || m_streamOffset != streamOffset; NewRow(streamOffset); if (m_collection == null) { Global.Tracer.Assert(condition: false, "Invalid FieldsImpl. m_collection should not be null."); } if (fields == null) { for (int i = 0; i < m_count; i++) { Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef = m_collection[i]?.FieldDef; m_collection[i] = new FieldImpl(m_reportOM, null, isAggregationField: false, fieldDef); } } else if (flag) { if (fields.Length != m_count) { Global.Tracer.Assert(false, "Wrong number of fields during ReportOM update. Usually this means the data set is wrong. Expected: {0}. Actual: {1}", m_count, fields.Length); } for (int j = 0; j < m_count; j++) { m_collection[j] = fields[j]; } m_isAggregateRow = false; m_aggregationFieldCount = m_aggregationFieldCountForDetailRow; } }
internal void Add(string name, FieldImpl field) { Global.Tracer.Assert(m_collection != null, "(null != m_collection)"); Global.Tracer.Assert(m_nameMap != null, "(null != m_nameMap)"); Global.Tracer.Assert(m_count < m_collection.Length, "(m_count < m_collection.Length)"); m_nameMap.Add(name, m_count); m_collection[m_count] = field; m_count++; }
internal void ConsumeAggregationField(int fieldIndex) { FieldImpl fieldImpl = this[fieldIndex]; if (!fieldImpl.AggregationFieldChecked && fieldImpl.IsAggregationField) { fieldImpl.AggregationFieldChecked = true; m_aggregationFieldCount--; } }
internal void AddFieldsUsedInExpression(List <string> fieldsUsedInValueExpression) { if (m_collection == null) { return; } for (int i = 0; i < m_collection.Length; i++) { FieldImpl fieldImpl = m_collection[i]; if (fieldImpl != null && fieldImpl.UsedInExpression && fieldImpl.FieldDef != null && fieldImpl.FieldDef.DataField != null) { fieldsUsedInValueExpression.Add(fieldImpl.FieldDef.DataField); } } }
internal void ResetFieldsUsedInExpression() { if (m_collection == null) { return; } for (int i = 0; i < m_collection.Length; i++) { FieldImpl fieldImpl = m_collection[i]; if (fieldImpl != null) { fieldImpl.UsedInExpression = false; } } }
private void CreateAndInitializeCalculatedFieldWrapper(ObjectModelImpl reportOM, bool readerExtensionsSupported, DataSetCore dataSet, int fieldIndex, Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef) { CalculatedFieldWrapperImpl value = new CalculatedFieldWrapperImpl(fieldDef, reportOM.OdpContext.ReportRuntime); bool isAggregationField = (!readerExtensionsSupported) ? true : false; if (dataSet.InterpretSubtotalsAsDetails == Microsoft.ReportingServices.ReportIntermediateFormat.DataSet.TriState.True) { isAggregationField = true; } m_fields[fieldIndex] = new FieldImpl(reportOM, value, isAggregationField, fieldDef); if (dataSet.ExprHost != null && fieldDef.ExprHost == null) { fieldDef.SetExprHost(dataSet.ExprHost, reportOM); } }
internal void SetRowIndex(int rowIndex) { Global.Tracer.Assert(m_addRowIndex, "(m_addRowIndex)"); Global.Tracer.Assert(m_count > 0, "(m_count > 0)"); m_collection[m_count - 1] = new FieldImpl(m_reportOM, rowIndex, isAggregationField: false, null); }
internal void UpdateFieldValues(ObjectModelImpl reportOM, bool useDataSetFieldsCache, bool reuseFieldObjects, Microsoft.ReportingServices.ReportIntermediateFormat.RecordRow row, DataSetInstance dataSetInstance, bool readerExtensionsSupported) { Global.Tracer.Assert(row != null, "Empty data row / no data reader"); if (m_dataSetInstance != dataSetInstance) { m_dataSetInstance = dataSetInstance; m_dataSet = dataSetInstance.DataSetDef.DataSetCore; if (m_dataSet.FieldsContext != null && useDataSetFieldsCache) { m_fields = m_dataSet.FieldsContext.Fields; } else { reuseFieldObjects = false; } m_dataReader = null; m_lastRowOffset = DataFieldRow.UnInitializedStreamOffset; m_pendingFieldValueUpdate = false; } m_allFieldsCleared = false; FieldInfo[] fieldInfos = dataSetInstance.FieldInfos; if (m_fields.ReaderExtensionsSupported && m_dataSet.InterpretSubtotalsAsDetails == Microsoft.ReportingServices.ReportIntermediateFormat.DataSet.TriState.False) { m_fields.IsAggregateRow = row.IsAggregateRow; m_fields.AggregationFieldCount = row.AggregationFieldCount; if (!row.IsAggregateRow) { m_fields.AggregationFieldCountForDetailRow = row.AggregationFieldCount; } } int num = 0; int count = m_dataSet.Fields.Count; int num2 = row.RecordFields.Length; for (num = 0; num < num2; num++) { FieldImpl fieldImpl = reuseFieldObjects ? m_fields.GetFieldByIndex(num) : null; Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef = m_dataSet.Fields[num]; Microsoft.ReportingServices.ReportIntermediateFormat.RecordField recordField = row.RecordFields[num]; if (recordField == null) { if (!reuseFieldObjects || fieldImpl == null) { fieldImpl = new FieldImpl(reportOM, DataFieldStatus.IsMissing, null, fieldDef); } else { fieldImpl.UpdateValue(null, isAggregationField: false, DataFieldStatus.IsMissing, null); } } else if (recordField.FieldStatus == DataFieldStatus.None) { if (!reuseFieldObjects || fieldImpl == null) { fieldImpl = new FieldImpl(reportOM, recordField.FieldValue, recordField.IsAggregationField, fieldDef); } else { fieldImpl.UpdateValue(recordField.FieldValue, recordField.IsAggregationField, DataFieldStatus.None, null); } } else if (!reuseFieldObjects || fieldImpl == null) { fieldImpl = new FieldImpl(reportOM, recordField.FieldStatus, ReportRuntime.GetErrorName(recordField.FieldStatus, null), fieldDef); } else { fieldImpl.UpdateValue(null, isAggregationField: false, recordField.FieldStatus, ReportRuntime.GetErrorName(recordField.FieldStatus, null)); } if (recordField != null && fieldInfos != null) { FieldInfo fieldInfo = fieldInfos[num]; if (fieldInfo != null && fieldInfo.PropertyCount != 0 && recordField.FieldPropertyValues != null) { for (int i = 0; i < fieldInfo.PropertyCount; i++) { fieldImpl.SetProperty(fieldInfo.PropertyNames[i], recordField.FieldPropertyValues[i]); } } } m_fields[num] = fieldImpl; } if (num >= count) { return; } if (!reuseFieldObjects && reportOM.OdpContext.ReportRuntime.ReportExprHost != null) { m_dataSet.SetExprHost(reportOM.OdpContext.ReportRuntime.ReportExprHost, reportOM); } for (; num < count; num++) { Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef2 = m_dataSet.Fields[num]; FieldImpl fieldImpl2 = reuseFieldObjects ? m_fields.GetFieldByIndex(num) : null; if (reuseFieldObjects && fieldImpl2 != null) { if (!fieldImpl2.ResetCalculatedField()) { CreateAndInitializeCalculatedFieldWrapper(reportOM, readerExtensionsSupported, m_dataSet, num, fieldDef2); } } else { CreateAndInitializeCalculatedFieldWrapper(reportOM, readerExtensionsSupported, m_dataSet, num, fieldDef2); } } }