Most RDBMSs support something like this. But you'd want to cache the results
so you only have to do it once.

On 9/17/07, Greg Morphis <[EMAIL PROTECTED]> wrote:
>
> Not sure if your DB supports this but with Oracle I can select the
> columns from the table..
> select column_name
> from user_tab_columns
> where table_name = 'MY_TABLE'
> Granted this would require 2 trips to the database, 1 to get the
> column names, then check to see if your sortby variable is in that
> list, then another to actually query the table.
>
>
>
>
>
>
>
>
>
>
> On 9/17/07, Brian Kotek <[EMAIL PROTECTED]> wrote:
> > On 9/17/07, Vince Collins <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > That suggestion works.  However, in an example of a query with 10
> > > columns and assuming you want to allow desc and asc, does anyone  have
> a
> > > more conscience way other than 20 cfcase statements?
> >
> >
> > You could specify a list of table names and use ListFindNoCase(). Or you
> > could come up with an automatic solution by using JDBC metadata (or
> if/when
> > you switch the CF8, the CFDBINFO tag) to get the valid column names for
> the
> > table and compare the incoming order by value to those. You'd probably
> want
> > to do this once per table and cache the column names somewhere so you
> > wouldn't have to do it on every request.
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288659
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