Thanks for the explanation Adam. Back to the drawing board...

This looks interesting

http://mkruger.cfwebtools.com/index.cfm?mode=alias&alias=no_cfqueryparam
http://mkruger.cfwebtools.com/index.cfm?mode=alias&alias=binding_oracle

eg
<cfquery name="getUser" datasource="#dsn#">
   DECLARE   @param1 varchar(50)
   DECLARE @param2 int = 5555

   set @param1 = 'joe'
   set @param2 = 5555

   SELECT    name, Email, userId
   FROM   users
   WHERE   username = @param1
   AND      pin = @param2
</cfquery>



On 5/5/07, Adam Cameron <[EMAIL PROTECTED]> wrote:
>
>
> > So back to the question, can cf tags be put in a string to be used in
> > another tag later?
>
> Short answer: no.
>
> Mid-length answer:
> You've got to think about the CF live cycle.  What you see as source
> code isn't actually what's finally executed.  Before it's executed,
> CFML is "compiled" into Java bytecode, and *that* is executed.  For
> CFML tags to "run", they need to already be there at "compile
> time" (as opposed to "run time", which is when your string exists).
>
> This is the same reason why one cannot "build" CFML statements out of
> other CFML statements at runtime - which is a question that does the
> round on various forums every week or so - and expect the built
> statements to somehow run.
>
> Long answer:
> The best you can hope for is to write your string to a file, and then
> include it.  Even with CF's gains in this area over the last few
> versions, this is a slow solution, as your runtime file needs to be
> compiled (slow) before it's executed.
>
> For your <cfqueryparam> situation, what I've done is to re-implement
> <cfquery> as a function, and include in that processing for swapping
> out a token (by default, it's {cfqp}) in my SQL string for a
> <cfqueryparam> tag, populating it from an array of structs also passed-
> in to the function.  Someone else had written a far more elegant
> solution a while back which DID allow for in-line #cfqueryParam()#
> calls in the SQL string, which again was subsequently re-processed as
> a <cfqueryparam> tag by the cfquery() function.  I've lost his source
> code, so am in the process of re-implementing my own.  I'm 90% of the
> way through it... just waiting for a spare hour to finish it.  My
> development paused for reflection a bit when I found out that there
> are [cough] "things on the horizon" which will make re-implementing CF
> tags as functions *much* *much* *much* easier.  Once it's released.
>
> --
> Adam
>
>
> >
>


-- 
If you are not living on the edge,
You are taking up too much space.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to