Class Query
Internal representation of an active query
Inheritance
Namespace:Microsoft.SqlTools.ServiceLayer.QueryExecution
Assembly:Microsoft.SqlTools.ServiceLayer.dll
Syntax
public class Query : IDisposable
Constructors
| Improve this Doc View SourceQuery(String, ConnectionInfo, QueryExecutionSettings, IFileStreamFactory)
Constructor for a query
Declaration
public Query(string queryText, ConnectionInfo connection, QueryExecutionSettings settings, IFileStreamFactory outputFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | queryText | The text of the query to execute |
| ConnectionInfo | connection | The information of the connection to use to execute the query |
| QueryExecutionSettings | settings | Settings for how to execute the query, from the user |
| IFileStreamFactory | outputFactory | Factory for creating output files |
Properties
| Improve this Doc View SourceBatchSummaries
The summaries of the batches underneath this query
Declaration
public BatchSummary[] BatchSummaries { get; }
| Type | Description |
|---|---|
| BatchSummary[] |
HasExecuted
Whether or not the query has completed executed, regardless of success or failure
Remarks
Don't touch the setter unless you're doing unit tests!
Declaration
public bool HasExecuted { get; }
| Type | Description |
|---|---|
| System.Boolean |
QueryText
The text of the query to execute
Declaration
public string QueryText { get; set; }
| Type | Description |
|---|---|
| System.String |
Methods
| Improve this Doc View SourceCancel()
Cancels the query by issuing the cancellation token
Declaration
public void Cancel()
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Execute()
Declaration
public void Execute()
GetSubset(Int32, Int32, Int32, Int32)
Retrieves a subset of the result sets
Declaration
public Task<ResultSetSubset> GetSubset(int batchIndex, int resultSetIndex, int startRow, int rowCount)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | batchIndex | The index for selecting the batch item |
| System.Int32 | resultSetIndex | The index for selecting the result set |
| System.Int32 | startRow | The starting row of the results |
| System.Int32 | rowCount | How many rows to retrieve |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<ResultSetSubset> | A subset of results |
Events
| Improve this Doc View SourceBatchCompleted
Event to be called when a batch is completed.
Declaration
public event Batch.BatchAsyncEventHandler BatchCompleted
BatchStarted
Event to be called when a batch starts execution.
Declaration
public event Batch.BatchAsyncEventHandler BatchStarted
QueryCompleted
Callback for when the query has completed successfully
Declaration
public event Query.QueryAsyncEventHandler QueryCompleted
QueryConnectionException
Callback for when the query connection has failed
Declaration
public event Query.QueryAsyncErrorEventHandler QueryConnectionException
QueryFailed
Callback for when the query has failed
Declaration
public event Query.QueryAsyncEventHandler QueryFailed
ResultSetCompleted
Event to be called when a resultset has completed.
Declaration
public event ResultSet.ResultSetAsyncEventHandler ResultSetCompleted