Derby
  1. Derby
  2. DERBY-5880

Move java.sql.Wrapper implementations to base classes in embedded driver

    Details

      Description

      Now that the JDBC 3.0 classes in the embedded driver are compiled with source level 1.5, we could move the unwrap()/isWrapperFor() methods to the base classes to enable reuse, like we did for the client driver in DERBY-5868.

      1. d5880-1a.diff
        36 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Hide
          Knut Anders Hatlen added a comment -

          Attaching d5880-1a.diff which moves the Wrapper methods to super-classes where that may enable more reuse.

          Unfortunately, EmbedStatement40, EmbedPreparedStatement40 and EmbedCallableStatement40 don't have a common sub-class compiled against Java 5 yet, so the had to keep their separate implementations.

          In the brokered classes, however, the implementations in BrokeredStatement40, BrokeredPreparedStatement40 and BrokeredCallableStatement40 could be replaced by a single one in BrokeredStatement.

          In EmbedParameterMetaData40, the Wrapper methods were moved to EmbedParameterMetaData30, which made the EmbedParameterMetaData40 class empty so it could be removed.

          In the data source classes, the Wrapper methods in EmbedDataSource40, EmbeddedConnectionPoolDataSource40 and EmbeddedXADataSource40 could be replaced by a single implementation in EmbededDataSource. This change also made the data source classes that are not suffixed with "40", implement the full JDBC 4.0 interface. The javadoc comments in the classes were updated to say that.

          Because the JDBC 3 data source classes are more capable than before, JDBC4FromJDBC3DataSourceTest had to be updated. It expected calls to the Wrapper methods to result in AbstractMethodErrors when using the JDBC 3 flavour of the data sources, but now they succeed.

          Finally, I came across two methods (setBinaryStream() and setCharacterStream()) in EmbedCallableStatement40 that had equivalent implementations in the super-class EmbedPreparedStatement, so I removed them and let EmbedCallableStatement40 inherit them instead.

          All the regression tests ran cleanly with the patch.

          Show
          Knut Anders Hatlen added a comment - Attaching d5880-1a.diff which moves the Wrapper methods to super-classes where that may enable more reuse. Unfortunately, EmbedStatement40, EmbedPreparedStatement40 and EmbedCallableStatement40 don't have a common sub-class compiled against Java 5 yet, so the had to keep their separate implementations. In the brokered classes, however, the implementations in BrokeredStatement40, BrokeredPreparedStatement40 and BrokeredCallableStatement40 could be replaced by a single one in BrokeredStatement. In EmbedParameterMetaData40, the Wrapper methods were moved to EmbedParameterMetaData30, which made the EmbedParameterMetaData40 class empty so it could be removed. In the data source classes, the Wrapper methods in EmbedDataSource40, EmbeddedConnectionPoolDataSource40 and EmbeddedXADataSource40 could be replaced by a single implementation in EmbededDataSource. This change also made the data source classes that are not suffixed with "40", implement the full JDBC 4.0 interface. The javadoc comments in the classes were updated to say that. Because the JDBC 3 data source classes are more capable than before, JDBC4FromJDBC3DataSourceTest had to be updated. It expected calls to the Wrapper methods to result in AbstractMethodErrors when using the JDBC 3 flavour of the data sources, but now they succeed. Finally, I came across two methods (setBinaryStream() and setCharacterStream()) in EmbedCallableStatement40 that had equivalent implementations in the super-class EmbedPreparedStatement, so I removed them and let EmbedCallableStatement40 inherit them instead. All the regression tests ran cleanly with the patch.
          Hide
          Knut Anders Hatlen added a comment -

          Committed revision 1372403.

          Show
          Knut Anders Hatlen added a comment - Committed revision 1372403.
          Hide
          Mike Matrigali added a comment -

          this looks like an improvement rather than bug fix. changing and marking reject to take it off live backport list.

          Show
          Mike Matrigali added a comment - this looks like an improvement rather than bug fix. changing and marking reject to take it off live backport list.

            People

            • Assignee:
              Knut Anders Hatlen
              Reporter:
              Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development