Kaydet (Commit) 6feeb775 authored tarafından Aron Budea's avatar Aron Budea

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(...)).

Change-Id: I9563cb56e700e7fd033100cb200f41f074669020
Reviewed-on: https://gerrit.libreoffice.org/48285Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAron Budea <aron.budea@collabora.com>
üst 404a2ff6
......@@ -1696,7 +1696,8 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName,
uno::Reference< sdbcx::XColumnsSupplier> xColsSupp;
bool bDisposeConnection = false;
if(pImpl->pMergeData &&
pImpl->pMergeData->sDataSource == rDBName && pImpl->pMergeData->sCommand == rTableName)
((pImpl->pMergeData->sDataSource == rDBName && pImpl->pMergeData->sCommand == rTableName) ||
(rDBName.isEmpty() && rTableName.isEmpty())))
{
xConnection = pImpl->pMergeData->xConnection;
xSource = SwDBManager::getDataSourceAsParent(xConnection,rDBName);
......@@ -2400,11 +2401,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;
......@@ -2460,8 +2465,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)))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment