It is a fact that using <cfqueryparam> outside of <cfquery> will result in
it being seen by CF as purely string text. It will never be executed as an
actual <cfqueryparam>.

I obviously do not know what you're dealing with, specifically, but it
sounds like you have a "god" query on your hands, and it really needs to be
split up into separate methods/functionality. That is, of course, from the
outside looking in. :-)


On Tue, Jan 22, 2013 at 4:19 PM, Tom McNeer <tmcn...@gmail.com> wrote:

>
> Thanks for the replies. The answer to Steve, Bill and Matt is, the query is
> far too dynamic to be built inside a cfquery without a million cfif or
> switch/case statements.
>
> In fact, that sort of thing is what we're trying to replace. The existing
> routine is a cfquery tag that has stacks of specific logic, and it's
> already almost unmaintainable. The current requirement means there will be
> literally hundreds of possible combinations of parameters and operators.
>
> I've built lots and lots of dynamic queries in the manner you suggest, and
> I understand your concern. It just won't work in this case. Please take my
> word for it.
>
> On Tue, Jan 22, 2013 at 4:47 PM, Bill Moniz <hydro.b...@gmail.com> wrote:
>
> > Coldfusion is just going to see #sqlStatement# as a block
> > of literal text, so it will pass
> >
> >  WHERE firstName LIKE <cfqueryparam cfsqltype="cf_sql_varchar"
> > value="%bar%" />
> >
> > into the DB exactly as written.
> >
>
> It appears you may well be correct. But that's exactly what I'm trying to
> determine for certain. Do you know that this is the case, or are you
> assuming it to be so?
>
> Believe me, I'm not trying to be argumentative. I've combed the docs and
> Googled extensively before asking my question here.
>
> I suppose that's the key question: if a query statement containing
> queryParam statements is output within a cfquery tag, does CF try to
> interpret the tags, or simply pass the plain text to the driver?
>
> It does seem as if Bill is correct, and CF simply passes the queryParam tag
> as text to the driver. Can anyone confirm for certain this is true, or
> point to anywhere in the docs this is dealt with?
>
> Thanks to everyone for their suggestions.
>
> --
> Thanks,
>
> Tom
>
> Tom McNeer
> MediumCool
> http://www.mediumcool.com
> 1735 Johnson Road NE
> Atlanta, GA 30306
> 404.589.0560
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354014
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to