jeudi 5 mars 2015

How to escape whole string (used as query parameter)

I need to write a select query using Python 2.7 and SQLite. The query makes use of results from a previous query. I can't use the result string in my query because it's not properly escaped. How can I escape the whole string so it's valid for my query ? I don't know on beforehand what needs to be escaped because I don't know the result of the previous query.


Any excising modules, functions or ... ?


Sample:



WHERE message LIKE "%How hard do you find it? Having to say, \xcf don\'t know."?%"


Many thanks !


Aucun commentaire:

Enregistrer un commentaire