In message <[EMAIL PROTECTED]>, I wrote:

>     def EscapeSQLWild(Str) :
>         """escapes MySQL pattern wildcards in Str."""
>         Result = []
>         for Ch in str(Str) :
>             if Ch == "%" or Ch == "_" :
>                 Result.append("\\")
>             #end if
>             Result.append(Ch)
>         #end for
>         return "".join(Result)
>     #end EscapeSQLWild

Correction, backslashes need to be escaped at this level as well. So that
should become

     def EscapeSQLWild(Str) :
         """escapes MySQL pattern wildcards in Str."""
         Result = []
         for Ch in str(Str) :
             if Ch == "\\" or Ch == "%" or Ch == "_" :
                 Result.append("\\")
             #end if
             Result.append(Ch)
         #end for
         return "".join(Result)
     #end EscapeSQLWild

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to