You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The FirebirdSql.Data.Isql.FbBatchExecution class does not support RECREATE TRIGGER statements. Executing the test case below results in the following exception:
System.Exception: The type of the SQL statement could not be determinated.
at FirebirdSql.Data.Isql.FbBatchExecution.GetStatementType(String sqlStatement)
at FirebirdSql.Data.Isql.FbBatchExecution.Execute(Boolean autoCommit)
at FirebirdSql.Data.Isql.FbBatchExecution.Execute()
at FBScript.Commands.RunScriptCommand.RecreateTrigger()
Note that the exact same RECREATE statement DOES work when executed using FbCommand.ExecuteNonQuery.
===============================
var script = @"RECREATE TRIGGER MYTRIGGER FOR MYTABLE ACTIVE
BEFORE INSERT POSITION 0
AS
BEGIN
IF (http://new.ID IS NULL) THEN
BEGIN http://new.ID = gen_id(gen_MyTable, 1);
END
END";
var connectionStr = "Server=localhost;User=SYSDBA;Password=masterkey;Pooling=true;Connection Lifetime=60;Database=C:\\Projects\\MYDATABASE.FDB;Enlist=false";
var scripter = new FBScript(script);
scripter.Parse();
var connection = new FbConnection(connectionStr);
connection.Open();
var batchExecution = new FbBatchExecution(connection);
foreach (string cmd in scripter.Results)
{
batchExecution.SqlStatements.Add(cmd);
}
try
{
batchExecution.Execute();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
Submitted by: Ashley Tate (ashleytate)
The FirebirdSql.Data.Isql.FbBatchExecution class does not support RECREATE TRIGGER statements. Executing the test case below results in the following exception:
System.Exception: The type of the SQL statement could not be determinated.
at FirebirdSql.Data.Isql.FbBatchExecution.GetStatementType(String sqlStatement)
at FirebirdSql.Data.Isql.FbBatchExecution.Execute(Boolean autoCommit)
at FirebirdSql.Data.Isql.FbBatchExecution.Execute()
at FBScript.Commands.RunScriptCommand.RecreateTrigger()
Note that the exact same RECREATE statement DOES work when executed using FbCommand.ExecuteNonQuery.
===============================
var script = @"RECREATE TRIGGER MYTRIGGER FOR MYTABLE ACTIVE
BEFORE INSERT POSITION 0
AS
BEGIN
IF (http://new.ID IS NULL) THEN
BEGIN
http://new.ID = gen_id(gen_MyTable, 1);
END
END";
var connectionStr = "Server=localhost;User=SYSDBA;Password=masterkey;Pooling=true;Connection Lifetime=60;Database=C:\\Projects\\MYDATABASE.FDB;Enlist=false";
var scripter = new FBScript(script);
scripter.Parse();
var connection = new FbConnection(connectionStr);
connection.Open();
var batchExecution = new FbBatchExecution(connection);
foreach (string cmd in scripter.Results)
{
batchExecution.SqlStatements.Add(cmd);
}
try
{
batchExecution.Execute();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
Commits: 9b82cee
The text was updated successfully, but these errors were encountered: