Show
Ignore:
Timestamp:
04/22/02 14:57:50 (10 years ago)
Author:
team4
Message:

*** empty log message ***

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-0_71-bugfixes/Rapla/src/org/rapla/storage/dbsql/DBOperator.java

    r283 r339  
    8585        Connection con = null; 
    8686        Connection idcon = null; 
     87        boolean bAutoCommit = true; 
    8788        boolean bFailed = true; 
    8889        try { 
     
    9091                con = openConnection(); 
    9192                idcon = openConnection(); 
    92                 con.setAutoCommit(false); 
     93                try { 
     94                    con.setAutoCommit(false); 
     95                    // Check if autocommit is disabled (Transaction Support) 
     96                    bAutoCommit = con.getAutoCommit(); 
     97                } catch (SQLException ex) { 
     98                    config.getLog().log(3,"No Transaction support"); 
     99                } 
    93100                for (int i=0;i<obj.length;i++)  
    94101                    raplaSQL.store(con,idcon,obj[i]); 
     
    96103                bFailed = false; 
    97104            } finally { 
    98                 if (bFailed && (con != null)) { 
     105                if (bFailed && (con != null) && !bAutoCommit) { 
    99106                    con.rollback(); 
    100107                    config.getLog().log(4,"Doing rollback"); 
    101108                } 
    102                 if (!bFailed && (con != null)) { 
     109                if (!bFailed && (con != null) && !bAutoCommit) { 
    103110                    con.commit(); 
    104111                    config.getLog().log(4,"Commiting"); 
     
    117124        checkNoDependencies(obj); 
    118125        Connection con = null; 
     126        boolean bAutoCommit = true; 
    119127        boolean bFailed = true; 
    120128        try { 
    121129            try { 
    122130                con = openConnection(); 
    123                 con.setAutoCommit(false); 
     131                try { 
     132                    con.setAutoCommit(false); 
     133                    // Check if autocommit is disabled 
     134                    bAutoCommit = con.getAutoCommit(); 
     135                } catch (SQLException ex) { 
     136                    config.getLog().log(3,"No Transaction support"); 
     137                } 
    124138                for (int i=0;i<obj.length;i++) { 
    125139                    raplaSQL.remove(con,obj[i]); 
     
    128142                bFailed = false; 
    129143            } finally { 
    130                 if (bFailed && (con != null)) { 
     144                if (bFailed && (con != null) && !bAutoCommit) { 
    131145                    con.rollback(); 
    132146                    config.getLog().log(4,"Doing rollback"); 
    133147                } 
    134                 if (!bFailed && (con != null)) { 
     148                if (!bFailed && (con != null) && !bAutoCommit) { 
    135149                    con.commit(); 
    136150                    config.getLog().log(4,"Commiting");