Skip to content

Commit 5672df2

Browse files
committed
Support for functions (DNET-760).
1 parent 063ebd2 commit 5672df2

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public void Execute(bool autoCommit = true)
129129
case SqlStatementType.AlterDatabase:
130130
case SqlStatementType.AlterDomain:
131131
case SqlStatementType.AlterException:
132+
case SqlStatementType.AlterFunction:
132133
case SqlStatementType.AlterIndex:
133134
case SqlStatementType.AlterProcedure:
134135
case SqlStatementType.AlterRole:
@@ -140,6 +141,7 @@ public void Execute(bool autoCommit = true)
140141
case SqlStatementType.CreateCollation:
141142
case SqlStatementType.CreateDomain:
142143
case SqlStatementType.CreateException:
144+
case SqlStatementType.CreateFunction:
143145
case SqlStatementType.CreateGenerator:
144146
case SqlStatementType.CreateIndex:
145147
case SqlStatementType.CreateProcedure:
@@ -180,6 +182,7 @@ public void Execute(bool autoCommit = true)
180182
case SqlStatementType.Open:
181183
case SqlStatementType.Prepare:
182184
case SqlStatementType.Revoke:
185+
case SqlStatementType.RecreateFunction:
183186
case SqlStatementType.RecreateProcedure:
184187
case SqlStatementType.RecreateTable:
185188
case SqlStatementType.RecreateTrigger:

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ static bool IsSetTermStatement(string statement, out string newTerm)
150150
{
151151
return SqlStatementType.AlterException;
152152
}
153+
if (sqlStatement.StartsWith("ALTER FUNCTION", StringComparison.OrdinalIgnoreCase))
154+
{
155+
return SqlStatementType.AlterFunction;
156+
}
153157
if (sqlStatement.StartsWith("ALTER INDEX", StringComparison.OrdinalIgnoreCase))
154158
{
155159
return SqlStatementType.AlterIndex;
@@ -215,6 +219,11 @@ static bool IsSetTermStatement(string statement, out string newTerm)
215219
{
216220
return SqlStatementType.CreateException;
217221
}
222+
if (sqlStatement.StartsWith("CREATE FUNCTION", StringComparison.OrdinalIgnoreCase) ||
223+
sqlStatement.StartsWith("CREATE OR ALTER FUNCTION", StringComparison.OrdinalIgnoreCase))
224+
{
225+
return SqlStatementType.CreateFunction;
226+
}
218227
if (sqlStatement.StartsWith("CREATE GENERATOR", StringComparison.OrdinalIgnoreCase))
219228
{
220229
return SqlStatementType.CreateGenerator;
@@ -447,6 +456,10 @@ static bool IsSetTermStatement(string statement, out string newTerm)
447456
{
448457
return SqlStatementType.Revoke;
449458
}
459+
if (sqlStatement.StartsWith("RECREATE FUNCTION", StringComparison.OrdinalIgnoreCase))
460+
{
461+
return SqlStatementType.RecreateFunction;
462+
}
450463
if (sqlStatement.StartsWith("RECREATE PROCEDURE", StringComparison.OrdinalIgnoreCase))
451464
{
452465
return SqlStatementType.RecreateProcedure;

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public enum SqlStatementType
5252
/// </summary>
5353
AlterException,
5454

55+
/// <summary>
56+
/// Represents the SQL statement: <b>ALTER FUNCTION</b>
57+
/// </summary>
58+
AlterFunction,
59+
5560
/// <summary>
5661
/// Represents the SQL statement: <b>ALTER INDEX</b>
5762
/// </summary>
@@ -127,6 +132,11 @@ public enum SqlStatementType
127132
/// </summary>
128133
CreateException,
129134

135+
/// <summary>
136+
/// Represents the SQL statement: <b>CREATE FUNCTION</b>
137+
/// </summary>
138+
CreateFunction,
139+
130140
/// <summary>
131141
/// Represents the SQL statement: <b>CREATE GENERATOR</b>
132142
/// </summary>
@@ -352,6 +362,11 @@ public enum SqlStatementType
352362
/// </summary>
353363
Prepare,
354364

365+
/// <summary>
366+
/// Represents the SQL statement: <b>RECREATE FUNCTION</b>
367+
/// </summary>
368+
RecreateFunction,
369+
355370
/// <summary>
356371
/// Represents the SQL statement: <b>RECREATE PROCEDURE</b>
357372
/// </summary>

0 commit comments

Comments
 (0)