mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.6.x] Fixed #21235 -- Disabled savepoints for old versions of SQLite.
Thanks Ramiro for the report.
Backport of 91547772 from master.
			
			
This commit is contained in:
		| @@ -367,12 +367,16 @@ class DatabaseWrapper(BaseDatabaseWrapper): | ||||
|             BaseDatabaseWrapper.close(self) | ||||
|  | ||||
|     def _savepoint_allowed(self): | ||||
|         # Two conditions are required here: | ||||
|         # - A sufficiently recent version of SQLite to support savepoints, | ||||
|         # - Being in a transaction, which can only happen inside 'atomic'. | ||||
|  | ||||
|         # When 'isolation_level' is not None, sqlite3 commits before each | ||||
|         # savepoint; it's a bug. When it is None, savepoints don't make sense | ||||
|         # because autocommit is enabled. The only exception is inside atomic | ||||
|         # blocks. To work around that bug, on SQLite, atomic starts a | ||||
|         # because autocommit is enabled. The only exception is inside 'atomic' | ||||
|         # blocks. To work around that bug, on SQLite, 'atomic' starts a | ||||
|         # transaction explicitly rather than simply disable autocommit. | ||||
|         return self.in_atomic_block | ||||
|         return self.features.uses_savepoints and self.in_atomic_block | ||||
|  | ||||
|     def _set_autocommit(self, autocommit): | ||||
|         if autocommit: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user