Skip to content

Commit 6b7b59e

Browse files
committed
[DB-33036] resultset: fetch next might return no more results
If the last result was larger than the max message size the result set will not be marked complete when it's fetched, but the next fetch will return no more data. In that case we want to return None else the result set index will be too large and throw an error. After fetching more results check to see if we're done; if so return None.
1 parent 203901b commit 6b7b59e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pynuodb/result_set.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ def fetchone(self, session):
3232
"""
3333
:type session EncodedSession
3434
"""
35+
if self.results_idx == len(self.results) and not self.complete:
36+
session.fetch_result_set_next(self)
37+
3538
if self.results_idx == len(self.results):
36-
if not self.complete:
37-
session.fetch_result_set_next(self)
38-
else:
39-
return None
39+
return None
4040

4141
res = self.results[self.results_idx]
4242
self.results_idx += 1

0 commit comments

Comments
 (0)