[ http://issues.apache.org/jira/browse/DERBY-1393?page=all ]

Knut Anders Hatlen updated DERBY-1393:
--------------------------------------

    Attachment: derby-1393-v1.diff
                derby-1393-v1.stat

Attached a patch for this issue (derby-1393-v1.diff). Description of
the patch:

  The new setObject() methods call checkForSupportedDataType() to
  check whether targetSqlType is supported.

  Added a new error message "The data type ''{0}'' is not supported."
  with SQL state 0A000 (which ensures that the exception is converted
  to SQLFeatureNotSupportedException). This error message is used when
  targetSqlType is not supported.

  Added more JDBC 4.0 constants (from java.sql.Types) to
  JDBC40Translation and created a test JDBC40TranslationTest which
  tests that the constants are correct (the values of the constants
  are hard coded, so we don't get the compile-time check as with
  JDBC{2,3}0Translation).

  New test case SetObjectUnsupportedTest which is run as part of
  PreparedStatementTest and CallableStatementTest in the jdbc40 suite.

Derbyall runs cleanly. The patch is ready for review. Thanks!

> PreparedStatement.setObject(Object,int,int) should throw for unsupported types
> ------------------------------------------------------------------------------
>
>          Key: DERBY-1393
>          URL: http://issues.apache.org/jira/browse/DERBY-1393
>      Project: Derby
>         Type: Bug

>   Components: JDBC, SQL
>     Versions: 10.2.0.0
>  Environment: JDBC 4, jdk 1.6
>     Reporter: Dyre Tjeldvoll
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: derby-1393-v1.diff, derby-1393-v1.stat
>
> From the javadoc:
> Throws:
>  ...
>     SQLFeatureNotSupportedException - if targetSqlType is a ARRAY, BLOB, 
> CLOB, DATALINK, JAVA_OBJECT, NCHAR, NCLOB, NVARCHAR, LONGNVARCHAR, REF, 
> ROWID, SQLXML or STRUCT data type and the JDBC driver does not support this 
> data type
> Since Derby doesn't support ARRAY, DATALINK, NCHAR, NCLOB, NVARCHAR, 
> LONGNVARCHAR, REF, ROWID, SQLXML or STRUCT the method should throw 
> SQLFeatureNotSupportedException if used with any of these types. Currently a 
> general type conversion exception is thrown:
> >>1) 
> >>testSetObjectNotImplementedARRAY(org.apache.derbyTesting.functionTests.tests.jdbc4.PreparedStatementTest)SQL
> >> Exception: An attempt was made to get a data value of type 'CLOB' from a 
> >>data value of type '2003'.
> >>Caused by: SQL Exception: An attempt was made to get a data value of type 
> >>'CLOB' from a data value of type '2003'.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to