nanodbc icon indicating copy to clipboard operation
nanodbc copied to clipboard

"Fetch type out of range" error when calling result.prior(), result.first(), result.last() or result.at_end()

Open thibaudk opened this issue 3 years ago • 1 comments

Environment

  • nanodbc version: 2.13.0-3 installed from aur
  • DBMS name/version: Microsoft SQL Server 2019 (RTM-GDR) (KB5014356) - 15.0.2095.3 (X64) Apr 29 2022 18:00:13 Copyright (C) 2019 Microsoft Corporation Express Edition (64-bit) on Windows Server 2016 Standard 10.0 <X64> (Build 14393: ) (Hypervisor)
  • ODBC connection string: i simply initialize the the connection object with {"dbName", "userName", "pwd"}
  • OS and Compiler: Archlinux, clang version 14.0.6
  • CMake settings: only -Dnanodbc_DIR:PATH=/usr/lib/cmake/nanodbc is set

Actual behavior

calling result.prior(), result.first(), result.last() or result.at_end() throws the following error: nanodbc-2.13.0/nanodbc/nanodbc.cpp:2789: HY10: [Microsoft][ODBC Driver 18 for SQL Server]Fetch type out of range

I also noticed that result.position() always returns 0. Basically, only result.next() seem to affect the current result set.

Disclaimer

I may be simply missing something in the configuration of unixODBC, or it could be a limitation of connecting to mssql on a windows server form a Linux machine. My apologies if this is not an actual issue of nanodbc.

thibaudk avatar Jan 02 '23 11:01 thibaudk

Searching https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlfetchscroll-function for fetch type out of range yields: image

Looks like we're back to the square of configurable cursors https://github.com/nanodbc/nanodbc/issues/93#issuecomment-358245887

mloskot avatar Jan 02 '23 15:01 mloskot