Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactored get_fulltext_search_sql() to DatabaseOperations.fulltext_s…

…earch_sql(). Refs #5106

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5a6426448f9813ef9abe17d59eb99e278f9461ee 1 parent 23a736d
Adrian Holovaty adrianholovaty authored
8 django/db/backends/__init__.py
View
@@ -91,3 +91,11 @@ def drop_foreignkey_sql(self):
Returns the SQL command that drops a foreign key.
"""
return "DROP CONSTRAINT"
+
+ def fulltext_search_sql(self, field_name):
+ """
+ Returns the SQL WHERE clause to use in order to perform a full-text
+ search of the given field_name. Note that the resulting string should
+ contain a '%s' placeholder for the value being searched against.
+ """
+ raise NotImplementedError('Full-text search is not implemented for this database backend')
3  django/db/backends/ado_mssql/base.py
View
@@ -110,9 +110,6 @@ def get_limit_offset_sql(limit, offset=None):
def get_random_function_sql():
return "RAND()"
-def get_fulltext_search_sql(field_name):
- raise NotImplementedError
-
def get_pk_default_value():
return "DEFAULT"
1  django/db/backends/dummy/base.py
View
@@ -46,7 +46,6 @@ def close(self):
get_last_insert_id = complain
get_limit_offset_sql = complain
get_random_function_sql = complain
-get_fulltext_search_sql = complain
get_pk_default_value = complain
get_max_name_length = ignore
get_start_transaction_sql = complain
6 django/db/backends/mysql/base.py
View
@@ -74,6 +74,9 @@ def date_trunc_sql(self, lookup_type, field_name):
def drop_foreignkey_sql(self):
return "DROP FOREIGN KEY"
+ def fulltext_search_sql(self, field_name):
+ return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
+
class DatabaseWrapper(BaseDatabaseWrapper):
ops = DatabaseOperations()
@@ -164,9 +167,6 @@ def get_limit_offset_sql(limit, offset=None):
def get_random_function_sql():
return "RAND()"
-def get_fulltext_search_sql(field_name):
- return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
-
def get_pk_default_value():
return "DEFAULT"
6 django/db/backends/mysql_old/base.py
View
@@ -84,6 +84,9 @@ def date_trunc_sql(self, lookup_type, field_name):
def drop_foreignkey_sql(self):
return "DROP FOREIGN KEY"
+ def fulltext_search_sql(self, field_name):
+ return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
+
class DatabaseWrapper(BaseDatabaseWrapper):
ops = DatabaseOperations()
@@ -183,9 +186,6 @@ def get_limit_offset_sql(limit, offset=None):
def get_random_function_sql():
return "RAND()"
-def get_fulltext_search_sql(field_name):
- return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
-
def get_pk_default_value():
return "DEFAULT"
3  django/db/backends/oracle/base.py
View
@@ -186,9 +186,6 @@ def get_limit_offset_sql(limit, offset=None):
def get_random_function_sql():
return "DBMS_RANDOM.RANDOM"
-def get_fulltext_search_sql(field_name):
- raise NotImplementedError
-
def get_pk_default_value():
return "DEFAULT"
3  django/db/backends/postgresql/base.py
View
@@ -140,9 +140,6 @@ def get_limit_offset_sql(limit, offset=None):
def get_random_function_sql():
return "RANDOM()"
-def get_fulltext_search_sql(field_name):
- raise NotImplementedError
-
def get_pk_default_value():
return "DEFAULT"
3  django/db/backends/postgresql_psycopg2/base.py
View
@@ -94,9 +94,6 @@ def get_limit_offset_sql(limit, offset=None):
def get_random_function_sql():
return "RANDOM()"
-def get_fulltext_search_sql(field_name):
- raise NotImplementedError
-
def get_pk_default_value():
return "DEFAULT"
3  django/db/backends/sqlite3/base.py
View
@@ -127,9 +127,6 @@ def get_limit_offset_sql(limit, offset=None):
def get_random_function_sql():
return "RANDOM()"
-def get_fulltext_search_sql(field_name):
- raise NotImplementedError
-
def get_pk_default_value():
return "NULL"
2  django/db/models/query.py
View
@@ -810,7 +810,7 @@ def get_where_clause(lookup_type, table_prefix, field_name, value, db_type):
elif lookup_type == 'isnull':
return "%s IS %sNULL" % (field_sql, (not value and 'NOT ' or ''))
elif lookup_type == 'search':
- return backend.get_fulltext_search_sql(field_sql)
+ return connection.ops.fulltext_search_sql(field_sql)
elif lookup_type in ('regex', 'iregex'):
if settings.DATABASE_ENGINE == 'oracle':
if lookup_type == 'regex':
Please sign in to comment.
Something went wrong with that request. Please try again.