public class DbAnalyzer extends Object
| コンストラクタと説明 |
|---|
DbAnalyzer() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
static void |
dumpResultSetRow(ResultSet rs,
String description)
For debugging/analyzing result sets
|
static List<TableColumn> |
getDefaultNullStringColumns(Collection<Table> tables)
Returns a list of columns that have the word "NULL" or "null" as their default value
instead of the likely candidate value null.
|
static List<ForeignKeyConstraint> |
getForeignKeyConstraints(Collection<Table> tables)
Returns a
List of all of the ForeignKeyConstraints
used by the specified tables. |
static List<ImpliedForeignKeyConstraint> |
getImpliedConstraints(Collection<Table> tables) |
static List<TableColumn> |
getMustBeUniqueNullableColumns(Collection<Table> tables)
Return a list of
TableColumns that are both nullable
and have an index that specifies that they must be unique (a rather strange combo). |
static List<Table> |
getOrphans(Collection<Table> tables) |
static List<String> |
getPopulatedSchemas(DatabaseMetaData meta)
getSchemas - returns a List of schema names (Strings) that contain tables
|
static List<String> |
getPopulatedSchemas(DatabaseMetaData meta,
String schemaSpec)
getSchemas - returns a List of schema names (Strings) that contain tables and
match the
schemaSpec regular expression |
static List<RailsForeignKeyConstraint> |
getRailsConstraints(Map<String,Table> tables)
Ruby on Rails-based databases typically have no real referential integrity
constraints.
|
static List<String> |
getSchemas(DatabaseMetaData meta)
getSchemas - returns a List of schema names (Strings)
|
static List<Table> |
getTablesWithIncrementingColumnNames(Collection<Table> tables) |
static List<Table> |
getTablesWithOneColumn(Collection<Table> tables) |
static List<Table> |
getTablesWithoutIndexes(Collection<Table> tables)
Return a list of
Tables that have neither an index nor a primary key. |
static List<TableColumn> |
sortColumnsByTable(List<TableColumn> columns) |
static List<Table> |
sortTablesByName(List<Table> tables) |
public static List<ImpliedForeignKeyConstraint> getImpliedConstraints(Collection<Table> tables)
public static List<RailsForeignKeyConstraint> getRailsConstraints(Map<String,Table> tables)
Basically all tables have a primary key named ID.
All tables are named plural names.
The columns that logically reference that ID are the singular
form of the table name suffixed with _ID.
A side-effect of calling this method is that the returned collection of constraints will be "tied into" the associated tables.
tables - RailsForeignKeyConstraintspublic static List<ForeignKeyConstraint> getForeignKeyConstraints(Collection<Table> tables)
List of all of the ForeignKeyConstraints
used by the specified tables.tables - Collectionpublic static List<Table> getOrphans(Collection<Table> tables)
public static List<TableColumn> getMustBeUniqueNullableColumns(Collection<Table> tables)
TableColumns that are both nullable
and have an index that specifies that they must be unique (a rather strange combo).public static List<Table> getTablesWithoutIndexes(Collection<Table> tables)
Tables that have neither an index nor a primary key.public static List<Table> getTablesWithIncrementingColumnNames(Collection<Table> tables)
public static List<Table> getTablesWithOneColumn(Collection<Table> tables)
public static List<TableColumn> sortColumnsByTable(List<TableColumn> columns)
public static List<TableColumn> getDefaultNullStringColumns(Collection<Table> tables)
tables - Collectionpublic static List<String> getSchemas(DatabaseMetaData meta) throws SQLException
meta - DatabaseMetaDataSQLExceptionpublic static List<String> getPopulatedSchemas(DatabaseMetaData meta) throws SQLException
meta - DatabaseMetaDataSQLExceptionpublic static List<String> getPopulatedSchemas(DatabaseMetaData meta, String schemaSpec) throws SQLException
schemaSpec regular expressionmeta - DatabaseMetaDataSQLExceptionpublic static void dumpResultSetRow(ResultSet rs, String description) throws SQLException
rs - ResultSetSQLExceptionCopyright © 2016. All Rights Reserved.