Tuesday, May 31, 2011

Text search, sqlite bindings and Python

c.execute("SELECT * FROM entries WHERE (title LIKE ? OR body LIKE ?) order by date desc", ("%%%s%%" %text, "%%%s%%" %text))

Notes
  1. Putting %?% does not work
  2. "%?%" does not work
  3. Double percent sign (%%) due to python string substitution rules

No comments:

Post a Comment