Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3119

Derby does not resolve functions to methods with Integer return type.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.1.4
    • 10.3.2.1, 10.4.1.3
    • SQL
    • None

    Description

      Derby can bind a function invocation to a method which returns int but not to a method which returns Integer. I think that both of these resolutions should succeed given the rules in the SQL Standard, part 13, section 8.6, syntax rule 5, case a, item ii. Here is some code which shows this problem. First a class to declare the methods:

      public class zz
      {
      public static int returnsInt()

      { return 1; }

      public static Integer returnsInteger()

      { return new Integer( 2 ); }

      }

      The following ij script shows that the int-returning method is resolved but not the Integer-returning method:

      ij version 10.4
      ij> connect 'jdbc:derby:derby10.4;create=true';
      WARNING 01J01: Database 'derby10.4' not created, connection made to existing database instead.
      ij> drop function returnsInt;
      0 rows inserted/updated/deleted
      ij> drop function returnsInteger;
      0 rows inserted/updated/deleted
      ij> create function returnsInt()
      returns int
      language java
      parameter style java
      no sql
      external name 'zz.returnsInt'
      ;
      0 rows inserted/updated/deleted
      ij> create function returnsInteger()
      returns int
      language java
      parameter style java
      no sql
      external name 'zz.returnsInteger'
      ;
      0 rows inserted/updated/deleted
      ij> values ( returnsInt() );
      1
      -----------
      1

      1 row selected
      ij> values ( returnsInteger() );
      ERROR 42X50: No method was found that matched the method call int zz.returnsInteger(), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.

      Attachments

        1. DERBY-3119-10_3.diff
          7 kB
          Dag H. Wanvik
        2. derby-3119-1_diff.txt
          7 kB
          James F. Adams

        Activity

          People

            james.f.adams James F. Adams
            rhillegas Richard N. Hillegas
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: