sw/qa/extras/uiwriter/uiwriter.cxx | 7 ++++++- sw/source/uibase/dbui/dbmgr.cxx | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-)
New commits: commit e3adde7b2dfa85c011640ea9689fa9258d0d61cc Author: Aron Budea <aron.bu...@collabora.com> Date: Mon Jan 22 03:00:28 2018 +0100 tdf115103: find data source if sDataSource/sCommand are empty In several functions data source was only found if sDataSource and sCommand corresponded to what was set in fields. In imported DOC(X) files these aren't set. Now use the data source even if field's sDataSource/sCommand are empty (similarly to SwDBManager::IsDataSourceOpen(...)). Reviewed-on: https://gerrit.libreoffice.org/48285 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Aron Budea <aron.bu...@collabora.com> (cherry picked from commit 6feeb77552c38e3d9819611e9678470a44c00c84) Change-Id: I9563cb56e700e7fd033100cb200f41f074669020 Reviewed-on: https://gerrit.libreoffice.org/48614 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> (cherry picked from commit b4cef1fb91c7b5024c4e370b0c57a1d4c463a476) diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 2c116217ba5d..a60ea06861eb 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1711,7 +1711,8 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName, uno::Reference< sdbcx::XColumnsSupplier> xColsSupp; bool bDisposeConnection = false; if(pImpl->pMergeData && - pImpl->pMergeData->sDataSource.equals(rDBName) && pImpl->pMergeData->sCommand.equals(rTableName)) + ((pImpl->pMergeData->sDataSource == rDBName && pImpl->pMergeData->sCommand == rTableName) || + (rDBName.isEmpty() && rTableName.isEmpty()))) { xConnection = pImpl->pMergeData->xConnection; xSource = SwDBManager::getDataSourceAsParent(xConnection,rDBName); @@ -2419,11 +2420,15 @@ sal_uInt32 SwDBManager::GetSelectedRecordId( { sal_uInt32 nRet = 0xffffffff; //check for merge data source first - if(pImpl->pMergeData && rDataSource == pImpl->pMergeData->sDataSource && - rTableOrQuery == pImpl->pMergeData->sCommand && - (nCommandType == -1 || nCommandType == pImpl->pMergeData->nCommandType) && - pImpl->pMergeData->xResultSet.is()) + if(pImpl->pMergeData && + ((rDataSource == pImpl->pMergeData->sDataSource && + rTableOrQuery == pImpl->pMergeData->sCommand) || + (rDataSource.isEmpty() && rTableOrQuery.isEmpty())) && + (nCommandType == -1 || nCommandType == pImpl->pMergeData->nCommandType) && + pImpl->pMergeData->xResultSet.is()) + { nRet = GetSelectedRecordId(); + } else { SwDBData aData; @@ -2479,8 +2484,10 @@ void SwDBManager::CloseAll(bool bIncludingMerge) SwDSParam* SwDBManager::FindDSData(const SwDBData& rData, bool bCreate) { //prefer merge data if available - if(pImpl->pMergeData && rData.sDataSource == pImpl->pMergeData->sDataSource && - rData.sCommand == pImpl->pMergeData->sCommand && + if(pImpl->pMergeData && + ((rData.sDataSource == pImpl->pMergeData->sDataSource && + rData.sCommand == pImpl->pMergeData->sCommand) || + (rData.sDataSource.isEmpty() && rData.sCommand.isEmpty())) && (rData.nCommandType == -1 || rData.nCommandType == pImpl->pMergeData->nCommandType || (bCreate && pImpl->pMergeData->nCommandType == -1))) { commit 2c9ff74995a58fae60ac7fe830db8bf07fb0b16b Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Fri Jan 19 10:14:07 2018 +0100 Don't create database files in $HOME Regression from commit 46b3202bf883618f1585850191c19776861013ed Change-Id: If8e0b309274ea14e996e0dde2d1ee9b49ff0f737 Reviewed-on: https://gerrit.libreoffice.org/48173 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/48477 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> (cherry picked from commit 61651849676ef1377f2e51675379bb4b7444557b) diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 5c96aacf7a1e..95206bf7944d 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -4649,13 +4649,16 @@ void SwUiWriterTest::testTdf115013() { const OUString sColumnName("Name with spaces, \"quotes\" and \\backslashes"); + utl::TempFile aTempDir(nullptr, true); + const OUString aWorkDir = aTempDir.GetURL(); + //create new writer document SwDoc* pDoc = createDoc(); { // Load and register data source const OUString aDataSourceURI(m_directories.getURLFromSrc(DATA_DIRECTORY) + "datasource.ods"); - OUString sDataSource = SwDBManager::LoadAndRegisterDataSource(aDataSourceURI, nullptr, nullptr, nullptr); + OUString sDataSource = SwDBManager::LoadAndRegisterDataSource(aDataSourceURI, nullptr, &aWorkDir); CPPUNIT_ASSERT(!sDataSource.isEmpty()); // Insert a new field type for the mailmerge field @@ -4689,6 +4692,8 @@ void SwUiWriterTest::testTdf115013() OUString sColumn = static_cast<SwDBFieldType*>(pField->GetTyp())->GetColumnName(); // The column name must come correct after round trip CPPUNIT_ASSERT_EQUAL(sColumnName, sColumn); + + utl::removeTree(aWorkDir); } CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits