Apologies but does anyone know how to preserve cas...
# cfml-general
j
Apologies but does anyone know how to preserve case for query columns?
w
you mean when doing something like query.columnlist or the like?
j
Yes. It is converting it to upper case when I use queryExecute. I know CFML likes to do that by default, so I'm trying to find a way to keep the casing as is was in the query.
w
yeah. rather than rely on columnlist, you want to getMetaData(theQuery) and inside that is a columns key, i think it's an array iirc
t
There's also
this.serialization.preserveCaseForQueryColumn = true;
which you can set in the Application.cfc so if you're serializing it to a json struct, it'll keep the cases.
j
Tried that setting, won't work for some odd reason.
w
tim, what's the cf version compat?
t
that's a good question... I think we sarted using it in cf2016, but I'll double check.
w
john, try writedump'ing getMetadata(query), should have what you want
j
lucee 4.5 😕
I'll try that
mmm, I guess I need to loop through the array but I see the casing is there now
w
what is this for, to convert a query to an array of structs or something?
j
Yeah, basically.
w
do you want a UDF for it?
j
They have one already, I'm attempting to code around it.
Might just fix it
✔️ 1
t
preserveCaseForQueryColumn
was apparently added in CF11, Update 5, per ray camden's blog: https://www.raymondcamden.com/2015/04/14/coldfusion-updates-released-today But yeah, I have no idea what the Lucee support on that is.
✔️ 1
j
A lot of this could be avoided if I convince them to push to lucee 5, I think
regardless, I got it going now. Thank you very much!