QueryToStruct

Description

add a function which replicates what <cfquery returnType="struct"> returns

https://docs.lucee.org/reference/tags/query.html#attribute-returntype

https://github.com/lucee/Lucee/blob/6.0/core/src/main/java/lucee/runtime/type/query/QueryStruct.java#L163

required argument(s)

optional arguments

  • structType (default ordered)

  • valueRowNumber (boolean, default false)= rather than returning all the columns as a struct, set the value to the source row number

valueRowNumber is useful to avoid the overhead of loading all the column values into a struct,
as it common to just use a struct as a lookup to see if the columnKey exists, a bit like ES6 sets in javascript

https://trycf.com/gist/f078856f94aa5a603842f0f80b6eb6de/lucee5?theme=monokai

Activity

Show:

Harry Klein 20 July 2023 at 09:45

I guess there is no chance to rename this function as Taffy or our CMS and several of our apps use a function with the same name?

Pothys - MitrahSoft 5 December 2022 at 15:30

I've checked this ticket with the lucee latest build 6.0.0.305-SNAPSHOT. Now lucee supports QueryToStruct() and it works fine

Pothys - MitrahSoft 30 September 2022 at 11:27

I added a new function queryToStruct()

Pull Request: https://github.com/lucee/Lucee/pull/1826

Fixed

Details

Assignee

Reporter

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

Sprint

Fix versions

Priority

Created 29 January 2021 at 22:44
Updated 12 February 2025 at 21:20
Resolved 5 December 2022 at 15:30

Flag notifications