groovy

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

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.0-JSR-6
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    1

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.

Activity

Hide
Guillaume Laforge added a comment -

Thanks a lot for your patch Peter.
I'm looking forward applying other contributions from you

Show
Guillaume Laforge added a comment - Thanks a lot for your patch Peter. I'm looking forward applying other contributions from you

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: