|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.finalist.jaggenerator.DatabaseUtils
This class is a refactoring mid-step. The original code contained duplicate methods for database access in different classes - I've rehoused them here.
Field Summary | |
(package private) static org.apache.commons.logging.Log |
log
|
Constructor Summary | |
DatabaseUtils()
|
Method Summary | |
static void |
clearCache()
This needs to be called when databases are switched. |
static void |
clearColumnsCacheForTable(java.lang.String tableName)
Forces an update of a particular table's columns the next time they are required. |
static java.util.ArrayList |
getColumns(java.lang.String tablename)
Gets all columns in the specified table, setting up a database connection if one isn't already available. |
static java.util.ArrayList |
getColumns(java.lang.String tablename,
boolean forceConnection)
Gets all columns in the specified table. |
static java.util.List |
getForeignKeys(java.lang.String tablename)
Gets information about any foreign keys that are imported into the specified table. |
static java.util.ArrayList |
getPrimaryKeys(java.lang.String tablename)
A list with Strings of all primary key fields. |
static java.util.ArrayList |
getTables()
Grabs the list of tables from the database. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static org.apache.commons.logging.Log log
Constructor Detail |
public DatabaseUtils()
Method Detail |
public static java.util.ArrayList getColumns(java.lang.String tablename)
tablename
- the name of the table.
null
if the table/column doesn't exist.public static java.util.ArrayList getColumns(java.lang.String tablename, boolean forceConnection)
tablename
- the name of the table.forceConnection
- set to true
if this method should force a database connect,
if not already connected.
null
if the table/column doesn't exist, or if no database connection was available and
forceConnection
was set to false
.public static java.util.List getForeignKeys(java.lang.String tablename)
tablename
-
null
..public static java.util.ArrayList getPrimaryKeys(java.lang.String tablename)
tablename
-
null
.public static java.util.ArrayList getTables()
null
.public static void clearCache()
public static void clearColumnsCacheForTable(java.lang.String tableName)
tableName
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |