예제 #1
0
 public void insert(PlanningFact fact) throws Exception {
   String query =
       String.format(
           "INSERT INTO planning_fact VALUES (DEFAULT, '%s', '%s', %d, %d, '%s', '%s', %d, %d, '%s')",
           toTimeStamp(fact.getDate()),
           fact.getType().toDBType(),
           fact.getPlanning(),
           fact.getProf(),
           escape(fact.getCommentaire()),
           minutesToPGInterval(fact.getDureeMinutes()),
           fact.getStatut(),
           fact.getNiveau(),
           escape(fact.getPlanningDescription()));
   dataConnection.executeUpdate(query);
 }
예제 #2
0
 public void update(PlanningFact fact) throws Exception {
   if (fact.getId() == -1)
     throw new IllegalArgumentException("Cannot save transient fact " + fact);
   String query =
       String.format(
           "UPDATE planning_fact "
               + "SET date = '%s', type = '%s', planning = %d, prof =  %d, commentaire = '%s', duree = '%s', statut = %d, niveau = %d, planning_desc = '%s' "
               + "WHERE id = "
               + fact.getId(),
           toTimeStamp(fact.getDate()),
           fact.getType().toDBType(),
           fact.getPlanning(),
           fact.getProf(),
           escape(fact.getCommentaire()),
           minutesToPGInterval(fact.getDureeMinutes()),
           fact.getStatut(),
           fact.getNiveau(),
           escape(fact.getPlanningDescription()));
   dataConnection.executeUpdate(query);
 }
예제 #3
0
 public static boolean delete(int id, DataConnection dc) throws SQLException {
   int deleted = dc.executeUpdate(getDeleteQuery(id));
   return deleted > 0;
 }
예제 #4
0
 public static void insert(RehearsalPass card, DataConnection dc) throws SQLException {
   card.setId(nextId(SEQUENCE, dc));
   dc.executeUpdate(getInsertQuery(card));
 }
예제 #5
0
 public void delete(long id) throws Exception {
   dataConnection.executeUpdate("DELETE FROM planning_fact WHERE id = " + id);
 }