dbaccess/source/core/api/preparedstatement.cxx | 7 +++++++ 1 file changed, 7 insertions(+)
New commits: commit dc823f5fa4a5d2eca56297b9045e5962536c00f9 Author: Julien Nabet <serval2...@yahoo.fr> Date: Tue Apr 10 07:30:38 2018 +0200 tdf#116890: make unique column names in prepared statement ...like we do resultset. Thanks to Lionel for this solution Change-Id: I44f307cd6bddf76716d7c73b8783070abe43bdf3 Reviewed-on: https://gerrit.libreoffice.org/52662 Reviewed-by: Lionel Elie Mamane <lio...@mamane.lu> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/dbaccess/source/core/api/preparedstatement.cxx b/dbaccess/source/core/api/preparedstatement.cxx index 7080fe32b087..69e5138d689a 100644 --- a/dbaccess/source/core/api/preparedstatement.cxx +++ b/dbaccess/source/core/api/preparedstatement.cxx @@ -26,6 +26,7 @@ #include <comphelper/property.hxx> #include <comphelper/sequence.hxx> +#include <connectivity/dbtools.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/typeprovider.hxx> @@ -158,6 +159,12 @@ Reference< css::container::XNameAccess > OPreparedStatement::getColumns() // retrieve the name of the column OUString aName = xMetaData->getColumnName(i + 1); OResultColumn* pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta); + // don't silently assume that the name is unique - preparedStatement implementations + // are allowed to return duplicate names, but we are required to have + // unique column names + if ( m_pColumns->hasByName( aName ) ) + aName = ::dbtools::createUniqueName( m_pColumns.get(), aName ); + m_pColumns->append(aName, pColumn); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits