diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-27 02:50:16 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-27 02:50:16 +0000 |
| commit | 9c52d56f6f8a9cdafb231adf9f4110473099c9b5 (patch) | |
| tree | eeded174bec983e4415f5f52f187b3d5d9a1882d /django/db/backends/__init__.py | |
| parent | c91a30f00fd182faf8ca5c03cd7dbcf8b735b458 (diff) | |
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/__init__.py')
| -rw-r--r-- | django/db/backends/__init__.py | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index be1776e65f..8917fc3b23 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -49,7 +49,8 @@ class BaseDatabaseFeatures(object): supports_constraints = True supports_tablespaces = False uses_case_insensitive_names = False - uses_custom_queryset = False + uses_custom_query_class = False + empty_fetchmany_value = [] class BaseDatabaseOperations(object): """ @@ -86,10 +87,9 @@ class BaseDatabaseOperations(object): Returns the SQL necessary to cast a datetime value so that it will be retrieved as a Python datetime object instead of a string. - This SQL should include a '%s' in place of the field's name. This - method should return None if no casting is necessary. + This SQL should include a '%s' in place of the field's name. """ - return None + return "%s" def deferrable_sql(self): """ @@ -169,6 +169,14 @@ class BaseDatabaseOperations(object): sql += " OFFSET %s" % offset return sql + def lookup_cast(self, lookup_type): + """ + Returns the string to use in a query when performing lookups + ("contains", "like", etc). The resulting string should contain a '%s' + placeholder for the column being searched against. + """ + return "%s" + def max_name_length(self): """ Returns the maximum length of table and column names, or None if there @@ -176,6 +184,14 @@ class BaseDatabaseOperations(object): """ return None + def no_limit_value(self): + """ + Returns the value to use for the LIMIT when we are wanting "LIMIT + infinity". Returns None if the limit clause can be omitted in this case. + """ + # FIXME: API may need to change once Oracle backend is repaired. + raise NotImplementedError() + def pk_default_value(self): """ Returns the value to use during an INSERT statement to specify that @@ -183,11 +199,11 @@ class BaseDatabaseOperations(object): """ return 'DEFAULT' - def query_set_class(self, DefaultQuerySet): + def query_class(self, DefaultQueryClass): """ Given the default QuerySet class, returns a custom QuerySet class to use for this backend. Returns None if a custom QuerySet isn't used. - See also BaseDatabaseFeatures.uses_custom_queryset, which regulates + See also BaseDatabaseFeatures.uses_custom_query_class, which regulates whether this method is called at all. """ return None @@ -205,6 +221,17 @@ class BaseDatabaseOperations(object): """ return 'RANDOM()' + def regex_lookup(self, lookup_type): + """ + Returns the string to use in a query when performing regular expression + lookups (using "regex" or "iregex"). The resulting string should + contain a '%s' placeholder for the column being searched against. + + If the feature is not supported (or part of it is not supported), a + NotImplementedError exception can be raised. + """ + raise NotImplementedError + def sql_flush(self, style, tables, sequences): """ Returns a list of SQL statements required to remove all data from |
