From: Sergey K. <jus...@us...> - 2005-09-28 22:17:06
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Transaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11717/src/NHibernate/Transaction Modified Files: AdoTransaction.cs Log Message: More updates to AdoTransaction Index: AdoTransaction.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Transaction/AdoTransaction.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AdoTransaction.cs 28 Sep 2005 22:04:11 -0000 1.9 --- AdoTransaction.cs 28 Sep 2005 22:16:55 -0000 1.10 *************** *** 18,21 **** --- 18,22 ---- private bool committed; private bool rolledBack; + private bool commitFailed; /// <summary> *************** *** 127,131 **** { CheckNotDisposed(); ! CheckRunning(); log.Debug( "commit" ); --- 128,132 ---- { CheckNotDisposed(); ! CheckBegun(); log.Debug( "commit" ); *************** *** 145,148 **** --- 146,151 ---- { log.Error( "Commit failed", e ); + AfterTransactionCompletion( false ); + commitFailed = true; throw new TransactionException( "Commit failed with SQL exception", e ); } *************** *** 160,180 **** { CheckNotDisposed(); ! CheckRunning(); log.Debug( "rollback" ); ! try ! { ! trans.Rollback(); ! rolledBack = true; ! Dispose(); ! } ! catch( Exception e ) ! { ! log.Error( "Rollback failed", e ); ! throw new TransactionException( "Rollback failed with SQL Exception", e ); ! } ! finally { ! AfterTransactionCompletion( false ); } } --- 163,187 ---- { CheckNotDisposed(); ! CheckBegun(); log.Debug( "rollback" ); ! ! if( !commitFailed ) { ! try ! { ! trans.Rollback(); ! rolledBack = true; ! Dispose(); ! } ! catch( Exception e ) ! { ! log.Error( "Rollback failed", e ); ! throw new TransactionException( "Rollback failed with SQL Exception", e ); ! } ! finally ! { ! AfterTransactionCompletion( false ); ! } } } *************** *** 284,288 **** } ! private void CheckRunning() { if( !begun ) --- 291,295 ---- } ! private void CheckBegun() { if( !begun ) *************** *** 290,298 **** throw new TransactionException( "Transaction not successfully started" ); } - - if( rolledBack || committed ) - { - throw new TransactionException( "Transaction already finished" ); - } } } --- 297,300 ---- |