Derby
  1. Derby
  2. DERBY-2243

DatabaseMetaData.supportsANSI92EntryLevelSQL() returns false for embedded, true for client driver

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.2.1.6, 10.2.2.0, 10.3.1.4
    • Fix Version/s: 10.3.1.4
    • Component/s: JDBC
    • Labels:
      None

      Description

      Since this method is returning the support level of SQL it must be consistent across the drivers.
      Probably need some investigation as to which is correct, most likely 'true'.

      1. Derby-2243_v1.diff
        6 kB
        Saurabh Vyas
      2. Derby-2243_v1.stat
        0.6 kB
        Saurabh Vyas
      3. Derby-2243_v2.diff
        8 kB
        Saurabh Vyas
      4. Derby-2243_v2.stat
        0.7 kB
        Saurabh Vyas

        Issue Links

          Activity

          Hide
          Saurabh Vyas added a comment -

          I looked into the code and found that DatabaseMetaData.supportsANSI92EntryLevelSQL() is implements in different way in Embedded and Network-Client mode.
          In embedded mode EmbedDatabaseMetaData implements DatabaseMetaData & it returns false for various functions including supportsANSI92EntryLevelSQL() which is incorrect. Whereas for network mode, NetDatabaseMetaData implements DatabaseMetaData & it returns true for supportsANSI92EntryLevelSQL().

          I crossed check it with MySql code & found that it also return true (which is expected ) for supportsANSI92EntryLevelSQL().
          Same is the case with DERBY-2244 (https://issues.apache.org/jira/browse/DERBY-2244) & it returns false for supportsExpressionsInOrderBy() which is incorrect as derby does supports Order By Clause.

          Show
          Saurabh Vyas added a comment - I looked into the code and found that DatabaseMetaData.supportsANSI92EntryLevelSQL() is implements in different way in Embedded and Network-Client mode. In embedded mode EmbedDatabaseMetaData implements DatabaseMetaData & it returns false for various functions including supportsANSI92EntryLevelSQL() which is incorrect. Whereas for network mode, NetDatabaseMetaData implements DatabaseMetaData & it returns true for supportsANSI92EntryLevelSQL(). I crossed check it with MySql code & found that it also return true (which is expected ) for supportsANSI92EntryLevelSQL(). Same is the case with DERBY-2244 ( https://issues.apache.org/jira/browse/DERBY-2244 ) & it returns false for supportsExpressionsInOrderBy() which is incorrect as derby does supports Order By Clause.
          Hide
          Saurabh Vyas added a comment -

          Modifying the return type for methods like

          • supportsANSI92EntryLevelSQL()
          • supportsExpressionsInOrderBy()
            in EmbedDatabaseMetaData.java to return TRUE as Derby does support these features
            Thus now the behavior is consistent across drivers.

          This patch address DERBY-2244 (https://issues.apache.org/jira/browse/DERBY-2244) also.

          Accordingly modified the master output files also as earlier these methods were expected to return FALSE but now they will return TRUE value.

          Show
          Saurabh Vyas added a comment - Modifying the return type for methods like supportsANSI92EntryLevelSQL() supportsExpressionsInOrderBy() in EmbedDatabaseMetaData.java to return TRUE as Derby does support these features Thus now the behavior is consistent across drivers. This patch address DERBY-2244 ( https://issues.apache.org/jira/browse/DERBY-2244 ) also. Accordingly modified the master output files also as earlier these methods were expected to return FALSE but now they will return TRUE value.
          Hide
          Daniel John Debrunner added a comment -

          MySQL's return value should have no impact on Derby, it's if Derby supports these features only.

          Also, please be careful looking at MySQL code, bringing MySQL GPL code into Derby's codebase would not be acceptable.

          Obviously in this case a return true/false is not an issue, but demonstrated access to a piece of work is enough for copyright infringements.

          E.g. if someone says I looked at MySQL code to see how X was done and then implemented the same functionality in Derby in a similar manner that could be enough to pollute the Derby code base with GPL.

          Show
          Daniel John Debrunner added a comment - MySQL's return value should have no impact on Derby, it's if Derby supports these features only. Also, please be careful looking at MySQL code, bringing MySQL GPL code into Derby's codebase would not be acceptable. Obviously in this case a return true/false is not an issue, but demonstrated access to a piece of work is enough for copyright infringements. E.g. if someone says I looked at MySQL code to see how X was done and then implemented the same functionality in Derby in a similar manner that could be enough to pollute the Derby code base with GPL.
          Hide
          Saurabh Vyas added a comment -

          My apologies on this and thanks Dan for correcting me. Well what I was trying to see that how other Databases handled this scenario, but I was not sure of this licensing issue. Thanks again.

          Show
          Saurabh Vyas added a comment - My apologies on this and thanks Dan for correcting me. Well what I was trying to see that how other Databases handled this scenario, but I was not sure of this licensing issue. Thanks again.
          Hide
          Daniel John Debrunner added a comment -

          Patch looks fine though I personally don't like the habit of just commenting out the old code. If that practice is followed then after a while the code becomes unreadable. SVN history provides the ability to see old code.

          Also I think you need to modifiy jdbcapi.DatabaseMetaDataTest, since it is checking the output of these methods.

          Show
          Daniel John Debrunner added a comment - Patch looks fine though I personally don't like the habit of just commenting out the old code. If that practice is followed then after a while the code becomes unreadable. SVN history provides the ability to see old code. Also I think you need to modifiy jdbcapi.DatabaseMetaDataTest, since it is checking the output of these methods.
          Hide
          Saurabh Vyas added a comment -

          Thanks Dan for your comments and guiding me for best practices (i.e. removing the old code rather than just commenting it)
          Incorporated the changes & modified jdbcapi.DatabaseMetaDataTest to reflect the changes (i.e. TRUE as return value for these methods).

          Show
          Saurabh Vyas added a comment - Thanks Dan for your comments and guiding me for best practices (i.e. removing the old code rather than just commenting it) Incorporated the changes & modified jdbcapi.DatabaseMetaDataTest to reflect the changes (i.e. TRUE as return value for these methods).
          Hide
          Daniel John Debrunner added a comment -

          Patch Derby-2243_v2.diff committed revision 498732 - Thanks Saurabh Vyas.

          BTW - I see that you do not have an ICLA on file at Apache, if you are intending to work more on Derby I would encourage you to submit an ICLA ahead of time rather than waiting for a significant contribution.

          Show
          Daniel John Debrunner added a comment - Patch Derby-2243_v2.diff committed revision 498732 - Thanks Saurabh Vyas. BTW - I see that you do not have an ICLA on file at Apache, if you are intending to work more on Derby I would encourage you to submit an ICLA ahead of time rather than waiting for a significant contribution.
          Hide
          Saurabh Vyas added a comment -

          Thanks a lot Dan. I had files for ICLA now.
          Apart I had verified for this issue & Derby-2244, and now these methods returned the correct values.

          Show
          Saurabh Vyas added a comment - Thanks a lot Dan. I had files for ICLA now. Apart I had verified for this issue & Derby-2244, and now these methods returned the correct values.
          Hide
          Saurabh Vyas added a comment -

          Thanks alot for modifying the assert condition in DatabaseMetaDataTest.java (Just looked at the comments in the test code for DERBY-2243 & DERBY-2244.)

          Show
          Saurabh Vyas added a comment - Thanks alot for modifying the assert condition in DatabaseMetaDataTest.java (Just looked at the comments in the test code for DERBY-2243 & DERBY-2244 .)

            People

            • Assignee:
              Saurabh Vyas
              Reporter:
              Daniel John Debrunner
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development