summaryrefslogtreecommitdiff
path: root/extensions/source/bibliography/datman.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/source/bibliography/datman.cxx')
-rw-r--r--extensions/source/bibliography/datman.cxx54
1 files changed, 24 insertions, 30 deletions
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index a15a3e889c18..407645c1df89 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -948,48 +948,42 @@ void BibDataManager::setActiveDataTable(const OUString& rTable)
Reference< XConnection > xConnection = getConnection( m_xForm );
Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
Reference< XNameAccess > xAccess = xSupplyTables->getTables();
- Sequence< OUString > aTableNameSeq = xAccess->getElementNames();
- sal_uInt32 nCount = aTableNameSeq.getLength();
- const OUString* pTableNames = aTableNameSeq.getConstArray();
- const OUString* pTableNamesEnd = pTableNames + nCount;
-
- for ( ; pTableNames != pTableNamesEnd; ++pTableNames )
+ for (auto& rTableName: xAccess->getElementNames())
{
- if ( rTable == *pTableNames )
+ if (rTable == rTableName)
{
aActiveDataTable = rTable;
Any aVal; aVal <<= rTable;
aPropertySet->setPropertyValue( "Command", aVal );
- break;
- }
- }
- if (pTableNames != pTableNamesEnd)
- {
- Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
- aQuoteChar = xMetaData->getIdentifierQuoteString();
- Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY);
- if ( xFactory.is() )
- m_xParser.set( xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY );
+ Reference<XDatabaseMetaData> xMetaData = xConnection->getMetaData();
+ aQuoteChar = xMetaData->getIdentifierQuoteString();
- OUString aString("SELECT * FROM ");
+ Reference<XMultiServiceFactory> xFactory(xConnection, UNO_QUERY);
+ if (xFactory.is())
+ m_xParser.set( xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY );
- OUString sCatalog, sSchema, sName;
- ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation );
- aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName );
+ OUString aString("SELECT * FROM ");
- m_xParser->setElementaryQuery(aString);
+ OUString sCatalog, sSchema, sName;
+ ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation );
+ aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName );
- BibConfig* pConfig = BibModul::GetConfig();
- pConfig->setQueryField(getQueryField());
- startQueryWith(pConfig->getQueryText());
+ m_xParser->setElementaryQuery(aString);
+
+ BibConfig* pConfig = BibModul::GetConfig();
+ pConfig->setQueryField(getQueryField());
+ startQueryWith(pConfig->getQueryText());
+
+ BibDBDescriptor aDesc;
+ aDesc.sDataSource = aDataSourceURL;
+ aDesc.sTableOrQuery = aActiveDataTable;
+ aDesc.nCommandType = CommandType::TABLE;
+ BibModul::GetConfig()->SetBibliographyURL(aDesc);
- BibDBDescriptor aDesc;
- aDesc.sDataSource = aDataSourceURL;
- aDesc.sTableOrQuery = aActiveDataTable;
- aDesc.nCommandType = CommandType::TABLE;
- BibModul::GetConfig()->SetBibliographyURL(aDesc);
+ break;
+ }
}
}
}