Derby
  1. Derby
  2. DERBY-2516

Network Client allows execution of callable statement when one of the parameters is not set

    Details

    • Urgency:
      Low
    • Issue & fix info:
      Newcomer
    • Bug behavior facts:
      Embedded/Client difference

      Description

      If the second input parameter is set and the first is not. Client allows execution of the stored procedure. See the following code in LangProcedureTest.java with a reference to this bug.

      op.clearParameters();
      op.setString(2, "2");
      try

      { // a not set op.execute(); fail("FAIL - a not set"); }

      catch (SQLException sqle)

      { assertSQLState("07000", sqle); }
      1. d2516-1a.diff
        5 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Hide
          Kathey Marsden added a comment -

          found while converting procedure.java

          Show
          Kathey Marsden added a comment - found while converting procedure.java
          Hide
          Kathey Marsden added a comment -

          Triaged for 10.8. Marked newcomer hoping the fix is as clear as the reproduction.

          Show
          Kathey Marsden added a comment - Triaged for 10.8. Marked newcomer hoping the fix is as clear as the reproduction.
          Hide
          Knut Anders Hatlen added a comment -

          The problem appears to be caused by client.am.PreparedStatement.checkThatAllParametersAreSet(), which checks that every parameter is either set or registered as an out parameter. In the failing test case, parameter 1 is registered as an output parameter, so checkThatAllParametersAreSet() thinks everything is OK. However, since it's an INOUT parameter it needs to be set even if it has been registered as an out parameter.

          We should make checkThatAllParametersAreSet() always raise an exception if an INOUT parameter isn't set.

          Show
          Knut Anders Hatlen added a comment - The problem appears to be caused by client.am.PreparedStatement.checkThatAllParametersAreSet(), which checks that every parameter is either set or registered as an out parameter. In the failing test case, parameter 1 is registered as an output parameter, so checkThatAllParametersAreSet() thinks everything is OK. However, since it's an INOUT parameter it needs to be set even if it has been registered as an out parameter. We should make checkThatAllParametersAreSet() always raise an exception if an INOUT parameter isn't set.
          Hide
          Knut Anders Hatlen added a comment -

          Attaching a patch that makes checkThatAllParametersAreSet() throw an exception if an INOUT parameter has not been set and adds a test case to ProcedureTest to verify that it works.

          The patch also enables the failing code in LangProcedureTest for the client driver. Note that LangProcedureTest does not run as part of suites.All yet, as it needs more fixes to run cleanly (Dag has a patch for that in DERBY-5945, but it's not yet committed).

          All the regression tests ran cleanly with the patch.

          Show
          Knut Anders Hatlen added a comment - Attaching a patch that makes checkThatAllParametersAreSet() throw an exception if an INOUT parameter has not been set and adds a test case to ProcedureTest to verify that it works. The patch also enables the failing code in LangProcedureTest for the client driver. Note that LangProcedureTest does not run as part of suites.All yet, as it needs more fixes to run cleanly (Dag has a patch for that in DERBY-5945 , but it's not yet committed). All the regression tests ran cleanly with the patch.
          Hide
          Dag H. Wanvik added a comment -

          The patch is straight-forward; looks good to me. +1
          Made a comment on DERBY-5945 to enable LangProcedureTest when that issue is fixed.

          Show
          Dag H. Wanvik added a comment - The patch is straight-forward; looks good to me. +1 Made a comment on DERBY-5945 to enable LangProcedureTest when that issue is fixed.
          Hide
          Knut Anders Hatlen added a comment -

          Thanks, Dag!

          Committed revision 1428256.

          Show
          Knut Anders Hatlen added a comment - Thanks, Dag! Committed revision 1428256.
          Hide
          Knut Anders Hatlen added a comment -

          [bulk update] Close all resolved issues that haven't been updated for more than one year.

          Show
          Knut Anders Hatlen added a comment - [bulk update] Close all resolved issues that haven't been updated for more than one year.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development