summaryrefslogtreecommitdiffstats
path: root/connectivity
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-07-16 15:34:53 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-08-07 23:27:37 +0200
commitb9a0dc13a02e71dc680ad6b3d1d9f55ae27e3217 (patch)
tree7901d397b9f41d63b869e8e92707a6c140dcefba /connectivity
parenttdf#121599, tdf#123099: ignore migration dialog when (diff)
downloadcore-b9a0dc13a02e71dc680ad6b3d1d9f55ae27e3217.tar.gz
core-b9a0dc13a02e71dc680ad6b3d1d9f55ae27e3217.zip
tdf#123591: truncate and round to 'scale' number of decimal places
otherwise the number will be incorrectly converted to OUString if scale < number of decimals See https://bugs.documentfoundation.org/show_bug.cgi?id=123591#c25 Change-Id: Ie32c9c6ab339d6907e9a4e2645d6f19bad9e67c8 Reviewed-on: https://gerrit.libreoffice.org/75727 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 54028dc503fc08eb12e287919d5e2850cff05b73) Reviewed-on: https://gerrit.libreoffice.org/76751
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 69ce91f42da1..71a43454f315 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -18,6 +18,7 @@
*/
#include <sal/config.h>
+#include <cmath>
#include <string_view>
@@ -729,7 +730,8 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
OUString sValue;
if( x >>= dbValue )
{
- sValue = OUString::number( dbValue );
+ // truncate and round to 'scale' number of decimal places
+ sValue = OUString::number( std::floor((dbValue * pow10Integer(scale)) + .5) / pow10Integer(scale) );
}
else
{