MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / scroll

Method scroll

pymysql/cursors.py:493–516  ·  view source on GitHub ↗
(self, value, mode="relative")

Source from the content-addressed store, hash-verified

491 return rows
492
493 def scroll(self, value, mode="relative"):
494 self._check_executed()
495
496 if mode == "relative":
497 if value < 0:
498 raise err.NotSupportedError(
499 "Backwards scrolling not supported by this cursor"
500 )
501
502 for _ in range(value):
503 self.read_next()
504 self.rownumber += value
505 elif mode == "absolute":
506 if value < self.rownumber:
507 raise err.NotSupportedError(
508 "Backwards scrolling not supported by this cursor"
509 )
510
511 end = value - self.rownumber
512 for _ in range(end):
513 self.read_next()
514 self.rownumber = value
515 else:
516 raise err.ProgrammingError("unknown scroll mode %s" % mode)
517
518
519class SSDictCursor(DictCursorMixin, SSCursor):

Callers

nothing calls this directly

Calls 2

read_nextMethod · 0.95
_check_executedMethod · 0.80

Tested by

no test coverage detected