Package org.dbunit.ext.h2
Class H2MetadataHandler
java.lang.Object
org.dbunit.database.DefaultMetadataHandler
org.dbunit.ext.h2.H2MetadataHandler
- All Implemented Interfaces:
IMetadataHandler
Special metadata handler for H2.
H2 2.x rewrote INFORMATION_SCHEMA to be SQL-standard-compliant, and most of its internal
tables now report a JDBC TABLE_TYPE of "BASE TABLE" instead of the
"SYSTEM TABLE" type H2 1.x used. Since
DatabaseConfig.PROPERTY_TABLE_TYPE defaults to {"TABLE"},
those tables now pass dbunit's default system-table filter and leak into table listings that are
not scoped to a single schema (i.e. schemaName is null). This handler excludes
the INFORMATION_SCHEMA schema from getTables(java.sql.DatabaseMetaData, java.lang.String, java.lang.String[]) results to restore the pre-2.x
behavior.
- Since:
- 3.5.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTables(DatabaseMetaData metaData, String schemaName, String[] tableType) Returns the tables in the given schema that matches one of the given tableTypes.Methods inherited from class org.dbunit.database.DefaultMetadataHandler
getColumns, getPrimaryKeys, getSchema, matches, matches, supportsColumnCache, tableExistsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dbunit.database.IMetadataHandler
matchesColumn
-
Constructor Details
-
H2MetadataHandler
public H2MetadataHandler()
-
-
Method Details
-
getTables
public ResultSet getTables(DatabaseMetaData metaData, String schemaName, String[] tableType) throws SQLException Returns the tables in the given schema that matches one of the given tableTypes. Excludes tables belonging to theINFORMATION_SCHEMAschema.- Specified by:
getTablesin interfaceIMetadataHandler- Overrides:
getTablesin classDefaultMetadataHandler- Parameters:
metaData- The database meta dataschemaName- schema for which the tables should be retrieved;nullreturns all schemastableType- 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- if a database access error occurs.
-