HI guys,

"I don't want to 'miss' you. OR I would like's to have Beer's"

What about a string like the above. See the issues is I want the single
quotes to remain where they are but in my SQL statement it reads the '
mark as an end tag to the SQL statement. This is incorrect so therefor it
throws thy error.

Does that make sense?

J.


> Remember that preservesinglequotes is a kind of double negative thing.
>    Normally, you want single quotes to be escaped so they will go into
> the database properly.  So if you have a string like:
> 
> I don't want to 'miss' you   
> 
> to go into the database,  then normally the query would escape it with
> another single quote, and send the following string to the database:
> 
> 
> I don''t want to ''miss'' you   
> 
> (i.e. double all the single quotes)
> 
> What the preservesinglequotes function does is ensure that the string
> is passed to the database in the query WITHOUT escaping the single
> quotes.  In other words, where you have a single quote in your
> variable, only one single quote will be passed to the database.
> 
> In normal circumstances, you wouldn't need to use
> preservesinglequotes.  IT's only if you have to have the single quote
> passed as part of a command to the database or perhaps its got to be
> used in a function there or a stored procedure or something like that.
> 
> Cheers
> Mike Kear
> Windsor, NSW, Australia
> Certified Advanced ColdFusion Developer
> AFP Webworks
> http://afpwebworks.com
> ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month
> 
> 
> On Wed, 16 Feb 2005 13:43:34 +1100, Jeremy <[EMAIL PROTECTED]> wrote:
> > Hi Guys,
> > 
> > IF anyone is left. See everyone I know is going to MXDU...*sigh* my
> > company won't let me go to the toliet without a hall monitor pass.
> > 
> > So my question is this. Can you use PreserveSingleQuote() in a SQL
> > statement. Because it seems to be ignoring it and I'm not sure.
> > 
> > Example
> > <cfset JobDesc = "1 ' 2' ' 3">
> > 
> > <cfquery name="QNAME" datasource="MyDSN">
> > UPDATE tbl_JobOrder
> > SET JobTitle = '#JobTitle#',
> > JobOrderDesc = '#PreserveSingleQuotes(JobDesc)#',
> > 
> > I also tried setting it outside of the query but get the same results. I'm
> > on the verge of removing the quotes all together.
> > 
> > ---

---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to