connectivity/source/drivers/firebird/PreparedStatement.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit b7c74a050bc0e1b5ac86dfe476d68a5029bada6e
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Jul 10 13:26:10 2019 +0200
Commit:     Xisco FaulĂ­ <xiscofa...@libreoffice.org>
CommitDate: Wed Jul 10 16:02:13 2019 +0200

    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 <lio...@mamane.lu>
    Tested-by: Jenkins
    (cherry picked from commit fb52df57abe51a5923a49fb0818f4b58565dfc25)
    Reviewed-on: https://gerrit.libreoffice.org/75350
    Reviewed-by: Xisco FaulĂ­ <xiscofa...@libreoffice.org>

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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to