You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org> on 2006/04/05 18:02:47 UTC

[jira] Commented: (DERBY-940) Add JDBC 4 Wrapper support

    [ http://issues.apache.org/jira/browse/DERBY-940?page=comments#action_12373391 ] 

Knut Anders Hatlen commented on DERBY-940:
------------------------------------------

Hi Narayanan,

I haven't read your code, just looked at the description you provided
in DERBY940_v4_embedded.html, so I'm just commenting on what you have
written there.

----

First, you say that the compiler generates warnings because the unwrap
methods have code like this:

    if(iface.isInstance(this)) {
        return (T)this;
    } else {
        throw newSQLException....
    }

I think you can avoid the warning by using Class.cast(). Also, the
code above calls isInstance() twice (the cast does it internally to
decide whether it should throw ClassCastException), so I think it
would be better to rewrite it like this:

    try {
        return iface.cast(this);
    } catch (ClassCastException cce) {
        throw newSQLException....
    }

----

JUnit:

You write that you didn't find any TestSuite.addTest(String) method,
just TestSuite.addTest(Test), so you have to write new classes. I
don't know much about JUnit tests, but I suspect that there's a typo
in Kristian's advice. I think what he meant to say was:

  TestSuite suite = new TestSuite(CallableStatementTest.class, "suitename");
  if (!usingDerbyNetClient()) {
      suite.addTest(new CallableStatementTest("specialTestWrapperSupport1")); // Name must not start with "test"
      suite.addTest(new CallableStatementTest("specialTestWrapperSupport2"));
  }

If you do it like this, you don't have to create a new class for each
special case.

> Add JDBC 4 Wrapper support
> --------------------------
>
>          Key: DERBY-940
>          URL: http://issues.apache.org/jira/browse/DERBY-940
>      Project: Derby
>         Type: New Feature

>   Components: JDBC
>     Reporter: Rick Hillegas
>     Assignee: V.Narayanan
>      Fix For: 10.2.0.0
>  Attachments: DERBY940_embedded.html, DERBY940_v4_embedded.html, wrapper_ver1_embedded.diff, wrapper_ver1_embedded.stat, wrapper_ver2_embedded.diff, wrapper_ver2_embedded.stat, wrapper_ver3_embedded.diff, wrapper_ver3_embedded.stat, wrapper_ver4_embedded.diff, wrapper_ver4_embedded.stat
>
> As described in the JDBC 4 spec, sections 21 and 3.1.

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