converted to BaseDB to DBUtils

Former-commit-id: 4710ba824597c979d3ad12c8500873e0087e71c9
This commit is contained in:
Jeremy Long
2014-01-03 14:27:43 -05:00
parent 5837718cf4
commit b6a4dfb424

View File

@@ -18,13 +18,6 @@
*/
package org.owasp.dependencycheck.data;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -32,15 +25,19 @@ import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.owasp.dependencycheck.data.nvdcve.CveDB;
import static org.owasp.dependencycheck.data.nvdcve.CveDB.DB_SCHEMA_VERSION;
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
import org.owasp.dependencycheck.utils.Settings;
/**
*
* @author Jeremy Long (jeremy.long@owasp.org)
*/
public class BaseDB {
public final class DBUtils {
/**
* Private constructor for a utility class.
*/
private DBUtils() {
}
/**
* Returns the generated integer primary key for a newly inserted row.
@@ -50,7 +47,7 @@ public class BaseDB {
* @throws DatabaseException thrown if there is an exception obtaining the
* key
*/
protected int getGeneratedKey(PreparedStatement statement) throws DatabaseException {
public static int getGeneratedKey(PreparedStatement statement) throws DatabaseException {
ResultSet rs = null;
int id = 0;
try {
@@ -70,7 +67,7 @@ public class BaseDB {
*
* @param statement a Statement object
*/
public void closeStatement(Statement statement) {
public static void closeStatement(Statement statement) {
if (statement != null) {
try {
statement.close();
@@ -87,7 +84,7 @@ public class BaseDB {
*
* @param rs a ResultSet to close
*/
public void closeResultSet(ResultSet rs) {
public static void closeResultSet(ResultSet rs) {
if (rs != null) {
try {
rs.close();