Code

Ticket #4676: sql.diff

File sql.diff, 728 bytes (added by djangoproject.com@…, 7 years ago)

Patch againt svn revision 5526

Line 
1Index: base.py
2===================================================================
3--- base.py     (revision 5526)
4+++ base.py     (working copy)
5@@ -87,6 +87,9 @@
6         return name # Quoting once is enough.
7     return '"%s"' % name
8 
9+def unquote_name(name):
10+    return name.strip('"')
11+
12 dictfetchone = util.dictfetchone
13 dictfetchmany = util.dictfetchmany
14 dictfetchall = util.dictfetchall
15@@ -121,7 +124,8 @@
16     return " DEFERRABLE INITIALLY DEFERRED"
17 
18 def get_fulltext_search_sql(field_name):
19-    raise NotImplementedError
20+    requoted_field_name = quote_name("%s_tsv" %(unquote_name(field_name)))
21+    return "%s @@ to_tsquery(%%s)" % requoted_field_name
22 
23 def get_drop_foreignkey_sql():
24     return "DROP CONSTRAINT"