protected IDataReader RunLiveQuery(List <Microsoft.ReportingServices.ReportIntermediateFormat.ParameterValue> queryParams, object[] paramValues) { IDataReader reader = null; IDbCommand command = null; IJobContext jobContext = m_odpContext.JobContext; if (m_dataSourceConnection == null) { m_dataSourceConnection = RuntimeDataSource.OpenConnection(m_dataSource, m_dataSet, m_odpContext, m_executionMetrics); } try { m_executionMetrics.StartTimer(DataProcessingMetrics.MetricType.Query); command = CreateCommand(); SetCommandParameters(command, queryParams, paramValues); string commandText = SetCommandText(command); StoreCommandText(commandText); SetCommandType(command); SetTransaction(command); m_odpContext.CheckAndThrowIfAborted(); SetCommandTimeout(command); ExtractRewrittenCommandText(command); SetRestartPosition(command); DataSourceInfo dataSourceInfo = null; if (command is IDbImpersonationNeededForCommandCancel) { dataSourceInfo = m_dataSource.GetDataSourceInfo(m_odpContext); } m_command = command; m_commandWrappedForCancel = new CommandWrappedForCancel(m_command, m_odpContext.CreateAndSetupDataExtensionFunction, m_dataSource, dataSourceInfo, m_dataSet.Name, m_dataSourceConnection); if (jobContext != null) { jobContext.SetAdditionalCorrelation(m_command); jobContext.ApplyCommandMemoryLimit(m_command); } DataSourceErrorInspector errorInspector = CreateErrorInspector(); reader = ExecuteReader(jobContext, errorInspector, commandText); StoreDataReader(reader, errorInspector); return(reader); } catch (RSException) { EagerInlineCommandAndReaderCleanup(ref reader, ref command); throw; } catch (Exception e) { if (AsynchronousExceptionDetection.IsStoppingException(e)) { throw; } EagerInlineCommandAndReaderCleanup(ref reader, ref command); throw; } finally { m_executionMetrics.RecordTimerMeasurement(DataProcessingMetrics.MetricType.Query); } }
public override void Abort() { base.Abort(); if (RuntimeDataSource != null) { RuntimeDataSource.Abort(); } }
protected void CloseConnection() { if (m_isConnectionOwner && m_dataSourceConnection != null) { RuntimeDataSource.CloseConnection(m_dataSourceConnection, m_dataSource, m_odpContext, m_executionMetrics); m_dataSourceConnection = null; } }
internal void Close() { IDataReader obj = Interlocked.Exchange(ref m_dataReader, null); if (obj != null) { QueryExecutionUtils.DisposeDataExtensionObject(ref obj, "data reader", m_dataSet.Name, m_executionMetrics, DataProcessingMetrics.MetricType.DisposeDataReader); } m_commandWrappedForCancel = null; IDbCommand obj2 = Interlocked.Exchange(ref m_command, null); if (obj2 != null) { QueryExecutionUtils.DisposeDataExtensionObject(ref obj2, "command", m_dataSet.Name); } IDbConnection dbConnection = Interlocked.Exchange(ref m_connection, null); if (dbConnection != null) { RuntimeDataSource.CloseConnection(dbConnection, m_dataSource, m_odpContext, m_executionMetrics); } }