Hold on, let's review your posts...
Your first code snippet was:
<cfquery name="insert" database="Database">
Insert into Tablename ( Fieldname ) values ( 'God's Kitchen 05' )
</cfquery>
This will never work for obvious reasons the apostrophe is ending the SQL
command early and renders it invalid - not surprises here.
Rod (as did Ryan) - posted a solution; which will work - escape the quote;
Insert into Tablename ( Fieldname ) values ( 'God''s Kitchen 05')
I then mentioned using cfqueryparam which would work 100% of the time no
messing on all versions of the DataDirect driver all the way back to 3.1 I
think. I provided a nice snippet which you could run to prove it on the
same drivers (so it is definitely not the drivers) - to repeat, it is not a
problem with the drivers.
You then posted these absurd code snippets:
<cfquery>
#PreserveSingleQuotes(SQLString)#
</cfquery>
And
<cfset test = "God's Kitchen 05" />
<cfsavecontent variable="Andrew">
Insert into table ( fieldname) values ( '#test#' ) </cfsavecontent>
<cfquery>
#PreserveSingleQuotes(Andrew)#
</cfquery>
I have no idea why you would want to do this, its not good coding and it
will obviously not work - it will suffer the same fate as your first
snippet, as the values block would read ('God's Kitchen 05')....error every
time.
It seems what you have here is you were using bad/malformed code and blaming
the 3.4 drivers - and that the fact that the 3.5 drivers actually allow you
to do it is no more than luck I think; they handle it for you - but it
doesn't detract away from the fact that its bad code which just happens to
work on 3.5.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Andrew Scott
Sent: 10 November 2005 23:54
To: CFAussie Mailing List
Subject: [cfaussie] Re: Single Quote Preservation
Neil don't piss me off, read my posts.
I was not interested in the fact I should be using cfqueryparam, I was
interested in the preservation of single quotes with basic code that should
work and didn't.
I found the problem and posted the results, leave it at that. And go and
find another person to have a debate with that is not interested in your
opinion anymore.
Regards
Andrew Scott
Analyst Programmer
CMS Transport Systems
Level 2/33 Bank Street
South Melbourne, Victoria, 3205
Phone: 03 9699 7988 - Fax: 03 9699 7976
Quote:
The glory of friendship is not the outstretched hand, nor the kindly smile,
nor the joy of companionship; it is the spiritual inspiration that comes to
one when he discovers that someone else believes in him and is willing to
trust him with his friendship. - Ralph Waldo Emerson
----------------------------------------------------------------------------
--------------------------
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Robertson-Ravo, Neil (RX)
Sent: Friday, 11 November 2005 10:24 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Single Quote Preservation
This looks like bad coding I'm afraid - look at what you are trying to
achieve and look at the example I, and others posted for better examples.
"This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540. It contains information which is
confidential and may also be privileged. It is for the exclusive use of the
intended recipient(s). If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful. If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910. The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions."
Visit our website at http://www.reedexpo.com
-----Original Message-----
From: [EMAIL PROTECTED]
<[EMAIL PROTECTED]>
To: CFAussie Mailing List <[email protected]>
Sent: Thu Nov 10 23:09:44 2005
Subject: [cfaussie] Re: Single Quote Preservation
That's the thing, the error messaged changed for example.
#PresserSingleQuotes(String)#
Produced an error on the single quote and the s Where
'#PreserveSingleQuotes(String)#'
Produced unknown column and as I have updated the drivers I am not going to
be able to repeat this.
Now here is the kicker...
<cfqueryparam ..... >
Produced the same result has '#PreserveSingleQuotes(String)#'
And this
Values ('God's Kitchen 05')
Produced the same error as #PresserSingleQuotes(String)#
Now that I have updated the Macromedia Drivers all the above now work
correctly except for the reason I ran into this problem in the first place
still exists, and has been logged as a bug against MM.
It appears that if a java webservice returns a structured array, this line
of code will not work.
Values ( '#Array[1].getStringValue()#') nor will
'#PreserveSingleQuotes(SQLString)#' nor will <cfqueryparam ....>
However updating the drivers at least allowed me to save the query into a
variable and do this
<cfquery>
#PreserveSingleQuotes(SQLString)#
</cfquery>
Now as I stated I wrote, and rewrote this code in many ways to find out why
this would not work. And all the code written now works with the latest
drivers.
Now the documentation to CF says that by default Single Quotes are preserved
in a query, so that means this should have worked but it didn't.
<cfset test = "God's Kitchen 05" />
<cfquery>
Insert into table ( fieldname) values ( '#test#' )
</cfquery>
But it didn't so the next step was to try this.
<cfset test = "God's Kitchen 05" />
<cfsavecontent variable="Andrew">
Insert into table ( fieldname) values ( '#test#' )
</cfsavecontent>
<cfquery>
#PreserveSingleQuotes(Andrew)#
</cfquery>
Which is supposed to work as well, and it didn't. But as I stated I upgraded
the Macromedia Drivers to 3.5 and all the above code now works.
So back of Neil, you were not here pulling your hair out on this one. I
was..
Regards
Andrew Scott
Analyst Programmer
CMS Transport Systems
Level 2/33 Bank Street
South Melbourne, Victoria, 3205
Phone: 03 9699 7988 - Fax: 03 9699 7976
Quote:
98% of all statistics are made up. (Anonymous)
----------------------------------------------------------------------------
--------------------------
-----
---
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/
This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540. It contains information which is
confidential and may also be privileged. It is for the exclusive use of the
intended recipient(s). If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful. If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910. The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions.
Visit our website at http://www.reedexpo.com
---
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/
---
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/
This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540. It contains information which is
confidential and may also be privileged. It is for the exclusive use of the
intended recipient(s). If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful. If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910. The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions.
Visit our website at http://www.reedexpo.com
---
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/