groovy

Sql.expand not working in Sql.eachRow(GString sql, Closure metaClosure, Closure rowClosure)

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7-beta-1
  • Fix Version/s: 1.6.6, 1.7-rc-1
  • Component/s: SQL processing
  • Labels:
    None
  • Number of attachments :
    0

Description

The sample script below shows that Sql.expand does work for:
Sql.eachRow(GString sql, Closure rowClosure)
but NOT for
Sql.eachRow(GString sql, Closure metaClosure, Closure rowClosure)

-----------
import groovy.sql.Sql

import java.util.logging.*
Logger.getLogger('groovy.sql').level=Level.FINE

db = Sql.newInstance( 'jdbc:hsqldb:mem:GinA'
, 'sa'
, ''
, 'org.hsqldb.jdbcDriver')
db.execute "create table emp (name varchar(10))"

def tableName = "Emp"

// Line below logs: select * from Emp
db.eachRow("select * from ${Sql.expand tableName}") {}

// Line below logs: select * from groovy.sql.Sql$35@8ab08f
db.eachRow("select * from ${Sql.expand tableName}", {} ) {}

Activity

Hide
Paul King added a comment -

My testing shows that changeset 17986 from yesterday fixes this issue. Can you confirm?

Show
Paul King added a comment - My testing shows that changeset 17986 from yesterday fixes this issue. Can you confirm?
Hide
Albatross added a comment -

Confirmed as fixed on 1.7-rc-1-SNAPSHOT

Show
Albatross added a comment - Confirmed as fixed on 1.7-rc-1-SNAPSHOT
Hide
Paul King added a comment -

Fixed as part of another issue as previously noted

Show
Paul King added a comment - Fixed as part of another issue as previously noted

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: