public class DefaultMetadataHandler extends Object implements IMetadataHandler
IMetadataHandler which works for the most databases.| Constructor and Description |
|---|
DefaultMetadataHandler() |
| Modifier and Type | Method and Description |
|---|---|
ResultSet |
getColumns(DatabaseMetaData databaseMetaData,
String schemaName,
String tableName)
Returns the result set for an invocation of
DatabaseMetaData.getColumns(String, String, String, String). |
ResultSet |
getPrimaryKeys(DatabaseMetaData metaData,
String schemaName,
String tableName) |
String |
getSchema(ResultSet resultSet)
Returns the schema name to which the table of the current result set index belongs.
|
ResultSet |
getTables(DatabaseMetaData metaData,
String schemaName,
String[] tableType)
Returns the tables in the given schema that matches one of the given tableTypes.
|
boolean |
matches(ResultSet resultSet,
String schema,
String table,
boolean caseSensitive)
Checks if the given
resultSet matches the given schema and table name. |
boolean |
matches(ResultSet columnsResultSet,
String catalog,
String schema,
String table,
String column,
boolean caseSensitive)
Checks if the given
resultSet matches the given schema and table name. |
boolean |
tableExists(DatabaseMetaData metaData,
String schemaName,
String tableName)
Checks if the given table exists.
|
public ResultSet getColumns(DatabaseMetaData databaseMetaData, String schemaName, String tableName) throws SQLException
IMetadataHandlerDatabaseMetaData.getColumns(String, String, String, String).getColumns in interface IMetadataHandlerdatabaseMetaData - The database metadata to be used for retrieving the columnsschemaName - The schema nametableName - The table nameSQLExceptionpublic boolean matches(ResultSet resultSet, String schema, String table, boolean caseSensitive) throws SQLException
IMetadataHandlerresultSet matches the given schema and table name.
The comparison is case sensitive.matches in interface IMetadataHandlerresultSet - A result set produced via DatabaseMetaData.getColumns(String, String, String, String)caseSensitive - Whether or not the comparison should be case sensitivetrue if the column metadata of the given resultSet matches
the given schema and table parameters.SQLExceptionIMetadataHandler.matches(ResultSet, String, String, String, String, boolean)public boolean matches(ResultSet columnsResultSet, String catalog, String schema, String table, String column, boolean caseSensitive) throws SQLException
IMetadataHandlerresultSet matches the given schema and table name.
The comparison is case sensitive.matches in interface IMetadataHandlercolumnsResultSet - A result set produced via DatabaseMetaData.getColumns(String, String, String, String)catalog - The name of the catalog to check. If null it is ignored in the comparisonschema - The name of the schema to check. If null it is ignored in the comparisontable - The name of the table to check. If null it is ignored in the comparisoncolumn - The name of the column to check. If null it is ignored in the comparisoncaseSensitive - Whether or not the comparison should be case sensitivetrue if the column metadata of the given resultSet matches
the given schema and table parameters.SQLExceptionpublic String getSchema(ResultSet resultSet) throws SQLException
IMetadataHandlergetSchema in interface IMetadataHandlerresultSet - The result set pointing to a valid record in the database that was returned
by DatabaseMetaData.getTables(String, String, String, String[]).SQLExceptionpublic boolean tableExists(DatabaseMetaData metaData, String schemaName, String tableName) throws SQLException
IMetadataHandlertableExists in interface IMetadataHandlermetaData - The database meta dataschemaName - The schema in which the table should be searched. If null
the schema is not used to narrow the table name.tableName - The table name to be searchedtrue if the given table exists in the given schema.
Else returns false.SQLExceptionpublic ResultSet getTables(DatabaseMetaData metaData, String schemaName, String[] tableType) throws SQLException
IMetadataHandlergetTables in interface IMetadataHandlermetaData - The database meta dataschemaName - schema for which the tables should be retrieved; null returns all schemastableType - a list of table types to include; null returns all typesDatabaseMetaData.getTables(String, String, String, String[])SQLExceptionpublic ResultSet getPrimaryKeys(DatabaseMetaData metaData, String schemaName, String tableName) throws SQLException
getPrimaryKeys in interface IMetadataHandlermetaData - The database meta dataschemaName - schema for which the tables should be retrieved; null returns all schemastableName - table for which the primary keys are retrievedDatabaseMetaData.getPrimaryKeys(String, String, String)SQLExceptionCopyright © 2002–2025. All rights reserved.