FEAT: Adding cursor.skip(n) #181
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work Item / Issue Reference
Summary
This pull request introduces a new convenience method,
skip
, to theCursor
class inmssql_python/cursor.py
, which allows users to advance the cursor position by a specified number of rows without fetching them. Comprehensive tests have been added to validate the method's behavior, including edge cases and integration with existing fetch methods.New feature: Cursor skipping
skip(count: int)
method to theCursor
class, enabling users to efficiently advance the cursor by a given number of rows without returning those rows. The method checks for closed cursors, validates arguments, supports no-op for zero, and raises appropriate errors for invalid usage.Testing and validation
test_cursor_skip_basic_functionality
to verify thatskip
advances the cursor as expected and integrates correctly withfetchone
.test_cursor_skip_zero_is_noop
), empty result sets (test_cursor_skip_empty_result_set
), skipping past the end (test_cursor_skip_past_end
), invalid arguments (test_cursor_skip_invalid_arguments
), and closed cursors (test_cursor_skip_closed_cursor
).skip
works correctly withfetchone
,fetchmany
, andfetchall
methods (test_cursor_skip_integration_with_fetch_methods
).