Package org.owasp.dependencycheck.utils
Class DBUtils
- java.lang.Object
-
- org.owasp.dependencycheck.utils.DBUtils
-
@ThreadSafe public final class DBUtils extends java.lang.ObjectCollection of utility methods for working with database objects.- Author:
- Jeremy Long
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseResultSet(java.sql.ResultSet rs)Closes the result set capturing and ignoring any SQLExceptions that occur.static voidcloseStatement(java.sql.Statement statement)Closes the given statement object ignoring any exceptions that occur.static intgetGeneratedKey(java.sql.PreparedStatement statement)Returns the generated integer primary key for a newly inserted row.
-
-
-
Method Detail
-
getGeneratedKey
public static int getGeneratedKey(java.sql.PreparedStatement statement) throws DatabaseExceptionReturns the generated integer primary key for a newly inserted row.- Parameters:
statement- a prepared statement that just executed an insert- Returns:
- a primary key
- Throws:
DatabaseException- thrown if there is an exception obtaining the key
-
closeStatement
public static void closeStatement(java.sql.Statement statement)
Closes the given statement object ignoring any exceptions that occur.- Parameters:
statement- a Statement object
-
closeResultSet
public static void closeResultSet(java.sql.ResultSet rs)
Closes the result set capturing and ignoring any SQLExceptions that occur.- Parameters:
rs- a ResultSet to close
-
-