Example #1
0
 public Collection<Section> getSections(int cid) {
   try {
     Collection<Section> sections = new ArrayList<Section>();
     String qry = "select SectId from SECTION where CourseId = ?";
     PreparedStatement pstmt = conn.prepareStatement(qry);
     pstmt.setInt(1, cid);
     ResultSet rs = pstmt.executeQuery();
     while (rs.next()) {
       int sectid = rs.getInt("SectId");
       sections.add(dbm.findSection(sectid));
     }
     rs.close();
     return sections;
   } catch (SQLException e) {
     dbm.cleanup();
     throw new RuntimeException("error getting course sections", e);
   }
 }