summaryrefslogtreecommitdiff
path: root/django/db/backends/__init__.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-11 07:06:50 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-11 07:06:50 +0000
commit5fb66670367501cab7c50bdf81e2600b840162ee (patch)
tree8693df185e2bea5a7f5678665b721364964db35d /django/db/backends/__init__.py
parent0543f33bbcc48e7dd8d977b77b0377c1928fcacb (diff)
Fixed #3460 -- Added an ability to enable true autocommit for psycopg2 backend.
Ensure to read the documentation before blindly enabling this: requires some code audits first, but might well be worth it for busy sites. Thanks to nicferrier, iamseb and Richard Davies for help with this patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/__init__.py')
-rw-r--r--django/db/backends/__init__.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 6ca7b87116..8a718dba9a 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -41,6 +41,21 @@ class BaseDatabaseWrapper(local):
if self.connection is not None:
return self.connection.rollback()
+ def _enter_transaction_management(self, managed):
+ """
+ A hook for backend-specific changes required when entering manual
+ transaction handling.
+ """
+ pass
+
+ def _leave_transaction_management(self, managed):
+ """
+ A hook for backend-specific changes required when leaving manual
+ transaction handling. Will usually be implemented only when
+ _enter_transaction_management() is also required.
+ """
+ pass
+
def _savepoint(self, sid):
if not self.features.uses_savepoints:
return
@@ -81,6 +96,8 @@ class BaseDatabaseFeatures(object):
update_can_self_select = True
interprets_empty_strings_as_nulls = False
can_use_chunked_reads = True
+ can_return_id_from_insert = False
+ uses_autocommit = False
uses_savepoints = False
# If True, don't use integer foreign keys referring to, e.g., positive
# integer primary keys.
@@ -230,6 +247,15 @@ class BaseDatabaseOperations(object):
"""
return 'DEFAULT'
+ def return_insert_id(self):
+ """
+ For backends that support returning the last insert ID as part of an
+ insert query, this method returns the SQL to append to the INSERT
+ query. The returned fragment should contain a format string to hold
+ hold the appropriate column.
+ """
+ pass
+
def query_class(self, DefaultQueryClass):
"""
Given the default Query class, returns a custom Query class