Esempio n. 1
0
 def next(self):
     if not self.has_result_set:
         raise ProgrammingError("Trying to fetch results on an operation with no results.")
     if len(self._buffer) > 0:
         return self._buffer.pop(0)
     elif self._last_operation_active:
         # self._buffer is empty here and op is active: try to pull more rows
         rows = rpc.fetch_results(self.service,
                 self._last_operation_handle, self.hs2_protocol_version,
                 self.description, self.buffersize)
         self._buffer.extend(rows)
         if len(self._buffer) == 0:
             raise StopIteration
         return self._buffer.pop(0)
     else:
         # buffer is already empty
         raise StopIteration
Esempio n. 2
0
 def next(self):
     if not self.has_result_set:
         raise ProgrammingError(
             "Trying to fetch results on an operation with no results.")
     if len(self._buffer) > 0:
         return self._buffer.pop(0)
     elif self._last_operation_active:
         # self._buffer is empty here and op is active: try to pull more rows
         rows = rpc.fetch_results(self.service, self._last_operation_handle,
                                  self.description, self.buffersize)
         self._buffer.extend(rows)
         if len(self._buffer) == 0:
             raise StopIteration
         return self._buffer.pop(0)
     else:
         # buffer is already empty
         raise StopIteration