protected bool InitializeDataSource(ExecutedQuery existingQuery)
 {
     if (this.m_dataSource.DataSets != null && 0 < this.m_dataSource.DataSets.Count)
     {
         this.m_connection            = null;
         this.m_transaction           = null;
         this.m_needToCloseConnection = false;
         this.m_isGlobalConnection    = false;
         this.m_isTransactionOwner    = false;
         this.m_isGlobalTransaction   = false;
         this.m_runtimeDataSets       = this.CreateRuntimeDataSets();
         if (0 >= this.m_runtimeDataSets.Count)
         {
             return(false);
         }
         this.m_canAbort = true;
         this.m_odpContext.CheckAndThrowIfAborted();
         this.m_useConcurrentDataSetProcessing = (this.m_runtimeDataSets.Count > 1 && this.AllowConcurrentProcessing);
         if (!this.m_dataSource.IsArtificialForSharedDataSets)
         {
             if (existingQuery != null)
             {
                 this.InitializeFromExistingQuery(existingQuery);
             }
             else
             {
                 this.OpenInitialConnectionAndTransaction();
             }
         }
         return(true);
     }
     return(false);
 }
 public void AssumeOwnership(ref IDbConnection connection, ref IDbCommand command, ref IDbCommand commandWrappedForCancel, ref IDataReader dataReader)
 {
     ExecutedQuery.AssignAndClear <IDbConnection>(ref this.m_connection, ref connection);
     ExecutedQuery.AssignAndClear <IDbCommand>(ref this.m_command, ref command);
     ExecutedQuery.AssignAndClear <IDbCommand>(ref this.m_commandWrappedForCancel, ref commandWrappedForCancel);
     ExecutedQuery.AssignAndClear <IDataReader>(ref this.m_dataReader, ref dataReader);
 }
        public void Initialize()
        {
            ExecutedQuery executedQuery = null;

            try
            {
                ExecutedQueryCache executedQueryCache = base.m_odpContext.StateManager.ExecutedQueryCache;
                if (executedQueryCache != null)
                {
                    executedQueryCache.Extract(this.m_dataSet, out executedQuery);
                }
                base.InitializeDataSource(executedQuery);
                this.InitializeDataSet(executedQuery);
            }
            catch (Exception e)
            {
                base.HandleException(e);
                this.FinalCleanup();
                if (executedQuery != null)
                {
                    executedQuery.Close();
                }
                throw;
            }
        }
 private void Process(ExecutedQuery existingQuery)
 {
     this.InitializeDataSet();
     try
     {
         try
         {
             this.InitializeRowSourceAndProcessRows(existingQuery);
         }
         finally
         {
             this.CleanupProcess();
         }
         this.AllRowsRead();
         this.TeardownDataSet();
     }
     catch (RSException)
     {
         throw;
     }
     catch (Exception e)
     {
         if (AsynchronousExceptionDetection.IsStoppingException(e))
         {
             throw;
         }
         this.CleanupForException();
         throw;
     }
     finally
     {
         this.FinalCleanup();
     }
 }
        private bool TakeOwnershipFromExistingQuery(ExecutedQuery query)
        {
            IDataReader dataReader = null;

            try
            {
                base.m_executionMetrics.Add(query.ExecutionMetrics);
                base.m_executionMetrics.CommandText = query.ExecutionMetrics.CommandText;
                query.ReleaseOwnership(ref base.m_command, ref base.m_commandWrappedForCancel, ref dataReader);
                this.ExtractRewrittenCommandText(base.m_command);
                this.StoreDataReader(dataReader, query.ErrorInspector);
                return(RuntimeDataSet.ReaderExtensionsSupported(dataReader));
            }
            catch (RSException)
            {
                this.EagerInlineReaderCleanup(ref dataReader);
                throw;
            }
            catch (Exception e)
            {
                if (AsynchronousExceptionDetection.IsStoppingException(e))
                {
                    throw;
                }
                this.EagerInlineReaderCleanup(ref dataReader);
                throw;
            }
        }
Пример #6
0
 public void Initialize(ExecutedQuery existingQuery)
 {
     try
     {
         this.InitializeDataSet();
         if (base.m_dataSet.IsReferenceToSharedDataSet)
         {
             Global.Tracer.Assert(false, "Shared data sets cannot be used with a RuntimeIncrementalDataSet");
         }
         else if (existingQuery != null)
         {
             base.InitializeAndRunFromExistingQuery(existingQuery);
         }
         else
         {
             base.InitializeAndRunLiveQuery();
         }
     }
     catch (Exception)
     {
         this.CleanupForException();
         this.FinalCleanup();
         throw;
     }
 }
 private void InitializeFromExistingQuery(ExecutedQuery query)
 {
     query.ReleaseOwnership(ref this.m_connection);
     this.m_needToCloseConnection = true;
     this.MergeAutoCollationSettings(this.m_connection);
     this.m_executionMetrics.Add(DataProcessingMetrics.MetricType.OpenConnection, query.ExecutionMetrics.OpenConnectionDurationMs);
     this.m_executionMetrics.ConnectionFromPool = query.ExecutionMetrics.ConnectionFromPool;
     this.m_totalDurationFromExistingQuery      = new TimeMetric(query.ExecutionMetrics.TotalDuration);
 }
Пример #8
0
        public void Add(ExecutedQuery query)
        {
            int indexInCollection = query.DataSet.IndexInCollection;

            for (int i = this.m_queries.Count - 1; i <= indexInCollection; i++)
            {
                this.m_queries.Add(null);
            }
            this.m_queries[indexInCollection] = query;
        }
Пример #9
0
 public void Close()
 {
     for (int i = 0; i < this.m_queries.Count; i++)
     {
         ExecutedQuery executedQuery = this.m_queries[i];
         if (executedQuery != null)
         {
             executedQuery.Close();
         }
         this.m_queries[i] = null;
     }
 }
Пример #10
0
        public void Extract(DataSet dataSet, out ExecutedQuery query)
        {
            int indexInCollection = dataSet.IndexInCollection;

            if (indexInCollection >= this.m_queries.Count)
            {
                query = null;
            }
            else
            {
                query = this.m_queries[indexInCollection];
                this.m_queries[indexInCollection] = null;
            }
        }
        private bool RunFromExistingQuery(ExecutedQuery query)
        {
            if (this.m_dataSetInstance != null)
            {
                this.m_dataSetInstance.SetQueryExecutionTime(query.QueryExecutionTimestamp);
                this.m_dataSetInstance.CommandText = query.CommandText;
            }
            bool result = this.TakeOwnershipFromExistingQuery(query);

            if (!base.m_odpContext.IsSharedDataSetExecutionOnly && this.m_dataSetInstance != null)
            {
                this.m_dataSetInstance.SaveCollationSettings(base.m_dataSet);
                this.UpdateReportOMDataSet();
            }
            return(result);
        }
 protected virtual void InitializeRowSourceAndProcessRows(ExecutedQuery existingQuery)
 {
     if (base.m_dataSet.IsReferenceToSharedDataSet)
     {
         base.ProcessSharedDataSetReference();
     }
     else
     {
         if (existingQuery != null)
         {
             base.InitializeAndRunFromExistingQuery(existingQuery);
         }
         else
         {
             base.InitializeAndRunLiveQuery();
         }
         if (base.ProcessRetrievedData)
         {
             this.ProcessRows();
         }
     }
 }
Пример #13
0
        public void ProcessSingleOdp()
        {
            ExecutedQuery executedQuery = null;

            try
            {
                ExecutedQueryCache executedQueryCache = base.m_odpContext.StateManager.ExecutedQueryCache;
                if (executedQueryCache != null)
                {
                    executedQueryCache.Extract(this.m_dataSet, out executedQuery);
                }
                if (base.InitializeDataSource(executedQuery))
                {
                    this.m_runtimeDataSet.InitProcessingParams(base.m_connection, base.m_transaction);
                    this.m_runtimeDataSet.ProcessInline(executedQuery);
                    base.m_executionMetrics.Add(this.m_runtimeDataSet.DataSetExecutionMetrics);
                    if (base.m_totalDurationFromExistingQuery != null)
                    {
                        base.m_executionMetrics.TotalDuration.Subtract(base.m_totalDurationFromExistingQuery);
                    }
                    base.TeardownDataSource();
                }
            }
            catch (Exception e)
            {
                base.HandleException(e);
                throw;
            }
            finally
            {
                this.FinalCleanup();
                if (executedQuery != null)
                {
                    executedQuery.Close();
                }
            }
        }
 public void ReleaseOwnership(ref IDbConnection connection)
 {
     ExecutedQuery.AssignAndClear <IDbConnection>(ref connection, ref this.m_connection);
 }
 protected void InitializeDataSet(ExecutedQuery existingQuery)
 {
     this.RuntimeDataSet.InitProcessingParams(base.m_connection, base.m_transaction);
     this.RuntimeDataSet.Initialize(existingQuery);
 }
        protected void InitializeAndRunFromExistingQuery(ExecutedQuery query)
        {
            bool readerExtensionsSupported = this.RunFromExistingQuery(query);

            this.InitializeToProcessData(readerExtensionsSupported);
        }
 public void ProcessInline(ExecutedQuery existingQuery)
 {
     this.Process(existingQuery);
 }