From cb2e007302811ae55f15c2539de11fa21f9c732f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Fri, 5 Dec 2025 16:48:32 +0300 Subject: [PATCH] Table Valued Function eklendi --- .../views/sqlQueryManager/SqlQueryManager.tsx | 28 +++++++++++++++++-- .../components/SqlObjectExplorer.tsx | 12 ++++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/ui/src/views/sqlQueryManager/SqlQueryManager.tsx b/ui/src/views/sqlQueryManager/SqlQueryManager.tsx index ca2614cb..961835d4 100644 --- a/ui/src/views/sqlQueryManager/SqlQueryManager.tsx +++ b/ui/src/views/sqlQueryManager/SqlQueryManager.tsx @@ -212,8 +212,8 @@ WHERE t1.IsActive = 1; GO`, - 'create-function': `-- Create Scalar Function -CREATE FUNCTION [dbo].[FunctionName] + 'create-scalar-function': `-- Create Scalar Function +CREATE FUNCTION [dbo].[ScalarFunctionName] ( @Parameter1 INT, @Parameter2 NVARCHAR(100) @@ -230,6 +230,30 @@ BEGIN RETURN @Result; END +GO`, + + 'create-table-function': `-- Create Table-Valued Function +CREATE FUNCTION [dbo].[TableFunctionName] +( + @Parameter1 INT, + @Parameter2 NVARCHAR(100) +) +RETURNS TABLE +AS +RETURN +( + SELECT + t.Column1, + t.Column2, + t.Column3, + t.Column4 + FROM + TableName t + WHERE + t.Id = @Parameter1 + AND t.Column2 LIKE '%' + @Parameter2 + '%' + AND t.IsActive = 1 +) GO` } diff --git a/ui/src/views/sqlQueryManager/components/SqlObjectExplorer.tsx b/ui/src/views/sqlQueryManager/components/SqlObjectExplorer.tsx index 63d24c4d..a8fc7460 100644 --- a/ui/src/views/sqlQueryManager/components/SqlObjectExplorer.tsx +++ b/ui/src/views/sqlQueryManager/components/SqlObjectExplorer.tsx @@ -155,10 +155,16 @@ const SqlObjectExplorer = ({ data: { templateType: 'create-view' } as any, }, { - id: 'template-function', - label: 'Function', + id: 'template-scalar-function', + label: 'Scalar Function', type: 'object' as const, - data: { templateType: 'create-function' } as any, + data: { templateType: 'create-scalar-function' } as any, + }, + { + id: 'template-table-function', + label: 'Table-Valued Function', + type: 'object' as const, + data: { templateType: 'create-table-function' } as any, }, ], },