[CONPY-38] cursor.scroll() issues Created: 2020-01-24  Updated: 2021-03-10  Resolved: 2021-03-10

Status: Closed
Project: MariaDB Connector/Python
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 0.9.53

Type: Bug Priority: Major
Reporter: Wayne Davison (Inactive) Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

The absolute scroll() positioning seems to be off by one – if I use cursor.scroll(1, 'absolute') and grab the row using cursor.fetchone(), it give me the second row, not the first. Trying to use cursor.scroll(0) rejects the value as invalid, so it looks like the absolute values are supposed to be 1-relative. UPDATE: I looked at the git logs, and it looks like scroll(0) was made to work, so I guess the issue is that pip3 doesn't install a new enough version and I'm complaining about old code.

The source/cursor.rst file says that scroll() defaults to absolute, but it really defaults to relative (as the PyDOC states).

It looks like I must use a "buffered=True" clause on the execute() for scroll to work. I tried setting buffered=True on the cursor creation prior to the execute(), but it failed with:

mariadb.ProgrammingError: This method is available only for cursors with buffered result set or a read only cursor type

I also tried setting the cursor to read-only. e.g. various combos of these options:

cursor = conn.cursor(buffered=True, cursor_type=mariadb.CURSOR_TYPE_READ_ONLY)

... but I could only get it to work with cursor.execute("SELECT ...", buffered=True).



 Comments   
Comment by Georg Richter [ 2020-01-25 ]

I recently fixed the buffered issue, it should work if you build with sources from github, so I reclassified this report as documentation bug (relative is default, not absolute).

Comment by Georg Richter [ 2021-03-10 ]

Issue was already closed in 0.9.53

Generated at Thu Feb 08 03:29:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.