Subject Regression from 2.1.6
Author Fabiano
Hi all!

I reported this bug some months ago, but jaybird 2.2.0 was released without
solving it.
It is a showstopper for everybody who uses CachedRowSet, like me :-(

The result of resultSet.getMetaData.getColumnName() is inconsistent across
jaybird 2.1.6 and 2.2.0, and default Java CachedRowSetImpl rely on this method
to assign the names of CachedRowSet columns, leading to errors when in use with
JayBird 2.2.0.

Tested with Java 7 update 5.
CachedRowSetImpl is part of Java 7 distribution.
If you use Eclipse, maybe you need to turn off compile warning/erros for
"Forbidden reference (access rules)" for this code to compile.

public static void main(String[] args) throws Exception {
Class.forName("org.firebirdsql.jdbc.FBDriver");

Connection connection = DriverManager.getConnection(
"jdbc:firebirdsql://localhost/test", "sysdba", "masterkey");
PreparedStatement preparedStatement = connection
.prepareStatement("select 1 as field1 from rdb$database");
ResultSet resultSet = preparedStatement.executeQuery();

/*
* Using resultSet
*/
// jaybird 2.1.6 prints "FIELD1", jaybird 2.2.0 prints ""
System.out.println(resultSet.getMetaData().getColumnName(1));

// jaybird 2.1.6 prints "FIELD1", jaybird 2.2.0 prints "FIELD1"
System.out.println(resultSet.getMetaData().getColumnLabel(1));

/*
* Using cachedRowSet
*/
CachedRowSet cachedRowSet = new CachedRowSetImpl();
cachedRowSet.populate(resultSet);

// jaybird 2.1.6 prints "FIELD1", jaybird 2.2.0 prints ""
System.out.println(cachedRowSet.getMetaData().getColumnName(1));

// jaybird 2.1.6 prints "FIELD1", jaybird 2.2.0 prints "FIELD1"
System.out.println(cachedRowSet.getMetaData().getColumnLabel(1));

cachedRowSet.next();
// jaybird 2.1.6 works, jaybird 2.2.0 throws java.sql.SQLException: Invalid
column name
System.out.println(cachedRowSet.getInt("field1"));
}

Is there some possibility to solve this bug ASAP? Maybe on the developer branch?
I can try it in production if needed.

Please also add some tests for this issue.

Regards,

Fabiano