DB-API execute params, am I missing something?
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Fri May 29 21:35:37 EDT 2009
In message <0dcfcb4a-8844-420b-b2e2-
c8e68419774d 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.
More information about the Python-list
mailing list