mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #21166 -- Reset errors_occurred flag after commit and rollback.
This commit is contained in:
		| @@ -166,6 +166,8 @@ class BaseDatabaseWrapper(object): | |||||||
|         self.validate_thread_sharing() |         self.validate_thread_sharing() | ||||||
|         self.validate_no_atomic_block() |         self.validate_no_atomic_block() | ||||||
|         self._commit() |         self._commit() | ||||||
|  |         # A successful commit means that the database connection works. | ||||||
|  |         self.errors_occurred = False | ||||||
|  |  | ||||||
|     def rollback(self): |     def rollback(self): | ||||||
|         """ |         """ | ||||||
| @@ -174,6 +176,8 @@ class BaseDatabaseWrapper(object): | |||||||
|         self.validate_thread_sharing() |         self.validate_thread_sharing() | ||||||
|         self.validate_no_atomic_block() |         self.validate_no_atomic_block() | ||||||
|         self._rollback() |         self._rollback() | ||||||
|  |         # A successful rollback means that the database connection works. | ||||||
|  |         self.errors_occurred = False | ||||||
|  |  | ||||||
|     def close(self): |     def close(self): | ||||||
|         """ |         """ | ||||||
| @@ -381,6 +385,8 @@ class BaseDatabaseWrapper(object): | |||||||
|                 self.close() |                 self.close() | ||||||
|                 return |                 return | ||||||
|  |  | ||||||
|  |             # If an exception other than DataError or IntegrityError occurred | ||||||
|  |             # since the last commit / rollback, check if the connection works. | ||||||
|             if self.errors_occurred: |             if self.errors_occurred: | ||||||
|                 if self.is_usable(): |                 if self.is_usable(): | ||||||
|                     self.errors_occurred = False |                     self.errors_occurred = False | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user