From e407d87fce9dc2492384909a4e613f13f0dbf47d Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Tue, 25 Feb 2020 16:49:06 -0800 Subject: [PATCH] add missing udf type (#923) --- .../Metadata/MetadataService.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs b/src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs index c28de08e..39750d97 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs @@ -24,9 +24,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Metadata public static MetadataService Instance => LazyInstance.Value; - private static ConnectionService connectionService = null; + private static ConnectionService connectionService = null; - /// + /// /// Internal for testing purposes only /// internal static ConnectionService ConnectionServiceInstance @@ -139,7 +139,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Metadata out connInfo); ColumnMetadata[] metadata = null; - if (connInfo != null) + if (connInfo != null) { using (SqlConnection sqlConn = ConnectionService.OpenSqlConnection(connInfo, "Metadata")) { @@ -152,7 +152,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Metadata await requestContext.SendResult(new TableMetadataResult { - Columns = metadata + Columns = metadata }); } catch (Exception ex) @@ -176,13 +176,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Metadata @"SELECT s.name AS schema_name, o.[name] AS object_name, o.[type] AS object_type FROM sys.all_objects o INNER JOIN sys.schemas s ON o.schema_id = s.schema_id - WHERE (o.[type] = 'P' OR o.[type] = 'V' OR o.[type] = 'U' OR o.[type] = 'AF' OR o.[type] = 'FN' OR o.[type] = 'IF') "; - + WHERE o.[type] IN ('P','V','U','AF','FN','IF','TF') "; + if (!IsSystemDatabase(sqlConn.Database)) { sql += @"AND o.is_ms_shipped != 1 "; } - + sql += @"ORDER BY object_type, schema_name, object_name"; using (SqlCommand sqlCommand = new SqlCommand(sql, sqlConn)) @@ -207,7 +207,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Metadata metadataType = MetadataType.SProc; metadataTypeName = "StoredProcedure"; } - else if (objectType == "AF" || objectType == "FN" || objectType == "IF") + else if (objectType == "AF" || objectType == "FN" || objectType == "IF" || objectType == "TF") { metadataType = MetadataType.Function; metadataTypeName = "UserDefinedFunction";