Skip to content

Commit a2a49c0

Browse files
committed
Support for DROP PACKAGE/DROP PACKAGE BODY (DNET-838, DNET-839)
1 parent 4aa72e3 commit a2a49c0

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

Provider/src/FirebirdSql.Data.FirebirdClient.Tests/FbScriptTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,28 @@ public void RecreatePackageBody()
267267
Assert.AreEqual(SqlStatementType.RecreatePackageBody, script.Results[0].StatementType);
268268
}
269269

270+
[Test]
271+
public void DropPackage()
272+
{
273+
const string text =
274+
@"drop package p as begin end";
275+
FbScript script = new FbScript(text);
276+
script.Parse();
277+
Assert.AreEqual(1, script.Results.Count());
278+
Assert.AreEqual(SqlStatementType.DropPackage, script.Results[0].StatementType);
279+
}
280+
281+
[Test]
282+
public void DropPackageBody()
283+
{
284+
const string text =
285+
@"drop package body p as begin end";
286+
FbScript script = new FbScript(text);
287+
script.Parse();
288+
Assert.AreEqual(1, script.Results.Count());
289+
Assert.AreEqual(SqlStatementType.DropPackageBody, script.Results[0].StatementType);
290+
}
291+
270292
[Test]
271293
public void Merge()
272294
{

Provider/src/FirebirdSql.Data.FirebirdClient/Isql/FbBatchExecution.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ public void Execute(bool autoCommit = true)
163163
case SqlStatementType.DropFilter:
164164
case SqlStatementType.DropGenerator:
165165
case SqlStatementType.DropIndex:
166+
case SqlStatementType.DropPackage:
167+
case SqlStatementType.DropPackageBody:
166168
case SqlStatementType.DropProcedure:
167169
case SqlStatementType.DropSequence:
168170
case SqlStatementType.DropRole:

Provider/src/FirebirdSql.Data.FirebirdClient/Isql/FbScript.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,14 @@ static bool IsSetTermStatement(string statement, out string newTerm)
359359
{
360360
return SqlStatementType.DropIndex;
361361
}
362+
if (sqlStatement.StartsWith("DROP PACKAGE BODY", StringComparison.OrdinalIgnoreCase))
363+
{
364+
return SqlStatementType.DropPackageBody;
365+
}
366+
if (sqlStatement.StartsWith("DROP PACKAGE", StringComparison.OrdinalIgnoreCase))
367+
{
368+
return SqlStatementType.DropPackage;
369+
}
362370
if (sqlStatement.StartsWith("DROP PROCEDURE", StringComparison.OrdinalIgnoreCase))
363371
{
364372
return SqlStatementType.DropProcedure;

Provider/src/FirebirdSql.Data.FirebirdClient/Isql/SqlStatementType.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public enum SqlStatementType
7272
DropFilter,
7373
DropGenerator,
7474
DropIndex,
75+
DropPackage,
76+
DropPackageBody,
7577
DropProcedure,
7678
DropSequence,
7779
DropRole,

0 commit comments

Comments
 (0)