| java.lang.Object com.finalist.jaggenerator.DatabaseUtils
DatabaseUtils | public class DatabaseUtils (Code) | | This class is a refactoring mid-step. The original code contained duplicate methods for database access
in different classes - I've rehoused them here.
author: Michael O'Connor, Rudie Ekkelenkamp - Finalist IT Group |
Field Summary | |
static Log | log |
Method Summary | |
public static void | clearCache() This needs to be called when databases are switched. | public static void | clearColumnsCacheForTable(String tableName) Forces an update of a particular table's columns the next time they are required. | public static ArrayList | getColumns(String tablename) Gets all columns in the specified table, setting up a database connection if one isn't already available.
Parameters: tablename - the name of the table. | public static ArrayList | getColumns(String tablename, boolean forceConnection) Gets all columns in the specified table.
Parameters: tablename - the name of the table. Parameters: forceConnection - set to true if this method should force a database connect,if not already connected. | public static List | getForeignKeys(String tablename) Gets information about any foreign keys that are imported into the specified table. | public static ArrayList | getPrimaryKeys(String tablename) A list with Strings of all primary key fields. | public static ArrayList | getTables() Grabs the list of tables from the database. |
clearCache | public static void clearCache()(Code) | | This needs to be called when databases are switched.
|
clearColumnsCacheForTable | public static void clearColumnsCacheForTable(String tableName)(Code) | | Forces an update of a particular table's columns the next time they are required.
Parameters: tableName - |
getColumns | public static ArrayList getColumns(String tablename)(Code) | | Gets all columns in the specified table, setting up a database connection if one isn't already available.
Parameters: tablename - the name of the table. an ArrayList of Column objects for all columns in the specified table,or null if the table/column doesn't exist. |
getColumns | public static ArrayList getColumns(String tablename, boolean forceConnection)(Code) | | Gets all columns in the specified table.
Parameters: tablename - the name of the table. Parameters: forceConnection - set to true if this method should force a database connect,if not already connected. an ArrayList of Column objects for all columns in the specified table;or null if the table/column doesn't exist, or if no database connection was available andforceConnection was set to false . |
getForeignKeys | public static List getForeignKeys(String tablename)(Code) | | Gets information about any foreign keys that are imported into the specified table.
Parameters: tablename - a List of ForeignKey objects, never null .. |
getPrimaryKeys | public static ArrayList getPrimaryKeys(String tablename)(Code) | | A list with Strings of all primary key fields.
Parameters: tablename - an ArrayList of primary key column names for the specified table, never null . |
getTables | public static ArrayList getTables()(Code) | | Grabs the list of tables from the database.
a List of table names (String), never null . |
|
|