From 6b10197a684a8bed8c75e4ebb027bf5b8c16f130 Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Thu, 5 Dec 2024 10:30:18 +0100 Subject: [PATCH] Get function result scale and precision (#2709) * Get function result scale and precision fixes #2705 * add missing scale with sp_describe-- --- .../Routines/Functions/SqlServerFunctionModelFactory.cs | 6 +++++- .../Procedures/SqlServerStoredProcedureModelFactory.cs | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Core/RevEng.Core.80/Routines/Functions/SqlServerFunctionModelFactory.cs b/src/Core/RevEng.Core.80/Routines/Functions/SqlServerFunctionModelFactory.cs index 1c92ca370..7219b0d4f 100644 --- a/src/Core/RevEng.Core.80/Routines/Functions/SqlServerFunctionModelFactory.cs +++ b/src/Core/RevEng.Core.80/Routines/Functions/SqlServerFunctionModelFactory.cs @@ -51,7 +51,9 @@ protected override List> GetResultElementLists(SqlConn COALESCE(ts.name, tu.name) AS type_name, c.column_id AS column_ordinal, c.is_nullable, - c.max_length + c.max_length, + c.precision, + c.scale FROM sys.columns c inner join sys.types tu ON c.user_type_id = tu.user_type_id inner join sys.objects AS o on o.object_id = c.object_id @@ -91,6 +93,8 @@ FROM sys.columns c Ordinal = int.Parse(res["column_ordinal"].ToString()!, CultureInfo.InvariantCulture), Nullable = (bool)res["is_nullable"], MaxLength = maxLength, + Precision = (byte)res["precision"], + Scale = (byte)res["scale"], }; list.Add(parameter); diff --git a/src/Core/RevEng.Core.80/Routines/Procedures/SqlServerStoredProcedureModelFactory.cs b/src/Core/RevEng.Core.80/Routines/Procedures/SqlServerStoredProcedureModelFactory.cs index fdbe27a82..8a5cd625c 100644 --- a/src/Core/RevEng.Core.80/Routines/Procedures/SqlServerStoredProcedureModelFactory.cs +++ b/src/Core/RevEng.Core.80/Routines/Procedures/SqlServerStoredProcedureModelFactory.cs @@ -195,6 +195,8 @@ private static List> GetFirstResultSet(SqlConnection c Ordinal = int.Parse(row["column_ordinal"].ToString()!, CultureInfo.InvariantCulture), Nullable = (bool)row["is_nullable"], MaxLength = maxLength, + Precision = (byte)row["precision"], + Scale = (byte)row["scale"], }; list.Add(parameter);