Allow Query to return a 1-record Struct
Description
Activity
Show:
Igal Sapir 28 November 2020 at 05:34
IMO yes, throw an error. The alternative is to return the first row but that seems like it can lead to bugs. IMO this feature will be mostly used when querying by ID, so only one row should be returned.

Michael Offner 29 May 2020 at 16:19
what if there are more than one record, still throwing an error?
Fixed
Details
Details
Assignee
Reporter
Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Fix versions
Priority
Created 16 March 2020 at 22:17
Updated 21 December 2020 at 02:27
Resolved 21 December 2020 at 02:27
Currently we have the attributes `returnType="array"` and `returnType="struct" columnKey="..."` which are really cool, but a common use case is to return a single record from a query and convert it to struct.
That can be done by using `returnType="array"` and extracting the first row, but the proposal here is to be able to achieve the same by simply passing `returnType="struct"` without the `columnKey` attribute, which I think would be named better as `keyColumn` instead.