summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2019-01-31 11:50:15 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-19 15:20:08 +0000
commit1932953334e3b37441e0a12804813cc529dcbc04 (patch)
tree118287293afae339621fbc09b3bec8b0761787bf /src
parent1051db0b018b1ef686b9d04cdd37e70f39399289 (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 Change-Id: I905c947b4d0266a3245d5735300300ca00f77480 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit c2657f9762e01abd65ac991ba31e3ca085d9540c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc.cpp3
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 dd6eaab9cf..eb34f6e4cb 100644
--- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
@@ -1283,7 +1283,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;