public class DatabaseSchemaInspector extends Object
Vendor subclasses
TODO: This usually shouldn't be used directly, but through the ConnectedDB.
Except in the MappingGenerator. ConnectedDB is easier mockable for unit tests!| Modifier and Type | Field and Description |
|---|---|
static int |
KEYS_EXPORTED |
static int |
KEYS_IMPORTED |
| Constructor and Description |
|---|
DatabaseSchemaInspector(ConnectedDB db) |
| Modifier and Type | Method and Description |
|---|---|
DataType |
columnType(Attribute column) |
List<Join> |
foreignKeys(RelationName tableName,
int direction)
Returns a list of imported or exported (foreign) keys for a table.
|
RelationName |
getCorrectCapitalization(RelationName relationName)
Looks up a RelationName with the schema in order to retrieve the correct capitalization
|
boolean |
isNullable(Attribute column) |
boolean |
isZerofillColumn(Attribute column) |
List<Attribute> |
listColumns(RelationName tableName) |
List<RelationName> |
listTableNames(String searchInSchema)
Lists available table names
|
List<Attribute> |
primaryKeyColumns(RelationName tableName) |
Map<String,List<String>> |
uniqueColumns(RelationName tableName)
Returns unique indexes defined on the table.
|
public static final int KEYS_IMPORTED
public static final int KEYS_EXPORTED
public DatabaseSchemaInspector(ConnectedDB db)
public DataType columnType(Attribute column)
column - null if unknownpublic boolean isNullable(Attribute column)
public boolean isZerofillColumn(Attribute column)
public List<RelationName> listTableNames(String searchInSchema)
searchInSchema - Schema to list tables from; null to list tables from all schemasRelationNamespublic List<Attribute> listColumns(RelationName tableName)
public List<Attribute> primaryKeyColumns(RelationName tableName)
public Map<String,List<String>> uniqueColumns(RelationName tableName)
tableName - Name of a tablepublic List<Join> foreignKeys(RelationName tableName, int direction)
tableName - The table we are interested indirection - If set to KEYS_IMPORTED, the table's foreign keys are returned.
If set to KEYS_EXPORTED, the table's primary keys referenced from other tables are returned.Joins; the local columns are in attributes1()public RelationName getCorrectCapitalization(RelationName relationName)
relationName -