diff options
author | Andy Shaw <andy.shaw@qt.io> | 2019-01-31 11:50:15 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2021-01-14 07:02:43 +0000 |
commit | c2657f9762e01abd65ac991ba31e3ca085d9540c (patch) | |
tree | f1d7842acd0aaaf2a70cbdc7e53182a10a7cd43b /src/plugins/sqldrivers/odbc | |
parent | 1bcfada9f04bd20a7a64d448fbf60c0f0820ed09 (diff) |
QODBC: Preserve the whole value when using HighPrecision
Some ODBC drivers do not properly handle SQL_NO_DATA and therefore
decimal values returned with HighPrecision are cut off because the
decimal point is not taken into account.
Fixes: QTBUG-73286
Pick-to: 6.0 5.15 5.12
Change-Id: I905c947b4d0266a3245d5735300300ca00f77480
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'src/plugins/sqldrivers/odbc')
-rw-r--r-- | src/plugins/sqldrivers/odbc/qsql_odbc.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index 026a970cf0..5a77c26b62 100644 --- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp @@ -1289,7 +1289,8 @@ QVariant QODBCResult::data(int field) d->fieldCache[i] = qGetDoubleData(d->hStmt, i); break; case QSql::HighPrecision: - d->fieldCache[i] = qGetStringData(d->hStmt, i, info.length(), false); + const int extra = info.precision() > 0 ? 1 : 0; + d->fieldCache[i] = qGetStringData(d->hStmt, i, info.length() + extra, false); break; } break; |