org.d2rq.db.schema
Class Inspector

java.lang.Object
  extended by org.d2rq.db.schema.Inspector

public class Inspector
extends Object

Inspects a database to retrieve schema information. This should be called through SQLConnection when possible, because that class caches results.

Author:
Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
Inspector(Connection connection, Vendor vendor)
           
 
Method Summary
 List<ColumnDef> describeSelectStatement(String sqlQuery)
           
 TableDef describeTableOrView(TableName table)
           
 List<TableName> getTableNames(String searchInSchema)
          Lists available table names.
 boolean isReferencedByForeignKey(TableName table)
           
 boolean isZerofillColumn(ColumnName column)
          TODO: Move vendor-specific zerofill stuff to vendor.MySQL class TODO: This should be cached in TableDef and not called through ConnectedDB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Inspector

public Inspector(Connection connection,
                 Vendor vendor)
Method Detail

getTableNames

public List<TableName> getTableNames(String searchInSchema)
Lists available table names.

Parameters:
searchInSchema - Schema to list tables from; null to list tables from all schemas
Returns:
A list of table names

describeSelectStatement

public List<ColumnDef> describeSelectStatement(String sqlQuery)

describeTableOrView

public TableDef describeTableOrView(TableName table)

isReferencedByForeignKey

public boolean isReferencedByForeignKey(TableName table)
Returns:
true if another table has a foreign key referencing this table's primary key

isZerofillColumn

public boolean isZerofillColumn(ColumnName column)
TODO: Move vendor-specific zerofill stuff to vendor.MySQL class TODO: This should be cached in TableDef and not called through ConnectedDB