Feature proposal #7890
closedImprove Query action to support custom select query results output
Description
Currently the query action just returns the results of loadResult(). There's no customization beyond that. You can't specify how rows or columns are handled like a query field. Implement formatting support in addition to raw output that returns an array or object to be serialized to JSON.
Updated by krileon over 4 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
If the query contains a LIMIT of anything greater than 1 (e.g. LIMIT 5, or LIMIT 0, 5) or no LIMIT at all the result will be treated as an array. If the array result contains only 1 column the results will be comma separated. If the array result contains more than 1 column the results will be output as JSON. If the query does have a LIMIT 1 or LIMIT 0, 1 for single row output then the same parsing rules apply with single column directly being returned while multiple columns will be output as JSON. This will allow the query endpoint to work as an API endpoint due to JSON response being supported.