|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.afcs.warts.util.DatabaseUtils
The DatabaseUtils class provides numerous utility methods that simplify database use. The most useful methods simply wrap standard library methods providing error handling and recovery functionality that simplify the calling code.
LICENSE: This code is released to the public domain and may be used for any purpose whatsoever without permission or acknowledgment.
Method Summary | |
static boolean |
closeConnection(java.sql.Connection connection)
Calls close() on the Connection object received, if non-null. |
static boolean |
closeResultSet(java.sql.ResultSet resultSet)
Ensures that the ResultSet object received is closed, if non-null. |
static boolean |
closeStatement(java.sql.Statement statement)
Ensures that the Statement object received is closed, if non-null. |
static java.lang.String |
escapeTextForSqlQuery(java.lang.String inputString)
This method should be used to pre-process character data that is to be used in straight SQL statements. |
static void |
handleSQLException(java.sql.SQLException sqlException)
This method can be used by any database access classes to handle SQL exceptions in a consistent manner. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.String escapeTextForSqlQuery(java.lang.String inputString)
Note that this method should not be used when using PreparedStatements, as the JDBC driver has its own escaping mechanism.
inputString
- The string to be verified.
public static boolean closeConnection(java.sql.Connection connection)
connection
- The connection to call rollback() on.
public static boolean closeResultSet(java.sql.ResultSet resultSet)
resultSet
- The result set to close.
public static boolean closeStatement(java.sql.Statement statement)
statement
- The statement to close.
public static void handleSQLException(java.sql.SQLException sqlException)
sqlException
- The error to handle.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |