Skip to content

Fetching of rows containing empty data still fail #237

@jussihi

Description

@jussihi

Describe the bug

Even after #205 was fixed, it still seems to be problematic to fetch empty data in a row.

Exception message: `RuntimeError: Buffer length for fetch (30) is smaller, & data to be retrieved is longer (31). ColumnID - 11, datatype - 12`
Stack trace:

Traceback (most recent call last):
  File "/home/jussi/GIT/**/**.py", line 131, in <module>
    MSSQL.fetch_manyrows()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/jussi/GIT/**/classMSSQL.py", line 121, in fetch_manyrows
    rows = cursor.fetchall()
  File "/home/jussi/GIT/**/.venv/lib/python3.13/site-packages/mssql_python/cursor.py", line 1033, in fetchall
    raise e
  File "/home/jussi/GIT/**/.venv/lib/python3.13/site-packages/mssql_python/cursor.py", line 1017, in fetchall
    ret = ddbc_bindings.DDBCSQLFetchAll(self.hstmt, rows_data)
RuntimeError: Buffer length for fetch (30) is smaller, & data to be retrieved is longer (31). ColumnID - 11, datatype - 12

To reproduce

Fetch many rows that contain at least one column containing an emptry string/empty data

cursor = conn.cursor()
cursor.execute(query)
rows = cursor.fetchall()

Expected behavior

Return the fetched row successfully

Further technical details

Python version: 3.13.7, mssql-python 0.10.0
SQL Server version: SQL Server 2022
Operating system: WSL

Additional context

I also stumbled to this error message when I tried to patch the C++ bindings myself for bug described in #205 .

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriage neededFor new issues, not triaged yet.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions