You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Summary
This pull request refactors the `Cursor` class in
`mssql_python/cursor_mac.py` to improve data handling by introducing a
`Row` object for query results. The changes enhance type safety and make
the interface more consistent by replacing raw sequences (e.g., tuples)
with `Row` objects. Additionally, the implementation of `fetchone`,
`fetchmany`, and `fetchall` methods has been updated to reflect this new
design.
### Refactoring for Improved Data Handling:
* **Introduction of `Row` Object**: Added an import for the `Row` class
and updated the `fetchone`, `fetchmany`, and `fetchall` methods to
return `Row` objects instead of raw sequences like tuples. This change
improves type safety and encapsulates row data with metadata
(`mssql_python/cursor_mac.py`,
[[1]](diffhunk://#diff-4b626c1fe80240df798a2254710c9d104782e717f6c23e1268fc369906bf8c46R15)
[[2]](diffhunk://#diff-4b626c1fe80240df798a2254710c9d104782e717f6c23e1268fc369906bf8c46L36-R39)
[[3]](diffhunk://#diff-4b626c1fe80240df798a2254710c9d104782e717f6c23e1268fc369906bf8c46L654-R722).
### Method Updates:
* **`fetchone` Method**: Refactored to fetch raw data, check for no
data, and return a `Row` object constructed with the row data and
description.
* **`fetchmany` Method**: Updated to fetch a specified number of rows,
validate input size, and return a list of `Row` objects.
* **`fetchall` Method**: Modified to fetch all remaining rows and return
them as a list of `Row` objects.
### Issue Reference
Fixes
[AB#37748](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/37748)
### Checklist
- [x] **Tests Passed** (if applicable)
- [x] **Code is formatted**
- [x] **Docs Updated** (if necessary)
### Testing Performed
<!-- How was this fix tested? -->
- [x] Unit Tests
0 commit comments