Attaching derby-6000-09-ac-setObjectPS.diff. This patch adds support for the new PreparedStatement.setObject() overloads added by JDBC 4.2. I am running tests now.
Adds the following methods to the embedded and client drivers:
PreparedStatement.setObject(int parameterIndex, java.lang.Object x, SQLType targetSqlType)
PreparedStatement.setObject(int parameterIndex, java.lang.Object x, SQLType targetSqlType, int scaleOrLength)
The new overloads implement the following logic:
a) Raise an exception if SQLType is not a JDBCType whose corresponding type in java.sql.Types is supported by Derby.
b) Otherwise forward the call to the corresponding setObject() overload, using the corresponding type from java.sql.Types.
This patch adds a new JDBC 4.2 module to the engine. Additional JDBC 4.2 work can expand this module. Some temporary build logic has been added to allow the build to succeed if you are building with a version of Java before version 8. We can remove this temporary logic once Java 8 goes live and we can create JDBC 4.2 stubs parallel to the stubs for previous JDBC versions.
Touches the following files:
Removed an unneeded exception declaration from a HarmonySerialBlob constructor.
JDBC 4.2 adds a new type id: REF_CURSOR.
New JDBC 4.2 engine module.
The tests for this patch tripped over an existing bug in the client driver: PreparedStatement.setObject( int, Object, int ) fails if you are trying to set a UDT. The simpler overload of this method (setObject( int, Object )) was tested and worked. I have added a little logic to make the failing overload work in this case. The overload which used to fail is tested by the new tests added for this feature.
Embedded support for the new PreparedStatement.setObject() overloads.
Client support for the new PreparedStatement.setObject() overloads.
Tests for the new overloads. The tests execute if you are running on Java 8 or higher.