Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I stop Coldfusion from converting query column names to upper case?

When I select data from a MySQL table using the cfquery tag in ColdFusion 8, the column names are all converted to uppercase even though I've stored them in camelCase in the database table. Is there a way to make ColdFusion respect the case of the column names?

The reason I'm asking is because I'm returning the query result as a JSON object and I don't want to use upper case property names on the JavaScript side as I reserve that naming convention for constants.

like image 464
Jens Wegar Avatar asked Sep 29 '11 12:09

Jens Wegar


2 Answers

queryName.getMetaData().getColumnLabels()

return an array of query column label with original case from query

like image 53
tsurahman Avatar answered Nov 12 '22 07:11

tsurahman


Use getMetaData on the query object. It returns an array of columns showing the same case you used in the query.

like image 38
Raymond Camden Avatar answered Nov 12 '22 07:11

Raymond Camden