QuoteSQL
Anders J. Munch
2006 at jmunch.dk
Sat Sep 23 10:15:49 EDT 2006
Lawrence D'Oliveiro wrote:
> Why doesn't MySQLdb provide a function like this:
>
> def QuoteSQL(Str, DoWild) :
> """returns a MySQL string literal which evaluates to Str. Needed
> for those times when MySQLdb's automatic quoting isn't good enough."""
Presumably because you're expected to use placeholders. When is that
not good enough?
> elif Ch == "'" or Ch == "\"" or Ch == "\\" :
> Ch = "\\" + Ch
Always sad to see an SQL DBMS willfully violate the SQL standard.
- Anders
More information about the Python-list
mailing list