Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void supprimer(Exercice exercice, String BASE) {
- if(!load()) return;
- try {
- String matieres = "";
- for(Matiere matiere:exercice.getMatieres())
- matieres += "','" + matiere.getNom();
- matieres = matieres.substring(3);
- int id = s.executeQuery(String.format(
- "SELECT ID FROM %s WHERE NOM='%s' AND SUJET='%s' AND NIVEAU='%s' AND " +
- "(SELECT MATIERE_ID FROM MAT_%s WHERE EXERCICE_ID = ID) = " +
- "(SELECT ID FROM MATIERES WHERE NOM IN (%s))",
- BASE, exercice.getNom(), exercice.getSujet(), exercice.getNiveau().toString(),
- BASE, matieres)).getInt("ID");
- s.executeUpdate(String.format("DELETE FROM %s WHERE ID=%d", BASE, id));
- s.executeUpdate(String.format("DELETE FROM MAT_%s WHERE EXERCICE_ID=%d", BASE, id));
- }
- catch(Exception e) {
- System.err.println(e.getClass().getName() + ": " + e.getMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement