dimanche 1 février 2015

Find a strict string in a field

I have a database, which contains a field 'topic'. This field is a short text, about 200-300 words, I would say.


I need to find a string in this field, but in a particular way: only the string, and nothing else. Such things as



SELECT * FROM table WHERE abstract like '%myString%"


Are not possible, because it would also return something+my_string+something.



SELECT * FROM table WHERE abstract like '_myString_"


Does not work either, because my field could start with myString, and it would not match.


I would love to use REGEXP, but sqlite doesn't seem to support it yet. I read it is possible to tweak it, and use a personal function, but I would need a way to implement it for PyQt, to use it in my application.


Do you have any idea ?


Aucun commentaire:

Enregistrer un commentaire