Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.0-beta-2
-
Fix Version/s: 2.0-beta-3, 1.8.7
-
Component/s: SQL processing
-
Labels:None
-
Testcase included:yes
-
Patch Submitted:Yes
-
Number of attachments :
Description
The groovy.sql.Sql.eachRow functions do not support named parameters it would be nice if they did. Also, the rows(sql, params) function is the only rows function to support named parameters, it seems to use some unexpected (to me) behaviour of reflection that causes the passed in map to be placed into an array (thus calling rows(String sql, Object[] params)). Test cases for these have been attached.
A suggested fix would be to add overloaded methods which expect Maps and place them in a List. This could also be expanded to include the methods:
execute
executeInsert
executeUpdate
firstRow
query
I have put together a quick subclass of Sql which adds these methods and could be merged into the the Sql class if desired. If there is any interest in this fix I'll look at adding more test cases.
It might be worth noting that the main reason I become interested in using the named parameter variants as opposed to the GString implementations is that the docs did not indicate that the GStrings used parameter replacement (which I now know they do from reading the source) so it might be a good addition to the docs to have this mentioned.
Issue Links
- is depended upon by
-
GROOVY-5401
Extend groovy.sql.DataSet with paging capabilities
-
Activity
| Field | Original Value | New Value |
|---|---|---|
| Link |
This issue is depended upon by |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Paul King [ paulk ] | |
| Fix Version/s | 2.0-beta-3 [ 18244 ] | |
| Fix Version/s | 1.8.7 [ 18317 ] | |
| Resolution | Fixed [ 1 ] |
| Status | Resolved [ 5 ] | Closed [ 6 ] |