I have a Struct "stWestcar". And stWestcar["#thisKey#"].Resource = "This is
Sean's test".
I'm doing a SQL Insert and I know that CF normally takes care of single
quotes inside of CFQUERY so I don't worry about it.
<cfquery name="qTest" datasource="foo">
INSERT INTO TempTable(Identifier,Resource)
VALUES('#thisKey#','#stWestcar["#thisKey#"].Resource#');
</cfquery>
Well, I get the SQL Error, and it turns out the above SQL is being passed
off to SQL-Server as: "INSERT INTO TempTable(Identifier,Resource)
VALUES('test','This is Sean's test');" Which of course is an invalid SQL
Statement. I scratch my head, and recall how hard it usually is for me to
get single quotes into SQL statements when I need to, hence the need for
PreserveSingleQuotes()....
So above the SQL Statement, I take the Struct Value out and put it into a
simple variable and use that simple variable in the SQL, and of course it
works.
<cfset SafeText=stWestcar["#thisKey#"].Resource>
<cfquery name="qTest" datasource="foo">
INSERT INTO TempTable(Identifier,Resource)
VALUES('#thisKey#','#SafeText#');
</cfquery>
Now why is that? anyone have a pointer to where I was supposed to read about
this behavior? I even tried using a StructFind(stWestcar["#thisKey#"],
"Resource") in the SQL, that didn't work either.... Why can it interpolate
the value of a simple variable and do the magic-single-quote-escape-trick
but can't interpolate a complex one. strange?...
/s
___________________________________________
Sean Brown <[EMAIL PROTECTED]>
http://www.westcar.com/
"Either way you get your dog back"
-Anonymous
___________________________________________
-----Original Message-----
From: Scott Weikert [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 11, 2000 1:29 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Client and session variables same thing different
Do some experiments. Set your session timeout to something ridiculously low,
say 2 minutes - and hit pages at 1:30 a few times, see if your session
sticks around, and then wait 2+ min a few times, and see if it conks out :)
--Scott
> -----Original Message-----
> From: Ricq Pattay [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 11, 2000 8:57 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: Client and session variables same thing different
>
>
> Huh. That's now how it seems on my end, but I must be
> spending too much time
> testing this thing as a developer instead of as a
> pseudo-user. :-) Thanks.
----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.