Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RECREATE TRIGGER not supported for batch execution [DNET383] #388

Closed
firebird-automations opened this issue May 28, 2011 · 1 comment
Closed

Comments

@firebird-automations
Copy link

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

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: vNext [ 10466 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants