|
3 | 3 | import java.sql.ResultSet; |
4 | 4 | import java.sql.SQLException; |
5 | 5 |
|
| 6 | +import cbit.vcell.modeldb.DbDriver; |
| 7 | +import org.apache.logging.log4j.LogManager; |
| 8 | +import org.apache.logging.log4j.Logger; |
6 | 9 | import org.vcell.db.ConnectionFactory; |
7 | 10 | import org.vcell.stochtest.TimeSeriesMultitrialData.SummaryStatistics; |
8 | 11 | import org.vcell.util.DataAccessException; |
|
14 | 17 | import cbit.vcell.modeldb.StochtestTable; |
15 | 18 |
|
16 | 19 | public class StochtestDbUtils { |
| 20 | + private static final Logger lg = LogManager.getLogger(StochtestDbUtils.class); |
17 | 21 |
|
18 | 22 | public static StochtestRun getStochtestRun(ConnectionFactory conFactory, KeyValue stochtestRunKey) throws IllegalArgumentException, SQLException, DataAccessException { |
19 | 23 |
|
@@ -112,11 +116,13 @@ public static void finalizeAcceptedStochtestRun(ConnectionFactory conFactory, St |
112 | 116 | stochtestRunTable.networkGenProbs.getUnqualifiedColName() + " = " + networkGenProbsRHS + " " + |
113 | 117 | " WHERE "+stochtestRunTable.id.getUnqualifiedColName()+" = " + acceptedStochtestRun.key.toString(); |
114 | 118 | stmt = con.createStatement(); |
115 | | -System.out.println(sql); |
116 | | - int numrows = stmt.executeUpdate(sql); |
117 | | - if (numrows != 1){ |
118 | | - throw new DataAccessException("failed to update mathgen status for id = "+acceptedStochtestRun.key); |
119 | | - } |
| 119 | + if (lg.isDebugEnabled()) { |
| 120 | + lg.debug("executeUpdate() SQL: '" + sql + "'", new DbDriver.StackTraceGenerationException()); |
| 121 | + } |
| 122 | + int numrows = stmt.executeUpdate(sql); // jcs: added logging |
| 123 | + if (numrows != 1) { |
| 124 | + throw new DataAccessException("failed to update mathgen status for id = " + acceptedStochtestRun.key); |
| 125 | + } |
120 | 126 | } finally { |
121 | 127 | if (stmt != null) { |
122 | 128 | stmt.close(); |
@@ -171,11 +177,13 @@ public static void finalizeAcceptedStochtestCompare(ConnectionFactory conFactory |
171 | 177 | } |
172 | 178 | sql += " WHERE "+stochtestCompareTable.id.getUnqualifiedColName()+" = " + acceptedStochtestCompare.key.toString(); |
173 | 179 | stmt = con.createStatement(); |
174 | | -System.out.println(sql); |
175 | | - int numrows = stmt.executeUpdate(sql); |
176 | | - if (numrows != 1){ |
177 | | - throw new DataAccessException("failed to update mathgen status for id = "+acceptedStochtestCompare.key); |
178 | | - } |
| 180 | + if (lg.isDebugEnabled()) { |
| 181 | + lg.debug("executeUpdate() SQL: '" + sql + "'", new DbDriver.StackTraceGenerationException()); |
| 182 | + } |
| 183 | + int numrows = stmt.executeUpdate(sql); // jcs: added logging |
| 184 | + if (numrows != 1) { |
| 185 | + throw new DataAccessException("failed to update mathgen status for id = " + acceptedStochtestCompare.key); |
| 186 | + } |
179 | 187 | } finally { |
180 | 188 | if (stmt != null) { |
181 | 189 | stmt.close(); |
@@ -262,11 +270,13 @@ public static StochtestRun acceptNextWaitingStochtestRun(ConnectionFactory conFa |
262 | 270 | " SET "+stochtestRunTable.status.getUnqualifiedColName() + " = " + "'"+StochtestRun.StochtestRunStatus.accepted+"'" + |
263 | 271 | " WHERE "+stochtestRunTable.id.getUnqualifiedColName()+" = " + stochtestRun.key.toString(); |
264 | 272 | stmt = con.createStatement(); |
265 | | -System.out.println(sql); |
266 | | - int numrows = stmt.executeUpdate(sql); |
267 | | - if (numrows != 1){ |
268 | | - throw new DataAccessException("failed to update mathgen status for id = "+stochtestRun.key); |
269 | | - } |
| 273 | + if (lg.isDebugEnabled()) { |
| 274 | + lg.debug("executeUpdate() SQL: '" + sql + "'", new DbDriver.StackTraceGenerationException()); |
| 275 | + } |
| 276 | + int numrows = stmt.executeUpdate(sql); // jcs: added logging |
| 277 | + if (numrows != 1) { |
| 278 | + throw new DataAccessException("failed to update mathgen status for id = " + stochtestRun.key); |
| 279 | + } |
270 | 280 | } finally { |
271 | 281 | if (stmt != null) { |
272 | 282 | stmt.close(); |
@@ -341,11 +351,13 @@ public static StochtestCompare acceptNextWaitingStochtestCompare(ConnectionFacto |
341 | 351 | " SET "+stochtestCompareTable.status.getUnqualifiedColName() + " = " + "'"+StochtestCompare.StochtestCompareStatus.accepted+"'" + |
342 | 352 | " WHERE "+stochtestCompareTable.id.getUnqualifiedColName()+" = " + stochtestCompare.key.toString(); |
343 | 353 | stmt = con.createStatement(); |
344 | | -System.out.println(sql); |
345 | | - int numrows = stmt.executeUpdate(sql); |
346 | | - if (numrows != 1){ |
347 | | - throw new DataAccessException("failed to update mathgen status for id = "+stochtestCompare.key); |
348 | | - } |
| 354 | + if (lg.isDebugEnabled()) { |
| 355 | + lg.debug("executeUpdate() SQL: '" + sql + "'", new DbDriver.StackTraceGenerationException()); |
| 356 | + } |
| 357 | + int numrows = stmt.executeUpdate(sql); // jcs: added logging |
| 358 | + if (numrows != 1) { |
| 359 | + throw new DataAccessException("failed to update mathgen status for id = " + stochtestCompare.key); |
| 360 | + } |
349 | 361 | } finally { |
350 | 362 | if (stmt != null) { |
351 | 363 | stmt.close(); |
|
0 commit comments