Something to note is that you cannot, of course, queryparam the
sortorder column that will be supplied. If the sort order field is
passed to your cfc from either get or post data, you may want to do
the sorting in a QoQ after the database query to get rid of the sql
injection threat. Ie.

<cfquery name="qfoo" datasource="#_dsn#">
 SELECT stuff FROM stuff
</cfquery>

<cfquery name="qfoo" dbtype="query">
 SELECT * FROM qfoo ORDER BY #arguments.order#
</cfquery>

<cfreturn qfoo />

Dominic

2009/3/3 Chad Gray <[email protected]>:
>
> Ok... and I can set the argument in the cfc to default to a order that is 
> common for the data.
>
> Then if I need a different order I will pass it to the CFC.  Makes sense.  
> Guess I was getting lazy here at the end of the day.
>
> Thanks Charlie!
>
>
>> -----Original Message-----
>> From: Charlie Griefer [mailto:[email protected]]
>> Sent: Tuesday, March 03, 2009 4:19 PM
>> To: cf-talk
>> Subject: Re: order query object
>>
>>
>> On Tue, Mar 3, 2009 at 1:10 PM, Chad Gray <[email protected]> wrote:
>>
>> >
>> > Say I have a CFC that returns a query object.
>> >
>> > When I go to output the data can I sort the query object on the display
>> > page?
>> >
>> > This way I don't have to have an ORDER BY in the SQL in the CFC.  I
>> could
>> > do the order by or sort when I go to display the query results instead.
>> >
>>
>> why not pass the sort order in as an argument to the CFC method?
>>
>> if you really wanted to, you could do a QoQ on the display page to sort.
>>  But I'd think that returning the query in the "proper" order (the order
>> in
>> which the display page wants to use it) would be preferable.
>>
>> --
>> I have failed as much as I have succeeded. But I love my life. I love my
>> wife. And I wish you my kind of success.
>>
>>
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320099
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to