[DB-SIG] Escaping Placeholders

M.-A. Lemburg mal at egenix.com
Tue Jul 6 21:56:32 CEST 2004


Peter L. Buschman wrote:
> 
> I know there must be an obvious answer to this question, but what is the 
> standard mechanism
> for escaping placeholders in dbapi execute method calls?
> 
> Eg., when using the qmark paramstyle and I want to include a literal 
> question-mark, do I use \?, '?', ??,

Depends on where you want to use it. Having the ? inside a
string literal is no problem at all and doesn't require
escaping, e.g. 'questions?'. I don't know where else you'd
want to use a literal question mark in the SQL that should
not be interpreted as parameter marker.

Do you have examples ?

> or something else entirely? Ditto for format, named, etc., in any 
> situations where literal text in the query
> might be mistaken for a placeholder.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jul 06 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the DB-SIG mailing list