Skip to content

Commit 32fc629

Browse files
korydraughnalanking
authored andcommitted
[#213] Add dedicated close() method to Query class.
This commit exposes the functionality of _close() in a backwards-compatible way. close() should be used when executing multiple GenQuery2 queries and the resultsets are no longer needed. This allows policy writers to avoid memory exhaustion when using GenQuery2.
1 parent 5300ccf commit 32fc629

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

genquery.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,14 @@ def _close(self):
378378
self.gqo = None
379379
self.cti = None
380380

381+
def close(self):
382+
"""Close the query.
383+
384+
When GenQuery1 is used, prevents filling the statement table.
385+
When GenQuery2 is used, closes the resultset.
386+
"""
387+
self._close()
388+
381389
def first(self):
382390
"""Get exactly one result (or None if no results are available)."""
383391
result = None

0 commit comments

Comments
 (0)