org.dbunit.ext.db2
Class Db2MetadataHandler

java.lang.Object
  extended by org.dbunit.database.DefaultMetadataHandler
      extended by org.dbunit.ext.db2.Db2MetadataHandler
All Implemented Interfaces:
IMetadataHandler

public class Db2MetadataHandler
extends DefaultMetadataHandler

Customized MetadataHandler for DB2 as match Columns of DefaultMetadataHandler fails with a RuntimeException.

Since:
2.4.7
Version:
$Revision: 1053 $ $Date: 2009-09-30 13:47:14 -0500 (Wed, 30 Sep 2009) $
Author:
gommma (gommma AT users.sourceforge.net), Last changed by: $Author: gommma $

Constructor Summary
Db2MetadataHandler()
           
 
Method Summary
 boolean matches(ResultSet columnsResultSet, String catalog, String schema, String table, String column, boolean caseSensitive)
          This method is overridden since - at least with DB2 driver db2jcc-9.5.jar - there is a problem that the DatabaseMetaData does not return the same values for catalog and schema like the columns ResultSet does.
 
Methods inherited from class org.dbunit.database.DefaultMetadataHandler
getColumns, getPrimaryKeys, getSchema, getTables, matches, tableExists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Db2MetadataHandler

public Db2MetadataHandler()
Method Detail

matches

public boolean matches(ResultSet columnsResultSet,
                       String catalog,
                       String schema,
                       String table,
                       String column,
                       boolean caseSensitive)
                throws SQLException
This method is overridden since - at least with DB2 driver db2jcc-9.5.jar - there is a problem that the DatabaseMetaData does not return the same values for catalog and schema like the columns ResultSet does. The debugging constellation is as follows
 catalog="BLA", catalogName=
 schema="BLA", schemaName="BLA"
 
This problem is taken into account by this metadata handler. Checks if the given resultSet matches the given schema and table name. The comparison is case sensitive.

Specified by:
matches in interface IMetadataHandler
Overrides:
matches in class DefaultMetadataHandler
Parameters:
columnsResultSet - 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 comparison
schema - The name of the schema to check. If null it is ignored in the comparison
table - The name of the table to check. If null it is ignored in the comparison
column - The name of the column to check. If null it is ignored in the comparison
caseSensitive - Whether or not the comparison should be case sensitive
Returns:
true if the column metadata of the given resultSet matches the given schema and table parameters.
Throws:
SQLException
See Also:
DefaultMetadataHandler.matches(java.sql.ResultSet, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)


Copyright © 2002-2012. All Rights Reserved.