It seems rather "asymmetrical" that there is a `qu...
# lucee
a
It seems rather "asymmetrical" that there is a
querytoStruct
function (https://docs.lucee.org/reference/functions/querytostruct.html), but not a
structToQuery
equiv.
(and, yes, I know there are alternatives; this was not the point)
d
A struct really can't be assumed it could be turned into a query object. Even an array of structs doesn't guarantee all the required data is there to convert it into a query object.
a
thats a separate point though if one defines what needs to be present I think Adam is right if you can create queries through series of loops and queryaddrow and set cell statements then being able to do the other way seems like a nice enhancement with a simple structtoquery
👍 1
I'd up vote it got a ticket Mr Cameron ?
z
yeah makes sense, just as long as the incoming struct matches the expected format
along the lines of
structToQuery(struct, keyColumnName)
?
how far along is the existing import for queryNew for this?
a
thats a separate point though
Yup. garbage in, garbage out. The docs can mandate what the baseline expectations / requirements are, and what conditions might cause exceptions to be thrown.
how far along is the existing import for queryNew for this?
"Instead", not "as well". So no preexisting query object; just one is returned from the function. TBH my actual requirement the other day was
arrayOfStructsToQuery
, but I just landed on
queryToStruct
when I was RTFMing and noted the reverse function was not there. In the end I just used
query.addRow(array)
(to an empty query with the appropriate columns defined)
z
a
Sensible function that, and fits well with the rest of the query API. @Mark Takata (Adobe) CF should add that.
z
thanks mate
m
I like this. @Charvi
👍 1