groovy

provide GString versions for Sql.rows and Sql.firstRow() [minor breaking change]

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.0-JSR-3
  • Fix Version/s: 1.5.2
  • Component/s: SQL processing
  • Labels:
    None
  • Number of attachments :
    0

Description

provide

groovy.sql.Sql.rows(GString)
groovy.sql.Sql.firstRow(GString)

analogous to
eachRow and query

Activity

Hide
Paul King added a comment -

Added. Just a note for existing users of the String versions of the rows() and firstRow() methods. If you are using GStrings with the String versions of these methods, you may need to add ".toString()" to your GStrings otherwise you may experience wierd behavior. E.g. if you have something like:

def table = 'PERSON'
GString query = "select * from $table"
def result = sql.rows(query)

The query will be passed looking for parameters and be changed to:

select * from ?

If you want to keep using the GString, just change the last line to:

def result = sql.rows(query.toString())
Show
Paul King added a comment - Added. Just a note for existing users of the String versions of the rows() and firstRow() methods. If you are using GStrings with the String versions of these methods, you may need to add ".toString()" to your GStrings otherwise you may experience wierd behavior. E.g. if you have something like:
def table = 'PERSON'
GString query = "select * from $table"
def result = sql.rows(query)
The query will be passed looking for parameters and be changed to:
select * from ?
If you want to keep using the GString, just change the last line to:
def result = sql.rows(query.toString())
Hide
Paul King added a comment -

close off release 1.5.4

Show
Paul King added a comment - close off release 1.5.4

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: