Class InformationExtractorJdbcDatabaseMetaDataImpl
- All Implemented Interfaces:
InformationExtractor
DatabaseMetaData
API for extraction.-
Nested Class Summary
Nested classes/interfaces inherited from class org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl
AbstractInformationExtractorImpl.ForeignKeyBuilder, AbstractInformationExtractorImpl.ForeignKeyBuilderImpl -
Constructor Summary
ConstructorsConstructorDescriptionInformationExtractorJdbcDatabaseMetaDataImpl(ExtractionContext extractionContext) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddColumns(TableInformation tableInformation) protected String<T> TprocessCatalogsResultSet(ExtractionContext.ResultSetProcessor<T> processor) Must do the following: obtain aResultSetcontaining a column of existing catalog names.protected <T> TprocessColumnsResultSet(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern, ExtractionContext.ResultSetProcessor<T> processor) Must do the following: obtain aResultSetcontaining a row for any existing catalog/schema/table/column combination as specified by thecatalog,schemaPattern,tableNamePattern, andcolumnNamePatternparameters described below.protected <T> TprocessCrossReferenceResultSet(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable, ExtractionContext.ResultSetProcessor<T> processor) Must do the following: obtain aResultSetcontaining a row for each foreign key column making up a foreign key for any existing foreignCatalog/foreignSchema/foreignTable combination as specified by parameters described below.protected <T> TprocessImportedKeysResultSet(String catalog, String schema, String table, ExtractionContext.ResultSetProcessor<T> processor) Must do the following: obtain aResultSetcontaining a row for each foreign key/ primary key column making up a foreign key for any existing catalog/schema/table combination as specified by thecatalog,schema, andtableparameters described below.protected <T> TprocessIndexInfoResultSet(String catalog, String schema, String table, boolean unique, boolean approximate, ExtractionContext.ResultSetProcessor<T> processor) Must do the following: obtain aResultSetcontaining a row for each column defined in an index.protected <T> TprocessPrimaryKeysResultSet(String catalogFilter, String schemaFilter, Identifier tableName, ExtractionContext.ResultSetProcessor<T> processor) protected <T> TprocessSchemaResultSet(String catalog, String schemaPattern, ExtractionContext.ResultSetProcessor<T> processor) Must do the following: obtain aResultSetcontaining a row for any existing catalog/schema combination as specified by thecatalogandschemaPatternparameters described below.protected <T> TprocessTableResultSet(String catalog, String schemaPattern, String tableNamePattern, String[] types, ExtractionContext.ResultSetProcessor<T> processor) Must do the following: obtain aResultSetcontaining a row for any existing catalog/schema/table/table type combination as specified by thecatalogFilter,schemaFilter,tableNameFilter, andtableTypesparameters described below.Methods inherited from class org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl
catalogExists, columnInformation, convertSQLException, getExtractionContext, getForeignKeys, getIndexes, getJdbcEnvironment, getPrimaryKey, getResultSetCatalogLabel, getResultSetColumnNameLabel, getResultSetColumnPositionColumn, getResultSetColumnSizeLabel, getResultSetDecimalDigitsLabel, getResultSetForeignKeyColumnNameLabel, getResultSetForeignKeyLabel, getResultSetIndexNameLabel, getResultSetIndexTypeLabel, getResultSetIsNullableLabel, getResultSetPrimaryKeyCatalogLabel, getResultSetPrimaryKeyColumnNameLabel, getResultSetPrimaryKeyNameLabel, getResultSetPrimaryKeySchemaLabel, getResultSetPrimaryKeyTableLabel, getResultSetRemarksLabel, getResultSetSchemaLabel, getResultSetSqlTypeCodeLabel, getResultSetTableNameLabel, getResultSetTableTypeLabel, getResultSetTypeNameLabel, getTable, getTables, interpretTruthValue, isPhysicalTableType, schemaExists, toMetaDataObjectName
-
Constructor Details
-
InformationExtractorJdbcDatabaseMetaDataImpl
-
-
Method Details
-
getResultSetTableTypesPhysicalTableConstant
- Specified by:
getResultSetTableTypesPhysicalTableConstantin classAbstractInformationExtractorImpl
-
processCatalogsResultSet
public <T> T processCatalogsResultSet(ExtractionContext.ResultSetProcessor<T> processor) throws SQLException Description copied from class:AbstractInformationExtractorImplMust do the following:-
obtain a
ResultSetcontaining a column of existing catalog names. The column label must be the same as returned byAbstractInformationExtractorImpl.getResultSetCatalogLabel(). - execute
processor.process( resultSet ); -
release resources whether
processor.process( resultSet )executes successfully or not.
- Specified by:
processCatalogsResultSetin classAbstractInformationExtractorImpl- Type Parameters:
T- - defined byprocessor- Parameters:
processor- - the provided ResultSetProcessor.- Returns:
- - defined by
processor - Throws:
SQLException- - if a database error occurs
-
obtain a
-
processSchemaResultSet
protected <T> T processSchemaResultSet(String catalog, String schemaPattern, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException Description copied from class:AbstractInformationExtractorImplMust do the following:-
obtain a
ResultSetcontaining a row for any existing catalog/schema combination as specified by thecatalogandschemaPatternparameters described below. The row contents will not be examined byprocessor.process( resultSet ), so column label names are not specified; - execute
processor.process( resultSet ); -
release resources whether
processor.process( resultSet )executes successfully or not.
The
catalogandschemaPatternparameters are as specified byDatabaseMetaData.getSchemas(String, String), and are copied here:- Specified by:
processSchemaResultSetin classAbstractInformationExtractorImpl- Type Parameters:
T- - defined byprocessor- Parameters:
catalog- – a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means catalog name should not be used to narrow down the search.schemaPattern- – a schema name; must match the schema name as it is stored in the database; null means schema name should not be used to narrow down the search.processor- - the provided ResultSetProcessor.- Returns:
- - defined by
processor - Throws:
SQLException- - if a database error occurs
-
obtain a
-
processTableResultSet
protected <T> T processTableResultSet(String catalog, String schemaPattern, String tableNamePattern, String[] types, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException Description copied from class:AbstractInformationExtractorImplMust do the following:-
obtain a
ResultSetcontaining a row for any existing catalog/schema/table/table type combination as specified by thecatalogFilter,schemaFilter,tableNameFilter, andtableTypesparameters described below. TheResultSetmust contain the following, consistent with the corresponding columns returned byDatabaseMetaData.getTables(String, String, String, String[])- column label
AbstractInformationExtractorImpl.getResultSetTableNameLabel()for table name - column label
AbstractInformationExtractorImpl.getResultSetTableTypeLabel()for table type - column label
AbstractInformationExtractorImpl.getResultSetRemarksLabel()for table comment
- column label
- execute
processor.process( resultSet ); -
release resources whether
processor.process( resultSet )executes successfully or not.
The
catalog,schemaPattern,tableNamePattern, andcolumnNamePatternparameters are as specified byDatabaseMetaData.getTables(String, String, String, String[]), and are copied here:- Specified by:
processTableResultSetin classAbstractInformationExtractorImpl- Type Parameters:
T- - defined byprocessor- Parameters:
catalog- - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the searchschemaPattern- - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the searchtableNamePattern- - a table name pattern; must match the table name as it is stored in the databasetypes- - a list of table typesprocessor- - the provided ResultSetProcessor.- Returns:
- - defined by
processor - Throws:
SQLException- - if a database error occurs
-
obtain a
-
processColumnsResultSet
protected <T> T processColumnsResultSet(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException Description copied from class:AbstractInformationExtractorImplMust do the following:-
obtain a
ResultSetcontaining a row for any existing catalog/schema/table/column combination as specified by thecatalog,schemaPattern,tableNamePattern, andcolumnNamePatternparameters described below. TheResultSetmust contain the following, consistent with the corresponding columns returned byDatabaseMetaData.getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)- column label
AbstractInformationExtractorImpl.getResultSetTableNameLabel()for table name - column label
AbstractInformationExtractorImpl.getResultSetColumnNameLabel()for column name - column label
AbstractInformationExtractorImpl.getResultSetSqlTypeCodeLabel()SQL type code from java.sql.Types - column label
AbstractInformationExtractorImpl.getResultSetTypeNameLabel()for database column type name - column label
AbstractInformationExtractorImpl.getResultSetColumnSizeLabel()for column size - column label
AbstractInformationExtractorImpl.getResultSetDecimalDigitsLabel()for number of fractional digits - column label
AbstractInformationExtractorImpl.getResultSetIsNullableLabel()for nullability
- column label
- execute
processor.process( resultSet ); -
release resources whether
processor.process( resultSet )executes successfully or not.
The
catalog,schemaPattern,tableNamePattern, andcolumnNamePatternparameters are as specified byDatabaseMetaData.getColumns(String, String, String, String), and are copied here:- Specified by:
processColumnsResultSetin classAbstractInformationExtractorImpl- Type Parameters:
T- - defined byprocessor- Parameters:
catalog- – a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the searchschemaPattern- – a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the searchtableNamePattern- – a table name pattern; must match the table name as it is stored in the databasecolumnNamePattern- – a column name pattern; must match the column name as it is stored in the databaseprocessor- - the provided ResultSetProcessor.- Returns:
- - defined by
processor - Throws:
SQLException- - if a database error occurs
-
obtain a
-
processPrimaryKeysResultSet
protected <T> T processPrimaryKeysResultSet(String catalogFilter, String schemaFilter, Identifier tableName, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException - Specified by:
processPrimaryKeysResultSetin classAbstractInformationExtractorImpl- Throws:
SQLException
-
processIndexInfoResultSet
protected <T> T processIndexInfoResultSet(String catalog, String schema, String table, boolean unique, boolean approximate, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException Description copied from class:AbstractInformationExtractorImplMust do the following:-
obtain a
ResultSetcontaining a row for each column defined in an index. TheResultSetmust contain the following, consistent with the corresponding columns returned byDatabaseMetaData.getIndexInfo(String, String, String, boolean, boolean)- column label
AbstractInformationExtractorImpl.getResultSetIndexNameLabel()for index name; null when TYPE is tableIndexStatistic - column label
AbstractInformationExtractorImpl.getResultSetIndexTypeLabel()index type:-
DatabaseMetaData.tableIndexStatistic- this identifies table statistics that are returned in conjunction with a table's index descriptions -
Any value other than
DatabaseMetaData.tableIndexStatistic- this indicates that a table's index description (not statisics) is being returned.
-
-
column label
AbstractInformationExtractorImpl.getResultSetColumnNameLabel()- column name;nullwhen TYPE isDatabaseMetaData.tableIndexStatistic
- column label
- execute
processor.process( resultSet ); -
release resources whether
processor.process( resultSet )executes successfully or not.
The
catalog,schemaPattern,tableNamePattern, andcolumnNamePatternparameters are as specified byDatabaseMetaData.getIndexInfo(String, String, String, boolean, boolean), and are copied here:- Specified by:
processIndexInfoResultSetin classAbstractInformationExtractorImpl- Type Parameters:
T- - defined byprocessor- Parameters:
catalog- – a catalog name; must match the catalog name as it is stored in this database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the searchschema- – a schema name; must match the schema name as it is stored in this database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the searchtable- – a table name; must match the table name as it is stored in this databaseunique- – when true, return only indices for unique values; when false, return indices regardless of whether unique or notapproximate- – when true, result is allowed to reflect approximate or out of data values; when false, results are requested to be accurateprocessor- - the provided ResultSetProcessor.- Returns:
- - defined by
processor - Throws:
SQLException- - if a database error occurs
-
obtain a
-
processImportedKeysResultSet
protected <T> T processImportedKeysResultSet(String catalog, String schema, String table, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException Description copied from class:AbstractInformationExtractorImplMust do the following:-
obtain a
ResultSetcontaining a row for each foreign key/ primary key column making up a foreign key for any existing catalog/schema/table combination as specified by thecatalog,schema, andtableparameters described below. TheResultSetmust contain the following, consistent with the corresponding columns returned byDatabaseMetaData.getImportedKeys(java.lang.String, java.lang.String, java.lang.String):-
column label
AbstractInformationExtractorImpl.getResultSetForeignKeyLabel()- foreign key name (may be null) -
column label
AbstractInformationExtractorImpl.getResultSetPrimaryKeyCatalogLabel()- primary key table catalog being imported (may be null) -
column label
AbstractInformationExtractorImpl.getResultSetPrimaryKeySchemaLabel()- primary key table schema being imported (may be null) -
column label
AbstractInformationExtractorImpl.getResultSetPrimaryKeyTableLabel()- primary key table name being imported -
column label
AbstractInformationExtractorImpl.getResultSetForeignKeyColumnNameLabel()- foreign key column name -
column label
AbstractInformationExtractorImpl.getResultSetPrimaryKeyColumnNameLabel()- primary key column name being imported
-
column label
- execute
processor.process( resultSet ); -
release resources whether
processor.process( resultSet )executes successfully or not.
The
catalog,schema, andtableparameters are as specified byDatabaseMetaData.getImportedKeys(String, String, String)and are copied here:- Specified by:
processImportedKeysResultSetin classAbstractInformationExtractorImpl- Type Parameters:
T- - defined byprocessor- Parameters:
catalog- – a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the searchschema- – a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the searchtable- – a table name; must match the table name as it is stored in the databaseprocessor- - the provided ResultSetProcessor.- Returns:
- - defined by
processor - Throws:
SQLException- - if a database error occurs
-
obtain a
-
processCrossReferenceResultSet
protected <T> T processCrossReferenceResultSet(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable, ExtractionContext.ResultSetProcessor<T> processor) throws SQLException Description copied from class:AbstractInformationExtractorImplMust do the following:-
obtain a
ResultSetcontaining a row for each foreign key column making up a foreign key for any existing foreignCatalog/foreignSchema/foreignTable combination as specified by parameters described below. TheResultSetmust contain the following, consistent with the corresponding columns returned byDatabaseMetaData.getCrossReference(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String):-
column label
AbstractInformationExtractorImpl.getResultSetForeignKeyLabel()- foreign key name (may be null) -
column label
AbstractInformationExtractorImpl.getResultSetPrimaryKeyCatalogLabel()- primary key table catalog being imported (may be null) -
column label
AbstractInformationExtractorImpl.getResultSetPrimaryKeySchemaLabel()- primary key table schema being imported (may be null) -
column label
AbstractInformationExtractorImpl.getResultSetPrimaryKeyTableLabel()- primary key table name being imported -
column label
AbstractInformationExtractorImpl.getResultSetForeignKeyColumnNameLabel()- foreign key column name -
column label
AbstractInformationExtractorImpl.getResultSetPrimaryKeyColumnNameLabel()- primary key column name being imported
-
column label
- execute
processor.process( resultSet ); -
release resources whether
processor.process( resultSet )executes successfully or not.
The
parentCatalog,parentSchema,parentTable,foreignCatalog,foreignSchema,foreignTableparameters are as specified byDatabaseMetaData.getCrossReference(String, String, String, String, String, String)and are copied here:- Specified by:
processCrossReferenceResultSetin classAbstractInformationExtractorImpl- Type Parameters:
T- - defined byprocessor- Parameters:
parentCatalog- a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog;nullmeans drop catalog name from the selection criteriaparentSchema- a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema;nullmeans drop schema name from the selection criteriaparentTable- the name of the table that exports the key; must match the table name as it is stored in the databaseforeignCatalog- a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog;nullmeans drop catalog name from the selection criteriaforeignSchema- a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema;nullmeans drop schema name from the selection criteriaforeignTable- the name of the table that imports the key; must match the table name as it is stored in the databaseprocessor- - the provided ResultSetProcessor.- Returns:
- - defined by
processor - Throws:
SQLException- - if a database error occurs- See Also:
-
obtain a
-
addColumns
- Overrides:
addColumnsin classAbstractInformationExtractorImpl
-