mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.7.x] Fixed #23909 -- Prevented crash when collecting SQL for RunSQL
Thanks James Rivett-Carnac for the report and Markus Holtermann
for the review.
Backport of e11c6fd21 from master.
			
			
This commit is contained in:
		| @@ -93,7 +93,11 @@ class BaseDatabaseSchemaEditor(object): | ||||
|         # Log the command we're running, then run it | ||||
|         logger.debug("%s; (params %r)" % (sql, params)) | ||||
|         if self.collect_sql: | ||||
|             self.collected_sql.append((sql % tuple(map(self.quote_value, params))) + ";") | ||||
|             ending = "" if sql.endswith(";") else ";" | ||||
|             if params is not None: | ||||
|                 self.collected_sql.append((sql % tuple(map(self.quote_value, params))) + ending) | ||||
|             else: | ||||
|                 self.collected_sql.append(sql + ending) | ||||
|         else: | ||||
|             with self.connection.cursor() as cursor: | ||||
|                 cursor.execute(sql, params) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user