- Timestamp:
- 04/22/02 14:57:50 (10 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/release-0_71-bugfixes/Rapla/src/org/rapla/storage/dbsql/DBOperator.java
r283 r339 85 85 Connection con = null; 86 86 Connection idcon = null; 87 boolean bAutoCommit = true; 87 88 boolean bFailed = true; 88 89 try { … … 90 91 con = openConnection(); 91 92 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 } 93 100 for (int i=0;i<obj.length;i++) 94 101 raplaSQL.store(con,idcon,obj[i]); … … 96 103 bFailed = false; 97 104 } finally { 98 if (bFailed && (con != null) ) {105 if (bFailed && (con != null) && !bAutoCommit) { 99 106 con.rollback(); 100 107 config.getLog().log(4,"Doing rollback"); 101 108 } 102 if (!bFailed && (con != null) ) {109 if (!bFailed && (con != null) && !bAutoCommit) { 103 110 con.commit(); 104 111 config.getLog().log(4,"Commiting"); … … 117 124 checkNoDependencies(obj); 118 125 Connection con = null; 126 boolean bAutoCommit = true; 119 127 boolean bFailed = true; 120 128 try { 121 129 try { 122 130 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 } 124 138 for (int i=0;i<obj.length;i++) { 125 139 raplaSQL.remove(con,obj[i]); … … 128 142 bFailed = false; 129 143 } finally { 130 if (bFailed && (con != null) ) {144 if (bFailed && (con != null) && !bAutoCommit) { 131 145 con.rollback(); 132 146 config.getLog().log(4,"Doing rollback"); 133 147 } 134 if (!bFailed && (con != null) ) {148 if (!bFailed && (con != null) && !bAutoCommit) { 135 149 con.commit(); 136 150 config.getLog().log(4,"Commiting");
![(please configure the [header_logo] section in trac.ini)](/chrome/site/rapla.jpg)