/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 * only, as published by the Free Software Foundation. * * OpenOffice.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * * for a copy of the LGPLv3 License. * ************************************************************************/ #ifndef SC_RANGESEQ_HXX #define SC_RANGESEQ_HXX #include #include #include "scmatrix.hxx" class SvNumberFormatter; class ScDocument; class ScRange; class ScRangeToSequence { public: static BOOL FillLongArray( com::sun::star::uno::Any& rAny, ScDocument* pDoc, const ScRange& rRange ); static BOOL FillLongArray( com::sun::star::uno::Any& rAny, const ScMatrix* pMatrix ); static BOOL FillDoubleArray( com::sun::star::uno::Any& rAny, ScDocument* pDoc, const ScRange& rRange ); static BOOL FillDoubleArray( com::sun::star::uno::Any& rAny, const ScMatrix* pMatrix ); static BOOL FillStringArray( com::sun::star::uno::Any& rAny, ScDocument* pDoc, const ScRange& rRange ); static BOOL FillStringArray( com::sun::star::uno::Any& rAny, const ScMatrix* pMatrix, SvNumberFormatter* pFormatter ); static BOOL FillMixedArray( com::sun::star::uno::Any& rAny, ScDocument* pDoc, const ScRange& rRange, BOOL bAllowNV = FALSE ); /** @param bDataTypes Additionally to the differentiation between string and double allow differentiation between other types such as as boolean. Needed for implementation of XFormulaParser. If , boolean values are treated as ordinary double values 1 (true) and 0 (false). */ static BOOL FillMixedArray( com::sun::star::uno::Any& rAny, const ScMatrix* pMatrix, bool bDataTypes = false ); }; class ScApiTypeConversion { public: /** Convert an uno::Any to double if possible, including integer types. @param o_fVal Out: the double value on successful conversion. @param o_eClass Out: the uno::TypeClass of rAny. @returns if successfully converted. */ static bool ConvertAnyToDouble( double & o_fVal, com::sun::star::uno::TypeClass & o_eClass, const com::sun::star::uno::Any & rAny ); }; class ScSequenceToMatrix { public: /** Convert a sequence of mixed elements to ScMatrix. Precondition: rAny.getValueType().equals( getCppuType( (uno::Sequence< uno::Sequence< uno::Any > > *)0)) @returns a new'd ScMatrix as ScMatrixRef, NULL if rAny couldn't be read as type Sequence> */ static ScMatrixRef CreateMixedMatrix( const com::sun::star::uno::Any & rAny ); }; class ScByteSequenceToString { public: // rAny must contain Sequence, // may or may not contain 0-bytes at the end static BOOL GetString( String& rString, const com::sun::star::uno::Any& rAny, sal_uInt16 nEncoding ); }; #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ on> LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-07-28 01:16:00 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-07-28 01:14:42 +0200
commit233af54afb6e493c3538efe7c93d0f53f1b4c3ab (patch)
treef31908c2b29995e6ea7f0d51edb4877a2773ae54 /sw/source/core/inc/DocumentListsManager.hxx
parent5373679b695e5bd4f68fe4554234dd9facc3e54f (diff)
tdf#162219: pass correct DecimalDigits value to SQLBindParameter HEADmaster
... when setting DECIMAL / NUMERIC. Passing 'scale' from setObjectWithInfo to SQLBindParameter was wrong anyway: in setObjectWithInfo, the scale is needed if it converts the object 'x' to the requested format before sending to the database. In this case, it mismatched with the actual count of decimals in the string sent to ODBC: it could be "1" or "1.2"; but 'scale' is always equal to the scale of the parameter in the database (4 in the bugdoc), which resulted in the error returned by driver. Note that there is code that truncates excessive decimals - it is in OKeySet::impl_convertValue_throw, implemented for i#106772; it would be best to remove that code, and let the database do its magic: e.g., passing a string like "1.99999" to a DECIMAL(19,4) field in MS SQL Server would round it to 2, while our code truncates it to 1.9999. The ODBC driver can handle more digits itself. But that isn't in the scope here, and may need to tweak other database connectors. Change-Id: Ib50c6d78bfd0cbf5ecd59f46f300107076ec0037 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171127 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>