Crash in BatchExecution when (FbTransaction == null)
----------------------------------------------------

                 Key: DNET-390
                 URL: http://tracker.firebirdsql.org/browse/DNET-390
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 2.6.5
         Environment: Windows 7, Visual Studio Team System 2008
            Reporter: Alexander
            Assignee: Jiri Cincura


When BatchExecution executing many sql command in 1 command without beginning 
transaction, there is error in this line:                  
this.sqlTransaction.Commit(); // 242 line in FbBatchExecution.cs
        
This situation can be replaying to execute some query like this:

CREATE TABLE sample(id bigint not null);
COMMIT WORK;

and C# code like this:

FbConnection c = new 
FbConnection(@"Database=employee.fdb;User=SYSDBA;Password=masterkey");
 c.Open();

 FbBatchExecution fbe = new FbBatchExecution(c);
 foreach (string cmd in script.Results) {
    fbe.SqlStatements.Add(cmd);
 }

 fbe.Execute();
 c.Close();
(copypasted from this:  
http://web.firebirdsql.org/dotnetfirebird/blog/2005_03_01_archive.html)

So, small fix is this:

                        case SqlStatementType.Commit:
                                if (sqlTransaction!=null)
                                                        {
                                                                // raise the 
event
                                                                
this.OnCommandExecuting(null);

                                                                
this.sqlTransaction.Commit();
                                                                
this.sqlTransaction = null;

                                                                // raise the 
event
                                                                
this.OnCommandExecuted(sqlStatement, null, -1);
                                                        }
                                                        break;
                        case SqlStatementType.Rollback:
                                                        if (sqlTransaction != 
null)
                                                        {

                                                                // raise the 
event
                                                                
this.OnCommandExecuting(null);

                                                                
this.sqlTransaction.Rollback();
                                                                
this.sqlTransaction = null;

                                                                // raise the 
event
                                                                
this.OnCommandExecuted(sqlStatement, null, -1);
                                                        }
                                                        break;
but in my opinion this is looks like dirty hack...

-- 
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

        

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to