This content has been marked as final. Show 8 replies
Id' try to help, but I can make neither head nor tail of what you're on
about. Can you reword? Forget how you're trying to do it, just explain
what you need done.
Want to see them in the "original" order? Use getColumnList() and ArrayToList() instead of looking at ColumnList directly......
<cfquery name="qTableSelected" datasource="#request.DSN#">
select * from category
<cfset colHeaderNames = ArrayToList(qTableSelected.getColumnList())>
<cfloop list="#colHeaderNames#" index="col" delimiters=",">
> Use getColumnList()
Personally my preference would be the udf. If only because it uses a documented function. Though getColumnList() may well be what CF uses internally ..
> Personally my preference would be the udf. If only because it uses a documented function.
Since when was the getMetadata() method of a *query object* a "documented"
function? Any more than getColumnList() is, I mean?
The only reference to getMetadata() I can see in the docs is for this:
Which is a completely different function.
There's nothing else in the docs index for getMetadata() under "G":
As far as I know all exposed methods of the the Java objects underlying the
CF data types are "tread with caution" because there's no guarantee they
will be implemented from one version of CF to the next.
> Though getColumnList() may well be what CF uses internally ..
I would say it almost certainly does. It seems unlikely they'd implement
it for no reason ;-)
I prefer Phil's way because it's tidier than the UDF at CFLib.
Adam Cameron wrote:
> Since when was the getMetadata() method of
> a *query object* a "documented" function?
Not the getMetaData() function _of_ a query object, but the CF function. It supports query objects.
http://livedocs.adobe.com/coldfusion/7/htmldocs/00000488.htm#1105179. That is what I use in my custom function. But you are right about the udf. I only glanced at it quickly, and mistakenly thought they were using the CF getMetaData function like I was.
> I would say it almost certainly does. It seems unlikely they'd implement
> it for no reason ;-)
> I prefer Phil's way because it's tidier than the UDF at CFLib.
Probably. But having stupidly written code that depended on some undocumented functionality.. and not surprisingly getting burned .. I will stick with the CF getMetaData() function thank you ;-)
> Not the getMetaData() function _of_ a query object
*method* _of_ a query object
> but the CF function. It
> supports query objects.
I'm glad you pointed me back at this. I recalled something about queries,
but only got as far as reading "CFC" when I looked it up just before, so
decided I must've been getting my wires crossed with the object method.
But no, there is is: works on queries too.
Cheers for the nudge.