Beispiel #1
0
 private string SetCommandText(IDbCommand command)
 {
     try
     {
         if (m_dataSet.Query.CommandText != null)
         {
             Microsoft.ReportingServices.RdlExpressions.StringResult stringResult = m_odpContext.ReportRuntime.EvaluateCommandText(m_dataSet);
             if (stringResult.ErrorOccurred)
             {
                 throw new ReportProcessingException(ErrorCode.rsQueryCommandTextProcessingError, m_dataSet.Name.MarkAsPrivate());
             }
             command.CommandText = stringResult.Value;
             if (m_odpContext.UseVerboseExecutionLogging)
             {
                 m_executionMetrics.CommandText = stringResult.Value;
             }
             return(stringResult.Value);
         }
         return(null);
     }
     catch (Exception innerException)
     {
         throw new ReportProcessingException(ErrorCode.rsErrorSettingCommandText, innerException, m_dataSet.Name.MarkAsPrivate());
     }
 }
Beispiel #2
0
 private string EvaluateConnectStringExpression(OnDemandProcessingContext processingContext)
 {
     if (m_connectString == null)
     {
         return(null);
     }
     if (ExpressionInfo.Types.Constant == m_connectString.Type)
     {
         return(m_connectString.StringValue);
     }
     Global.Tracer.Assert(processingContext.ReportRuntime != null, "(null != processingContext.ReportRuntime)");
     if (processingContext.ReportRuntime.ReportExprHost != null)
     {
         SetExprHost(processingContext.ReportRuntime.ReportExprHost, processingContext.ReportObjectModel);
     }
     Microsoft.ReportingServices.RdlExpressions.StringResult stringResult = processingContext.ReportRuntime.EvaluateConnectString(this);
     if (stringResult.ErrorOccurred)
     {
         throw new ReportProcessingException(ErrorCode.rsDataSourceConnectStringProcessingError, m_name);
     }
     return(stringResult.Value);
 }
        internal bool PassFilters(object dataInstance, out bool specialFilter)
        {
            bool flag = true;

            specialFilter = false;
            if (m_failFilters)
            {
                return(false);
            }
            if (m_filters != null)
            {
                for (int num = m_startFilterIndex; num < m_filters.Count; num++)
                {
                    Microsoft.ReportingServices.ReportIntermediateFormat.Filter filter = m_filters[num];
                    if (Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.Like == filter.Operator)
                    {
                        Microsoft.ReportingServices.RdlExpressions.StringResult stringResult = m_processingContext.ReportRuntime.EvaluateFilterStringExpression(filter, m_objectType, m_objectName);
                        ThrowIfErrorOccurred("FilterExpression", stringResult.ErrorOccurred, stringResult.FieldStatus);
                        Global.Tracer.Assert(filter.Values != null, "(null != filter.Values)");
                        Global.Tracer.Assert(1 <= filter.Values.Count, "(1 <= filter.Values.Count)");
                        Microsoft.ReportingServices.RdlExpressions.StringResult stringResult2 = m_processingContext.ReportRuntime.EvaluateFilterStringValue(filter, 0, m_objectType, m_objectName);
                        ThrowIfErrorOccurred("FilterValue", stringResult2.ErrorOccurred, stringResult2.FieldStatus);
                        if (stringResult.Value != null && stringResult2.Value != null)
                        {
                            if (!StringType.StrLikeText(stringResult.Value, stringResult2.Value))
                            {
                                flag = false;
                            }
                        }
                        else if (stringResult.Value != null || stringResult2.Value != null)
                        {
                            flag = false;
                        }
                    }
                    else
                    {
                        Microsoft.ReportingServices.RdlExpressions.VariantResult variantResult = m_processingContext.ReportRuntime.EvaluateFilterVariantExpression(filter, m_objectType, m_objectName);
                        ThrowIfErrorOccurred("FilterExpression", variantResult.ErrorOccurred, variantResult.FieldStatus);
                        object value = variantResult.Value;
                        if (filter.Operator == Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.Equal || Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.NotEqual == filter.Operator || Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.GreaterThan == filter.Operator || Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.GreaterThanOrEqual == filter.Operator || Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.LessThan == filter.Operator || Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.LessThanOrEqual == filter.Operator)
                        {
                            object value2 = EvaluateFilterValue(filter);
                            int    num2   = 0;
                            try
                            {
                                num2 = Compare(value, value2);
                            }
                            catch (ReportProcessingException_SpatialTypeComparisonError reportProcessingException_SpatialTypeComparisonError)
                            {
                                throw new ReportProcessingException(RegisterSpatialTypeComparisonError(reportProcessingException_SpatialTypeComparisonError.Type));
                            }
                            catch (ReportProcessingException_ComparisonError e)
                            {
                                throw new ReportProcessingException(RegisterComparisonError(e));
                            }
                            catch (Exception e2)
                            {
                                if (AsynchronousExceptionDetection.IsStoppingException(e2))
                                {
                                    throw;
                                }
                                throw new ReportProcessingException(RegisterComparisonError());
                            }
                            if (flag)
                            {
                                switch (filter.Operator)
                                {
                                case Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.Equal:
                                    if (num2 != 0)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.NotEqual:
                                    if (num2 == 0)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.GreaterThan:
                                    if (0 >= num2)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.GreaterThanOrEqual:
                                    if (0 > num2)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.LessThan:
                                    if (0 <= num2)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.LessThanOrEqual:
                                    if (0 < num2)
                                    {
                                        flag = false;
                                    }
                                    break;
                                }
                            }
                        }
                        else if (Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.In == filter.Operator)
                        {
                            object[] array = EvaluateFilterValues(filter);
                            flag = false;
                            if (array != null)
                            {
                                for (int i = 0; i < array.Length; i++)
                                {
                                    try
                                    {
                                        if (array[i] is ICollection)
                                        {
                                            foreach (object item in (ICollection)array[i])
                                            {
                                                if (Compare(value, item) == 0)
                                                {
                                                    flag = true;
                                                    break;
                                                }
                                            }
                                        }
                                        else if (Compare(value, array[i]) == 0)
                                        {
                                            flag = true;
                                        }
                                        if (flag)
                                        {
                                            goto IL_05e1;
                                        }
                                    }
                                    catch (ReportProcessingException_SpatialTypeComparisonError reportProcessingException_SpatialTypeComparisonError2)
                                    {
                                        throw new ReportProcessingException(RegisterSpatialTypeComparisonError(reportProcessingException_SpatialTypeComparisonError2.Type));
                                    }
                                    catch (ReportProcessingException_ComparisonError e3)
                                    {
                                        throw new ReportProcessingException(RegisterComparisonError(e3));
                                    }
                                    catch (Exception e4)
                                    {
                                        if (AsynchronousExceptionDetection.IsStoppingException(e4))
                                        {
                                            throw;
                                        }
                                        throw new ReportProcessingException(RegisterComparisonError());
                                    }
                                }
                            }
                        }
                        else if (Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.Between == filter.Operator)
                        {
                            object[] array2 = EvaluateFilterValues(filter);
                            flag = false;
                            Global.Tracer.Assert(array2 != null && 2 == array2.Length, "(null != values && 2 == values.Length)");
                            try
                            {
                                if (0 <= Compare(value, array2[0]) && 0 >= Compare(value, array2[1]))
                                {
                                    flag = true;
                                }
                            }
                            catch (ReportProcessingException_SpatialTypeComparisonError reportProcessingException_SpatialTypeComparisonError3)
                            {
                                throw new ReportProcessingException(RegisterSpatialTypeComparisonError(reportProcessingException_SpatialTypeComparisonError3.Type));
                            }
                            catch (ReportProcessingException_ComparisonError e5)
                            {
                                throw new ReportProcessingException(RegisterComparisonError(e5));
                            }
                            catch (RSException)
                            {
                                throw;
                            }
                            catch (Exception e6)
                            {
                                if (AsynchronousExceptionDetection.IsStoppingException(e6))
                                {
                                    throw;
                                }
                                throw new ReportProcessingException(RegisterComparisonError());
                            }
                        }
                        else if (Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.TopN == filter.Operator || Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.BottomN == filter.Operator)
                        {
                            if (m_filterInfo == null)
                            {
                                Global.Tracer.Assert(filter.Values != null && 1 == filter.Values.Count, "(null != filter.Values && 1 == filter.Values.Count)");
                                Microsoft.ReportingServices.RdlExpressions.IntegerResult integerResult = m_processingContext.ReportRuntime.EvaluateFilterIntegerValue(filter, 0, m_objectType, m_objectName);
                                ThrowIfErrorOccurred("FilterValue", integerResult.ErrorOccurred, integerResult.FieldStatus);
                                int       value3   = integerResult.Value;
                                IComparer comparer = (Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.TopN != filter.Operator) ? ((IComparer) new MyBottomComparer(m_processingContext.ProcessingComparer)) : ((IComparer) new MyTopComparer(m_processingContext.ProcessingComparer));
                                InitFilterInfos(new MySortedListWithMaxSize(comparer, value3, this), num);
                            }
                            SortAndSave(value, dataInstance);
                            flag          = false;
                            specialFilter = true;
                        }
                        else if (Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.TopPercent == filter.Operator || Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.BottomPercent == filter.Operator)
                        {
                            if (m_filterInfo == null)
                            {
                                Global.Tracer.Assert(filter.Values != null && 1 == filter.Values.Count, "(null != filter.Values && 1 == filter.Values.Count)");
                                Microsoft.ReportingServices.RdlExpressions.FloatResult floatResult = m_processingContext.ReportRuntime.EvaluateFilterIntegerOrFloatValue(filter, 0, m_objectType, m_objectName);
                                ThrowIfErrorOccurred("FilterValue", floatResult.ErrorOccurred, floatResult.FieldStatus);
                                double    value4    = floatResult.Value;
                                IComparer comparer2 = (Microsoft.ReportingServices.ReportIntermediateFormat.Filter.Operators.TopPercent != filter.Operator) ? ((IComparer) new MyBottomComparer(m_processingContext.ProcessingComparer)) : ((IComparer) new MyTopComparer(m_processingContext.ProcessingComparer));
                                InitFilterInfos(new MySortedListWithoutMaxSize(comparer2, this), num);
                                m_filterInfo.Percentage = value4;
                                m_filterInfo.Operator   = filter.Operator;
                            }
                            SortAndSave(value, dataInstance);
                            flag          = false;
                            specialFilter = true;
                        }
                    }
                    goto IL_05e1;
IL_05e1:
                    if (!flag)
                    {
                        return(false);
                    }
                }
            }
            return(flag);
        }