Commit in hps-java/src/main/java/org/lcsim/hps/conditions on MAIN | |||
ConditionsRecord.java | +7 | -11 | 1.3 -> 1.4 |
allow multiple records returned from find method
diff -u -r1.3 -r1.4 --- ConditionsRecord.java 9 Oct 2013 21:00:29 -0000 1.3 +++ ConditionsRecord.java 11 Oct 2013 00:06:36 -0000 1.4 @@ -208,17 +208,17 @@
* @throws IllegalArgumentException if no records are found. * @throws IllegalArgumentException if more than one record is found. */
- public static ConditionsRecord find(ConditionsManager manager, String name) {
+ public static ConditionsRecordCollection find(ConditionsManager manager, String name) {
CachedConditions<ConditionsRecordCollection> c = manager.getCachedConditions(ConditionsRecordCollection.class, ""); ConditionsRecordCollection conditionsRecords = c.getCachedData(); conditionsRecords = conditionsRecords.find(name); if (conditionsRecords.size() == 0) { throw new IllegalArgumentException("No ConditionsRecord with name: " + name); }
- if (conditionsRecords.size() > 1) { - throw new IllegalArgumentException("Duplicate ConditionsRecord with name: " + name); - } - return conditionsRecords.get(0);
+ //if (conditionsRecords.size() > 1) { + // throw new IllegalArgumentException("Duplicate ConditionsRecord with name: " + name); + //} + return conditionsRecords;
} /**
@@ -233,7 +233,6 @@
ConnectionManager manager = ConnectionManager.getConnectionManager(); String db = manager.getConnectionParameters().getDatabase(); String table = manager.getConnectionParameters().getConditionsTable();
- Connection connection = manager.createConnection();
String query = "SELECT * FROM " + db + "." + table
@@ -243,7 +242,7 @@
+ " AND run_end >= " + run;
- ResultSet resultSet = manager.query(connection, query);
+ ResultSet resultSet = manager.query(query);
// Iterate over conditions records. try {
@@ -254,10 +253,7 @@
} } catch (SQLException x) { throw new RuntimeException("Database error", x);
- } finally { - manager.cleanup(resultSet); - manager.cleanup(connection); - }
+ }
return conditionsRecords; }
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1