RECREATE TRIGGER not supported for batch execution
--------------------------------------------------

                 Key: DNET-383
                 URL: http://tracker.firebirdsql.org/browse/DNET-383
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 2.6
         Environment: Windows, .NET
            Reporter: Ashley Tate
            Assignee: Jiri Cincura
            Priority: Minor


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 (new.ID IS NULL) THEN
          BEGIN
                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);
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to