Class Batch
This class represents a batch within a query
Inheritance
Namespace:Microsoft.SqlTools.ServiceLayer.QueryExecution
Assembly:Microsoft.SqlTools.ServiceLayer.dll
Syntax
public class Batch : IDisposable
Properties
| Improve this Doc View SourceBatchText
The text of batch that will be executed
Declaration
public string BatchText { get; set; }
| Type | Description |
|---|---|
| System.String |
ExecutionElapsedTime
Localized timestamp for how long it took for the execution to complete
Declaration
public string ExecutionElapsedTime { get; }
| Type | Description |
|---|---|
| System.String |
ExecutionEndTimeStamp
Localized timestamp for when the execution completed. Stored in UTC ISO 8601 format; should be localized before displaying to any user
Declaration
public string ExecutionEndTimeStamp { get; }
| Type | Description |
|---|---|
| System.String |
ExecutionStartTimeStamp
Localized timestamp for when the execution began. Stored in UTC ISO 8601 format; should be localized before displaying to any user
Declaration
public string ExecutionStartTimeStamp { get; }
| Type | Description |
|---|---|
| System.String |
HasError
Whether or not this batch has an error
Declaration
public bool HasError { get; set; }
| Type | Description |
|---|---|
| System.Boolean |
HasExecuted
Whether or not this batch has been executed, regardless of success or failure
Declaration
public bool HasExecuted { get; set; }
| Type | Description |
|---|---|
| System.Boolean |
Id
Ordinal of the batch in the query
Declaration
public int Id { get; }
| Type | Description |
|---|---|
| System.Int32 |
ResultMessages
Messages that have come back from the server
Declaration
public IEnumerable<ResultMessage> ResultMessages { get; }
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<ResultMessage> |
ResultSets
The result sets of the batch execution
Declaration
public IList<ResultSet> ResultSets { get; }
| Type | Description |
|---|---|
| System.Collections.Generic.IList<ResultSet> |
ResultSummaries
Property for generating a set result set summaries from the result sets
Declaration
public ResultSetSummary[] ResultSummaries { get; }
| Type | Description |
|---|---|
| ResultSetSummary[] |
Summary
Creates a BatchSummary based on the batch instance
Declaration
public BatchSummary Summary { get; }
| Type | Description |
|---|---|
| BatchSummary |
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Execute(DbConnection, CancellationToken)
Executes this batch and captures any server messages that are returned.
Declaration
public Task Execute(DbConnection conn, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.Common.DbConnection | conn | The connection to use to execute the batch |
| System.Threading.CancellationToken | cancellationToken | Token for cancelling the execution |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
GetSubset(Int32, Int32, Int32)
Generates a subset of the rows from a result set of the batch
Declaration
public Task<ResultSetSubset> GetSubset(int resultSetIndex, int startRow, int rowCount)
Parameters
| Type | Name | Description |
|---|---|---|
| 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 SourceBatchCompletion
Event that will be called when the batch has completed execution
Declaration
public event Batch.BatchAsyncEventHandler BatchCompletion
BatchStart
Event to call when the batch has started execution
Declaration
public event Batch.BatchAsyncEventHandler BatchStart
ResultSetCompletion
Event that will be called when the resultset has completed execution. It will not be called from the Batch but from the ResultSet instance
Declaration
public event ResultSet.ResultSetAsyncEventHandler ResultSetCompletion