-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Unless I'm completely mistaken, CF handles single quotes
automatically, without PreserveSingleQuotes.

An example:

<cfset String = "That's a single quote...">
<cfquery name="Whatever" datasource="Whatever" debug>
        INSERT INTO TABLE (ID, String)
        VALUES (42, '#String#')
</cfquery>

Your debugging output for that should show an sql string of:
        INSERT INTO TABLE (ID, String)
        VALUES (42, 'That''s a single quote...')

Your single quotes have been automatically escaped as two single
quotes (as they should be), and they'll go into the database exactly
as they should -- as one single quote.

If you put PreserveSingleQuotes around the string in the CFQUERY,
then the SQL String would look like:
        INSERT INTO TABLE (ID, String)
        VALUES (42, 'That's a single quote...')

That would cause an error since your string ends after That, and you
have a random bunch of text hanging out after it.

Am I completely missing your question?

Best regards,
Zac Bedell

> -----Original Message-----
> From: Jake Hileman [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 21, 2000 11:59 AM
> To: CF-Talk
> Subject: Re: Single Quotes - Double Quotes ARGH!
> 
> 
> I'm still waiting for an answer to this question also! :)  
> Don't forget when
> you select, you'll have to use it also.  :)
> 
> Jake
> 
> ----- Original Message -----
> From: "Peter Theobald" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 26, 2000 4:03 PM
> Subject: Single Quotes - Double Quotes ARGH!
> 
> 
> > --=====================_14561452==_.ALT
> > Content-Type: text/plain; charset="us-ascii"
> >
> > In several CFQUERYs on many pages I am updating several 
> tables. Very often
> these text fields have apostrophes or double-quotes in them. 
> If I surround
> the fields with single quotes, then CF escapes them by 
> doubling them. They
> actually go into the database doubled. If I surround the 
> fields with double
> quotes, then CF cuts them off when it sees the first double-quote.
> >
> > I cant believe my only option is to surround every single 
> field in every
> single update on every single page with 
> PreserveSingleQuotes(). That would
> be several hundred PreserveSingleQuotes()...
> >
> > What is the common practice for handling this? The 
> apostrophe is a common
> character in English text...
> >
> >
> >
> > 
> --------------------------------------------------------------
> ------------
> -
> > Peter Theobald, Chief Technology Officer
> > LiquidStreaming http://www.liquidstreaming.com
> > [EMAIL PROTECTED]
> > Phone 1.212.545.1232 Fax 1.212.679.8032
> >
> > --=====================_14561452==_.ALT
> > Content-Type: text/html; charset="us-ascii"
> >
> > <html>
> > <font size=3>In several CFQUERYs on many pages I am updating
> > several tables. Very often these text fields have apostrophes or 
> double-quotes in
> > them. If I surround the fields with single quotes, then CF 
> escapes them
> > by doubling them. They actually go into the database doubled. If
> > I surround the fields with double quotes, then CF cuts them 
> off when it
> > sees the first double-quote.<br>
> > <br>
> > I cant believe my only option is to surround every single 
> field in every
> > single update on every single page with PreserveSingleQuotes().
> > That would be several hundred PreserveSingleQuotes()...<br>
> > <br>
> > What is the common practice for handling this? The 
> apostrophe is a common
> > character in English text...<br>
> > <br>
> > </font><br>
> >
> > <font size=2><b><br>
> > 
> --------------------------------------------------------------
> ------------
> -<br>
> > Peter Theobald, </b>Chief Technology Officer<br>
> > </font><font size=3 color="#0000FF"><b>LiquidStreaming
> > </b></font><a href="http://www.liquidstreaming.com/"
> eudora="autourl"><font size=2
> color="#0000FF"><u>http://www.liquidstreaming.com</a><br>
> > </u></font><font size=2>[EMAIL PROTECTED]<br>
> > <b>Phone</b> 1.212.545.1232 <b>Fax</b> 1.212.679.8032<br>
> > </font></html>
> >
> > --=====================_14561452==_.ALT--
> >
> > 
> --------------------------------------------------------------
> ------------
> ----
> > Archives: http://www.mail-archive.com/[email protected]/
> > To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=list
s/cf_talk or
send a message to [EMAIL PROTECTED] with
'unsubscribe' in
the body.
>

- ----------------------------------------------------------------------
- --------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_tal
k or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>

iQA/AwUBOco3/graVoMWBwRBEQJEtgCgjjzpKoUC/+H6KMeM0tYJvOSfPoMAoME4
xMOYrAMqeL9+tXey15fBMLu3
=cBmI
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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.

Reply via email to