----- Original Message ----- 
From: "Jochem van Dieten" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, July 30, 2003 4:44 PM
Subject: Re: Access to MySQL Migration


> > One thing we just noticed... MySQL recognizes C-style character escape
> > sequences, beginning with backslashes.
> >
> > http://www.mysql.com/doc/en/String_syntax.html
> >
> > For instance
> >
> > SET foo = 'some \t text'
> >
> > inserts a tab in the middle of the string.  This is biting us in migrating
data
> > fields containing backslashes.  If not escaped (\\) the ODBC driver throws
an
> > error.  Anyone figured out an easy workaround?
>
> cfqueryparam

How exactly does cfqueryparam fix this?  I just modified a tiny application I
wrote which now uses a MySQL table to track query history.  Using
<cfqueryparam> did indeed fix the problem, but I can't really tell what it's
doing.

My cfquery, which looks like

<cfquery datasource="Whois">
INSERT INTO history (searchdatetime, employeeid, searchstring, serverid)
VALUES (#CreateODBCDateTime(Now())#, #employeeid#,
        <cfqueryparam value="#form.domain#" cfsqltype="cf_sql_varchar">,
        #form.serverid#)
</cfquery>

is transformed into

INSERT INTO history (searchdatetime, employeeid, searchstring, serverid)
VALUES ({ts '2003-07-30 17:47:22'}, 9,
        ?,
        1)

Query Parameter Value(s) -
Parameter #1 = the search\

and the string "the search\" gets inserted into the table.  I understand how
the prepared statement works, but is <cfqueryparam> doing some type of
auto-escape (that isn't visible in the debug output or does it somehow affect
the query behavior?  Without <cfqueryparam> MySQL throws an error with the same
character string.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to