summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-07-10 13:26:10 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2019-07-10 14:46:34 +0200
commitfb52df57abe51a5923a49fb0818f4b58565dfc25 (patch)
tree1d7db2eceda8cc28308001b7f0a841352c131791 /connectivity
parenta53f65b4a8240a6277f6eb00daf01b81e2514da8 (diff)
tdf#123591: Firebird: take decimal places into account...
when copying values from Calc to Base Change-Id: I5dc645e3e9b153f71f2027a205815aaf83c1d6d3 Reviewed-on: https://gerrit.libreoffice.org/75346 Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Tested-by: Jenkins
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index cf44aa4d238d..737875e96b5a 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -422,6 +422,13 @@ void SAL_CALL OPreparedStatement::setDouble(sal_Int32 nIndex, double nValue)
XSQLVAR* pVar = m_pInSqlda->sqlvar + (nIndex - 1);
int dType = (pVar->sqltype & ~1); // drop flag bit for now
+ // take decimal places into account, later on they are removed in makeNumericString
+ // minus because firebird stores scale as a negative number
+ int nDecimalCount = -pVar->sqlscale;
+ sal_Int64 nDecimalCountExp = pow10Integer(nDecimalCount);
+
+ nValue = static_cast<double>(nValue * nDecimalCountExp);
+
// Caller might try to set an integer type here. It makes sense to convert
// it instead of throwing an error.
switch(dType)