Prevented SQLCompiler.execute_sql() from closing cursor twice.
cursor_iter() helper calls cursor.close() in a finally block.
This commit is contained in:
parent
f51a792c41
commit
304f6ff46a
|
@ -1223,15 +1223,11 @@ class SQLCompiler:
|
||||||
chunk_size,
|
chunk_size,
|
||||||
)
|
)
|
||||||
if not chunked_fetch or not self.connection.features.can_use_chunked_reads:
|
if not chunked_fetch or not self.connection.features.can_use_chunked_reads:
|
||||||
try:
|
# If we are using non-chunked reads, we return the same data
|
||||||
# If we are using non-chunked reads, we return the same data
|
# structure as normally, but ensure it is all read into memory
|
||||||
# structure as normally, but ensure it is all read into memory
|
# before going any further. Use chunked_fetch if requested,
|
||||||
# before going any further. Use chunked_fetch if requested,
|
# unless the database doesn't support it.
|
||||||
# unless the database doesn't support it.
|
return list(result)
|
||||||
return list(result)
|
|
||||||
finally:
|
|
||||||
# done with the cursor
|
|
||||||
cursor.close()
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def as_subquery_condition(self, alias, columns, compiler):
|
def as_subquery_condition(self, alias, columns, compiler):
|
||||||
|
|
Loading…
Reference in New Issue