[thelist] CF query tip
Judah McAuley
judah at wiredotter.com
Thu Jan 31 13:15:01 CST 2002
At 11:32 AM 1/31/2002 -0700, Scott Brady expounded...
>Judah wrote:
>
>3) cfqueryparam should also take care of it (and it's simpler). I haven't
>had any single quote problems using cfqueryparam in SQL Server, Oracle, or
>(surprisingly) Access.
Ah, right. Good call. I forgot about that one because I never use
it. There are so many ways to do things, I just never bother to use some
of the tags/functions. I'd really prefer it though if CF did structures
right. Ah well. They are very useful, but sometimes vexing.
Judah
<tip type="ColdFusion Structures" author="Judah McAuley">
All of the structure functions have the word Struct in them except for one:
Duplicate. It seems like Duplicate would be the same thing as StructCopy,
but they are slightly different. Duplicate makes an entire copy of a
structure and assigns it to a new variable. StructCopy makes a copy of the
*structure* of a structure and assigns it to a new variable. This new
variable will still reference the values in the structure it was copied
from. Duplicate makes a structure that is completely independent of the
structure it was copied from.
</tip>
<tip type="ColdFusion function StructClear()" author="Judah McAuley">
Be careful how you use the function StructClear. How you call the function
will change how it works.
Example: <cfscript>StructClear(foo);</cfscript> will clear all of the
values in the structure foo and give you the structure back with all the
keys intact.
Example 2: <cfset foo = StructClear(foo)> will turn foo into a simple
variable with the value YES. It will no longer be a structure and all of
your keys will be blown away.
Why? StructClear() always returns a value of YES which is a simple
value. When you assign it to foo, then foo becomes a simple variable and
is no longer a structure.
</tip>
More information about the thelist
mailing list