Skip to content

Commit e7b76a6

Browse files
authored
Feature/script execute (#563)
* added script as execute for stored procedures
1 parent 6f32221 commit e7b76a6

File tree

14 files changed

+571
-218
lines changed

14 files changed

+571
-218
lines changed

src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,6 +2397,30 @@ public static string ScriptingListObjectsCompleteParams_ConnectionString_Propert
23972397
}
23982398
}
23992399

2400+
public static string StoredProcedureScriptParameterComment
2401+
{
2402+
get
2403+
{
2404+
return Keys.GetString(Keys.StoredProcedureScriptParameterComment);
2405+
}
2406+
}
2407+
2408+
public static string ScriptingGeneralError
2409+
{
2410+
get
2411+
{
2412+
return Keys.GetString(Keys.ScriptingGeneralError);
2413+
}
2414+
}
2415+
2416+
public static string ScriptingExecuteNotSupportedError
2417+
{
2418+
get
2419+
{
2420+
return Keys.GetString(Keys.ScriptingExecuteNotSupportedError);
2421+
}
2422+
}
2423+
24002424
public static string unavailable
24012425
{
24022426
get
@@ -4597,6 +4621,15 @@ public class Keys
45974621
public const string ScriptingListObjectsCompleteParams_ConnectionString_Property_Invalid = "ScriptingListObjectsCompleteParams_ConnectionString_Property_Invalid";
45984622

45994623

4624+
public const string StoredProcedureScriptParameterComment = "StoredProcedureScriptParameterComment";
4625+
4626+
4627+
public const string ScriptingGeneralError = "ScriptingGeneralError";
4628+
4629+
4630+
public const string ScriptingExecuteNotSupportedError = "ScriptingExecuteNotSupportedError";
4631+
4632+
46004633
public const string unavailable = "unavailable";
46014634

46024635

src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,18 @@
13811381
<value>Error parsing ScriptingListObjectsCompleteParams.ConnectionString property.</value>
13821382
<comment></comment>
13831383
</data>
1384+
<data name="StoredProcedureScriptParameterComment" xml:space="preserve">
1385+
<value>-- TODO: Set parameter values here.</value>
1386+
<comment></comment>
1387+
</data>
1388+
<data name="ScriptingGeneralError" xml:space="preserve">
1389+
<value>An error occurred while scripting the objects.</value>
1390+
<comment></comment>
1391+
</data>
1392+
<data name="ScriptingExecuteNotSupportedError" xml:space="preserve">
1393+
<value>Scripting as Execute is only supported for Stored Procedures</value>
1394+
<comment></comment>
1395+
</data>
13841396
<data name="unavailable" xml:space="preserve">
13851397
<value>Unavailable</value>
13861398
<comment></comment>

src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,10 @@ ScriptingParams_FilePath_Property_Invalid = Invalid directory specified by the S
691691
ScriptingListObjectsCompleteParams_ConnectionString_Property_Invalid = Error parsing ScriptingListObjectsCompleteParams.ConnectionString property.
692692

693693

694+
StoredProcedureScriptParameterComment = -- TODO: Set parameter values here.
694695

696+
ScriptingGeneralError = An error occurred while scripting the objects.
697+
ScriptingExecuteNotSupportedError = Scripting as Execute is only supported for Stored Procedures
695698

696699
############################################################################
697700
# Admin Service

src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,6 +2312,21 @@
23122312
<note>.
23132313
Parameters: 0 - value (string), 1 - columnType (string) </note>
23142314
</trans-unit>
2315+
<trans-unit id="StoredProcedureScriptParameterComment">
2316+
<source>-- TODO: Set parameter values here.</source>
2317+
<target state="new">-- TODO: Set parameter values here.</target>
2318+
<note></note>
2319+
</trans-unit>
2320+
<trans-unit id="ScriptingGeneralError">
2321+
<source>An error occurred while scripting the objects.</source>
2322+
<target state="new">An error occurred while scripting the objects</target>
2323+
<note></note>
2324+
</trans-unit>
2325+
<trans-unit id="ScriptingExecuteNotSupportedError">
2326+
<source>Scripting as Execute is only supported for Stored Procedures</source>
2327+
<target state="new">Scripting as Execute is only supported for Stored Procedures</target>
2328+
<note></note>
2329+
</trans-unit>
23152330
</body>
23162331
</file>
23172332
</xliff>

src/Microsoft.SqlTools.ServiceLayer/Scripting/Contracts/ScriptAsRequest.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
//
5+
6+
namespace Microsoft.SqlTools.ServiceLayer.Scripting.Contracts
7+
{
8+
/// <summary>
9+
/// Scripting Operation type
10+
/// </summary>
11+
public enum ScriptingOperationType
12+
{
13+
Select = 0,
14+
Create = 1,
15+
Insert = 2,
16+
Update = 3,
17+
Delete = 4,
18+
Execute = 5
19+
}
20+
}

src/Microsoft.SqlTools.ServiceLayer/Scripting/Contracts/ScriptingOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ public class ScriptOptions
101101
/// ScriptCreate
102102
/// ScriptDrop
103103
/// ScriptCreateDrop
104-
/// ScriptSelect
105104
/// </summary>
106105
/// <remarks>
107106
/// The default is ScriptCreate.

src/Microsoft.SqlTools.ServiceLayer/Scripting/Contracts/ScriptingRequest.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ public class ScriptingParams
7373
/// </summary>
7474
public string OwnerUri { get; set; }
7575

76+
/// <summary>
77+
/// The script operation
78+
/// </summary>
79+
public ScriptingOperationType Operation { get; set; } = ScriptingOperationType.Create;
80+
7681
}
7782

7883
/// <summary>

0 commit comments

Comments
 (0)