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

Add the "oneRow" method to the groovy.sql.Sql class

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.0-beta-10
    • None
    • None

    Description

      I want to add a "oneRow" method to the groovy.sql.Sql class.

      So, instead of this :
      answer = 0
      sql.eachRow("select age from PERSON where firstName=James and lastName=Strachan") { row |
      answer = row[0]
      }

      I could write something like :
      result = sql.oneRow("select age from PERSON where firstName=James and lastName=Strachan").age

      or like this :
      result = sql.oneRow("select age from PERSON where firstName=James and lastName=Strachan")[0]

      Attachments

        1. patch2.txt
          12 kB
          Jean-Louis Berliet
        2. patchOneRow.txt
          11 kB
          Jean-Louis Berliet

        Activity

          People

            guillaume Guillaume Sauthier
            jlb Jean-Louis Berliet
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: