Skip to content

Commit

Permalink
delete old ssvc upon new one
Browse files Browse the repository at this point in the history
  • Loading branch information
memeeerit committed Nov 13, 2023
1 parent 020cf5a commit a96a61e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion reconciler/src/main/java/edu/rit/se/nvip/DatabaseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -799,9 +799,15 @@ public boolean exploitExists(String cveId) {
}

public void insertSSVCSet(Set<CompositeVulnerability> vulns) {
try (Connection conn = getConnection(); PreparedStatement pstmt = conn.prepareStatement(INSERT_SSVC)) {
String deleteOldSSVC = "DELETE FROM ssvc WHERE cve_id = ?";
try (Connection conn = getConnection(); PreparedStatement pstmt = conn.prepareStatement(INSERT_SSVC);
PreparedStatement deleteStmt = conn.prepareStatement(deleteOldSSVC)) {
conn.setAutoCommit(false);
for (CompositeVulnerability vuln : vulns) {
deleteStmt.setString(1, vuln.getCveId());
deleteStmt.executeUpdate();


// Get SSVC data
final SSVC ssvc = vuln.getSSVC();

Expand Down

0 comments on commit a96a61e

Please sign in to comment.