mirror of
				https://github.com/django/django.git
				synced 2025-11-04 05:35:37 +00:00 
			
		
		
		
	Fixed #20897 -- Added make_cursor() for consistent cursor creation
In django.db.backends.BaseDatabaseWrapper, pulled the creation of cursors in the non-debug case into a separate method, in order to make behavior more consistent when overriding the cursor creation in derived classes.
This commit is contained in:
		
							parent
							
								
									4ef10f245a
								
							
						
					
					
						commit
						27aa85246a
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -158,7 +158,7 @@ class BaseDatabaseWrapper(object):
 | 
			
		|||
                (self.use_debug_cursor is None and settings.DEBUG)):
 | 
			
		||||
            cursor = self.make_debug_cursor(self._cursor())
 | 
			
		||||
        else:
 | 
			
		||||
            cursor = utils.CursorWrapper(self._cursor(), self)
 | 
			
		||||
            cursor = self.make_cursor(self._cursor())
 | 
			
		||||
        return cursor
 | 
			
		||||
 | 
			
		||||
    def commit(self):
 | 
			
		||||
| 
						 | 
				
			
			@ -433,6 +433,12 @@ class BaseDatabaseWrapper(object):
 | 
			
		|||
        """
 | 
			
		||||
        return utils.CursorDebugWrapper(cursor, self)
 | 
			
		||||
 | 
			
		||||
    def make_cursor(self, cursor):
 | 
			
		||||
        """
 | 
			
		||||
        Creates a cursor without debug logging.
 | 
			
		||||
        """
 | 
			
		||||
        return utils.CursorWrapper(cursor, self)
 | 
			
		||||
 | 
			
		||||
    @contextmanager
 | 
			
		||||
    def temporary_connection(self):
 | 
			
		||||
        """
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue