Package org.dbunit.database
Interface IMetadataHandler
- All Known Implementing Classes:
Db2MetadataHandler,DefaultMetadataHandler,MySqlMetadataHandler,NetezzaMetadataHandler
public interface IMetadataHandler
Handler to specify the behavior for a lookup of column metadata using database metadata.
- Since:
- 2.4.4
- Version:
- $Revision$ $Date$
- Author:
- gommma (gommma AT users.sourceforge.net), Last changed by: $Author$
-
Method Summary
Modifier and TypeMethodDescriptiongetColumns(DatabaseMetaData databaseMetaData, String schemaName, String tableName) Returns the result set for an invocation ofDatabaseMetaData.getColumns(String, String, String, String).getPrimaryKeys(DatabaseMetaData databaseMetaData, String schemaName, String tableName) Returns the schema name to which the table of the current result set index belongs.getTables(DatabaseMetaData databaseMetaData, String schemaName, String[] tableTypes) Returns the tables in the given schema that matches one of the given tableTypes.booleanChecks if the givenresultSetmatches the given schema and table name.booleanmatches(ResultSet resultSet, String catalog, String schema, String table, String column, boolean caseSensitive) Checks if the givenresultSetmatches the given schema and table name.booleantableExists(DatabaseMetaData databaseMetaData, String schemaName, String tableName) Checks if the given table exists.
-
Method Details
-
getColumns
ResultSet getColumns(DatabaseMetaData databaseMetaData, String schemaName, String tableName) throws SQLException Returns the result set for an invocation ofDatabaseMetaData.getColumns(String, String, String, String).- Parameters:
databaseMetaData- The database metadata to be used for retrieving the columnsschemaName- The schema nametableName- The table name- Returns:
- The result set containing all columns
- Throws:
SQLException- Since:
- 2.4.4
-
matches
boolean matches(ResultSet resultSet, String schema, String table, boolean caseSensitive) throws SQLException Checks if the givenresultSetmatches the given schema and table name. The comparison is case sensitive.- Parameters:
resultSet- A result set produced viaDatabaseMetaData.getColumns(String, String, String, String)schema-table-caseSensitive- Whether or not the comparison should be case sensitive- Returns:
trueif the column metadata of the givenresultSetmatches the given schema and table parameters.- Throws:
SQLException- Since:
- 2.4.4
- See Also:
-
matches
boolean matches(ResultSet resultSet, String catalog, String schema, String table, String column, boolean caseSensitive) throws SQLException Checks if the givenresultSetmatches the given schema and table name. The comparison is case sensitive.- Parameters:
resultSet- A result set produced viaDatabaseMetaData.getColumns(String, String, String, String)catalog- The name of the catalog to check. Ifnullit is ignored in the comparisonschema- The name of the schema to check. Ifnullit is ignored in the comparisontable- The name of the table to check. Ifnullit is ignored in the comparisoncolumn- The name of the column to check. Ifnullit is ignored in the comparisoncaseSensitive- Whether or not the comparison should be case sensitive- Returns:
trueif the column metadata of the givenresultSetmatches the given schema and table parameters.- Throws:
SQLException- Since:
- 2.4.4
-
getSchema
Returns the schema name to which the table of the current result set index belongs.- Parameters:
resultSet- The result set pointing to a valid record in the database that was returned byDatabaseMetaData.getTables(String, String, String, String[]).- Returns:
- The name of the schema from the given result set
- Throws:
SQLException- Since:
- 2.4.4
-
tableExists
boolean tableExists(DatabaseMetaData databaseMetaData, String schemaName, String tableName) throws SQLException Checks if the given table exists.- Parameters:
databaseMetaData- The database meta dataschemaName- The schema in which the table should be searched. Ifnullthe schema is not used to narrow the table name.tableName- The table name to be searched- Returns:
- Returns
trueif the given table exists in the given schema. Else returnsfalse. - Throws:
SQLException- Since:
- 2.4.5
-
getTables
ResultSet getTables(DatabaseMetaData databaseMetaData, String schemaName, String[] tableTypes) throws SQLException Returns the tables in the given schema that matches one of the given tableTypes.- Parameters:
databaseMetaData- The database meta dataschemaName- schema for which the tables should be retrieved;nullreturns all schemastableTypes- a list of table types to include;nullreturns all types- Returns:
- The ResultSet which is retrieved using
DatabaseMetaData.getTables(String, String, String, String[]) - Throws:
SQLException- Since:
- 2.4.5
-
getPrimaryKeys
ResultSet getPrimaryKeys(DatabaseMetaData databaseMetaData, String schemaName, String tableName) throws SQLException - Parameters:
databaseMetaData- The database meta dataschemaName- schema for which the tables should be retrieved;nullreturns all schemastableName- table for which the primary keys are retrieved- Returns:
- The ResultSet which is retrieved using
DatabaseMetaData.getPrimaryKeys(String, String, String) - Throws:
SQLException- Since:
- 2.4.5
-