summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx39
1 files changed, 23 insertions, 16 deletions
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index e7a7af6870e9..c385c5fbbf37 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -789,29 +789,36 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( )
}
catch( const Exception& ) { }
- try
+ if ( !xResultSetMeta.is() && xPreparedStatement.is() )
{
- if ( !xResultSetMeta.is() )
+ try
{
- xStatement.reset( Reference< XStatement >( m_xConnection->createStatement(), UNO_QUERY_THROW ) );
- Reference< XPropertySet > xStatementProps( xStatement, UNO_QUERY_THROW );
- try { xStatementProps->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( false ) ); }
- catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION("dbaccess"); }
- xResMetaDataSup.set( xStatement->executeQuery( sSQL ), UNO_QUERY_THROW );
+ //@see issue http://qa.openoffice.org/issues/show_bug.cgi?id=110111
+ // access returns a different order of column names when executing select * from
+ // and asking the columns from the metadata.
+ Reference< XParameters > xParameters( xPreparedStatement, UNO_QUERY_THROW );
+ Reference< XIndexAccess > xPara = getParameters();
+ for(sal_Int32 i = 1;i <= xPara->getCount();++i)
+ xParameters->setNull(i,DataType::VARCHAR);
+ xResMetaDataSup.set(xPreparedStatement->executeQuery(), UNO_QUERY_THROW );
xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_QUERY_THROW );
}
+ catch( const Exception& ) { }
}
- catch( const Exception& )
+
+ if ( !xResultSetMeta.is() )
{
- //@see issue http://qa.openoffice.org/issues/show_bug.cgi?id=110111
- // access returns a different order of column names when executing select * from
- // and asking the columns from the metadata.
- Reference< XParameters > xParameters( xPreparedStatement, UNO_QUERY_THROW );
- Reference< XIndexAccess > xPara = getParameters();
- for(sal_Int32 i = 1;i <= xPara->getCount();++i)
- xParameters->setNull(i,DataType::VARCHAR);
- xResMetaDataSup.set(xPreparedStatement->executeQuery(), UNO_QUERY_THROW );
+ xStatement.reset( Reference< XStatement >( m_xConnection->createStatement(), UNO_QUERY_THROW ) );
+ Reference< XPropertySet > xStatementProps( xStatement, UNO_QUERY_THROW );
+ try { xStatementProps->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( false ) ); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION("dbaccess"); }
+ xResMetaDataSup.set( xStatement->executeQuery( sSQL ), UNO_QUERY_THROW );
xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_QUERY_THROW );
+
+ if (xResultSetMeta.is())
+ {
+ SAL_WARN("dbaccess", "OSingleSelectQueryComposer::getColumns failed to get xResultSetMeta from executed PreparedStatement, but got it from 'no escape processing' statement. SQL command:\n\t" << sSQL );
+ }
}
if ( aSelectColumns->get().empty() )