csv_writer = self.write_sql()
nextset = True
- download_as = self.uf['download_as']
- stmt_no = 1
- while nextset is True:
- if download_as == MANY_FILES_VALUE:
+ if self.uf['download_as'] == MANY_FILES_VALUE:
+ stmt_no = 1
+ while nextset is True:
with zipfile.Path(
self.zip_fd,
at=self.zip_at_pathname(f'stmt{stmt_no}.txt')
).open(mode='w', newline='') as fd:
self.write_resultset(
cur, self.make_csv_writer(fd), null_rep)
+ nextset = cur.nextset()
stmt_no += 1
- else:
+ self.zip_fd.close()
+ else:
+ while nextset is True:
self.write_resultset(cur, csv_writer, null_rep)
+ nextset = cur.nextset()
- nextset = cur.nextset()
-
- if download_as == MANY_FILES_VALUE:
- self.zip_fd.close()
self.tfile.seek(0)
def make_sql_results(self, cur):