Advertisement
Zeroji

Untitled

May 27th, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1.     private void supprimer(Exercice exercice, String BASE) {
  2.         if(!load()) return;
  3.         try {
  4.             String matieres = "";
  5.             for(Matiere matiere:exercice.getMatieres())
  6.                 matieres += "','" + matiere.getNom();
  7.             matieres = matieres.substring(3);
  8.             int id = s.executeQuery(String.format(
  9.                     "SELECT ID FROM %s WHERE NOM='%s' AND SUJET='%s' AND NIVEAU='%s' AND " +
  10.                     "(SELECT MATIERE_ID FROM MAT_%s WHERE EXERCICE_ID = ID) = " +
  11.                     "(SELECT         ID FROM MATIERES WHERE NOM IN (%s))",
  12.                     BASE, exercice.getNom(), exercice.getSujet(), exercice.getNiveau().toString(),
  13.                     BASE, matieres)).getInt("ID");
  14.             s.executeUpdate(String.format("DELETE FROM %s WHERE ID=%d", BASE, id));
  15.             s.executeUpdate(String.format("DELETE FROM MAT_%s WHERE EXERCICE_ID=%d", BASE, id));
  16.         }
  17.         catch(Exception e) {
  18.             System.err.println(e.getClass().getName() + ": " + e.getMessage());
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement