connectivity/source/drivers/postgresql/pq_statement.cxx | 43 ++++------------ connectivity/source/drivers/postgresql/pq_statement.hxx | 22 ++++---- 2 files changed, 25 insertions(+), 40 deletions(-)
New commits: commit 79b5bf5cab66efbec81f9eac4e023af4f5f5141f Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Thu Jan 15 12:45:45 2015 +0100 PostgreSQL statement: use :cppu::WeakComponentImplHelper Change-Id: I081d375b0249a3b0e47c1dd6db3f86fef272e7fd Reviewed-on: https://gerrit.libreoffice.org/13925 Tested-by: Michael Stahl <mst...@redhat.com> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx index 9b5fbe5..2bbec00 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.cxx +++ b/connectivity/source/drivers/postgresql/pq_statement.cxx @@ -49,6 +49,8 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> +#include <comphelper/sequence.hxx> + #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> @@ -157,8 +159,8 @@ static ::cppu::IPropertyArrayHelper & getStatementPropertyArrayHelper() Statement::Statement( const ::rtl::Reference< RefCountedMutex > & refMutex, const Reference< XConnection > & conn, struct ConnectionSettings *pSettings ) - : OComponentHelper( refMutex->mutex ) - , OPropertySetHelper( OComponentHelper::rBHelper ) + : Statement_BASE( refMutex->mutex ) + , OPropertySetHelper( Statement_BASE::rBHelper ) , m_connection( conn ) , m_pSettings( pSettings ) , m_refMutex( refMutex ) @@ -187,48 +189,29 @@ void Statement::checkClosed() throw (SQLException, RuntimeException ) *this, OUString(),1,Any()); } -Any Statement::queryInterface( const Type & reqType ) throw (RuntimeException, std::exception) +Any Statement::queryInterface( const Type & rType ) throw (RuntimeException, std::exception) { - Any ret; - - ret = OComponentHelper::queryInterface( reqType ); - if( ! ret.hasValue() ) - ret = ::cppu::queryInterface( reqType, - static_cast< XWarningsSupplier * > ( this ), - static_cast< XStatement * > ( this ), - static_cast< com::sun::star::sdbc::XResultSetMetaDataSupplier * > ( this ), - static_cast< XCloseable * > ( this ), - static_cast< XPropertySet * > ( this ), - static_cast< XMultipleResults * > ( this ), - static_cast< XMultiPropertySet * > ( this ), - static_cast< XGeneratedResultSet * > ( this ), - static_cast< XFastPropertySet * > ( this ) ); - return ret; + Any aRet = Statement_BASE::queryInterface(rType); + return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType); } Sequence< Type > Statement::getTypes() throw ( RuntimeException, std::exception ) { - static cppu::OTypeCollection *pCollection; + static Sequence< Type > *pCollection; if( ! pCollection ) { MutexGuard guard( osl::Mutex::getGlobalMutex() ); if( !pCollection ) { - static cppu::OTypeCollection collection( - cppu::UnoType<XWarningsSupplier>::get(), - cppu::UnoType<XStatement>::get(), - cppu::UnoType<com::sun::star::sdbc::XResultSetMetaDataSupplier>::get(), - cppu::UnoType<XCloseable>::get(), - cppu::UnoType<XPropertySet>::get(), - cppu::UnoType<XFastPropertySet>::get(), - cppu::UnoType<XMultiPropertySet>::get(), - cppu::UnoType<XGeneratedResultSet>::get(), - OComponentHelper::getTypes()); + static Sequence< Type > collection( + ::comphelper::concatSequences( + OPropertySetHelper::getTypes(), + Statement_BASE::getTypes())); pCollection = &collection; } } - return pCollection->getTypes(); + return *pCollection; } Sequence< sal_Int8> Statement::getImplementationId() throw ( RuntimeException, std::exception ) diff --git a/connectivity/source/drivers/postgresql/pq_statement.hxx b/connectivity/source/drivers/postgresql/pq_statement.hxx index f2e20c3..ac189de 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.hxx +++ b/connectivity/source/drivers/postgresql/pq_statement.hxx @@ -61,14 +61,16 @@ static const sal_Int32 STATEMENT_RESULT_SET_TYPE = 8; #define STATEMENT_SIZE 9 -class Statement : public cppu::OComponentHelper, - public cppu::OPropertySetHelper, - public com::sun::star::sdbc::XStatement, - public com::sun::star::sdbc::XCloseable, - public com::sun::star::sdbc::XWarningsSupplier, - public com::sun::star::sdbc::XMultipleResults, - public com::sun::star::sdbc::XGeneratedResultSet, - public com::sun::star::sdbc::XResultSetMetaDataSupplier +typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::sdbc::XStatement, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XMultipleResults, + ::com::sun::star::sdbc::XGeneratedResultSet, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier + > Statement_BASE; + +class Statement : public Statement_BASE, + public cppu::OPropertySetHelper { private: com::sun::star::uno::Any m_props[STATEMENT_SIZE]; @@ -93,8 +95,8 @@ public: virtual ~Statement(); public: // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { Statement_BASE::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { Statement_BASE::release(); } virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits