Class Query
Internal representation of an active query
Inheritance
Inherited Members
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; }
Property Value
| Type | Description |
|---|---|
| BatchSummary[] |
HasExecuted
Whether or not the query has completed executed, regardless of success or failure
Declaration
public bool HasExecuted { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
Don't touch the setter unless you're doing unit tests!
QueryText
The text of the query to execute
Declaration
public string QueryText { get; set; }
Property Value
| 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()
Implements
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
Event Type
| Type | Description |
|---|---|
| Batch.BatchAsyncEventHandler |
BatchStarted
Event to be called when a batch starts execution.
Declaration
public event Batch.BatchAsyncEventHandler BatchStarted
Event Type
| Type | Description |
|---|---|
| Batch.BatchAsyncEventHandler |
QueryCompleted
Callback for when the query has completed successfully
Declaration
public event Query.QueryAsyncEventHandler QueryCompleted
Event Type
| Type | Description |
|---|---|
| Query.QueryAsyncEventHandler |
QueryConnectionException
Callback for when the query connection has failed
Declaration
public event Query.QueryAsyncErrorEventHandler QueryConnectionException
Event Type
| Type | Description |
|---|---|
| Query.QueryAsyncErrorEventHandler |
QueryFailed
Callback for when the query has failed
Declaration
public event Query.QueryAsyncEventHandler QueryFailed
Event Type
| Type | Description |
|---|---|
| Query.QueryAsyncEventHandler |
ResultSetCompleted
Event to be called when a resultset has completed.
Declaration
public event ResultSet.ResultSetAsyncEventHandler ResultSetCompleted
Event Type
| Type | Description |
|---|---|
| ResultSet.ResultSetAsyncEventHandler |