Title:
[ANeff] ER for: QueryToArray()/query.toArray() or QueryGetRows()/query.getRows()
| View in TrackerStatus/Resolution/Reason: To Track//PRNeedInfo
Reporter/Name(from Bugbase): Aaron Neff / ()
Created: 05/06/2018
Components: Language
Versions: 2018
Failure Type: Others
Found In Build/Fixed In Build: /
Priority/Frequency: Normal /
Locale/System: /
Vote Count: 0
Issue: queryNew(columns,types,arrayOfStructs) can build a query from an arrayOfStructs (good), but no function* exists for getting an arrayOfStructs from a query.
Suggestion: queryToArray(theQuery)/theQuery.toArray(), or queryGetRows(theQuery[,startRow,endRow])/theQuery.getRows([startRow,endRow]), to return array of structs
Workarounds:
array function queryToArray(required query query) {
return ARGUMENTS.query.reduce(function(result, row) {return result.append(row);}, []);
}
-or-
array function queryToArray(required query query) {
return deserializeJSON(serializeJSON(ARGUMENTS.query, "struct"));
}
* - QueryGetRow()/query.getRow() exist, but only get 1 row (as struct). So, perhaps it makes sense to go w/ the more flexible and similarly-named QueryGetRows(theQuery[,startRow,endRow]) instead of the more limited QueryToArray(theQuery).
Attachments:
Comments: