Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3048

Groovy Sql API should support stored procedures that have output parameters and return a result set

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6-beta-1
    • Fix Version/s: 2.3.0-beta-1
    • Component/s: SQL processing
    • Labels:
      None

      Description

      If you have a stored procedure that has output parameters AND returns one or more result sets, you can't get all of the output using the Groovy SQL API. You can get just the output parameters by doing something like:

      sql.call("{ call someProc(?,?) }",
                  [Sql.out(Sql.INTEGER.type),Sql.out(Sql.VARCHAR.type)]) { param1, param2 ->
          println "returned ${param1} ${param2}"
      }
      

      or you can get a single resultset but not the output parameters by doing something like this:

      sql.query("{ call someProc(?,?) }",
                  [null, null]) { resultSet ->
          println "returned ${resultSet}"
      }
      

      but you can't do both, and if the stored proc returns multiple result sets you are out of luck as well. The Sql.call method should probably use the CallableStatement getResultSet and getMoreResult methods to get all of the result sets and and pass them as parameters to the closure.

        Attachments

          Activity

            People

            • Assignee:
              melix Cédric Champeau
              Reporter:
              plasticboy Benjamin Williams
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: