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

in eachRow's closures rows do not always respond to getClass()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.5
    • 2.1.5
    • SQL processing
    • None

    Description

      When I try to execute:

      def sqlq = Sql.newInstance("jdbc:oracle:thin:@${host}:1521:${sid}", "user",
                           "pw", "oracle.jdbc.OracleDriver")
      sqlq.eachRow('select * from dual where rownum<?',[2] ){ row ->
          println (row.getClass())
      }
      sqlq.close()
      

      i get:

      groovy.lang.MissingMethodException: No signature of method: groovy.sql.GroovyResultSet.getClass() is applicable for argument types: () values: []
      Possible solutions: getClass(), metaClass(groovy.lang.Closure), getMetaClass(), getMetaClass(), equals(java.lang.Object), getAt(java.lang.String)

      Following code gives:

      def sqlq = Sql.newInstance("jdbc:oracle:thin:@${host}:1521:${sid}", "user",
                           "pw", "oracle.jdbc.OracleDriver")
      sqlq.eachRow('select * from dual where rownum<?',[2] ){ row ->
          println (row)
      }
      sqlq.close()
      

      [DUMMY:X]

      I suppose object.getClass() method calls should always work.

      Attachments

        Activity

          People

            paulk Paul King
            dariusan dariusan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: