public class ConnectionMetaData extends Object implements TableReferenceMetaData
ConnectionMetaData provides convenient api to access the meta-data of a jdbc connection.
Connection jdbcConnection = ...;
ConnectionMetaData metaData = new ConnectionMetaData(jdbcConnection);
ForeignKeyList foreignKeys = metaData.getImportedKeys("film_actor");
ColumnMetaDataList filmActorColumns = metaData.getColumnMetaDataList("film_actor");
ForeignKey foreignKey = foreignKeys.getByFkColumnDescription(filmActorColumns.getByName("actor_id"));
assertNotNull(foreignKey);
assertEquals("fk_film_actor_actor", foreignKey.getName());
ColumnMetaDataList actorColumns = metaData.getColumnMetaDataList("actor");
foreignKey = foreignKeys.getByPkColumnDescription(actorColumns.getByName("actor_id"));
assertNotNull(foreignKey);
assertEquals("fk_film_actor_actor", foreignKey.getName());

| Constructor and Description |
|---|
ConnectionMetaData(Connection connection) |
ConnectionMetaData(Connection connection,
JdbcContext context) |
ConnectionMetaData(Connection connection,
JdbcContext context,
String... tableTypes) |
ConnectionMetaData(Connection connection,
String... tableTypes) |
| Modifier and Type | Method and Description |
|---|---|
protected PrimaryKey |
createPrimaryKey(ColumnMetaDataList columnMetaDataList,
List<PrimaryKeyColumn> primaryKeyColumns) |
ColumnMetaDataList |
getColumnMetaDataList(String tableName) |
List<ColumnMetaData> |
getColumnMetaDataList(TableMetaData jdbcTableMetaData) |
ForeignKeyList |
getExportedKeys(String tableName) |
ForeignKeyList |
getImportedKeys(String tableName) |
TableReferenceList |
getIncomingReferences(String tableName) |
TableReferenceList |
getOutgoingReferences(String tableName) |
PrimaryKey |
getPrimaryKey(String tableName) |
protected ScopedDatabaseMetaData |
getScopedDatabaseMetaData() |
TableMetaData |
getTableMetaData(String tableName)
Convenience method for
getTableMetaDataList().getByName(tableName). |
TableMetaDataList |
getTableMetaDataList() |
public ConnectionMetaData(Connection connection)
public ConnectionMetaData(Connection connection, String... tableTypes)
public ConnectionMetaData(Connection connection, JdbcContext context)
public ConnectionMetaData(Connection connection, JdbcContext context, String... tableTypes)
public TableMetaData getTableMetaData(String tableName) throws SQLException
getTableMetaDataList().getByName(tableName).tableName - SQLExceptionpublic TableMetaDataList getTableMetaDataList() throws SQLException
SQLExceptionprotected ScopedDatabaseMetaData getScopedDatabaseMetaData() throws SQLException
SQLExceptionpublic PrimaryKey getPrimaryKey(String tableName) throws SQLException
SQLExceptionprotected PrimaryKey createPrimaryKey(ColumnMetaDataList columnMetaDataList, List<PrimaryKeyColumn> primaryKeyColumns)
public List<ColumnMetaData> getColumnMetaDataList(TableMetaData jdbcTableMetaData) throws SQLException
SQLExceptionpublic ColumnMetaDataList getColumnMetaDataList(String tableName) throws SQLException
SQLExceptionpublic ForeignKeyList getExportedKeys(String tableName) throws SQLException
SQLExceptionpublic ForeignKeyList getImportedKeys(String tableName) throws SQLException
SQLExceptionpublic TableReferenceList getOutgoingReferences(String tableName) throws SQLException
getOutgoingReferences in interface TableReferenceMetaDataSQLExceptionpublic TableReferenceList getIncomingReferences(String tableName) throws SQLException
getIncomingReferences in interface TableReferenceMetaDataSQLExceptionCopyright © 2011–2023 Link Intersystems GmbH. All rights reserved.