groovy

Tiny improvement to groovy.sql.Sql eachRows()

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 1.7.x
  • Fix Version/s: 1.6.6, 1.7-rc-1
  • Component/s: SQL processing
  • Labels:
    None
  • Patch Submitted:
    Yes
  • Number of attachments :
    1

Description

A tiny improvement to eachRow().

Change

while (groovyRS.next()) { rowClosure.call(groovyRS); }

to

groovyRS.eachRow(rowClosure);

Activity

Hide
blackdrag blackdrag added a comment -

Looks like GroovyResultSet may update the row, while the current code doesn't do that. Is it still equal then?

Show
blackdrag blackdrag added a comment - Looks like GroovyResultSet may update the row, while the current code doesn't do that. Is it still equal then?
Hide
John Hurst added a comment -

I guess I was basing my change on the implementation of GroovyResultSetExtension.eachRow():

public void eachRow(Closure closure) throws SQLException {
while (next()) { closure.call(this); }
}

Is this not a safe assumption? (Is that what you're getting at?)

Show
John Hurst added a comment - I guess I was basing my change on the implementation of GroovyResultSetExtension.eachRow(): public void eachRow(Closure closure) throws SQLException { while (next()) { closure.call(this); } } Is this not a safe assumption? (Is that what you're getting at?)
Hide
Paul King added a comment -

Fix applied. Thanks.

Show
Paul King added a comment - Fix applied. Thanks.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: