On Tue, Jun 3, 2008 at 10:32 AM, msoulier <[EMAIL PROTECTED]> wrote: > > On May 15, 2:23 pm, msoulier <[EMAIL PROTECTED]> wrote: > > So, custom SQL in Django can't include a LIKE statement with a % > > unless it's escaped? I'm > > looking in the docs and I can't seem to find anything that mentions > > that. > > In fact, I've replaced my % with %% and it's not matching anything > now. > > So, I can't use LIKE at all in Django's custom SQL? >
I'm a little confused as to whether you are seeing a problem with one specific db backend or all. I can certainly use like with escaped %'s. In my case the backend is MySQL. Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from crossword.models import Entries, Clues >>> from django.db import connection >>> c = connection.cursor() >>> c.execute('Select Entry, Clue from Entries natural join Clues where Clue like "Django%%"') 1L >>> c.fetchall() ((u'GUITAR', u"Django Reinhardt's ax"),) >>> Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---