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

Provide access to auto-generated column values when using INSERT through groovy.sql.Sql

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.0-JSR-6
    • None
    • None

    Description

      At present, there is no easy way to access auto-generated values from an INSERT. For example, some tables have an autoincrement ID column which cannot be set with the INSERT statement, but it would be useful to know what value the database assigned to it for each row inserted.

      To this end, I have attached a patch that adds a new set of methods called executeInsert() that return a list of the column values auto-generated by the database. These value can be accessed via array access notation; for example keys[1][0] would return the value of the first auto-generated column in the second inserted row.

      No test yet, but may come later.

      Attachments

        1. Sql-executeInsert.patch
          6 kB
          Peter Ledbrook

        Activity

          People

            guillaume Guillaume Sauthier
            pledbrook Peter Ledbrook
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: