mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
Revert "Scripting should await result of requestcontext.sendresult in case it errors" (#526)
* Revert "Add rowcount check so that no results error is sent for a query where no rows are returned (#525)" This reverts commit3392f93a2e. * Revert "Add unknown status for DB Nodes whose status is not known (#524)" This reverts commit3d7b87eca2. * Revert "Should await result of requestcontext.sendresult in case it errors (#520)" This reverts commitcaf196ea31.
This commit is contained in:
@@ -2405,14 +2405,6 @@ namespace Microsoft.SqlTools.ServiceLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ScriptingUnexpectedError
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Keys.GetString(Keys.ScriptingUnexpectedError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string unavailable
|
public static string unavailable
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -4608,9 +4600,6 @@ namespace Microsoft.SqlTools.ServiceLayer
|
|||||||
public const string ScriptingListObjectsCompleteParams_ConnectionString_Property_Invalid = "ScriptingListObjectsCompleteParams_ConnectionString_Property_Invalid";
|
public const string ScriptingListObjectsCompleteParams_ConnectionString_Property_Invalid = "ScriptingListObjectsCompleteParams_ConnectionString_Property_Invalid";
|
||||||
|
|
||||||
|
|
||||||
public const string ScriptingUnexpectedError = "ScriptingUnexpectedError";
|
|
||||||
|
|
||||||
|
|
||||||
public const string unavailable = "unavailable";
|
public const string unavailable = "unavailable";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1380,10 +1380,6 @@
|
|||||||
<value>Error parsing ScriptingListObjectsCompleteParams.ConnectionString property.</value>
|
<value>Error parsing ScriptingListObjectsCompleteParams.ConnectionString property.</value>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ScriptingUnexpectedError" xml:space="preserve">
|
|
||||||
<value>Unexpected error while scripting: no result returned from script operation.</value>
|
|
||||||
<comment></comment>
|
|
||||||
</data>
|
|
||||||
<data name="unavailable" xml:space="preserve">
|
<data name="unavailable" xml:space="preserve">
|
||||||
<value>Unavailable</value>
|
<value>Unavailable</value>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
|
|||||||
@@ -690,8 +690,6 @@ ScriptingParams_FilePath_Property_Invalid = Invalid directory specified by the S
|
|||||||
|
|
||||||
ScriptingListObjectsCompleteParams_ConnectionString_Property_Invalid = Error parsing ScriptingListObjectsCompleteParams.ConnectionString property.
|
ScriptingListObjectsCompleteParams_ConnectionString_Property_Invalid = Error parsing ScriptingListObjectsCompleteParams.ConnectionString property.
|
||||||
|
|
||||||
ScriptingUnexpectedError = Unexpected error while scripting: no result returned from script operation.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2311,11 +2311,6 @@
|
|||||||
<note>.
|
<note>.
|
||||||
Parameters: 0 - value (string), 1 - columnType (string) </note>
|
Parameters: 0 - value (string), 1 - columnType (string) </note>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ScriptingUnexpectedError">
|
|
||||||
<source>Unexpected error while scripting: no result returned from script operation.</source>
|
|
||||||
<target state="new">Unexpected error while scripting: no result returned from script operation.</target>
|
|
||||||
<note></note>
|
|
||||||
</trans-unit>
|
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright (c) Microsoft. All rights reserved.
|
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
//
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|
||||||
{
|
|
||||||
public class ScriptingException : Exception
|
|
||||||
{
|
|
||||||
public ScriptingException()
|
|
||||||
: base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ScriptingException(string message, Exception exception)
|
|
||||||
: base(message, exception)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ScriptingException(string message)
|
|
||||||
: base(message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,6 @@ using Microsoft.SqlServer.Management.Smo;
|
|||||||
using Microsoft.SqlServer.Management.Common;
|
using Microsoft.SqlServer.Management.Common;
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
||||||
{
|
{
|
||||||
@@ -229,49 +228,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void RunSelectTask(ConnectionInfo connInfo, ScriptingParams parameters, RequestContext<ScriptingResult> requestContext)
|
private void RunSelectTask(ConnectionInfo connInfo, ScriptingParams parameters, RequestContext<ScriptingResult> requestContext)
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
ConnectionServiceInstance.ConnectionQueue.QueueBindingOperation(
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QueueItem queueItem = ConnectionServiceInstance.ConnectionQueue.QueueBindingOperation(
|
|
||||||
key: ConnectionServiceInstance.ConnectionQueue.AddConnectionContext(connInfo, "Scripting"),
|
key: ConnectionServiceInstance.ConnectionQueue.AddConnectionContext(connInfo, "Scripting"),
|
||||||
bindingTimeout: ScriptingOperationTimeout,
|
bindingTimeout: ScriptingOperationTimeout,
|
||||||
bindOperation: (bindingContext, cancelToken) =>
|
bindOperation: (bindingContext, cancelToken) =>
|
||||||
{
|
|
||||||
return DoScriptSelect(connInfo, parameters, bindingContext);
|
|
||||||
});
|
|
||||||
|
|
||||||
queueItem.ItemProcessed.WaitOne();
|
|
||||||
var result = queueItem.GetResultAsT<ScriptingResultWithException>();
|
|
||||||
if (result == null)
|
|
||||||
{
|
|
||||||
result = new ScriptingResultWithException()
|
|
||||||
{
|
|
||||||
Exception = new ScriptingException(SR.ScriptingUnexpectedError)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (result.Exception == null)
|
|
||||||
{
|
|
||||||
requestContext.SendResult(result).Wait();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
requestContext.SendError(result.Exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
requestContext.SendError(e);
|
|
||||||
}
|
|
||||||
}).ContinueWithOnFaulted(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ScriptingResult DoScriptSelect(ConnectionInfo connInfo, ScriptingParams parameters, IBindingContext bindingContext)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
string script = string.Empty;
|
string script = string.Empty;
|
||||||
ScriptingObject scriptingObject = parameters.ScriptingObjects[0];
|
ScriptingObject scriptingObject = parameters.ScriptingObjects[0];
|
||||||
|
try
|
||||||
|
{
|
||||||
Server server = new Server(bindingContext.ServerConnection);
|
Server server = new Server(bindingContext.ServerConnection);
|
||||||
server.DefaultTextMode = true;
|
server.DefaultTextMode = true;
|
||||||
|
|
||||||
@@ -302,12 +267,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send script result to client
|
// send script result to client
|
||||||
return new ScriptingResult { Script = script };
|
requestContext.SendResult(new ScriptingResult { Script = script });
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return new ScriptingResultWithException() { Exception = e};
|
requestContext.SendError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -349,10 +317,5 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ScriptingResultWithException : ScriptingResult
|
|
||||||
{
|
|
||||||
public Exception Exception { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user