• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfqueryparam and trim causing ' to double to ''

New Here ,
May 17, 2006 May 17, 2006

Copy link to clipboard

Copied

Has any one else seen this problem with CFMX (6,1,0,63958).

I have some queries running on a site with the version of CF listed above where we had trim() statements around a form field which was then used as a value for a cfqueryparam tag in an update query, and the ' were escaped to ''. There were even some cases of " going to \" and i think a few ' going to \'.

We developed this on a CFMX box (6,1,0,83762) where this didn't happen at all.

I even output the variable before and after the update, and the value had the orginal number of quotes, but the param value from the query always had it doubled.

This is the section of code i'm talking about.

communityShortDesc = <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#trim(attributes.communityShortDesc)#">,

That above statement would cause the ' to double, but just by taking out the trim like below, the ' wouldn't double.

communityShortDesc = <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#attributes.communityShortDesc#">,

I think the only option I have is to go through and find all the trims in the insert/update statements and remove then. I'm just curious if anyone has any other ideas for this.

Thanks

Sean
TOPICS
Advanced techniques

Views

813

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , May 29, 2006 May 29, 2006
Ahem. Let me picture this.

It did work right in the updated CFMX 6.1.

It did not work in the older CFMX 6.1.

"The cfqueryparam tag doubled single quotation marks (') when strings were manipulated within the tag attributes." is the _FIRST_ issue that is mentioned in the Macromedia's CFMX 6.1 updater fix-list.

...sometimes it's just so, So very difficult to remain calm and polite, when.... awww forget it. *rolleyes*

😉

Votes

Translate

Translate
LEGEND ,
May 17, 2006 May 17, 2006

Copy link to clipboard

Copied

If the scope is attributes, it looks like a custom tag. Trim the variable on the way in to the tag.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 17, 2006 May 17, 2006

Copy link to clipboard

Copied

The way our code base is set up, is that we dump all the form and url vars into the attributes scope. It isn't a custom tag but more of a fusebox type methodolgy.

we really don't need the trim, i'm not sure why the former developer put it there.

but i could do a

<cfoutput>#attributes.var#</cfoutput>
<cfquery>
<cfoutput>#attributes.var#</cfoutput>

the two outputs show ' tick. the param in cfquery when i look at the debugging code has ''.

it is very odd indeed

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 29, 2006 May 29, 2006

Copy link to clipboard

Copied

I have the exact same problem.

I was suggested the PreserveSingleQuotes function, which didn't work. Anyone know a fix?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 29, 2006 May 29, 2006

Copy link to clipboard

Copied

> I was suggested the PreserveSingleQuotes function, which didn't work. Anyone know a fix?

One thing that's not immediately obvious with preserveSingleQuotes(), is
that it ONLY works within <cfquery> tags. It achieves nothing if you do it
outwith those tags. I'm not sure whether this is relevant to your
situation.

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 29, 2006 May 29, 2006

Copy link to clipboard

Copied

Ahem. Let me picture this.

It did work right in the updated CFMX 6.1.

It did not work in the older CFMX 6.1.

"The cfqueryparam tag doubled single quotation marks (') when strings were manipulated within the tag attributes." is the _FIRST_ issue that is mentioned in the Macromedia's CFMX 6.1 updater fix-list.

...sometimes it's just so, So very difficult to remain calm and polite, when.... awww forget it. *rolleyes*

😉

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 31, 2006 May 31, 2006

Copy link to clipboard

Copied

LATEST
LOL, i guess I should have checked that.

http://www.adobe.com/support/documentation/en/coldfusion/mx61updater/releasenotes_cfmx61_updater02.h...

I agree, the *rolleyes* is approiate here. But iguess that is what I get for assuming that both servers were up to date.

Sean

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation