DB-API execute params, am I missing something?
sjmachin at lexicon.net
Sat May 30 04:51:32 CEST 2009
On May 30, 11:35 am, Lawrence D'Oliveiro <l... at geek-
> In message <0dcfcb4a-8844-420b-b2e2-
> c8e684197... at p6g2000pre.googlegroups.com>, John Machin wrote:
> > If you need to escape % or _ in a LIKE argument, do whatever the host
> > convention is.
> > E.g. you are searching for text that contains literally "5% discount",
> > with SQLite you could do:
> > [avoiding backslashes and concomitant confusion]
> > LIKE '%5~% discount%' ESCAPE '~'
> > on the command line, so using DB-API:
> > like_expr = user_input.replace("~", "~~").replace("%", "~%").replace
> > (etc etc)
> Sounds like an amazingly complicated, roundabout and not even reliable way
> of doing it.
Please (a) explain what you mean (b) suggest a better way.
More information about the Python-list