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

Knut Anders Hatlen updated DERBY-1476:
--------------------------------------

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

derby-1476-v1.diff adds a call to checkForSupportedDataType() in setNull(). It 
also moves that call in setObject() after 'if (obj == null) { setNull(pos, 
type); return; }' in order to avoid double checking. New test cases have been 
added to SetObjectUnsupportedTest so that it tests setObject(int,Object,int), 
setObject(int,Object,int,int), setNull(int,int) and setNull(int,int,String).

With this patch, setNull() and setObject() throw 
SQLFeatureNotSupportedException when running on JVM 1.6 and the specified 
sqlType is unsupported.

Derbyall ran cleanly (with the exception of grantRevokeDDL which also is seen 
in the Ole's regression tests). The patch is ready for review. Thanks!

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

>   Components: JDBC
>     Versions: 10.2.0.0
>  Environment: JDBC 4.0
>     Reporter: Knut Anders Hatlen
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: derby-1476-v1.diff, derby-1476-v1.stat
>
> The javadoc for PreparedStatement.setNull(int, int) says:
> http://download.java.net/jdk6/docs/api/java/sql/PreparedStatement.html#setNull(int,%20int)
> Throws:
>  ...
>     SQLFeatureNotSupportedException - if sqlType 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. With the client driver, no 
> exception is thrown when using this method with the unsupported types.

-- 
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