|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fuberlin.wiwiss.d2rq.dbschema.DatabaseSchemaInspector
public class DatabaseSchemaInspector
Inspects a database to retrieve schema information.
TODO: All the dbType checks should be moved to the 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!
Field Summary | |
---|---|
static int |
KEYS_EXPORTED
|
static int |
KEYS_IMPORTED
|
Constructor Summary | |
---|---|
DatabaseSchemaInspector(ConnectedDB db)
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int KEYS_IMPORTED
public static final int KEYS_EXPORTED
Constructor Detail |
---|
public DatabaseSchemaInspector(ConnectedDB db)
Method Detail |
---|
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 schemas
RelationName
spublic List<Attribute> listColumns(RelationName tableName)
public List<Attribute> primaryKeyColumns(RelationName tableName)
public Map<String,List<String>> uniqueColumns(RelationName tableName)
tableName
- Name of a table
public 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.
Join
s; the local columns are in attributes1()public RelationName getCorrectCapitalization(RelationName relationName)
relationName
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |