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

use of variable inside closure seems broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta-4
    • None
    • None

    Description

      reported by brianm - the value of 'sql' appears to be considered a property of the builder first.

      #!/usr/bin/env groovy

      import groovy.sql.Sql
      import groovy.xml.MarkupBuilder

      sql = Sql.newInstance("jdbc:postgresql://localhost/mydb?charSet=UTF-8",
      "foo", "bar",
      "org.postgresql.Driver")

      doc = new MarkupBuilder()
      doc.projects() {
      sql.eachRow("select * from profiles")

      { doc.profile(first: it.firstname, last: it.lastname, email: it.email) }

      }

      sql.close()

      println doc

      Attachments

        Activity

          People

            Unassigned Unassigned
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: