List:General Discussion« Previous MessageNext Message »
From:Mark Matthews Date:December 21 2005 9:59pm
Subject:Re: Cleaning illegal characters from varchar field
View as plain text  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nathan Gross wrote:
> On 12/21/05, Hassan Schroeder <hassan@stripped> wrote:
>> Nathan Gross wrote:
>>
>>>> /*  hint: java.sql.PreparedStatement  */
>>> I thought we are talking about a mysql specific function, which would
>>> not be in the vanilla j2se/j2ee pkg's. Actually, you know, I don't
>>> even know exactly what function I need to be looking for!
>> We're talking about escaping certain characters automatically, the
>> capability provided by PreparedStatements, implemented in this case
>> by Connector/J, which *is* MySQL-specific  :-)
> Woa! Let me verify. If I pass a qry string:
>  "SELECT Anyfield from Anytable where Anyfield = 'The man was 100% correct' "
> to a Connector/J Statement (or PreparedStatement via parameters), the
> driver will automatically [behind the scenes] escape the percent sign?
> If so, wow!
> Thanks;
> -nat
> 

Nat,

No, it does not escape "%", it only escapes quotes and binary data, just
as any other prepared statement implementation from any vendor does.

The '%' sign only has significance for the LIKE operator, so it doesn't
come into play in your above SELECT statement.

	-Mark

- --
Mark Matthews
MySQL AB, Software Development Manager - Connectivity
www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFDqdA7tvXNTca6JD8RAlNxAJ9pnWIFmFlkuzEJFcVr0ZI282wofwCgt/85
VB6AXmNS43n6b6b9kQmRLI8=
=v+fE
-----END PGP SIGNATURE-----
Thread
Cleaning illegal characters from varchar fieldNathan Gross20 Dec
  • Re: Cleaning illegal characters from varchar fieldSGreen21 Dec
    • Re: Cleaning illegal characters from varchar fieldNathan Gross21 Dec
      • Re: Cleaning illegal characters from varchar fieldSGreen21 Dec
        • Re: Cleaning illegal characters from varchar fieldNathan Gross21 Dec
          • Re: Cleaning illegal characters from varchar fieldSGreen21 Dec
          • Re: Cleaning illegal characters from varchar fieldHassan Schroeder21 Dec
            • Re: Cleaning illegal characters from varchar fieldNathan Gross21 Dec
              • Re: Cleaning illegal characters from varchar fieldHassan Schroeder21 Dec
                • Re: Cleaning illegal characters from varchar fieldNathan Gross21 Dec
                  • Matching phone numbers to addressesRussell Horn21 Dec
                    • Re: Matching phone numbers to addressesPeter Brawley21 Dec
                  • Re: Cleaning illegal characters from varchar fieldHassan Schroeder21 Dec
                    • Re: Cleaning illegal characters from varchar fieldNathan Gross21 Dec
                  • Re: Cleaning illegal characters from varchar fieldMark Matthews21 Dec
                    • Re: Cleaning illegal characters from varchar fieldNathan Gross21 Dec
      • Re: Cleaning illegal characters from varchar fieldJamesDR21 Dec
        • Re: Cleaning illegal characters from varchar fieldNathan Gross21 Dec