Changeset 3057
- Timestamp:
- 07/08/08 14:52:47 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PP/trunk/jungle/src/org/trinet/jasi/JasiDbReader.java
r1218 r3057 205 205 return count; 206 206 } 207 208 /** 209 * Return a list of program application names known by DataSource. 210 * Empty list if none 211 */ 212 public static java.util.List getApplicationNames(Connection conn) { 213 Statement sm = null; 214 ResultSet rs = null; 215 ArrayList aList = new ArrayList(); 216 try { 217 if ( conn == null || conn.isClosed() ) { 218 System.err.println ("JasiDbReader getBySQL(c,s) connection c is closed"); 219 return null; 220 } 221 sm = conn.createStatement(); 222 // NOTE: if ExecuteSQL.setSelectForUpdate(true) was set in DataSource 223 // this will lock the selected rows until commit() or close() are called 224 String sql = "SELECT DISTINCT name FROM applications ORDER BY name"; 225 ResultSetDb rsdb = new ResultSetDb(ExecuteSQL.rowQuery(sm, sql)); 226 rs = rsdb.getResultSet(); 227 if (rs != null) { 228 String name = null; 229 while ( rs.next() ) { 230 name = rs.getString(1); 231 if (name != null) aList.add(rs.getString(1)); 232 } 233 } 234 } 235 catch (SQLException ex) { 236 System.err.println(ex); 237 ex.printStackTrace(); 238 } 239 finally { 240 try { 241 if (rs != null) rs.close(); 242 if (sm != null) sm.close(); 243 } 244 catch (SQLException ex) {} 245 } 246 return aList; 247 } 248 207 249 208 250 /**
Note: See TracChangeset
for help on using the changeset viewer.
