mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-15 01:25:40 -05:00
Feature: Progressive Messages (#208)
This change is a reworking of the way that messages are sent to clients from the service layer. It is also a reworking of the protocol to ensure that all formulations of query send back events to the client in a deterministic ordering. To support the first change: * Added a new event that will be sent when a message is generated * Messages now indicate which Batch (if any) generated them * Messages now indicate if they were error level * Removed message storage in Batch objects and BatchSummary objects * Batch objects no longer have error state
This commit is contained in:
@@ -25,11 +25,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
/// </summary>
|
||||
public string ExecutionStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the batch was successful. True indicates errors, false indicates success
|
||||
/// </summary>
|
||||
public bool HasError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the result set within the query results
|
||||
/// </summary>
|
||||
@@ -40,11 +35,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
/// </summary>
|
||||
public SelectionData Selection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Any messages that came back from the server during execution of the batch
|
||||
/// </summary>
|
||||
public ResultMessage[] Messages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The summaries of the result sets inside the batch
|
||||
/// </summary>
|
||||
|
||||
@@ -21,11 +21,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
/// Summaries of the result sets that were returned with the query
|
||||
/// </summary>
|
||||
public BatchSummary[] BatchSummaries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Error message, if any
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
public class QueryExecuteCompleteEvent
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters to be sent back with a message notification
|
||||
/// </summary>
|
||||
public class QueryExecuteMessageParams
|
||||
{
|
||||
/// <summary>
|
||||
/// URI for the editor that owns the query
|
||||
/// </summary>
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The message that is being returned
|
||||
/// </summary>
|
||||
public ResultMessage Message { get; set; }
|
||||
}
|
||||
|
||||
public class QueryExecuteMessageEvent
|
||||
{
|
||||
public static readonly
|
||||
EventType<QueryExecuteMessageParams> Type =
|
||||
EventType<QueryExecuteMessageParams>.Create("query/message");
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
/// </summary>
|
||||
public class QueryExecuteResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Informational messages from the query runner. Optional, can be set to null.
|
||||
/// </summary>
|
||||
public string Messages { get; set; }
|
||||
}
|
||||
|
||||
public class QueryExecuteRequest
|
||||
|
||||
@@ -12,6 +12,17 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
/// </summary>
|
||||
public class ResultMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// ID of the batch that generated this message. If null, this message
|
||||
/// was not generated as part of a batch
|
||||
/// </summary>
|
||||
public int? BatchId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not this message is an error
|
||||
/// </summary>
|
||||
public bool IsError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of the message
|
||||
/// Stored in UTC ISO 8601 format; should be localized before displaying to any user
|
||||
@@ -23,20 +34,13 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Full constructor
|
||||
/// </summary>
|
||||
public ResultMessage(string timeStamp, string message)
|
||||
{
|
||||
Time = timeStamp;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with default "Now" time
|
||||
/// </summary>
|
||||
public ResultMessage(string message)
|
||||
public ResultMessage(string message, bool isError, int? batchId)
|
||||
{
|
||||
BatchId = batchId;
|
||||
IsError = isError;
|
||||
Time = DateTime.Now.ToString("o");
|
||||
Message = message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user