[Libreoffice-commits] core.git: connectivity/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 10 12:47:15 UTC 2019


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

New commits:
commit fb52df57abe51a5923a49fb0818f4b58565dfc25
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Jul 10 13:26:10 2019 +0200
Commit:     Xisco FaulĂ­ <xiscofauli at libreoffice.org>
CommitDate: Wed Jul 10 14:46:34 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 <lionel at mamane.lu>
    Tested-by: Jenkins

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)


More information about the Libreoffice-commits mailing list