diff options
Diffstat (limited to 'dbaccess/source/core/api/query.cxx')
-rw-r--r-- | dbaccess/source/core/api/query.cxx | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index 84c7730308c8..82b7b0525992 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -188,9 +188,10 @@ void OQuery::rebuildColumns() m_pColumnMediator = NULL; Reference<XColumnsSupplier> xColSup(m_xCommandDefinition,UNO_QUERY); + Reference< XNameAccess > xColumnDefinitions; if ( xColSup.is() ) { - Reference< XNameAccess > xColumnDefinitions = xColSup->getColumns(); + xColumnDefinitions = xColSup->getColumns(); if ( xColumnDefinitions.is() ) m_pColumnMediator = new OContainerMediator( m_pColumns, xColumnDefinitions, m_xConnection, OContainerMediator::eColumns ); } @@ -233,19 +234,29 @@ void OQuery::rebuildColumns() } Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); - const ::rtl::OUString* pBegin = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); - for ( ;pBegin != pEnd; ++pBegin) + Sequence< ::rtl::OUString> aDefintionNames; + bool bApplyDefinitionNames = false; + //if ( xColumnDefinitions.is() ) + //{ + // aDefintionNames = xColumnDefinitions->getElementNames(); + // bApplyDefinitionNames = aDefintionNames.getLength() == aNames.getLength(); + //} + + ::rtl::OUString sEmpty; + const ::rtl::OUString* pIter = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aNames.getLength(); + for ( sal_Int32 i = 0;pIter != pEnd; ++pIter,++i) { - Reference<XPropertySet> xSource(xColumns->getByName( *pBegin ),UNO_QUERY); - OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection ); + Reference<XPropertySet> xSource(xColumns->getByName( *pIter ),UNO_QUERY); + OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection, bApplyDefinitionNames ? aDefintionNames[i] : sEmpty); Reference< XChild > xChild( *pColumn, UNO_QUERY_THROW ); xChild->setParent( *this ); - implAppendColumn( *pBegin, pColumn ); + ::rtl::OUString sNewName = bApplyDefinitionNames ? aDefintionNames[i] : *pIter; + implAppendColumn( sNewName, pColumn ); Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW ); if ( m_pColumnMediator.is() ) - m_pColumnMediator->notifyElementCreated( *pBegin, xDest ); + m_pColumnMediator->notifyElementCreated( sNewName, xDest ); } } catch( const SQLContext& e ) |