I'm trying to retrive a float value from a SQL Server database into a double variable, I'm using this code:
bool CDataAccess::GetValue(UINT col, double& value)
{
int retCode = SQLGetData(m_hstmt, col, SQL_C_DOUBLE, &value, 0, &m_cbValue);
...
}
That code was working fine until last week when Windows update KB5019959 was installed; if I uninstall this update everything works fine again.
If I use SQL_C_FLOAT as parameter or change column type to double, it works, but that change will carry a hugh refactor...
There seems to be a possible change in behavior with how
BufferLengthis treated with doubles in the later versions of the driver when 0 is passed as the value. 0 used to work however no longer does for the default driver.The following will return the correct data from my testing:
NOTE:
sizeof(value)being passed as BufferLength vs0like beforeWe have encountered the same bug in QGIS which implementing the above fix has resolved the issue (https://github.com/qgis/QGIS/issues/50865)