Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1774,21 +1774,27 @@ public void cleanupDatabase() {
PreparedStatement psEcosystem = getPreparedStatement(conn, UPDATE_ECOSYSTEM);
PreparedStatement psEcosystem2 = getPreparedStatement(conn, UPDATE_ECOSYSTEM2)) {
if (psEcosystem != null) {
final long ecosystemStart = System.currentTimeMillis();
final int count = psEcosystem.executeUpdate();
if (count > 0) {
LOGGER.info("Updated the CPE ecosystem on {} NVD records", count);
LOGGER.info("Updated the CPE ecosystem on {} NVD records ({} ms)", count,
System.currentTimeMillis() - ecosystemStart);
Comment on lines +1780 to +1781
}
}
if (psEcosystem2 != null) {
final long ecosystemStart = System.currentTimeMillis();
final int count = psEcosystem2.executeUpdate();
if (count > 0) {
LOGGER.info("Removed the CPE ecosystem on {} NVD records", count);
LOGGER.info("Removed the CPE ecosystem on {} NVD records ({} ms)", count,
System.currentTimeMillis() - ecosystemStart);
}
}
if (psOrphans != null) {
final long orphanStart = System.currentTimeMillis();
final int count = psOrphans.executeUpdate();
if (count > 0) {
LOGGER.info("Cleaned up {} orphaned NVD records", count);
LOGGER.info("Cleaned up {} orphaned NVD records ({} ms)", count,
System.currentTimeMillis() - orphanStart);
}
}
final long millis = System.currentTimeMillis() - start;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/data/dbStatements.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ INSERT_PROPERTY=INSERT INTO properties (id, `value`) VALUES (?, ?)
UPDATE_PROPERTY=UPDATE properties SET `value` = ? WHERE id = ?
DELETE_PROPERTY=DELETE FROM properties WHERE id = ?

UPDATE_ECOSYSTEM=UPDATE cpeEntry e SET e.ecosystem=(SELECT cpeEcosystemCache.ecosystem FROM cpeEcosystemCache WHERE cpeEcosystemCache.vendor=e.vendor AND cpeEcosystemCache.product=e.product AND e.ecosystem IS NULL AND cpeEcosystemCache.ecosystem<>'MULTIPLE') WHERE e.ecosystem IS NULL;
UPDATE_ECOSYSTEM=UPDATE cpeEntry e SET e.ecosystem=(SELECT cpeEcosystemCache.ecosystem FROM cpeEcosystemCache WHERE cpeEcosystemCache.vendor=e.vendor AND cpeEcosystemCache.product=e.product AND cpeEcosystemCache.ecosystem<>'MULTIPLE') WHERE e.ecosystem IS NULL AND EXISTS(SELECT 1 FROM cpeEcosystemCache WHERE cpeEcosystemCache.vendor=e.vendor AND cpeEcosystemCache.product=e.product AND cpeEcosystemCache.ecosystem<>'MULTIPLE');
UPDATE_ECOSYSTEM2=UPDATE cpeEntry e SET e.ecosystem=null WHERE e.ecosystem IS NOT NULL AND EXISTS(SELECT * FROM cpeEcosystemCache WHERE cpeEcosystemCache.vendor=e.vendor AND cpeEcosystemCache.product=e.product AND cpeEcosystemCache.ecosystem='MULTIPLE');

SELECT_SCHEMA_VERSION=SELECT value FROM properties WHERE id = 'version'
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/data/dbStatements_h2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

MERGE_PROPERTY=MERGE INTO properties (id, `value`) KEY(id) VALUES(?, ?)
MERGE_CPE_ECOSYSTEM=MERGE INTO cpeEcosystemCache (vendor, product, ecosystem) KEY(vendor, product) VALUES(?, ?, ?)
CLEANUP_ORPHANS=DELETE FROM cpeEntry WHERE id IN (SELECT id FROM cpeEntry LEFT JOIN software ON cpeEntry.id = software.CPEEntryId WHERE software.CPEEntryId IS NULL)
CLEANUP_ORPHANS=DELETE FROM cpeEntry WHERE NOT EXISTS (SELECT 1 FROM software WHERE software.CPEEntryId = cpeEntry.id)

UPDATE_VULNERABILITY=SELECT * FROM update_vulnerability(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Expand Down
Loading