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

Sql.withBatch is not escaping SQL variables

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.7.3
    • None
    • SQL processing
    • None
    • Windows 7, Java 1.6.0_20

    Description

      I wanted to replace a loop of sql.update calls like this:

      sql.execute("update Foo set Baz = ${baz} where Bar = ${bar}")

      With

      sql.withBatch(200, { stmt ->
      stmt.addBatch("update Foo set Baz = ${bar} where Bar = ${bar}")
      })

      But looks like Sql.withBatch is not escaping variables like Sql.execute and Sql.update do
      and the script freaks out as soon as one of the bar variables contains a quote character.

      Attachments

        Activity

          People

            paulk Paul King
            behrangsa Behrang Saeedzadeh
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: