|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.indiana.util.db.DBTools
public class DBTools
Contains useful static methods for using a database.
Field Summary | |
---|---|
static java.lang.reflect.Method |
RESULTSET_DOT_GETINT
|
static java.lang.reflect.Method |
RESULTSET_DOT_GETSTRING
|
Constructor Summary | |
---|---|
DBTools()
|
Method Summary | |
---|---|
static boolean |
closeAll(java.sql.Connection connectionObject,
java.sql.Statement statementObject)
This method closes a conection and statement |
static boolean |
closeAll(java.sql.Statement statementObject)
This method closes a conection and statement |
static boolean |
closeResultSet(java.sql.ResultSet resultSet)
This method closes a JDBC resultset |
static boolean |
closeSQLConnection(java.sql.Connection connectionObject)
This method closes a JDBC connection |
static boolean |
closeSQLStatement(java.sql.Statement statementObject)
This method closes a JDBC statement |
static java.sql.Connection |
createNewSQLConnection(JDBCDriverInfo driverInfo)
This method will create a JDBC connection object from the JDBC driver information provided |
static java.sql.Statement |
createNewSQLStatement(JDBCDriverInfo driverInfo)
This method will create a JDBC statement object from the JDBC driver information provided |
static java.sql.Statement |
createNewSQLStatementFromConnectionObject(java.sql.Connection connectionObject)
This method will create a JDBC statement object from the JDBC connection object provided |
static void |
createTable(java.sql.Statement stmt,
java.lang.String tableName,
java.lang.String[] columnNames,
java.lang.String[] columnTypes)
This method is used to create the specified table using the given attribute names and types. |
static void |
deleteTable(java.sql.Statement stmt,
java.lang.String tableName)
This method is used to drop the featureSpecTable defined by this class from the database |
static void |
flushTable(java.sql.Statement stmt,
java.lang.String tableName)
This method is used to empty the extraDataTable in the database defined by this class |
static java.util.ArrayList |
readAllRowsOfQuery(java.sql.Statement stmt,
java.lang.String query,
java.lang.reflect.Method[] getMethods)
|
static java.util.ArrayList |
readAllRowsOfTable(java.sql.Statement stmt,
java.lang.String tableName,
java.lang.reflect.Method[] getMethods)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.reflect.Method RESULTSET_DOT_GETINT
public static final java.lang.reflect.Method RESULTSET_DOT_GETSTRING
Constructor Detail |
---|
public DBTools()
Method Detail |
---|
public static java.sql.Connection createNewSQLConnection(JDBCDriverInfo driverInfo)
driverInfo
- a JDBCDriverInfo
public static java.sql.Statement createNewSQLStatement(JDBCDriverInfo driverInfo)
driverInfo
- a JDBCDriverInfo
public static java.sql.Statement createNewSQLStatementFromConnectionObject(java.sql.Connection connectionObject)
connectionObject
- a Connection
public static java.util.ArrayList readAllRowsOfTable(java.sql.Statement stmt, java.lang.String tableName, java.lang.reflect.Method[] getMethods)
stmt
- The Statement object on which the query will be run.tableName
- The name of the table to read.numCols
- The number of columns in the table.getMethods
- An array of Method objects, where getMethods[i] is the ResultSet method
to use to get the value from column i (0-based).
public static java.util.ArrayList readAllRowsOfQuery(java.sql.Statement stmt, java.lang.String query, java.lang.reflect.Method[] getMethods)
public static void createTable(java.sql.Statement stmt, java.lang.String tableName, java.lang.String[] columnNames, java.lang.String[] columnTypes)
stmt
- an opened StatementtableName
- the name of the table to createcolumnNames
- the name of the columns or attributescolumnTypes
- types for each of the columns.public static void deleteTable(java.sql.Statement stmt, java.lang.String tableName)
stmt
- an opened StatementtableName
- name of the table to remove/droppublic static void flushTable(java.sql.Statement stmt, java.lang.String tableName)
stmt
- an opened StatementtableName
- name of the table to be flushedpublic static boolean closeSQLStatement(java.sql.Statement statementObject)
statementObject
- a Statement
public static boolean closeSQLConnection(java.sql.Connection connectionObject)
connectionObject
- a Connection
public static boolean closeResultSet(java.sql.ResultSet resultSet)
resultSet
- a ResultSet
public static boolean closeAll(java.sql.Connection connectionObject, java.sql.Statement statementObject)
connectionObject
- a ConnectionstatementObject
- a Statement
public static boolean closeAll(java.sql.Statement statementObject)
statementObject
- a Statement
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |