public void crossCheckGetColumnRowAndResultSetMetaData(
ResultSet rs, ResultSetMetaData rsmdt, int odbc)
throws Exception
{
int col = rs.getInt("ORDINAL_POSITION");
Version dataVersion = getDataVersion( getConnection() );
String catalogName = rs.getString("TABLE_CAT");
String schemaName = rs.getString("TABLE_SCHEM");
String tableName = rs.getString("TABLE_NAME");
// Check that the catalog/schema/table names reported by the
// ResultSetMetaData are correct. Note that for views, RSMD will
// return data for the underlying table, not for the view itself.
// Therefore, skip the check for views.
ResultSet views =
rs.getStatement().getConnection().getMetaData().getTables(
catalogName, schemaName, tableName, JDBC.GET_TABLES_VIEW);
boolean isView = JDBC.assertDrainResults(views) > 0;
if (!isView) {
assertEquals("RSMD.getCatalogName",
catalogName, rsmdt.getCatalogName(col));
assertEquals("RSMD.getSchemaName",
schemaName, rsmdt.getSchemaName(col));
assertEquals("RSMD.getTableName",
tableName, rsmdt.getTableName(col));
}
assertEquals("COLUMN_NAME",
rsmdt.getColumnName(col), rs.getString("COLUMN_NAME"));
// DERBY-2285 BOOLEAN columns appear different on
// network client.
// DMD returns BOOLEAN
// RSMD returns SMALLINT
int dmdColumnType = rs.getInt("DATA_TYPE");
if (dmdColumnType == Types.JAVA_OBJECT && usingDerbyNetClient()
&& ( dataVersion.compareTo( new Version( 10, 6, 0, 0 ) ) < 0 ) )
{
// DMD returns JAVA_OBJECT
// RSMD returns LONGVARBINARY!
assertEquals("DATA_TYPE",
Types.LONGVARBINARY, rsmdt.getColumnType(col));