Skip to content

Commit

Permalink
fix: use BIT for Oracle DB instead of Boolean
Browse files Browse the repository at this point in the history
resolves #6227
  • Loading branch information
jeremylong committed Dec 8, 2023
1 parent f1fe21e commit bdcdbf5
Showing 1 changed file with 20 additions and 5 deletions.
Expand Up @@ -978,10 +978,19 @@ private int updateOrInsertVulnerability(DefCveItem cve, String description) {
callUpdate.setNull(4, java.sql.Types.DOUBLE);
callUpdate.setNull(5, java.sql.Types.DOUBLE);
callUpdate.setNull(6, java.sql.Types.VARCHAR);
callUpdate.setNull(7, java.sql.Types.BOOLEAN);
callUpdate.setNull(8, java.sql.Types.BOOLEAN);
callUpdate.setNull(9, java.sql.Types.BOOLEAN);
callUpdate.setNull(10, java.sql.Types.BOOLEAN);
//TODO this is may also be an issue for MS SQL, if an issue is created we'll just need
// to create an isMsSQL flag. See todo below in setUpdateColum
if (isOracle) {
callUpdate.setNull(7, java.sql.Types.BIT);
callUpdate.setNull(8, java.sql.Types.BIT);
callUpdate.setNull(9, java.sql.Types.BIT);
callUpdate.setNull(10, java.sql.Types.BIT);
} else {
callUpdate.setNull(7, java.sql.Types.BOOLEAN);
callUpdate.setNull(8, java.sql.Types.BOOLEAN);
callUpdate.setNull(9, java.sql.Types.BOOLEAN);
callUpdate.setNull(10, java.sql.Types.BOOLEAN);
}
callUpdate.setNull(11, java.sql.Types.DOUBLE);
callUpdate.setNull(12, java.sql.Types.VARCHAR);
callUpdate.setNull(13, java.sql.Types.VARCHAR);
Expand Down Expand Up @@ -1649,7 +1658,13 @@ private void setUpdateColumn(PreparedStatement ps, int i, String value) throws S

private void setUpdateColumn(PreparedStatement ps, int i, Boolean value) throws SQLException {
if (value == null) {
ps.setNull(i, java.sql.Types.BOOLEAN);
//TODO this is may also be an issue for MS SQL, if an issue is created we'll just need
// to create an isMsSQL flag. See todo above in updateOrInsertVulnerability.
if (isOracle) {
ps.setNull(i, java.sql.Types.BIT);
} else {
ps.setNull(i, java.sql.Types.BOOLEAN);
}
} else {
ps.setBoolean(i, value);
}
Expand Down

0 comments on commit bdcdbf5

Please sign in to comment.