Yeah, that's true; my bad. But as you say, it's also insecure. Far
better, and my preference, is be to do something like this:
<cfparam name="attributes.join" default="left">
<cfquery name="getStuff" ...>
select b.*, j.columns
from basetable b
<cfif attributes.join EQ "left">
left
<cfelseif attributes.join EQ "right">
right
<cfelse>
inner
</cfif> jointable j on (j.x = b.x)
</cfquery>
No more hashes, no more security issues, and you even get handling
(though with a default, not a raised exception) for invalid values.
Cheers,
barneyb
On 6/27/05, S. Isaac Dealey <[EMAIL PROTECTED]> wrote:
> > Much simpler (but the same) meaning, is just that you
> > should NEVER have hashes inside CFQUERY tags, unless
> > they are also inside CFQUERYPARAM tags.
>
> I beg to differ:
>
> <cfparam name="attributes.join" default="left">
> <cfquery name="getStuff" ...>
> select b.*, j.columns
> from basetable b
> #attributes.join# jointable j on (j.x = b.x)
> </cfquery>
>
> I don't use this syntax because it's insecure... This is simplified to
> make the example... The point being that there are cases in which a
> non-queryparamed variable is viable as part of a sql statement when
> the content of the variable constitutes part of the sql syntax which
> is not bind-able.
>
>
> s. isaac dealey 954.522.6080
> new epoch : isn't it time for a change?
>
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/
Got Gmail? I have 50 invites.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210626
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54