mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-18 17:23:52 -05:00
Fix empty result set error handling and metadata service returning correct type name (#535)
- HandleSimpleExecuteRequest now handles the case where no rows are in a result by cleanly returning a success message but with no rows included. This is handled in the front-end instead and goes through the standard path (with a clean explanation message) instead of showing a `error: no results to return` - MetadataService was always meant to include the type name in the return result, as otherwise the front end has to guess. In order to fix a bug where this resulted in scripting based on the metadata failing (as front-end used `Procedure` instead of `StoredProcedure`), I'm returning the data here. I'll have a matching front end fix but this is overall a good solution to have.
This commit is contained in:
committed by
Karl Burtram
parent
f711aaea5b
commit
185978eb80
@@ -184,22 +184,27 @@ namespace Microsoft.SqlTools.ServiceLayer.Metadata
|
||||
var objectType = reader[2] as string;
|
||||
|
||||
MetadataType metadataType;
|
||||
string metadataTypeName;
|
||||
if (objectType.StartsWith("V"))
|
||||
{
|
||||
metadataType = MetadataType.View;
|
||||
metadataTypeName = "View";
|
||||
}
|
||||
else if (objectType.StartsWith("P"))
|
||||
{
|
||||
metadataType = MetadataType.SProc;
|
||||
metadataTypeName = "StoredProcedure";
|
||||
}
|
||||
else
|
||||
{
|
||||
metadataType = MetadataType.Table;
|
||||
metadataTypeName = "Table";
|
||||
}
|
||||
|
||||
metadata.Add(new ObjectMetadata
|
||||
{
|
||||
MetadataType = metadataType,
|
||||
MetadataTypeName = metadataTypeName,
|
||||
Schema = schemaName,
|
||||
Name = objectName
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user