connectivity/source/drivers/postgresql/pq_preparedstatement.cxx | 44 ++-------- connectivity/source/drivers/postgresql/pq_preparedstatement.hxx | 23 ++--- 2 files changed, 24 insertions(+), 43 deletions(-)
New commits: commit 59a89dc69fda12adeba14e7c47d247380716ce94 Author: kerem <hallacke...@gmail.com> Date: Tue Mar 22 11:56:20 2016 +0200 tdf#88462 convert manual XInterface implementations Change-Id: Ia77c4d95b6f9c6ac3488406c5fe7585ec6e876a1 Reviewed-on: https://gerrit.libreoffice.org/23424 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Lionel Elie Mamane <lio...@mamane.lu> Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx index a5f3cad..0bd05a5 100644 --- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx +++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx @@ -46,7 +46,7 @@ #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> @@ -169,8 +169,8 @@ PreparedStatement::PreparedStatement( const Reference< XConnection > & conn, struct ConnectionSettings *pSettings, const OString & stmt ) - : OComponentHelper(refMutex->mutex) - , OPropertySetHelper(OComponentHelper::rBHelper) + : PreparedStatement_BASE(refMutex->mutex) + , OPropertySetHelper(PreparedStatement_BASE::rBHelper) , m_connection(conn) , m_pSettings(pSettings) , m_stmt(stmt) @@ -240,49 +240,29 @@ void PreparedStatement::checkClosed() throw (SQLException, RuntimeException ) *this, OUString(),1,Any()); } -Any PreparedStatement::queryInterface( const Type & reqType ) throw (RuntimeException, std::exception) +Any PreparedStatement::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< XPreparedStatement * > ( this ), - static_cast< com::sun::star::sdbc::XResultSetMetaDataSupplier * > ( this ), - static_cast< XParameters * > ( this ), - static_cast< XCloseable * > ( this ), - static_cast< XGeneratedResultSet * > ( this ), - static_cast< XPropertySet * > ( this ), - static_cast< XMultiPropertySet * > ( this ), - static_cast< XFastPropertySet * > ( this ) ); - return ret; + Any aRet = PreparedStatement_BASE::queryInterface(rType); + return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType); } Sequence< Type > PreparedStatement::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<XPreparedStatement>::get(), - cppu::UnoType<com::sun::star::sdbc::XResultSetMetaDataSupplier>::get(), - cppu::UnoType<XParameters>::get(), - cppu::UnoType<XCloseable>::get(), - cppu::UnoType<XGeneratedResultSet>::get(), - cppu::UnoType<XPropertySet>::get(), - cppu::UnoType<XFastPropertySet>::get(), - cppu::UnoType<XMultiPropertySet>::get(), - OComponentHelper::getTypes()); + static Sequence< Type > collection( + ::comphelper::concatSequences( + OPropertySetHelper::getTypes(), + PreparedStatement_BASE::getTypes())); pCollection = &collection; } } - return pCollection->getTypes(); + return *pCollection; } Sequence< sal_Int8> PreparedStatement::getImplementationId() throw ( RuntimeException, std::exception ) diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx index 67a4a9e..11e449f 100644 --- a/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx +++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.hxx @@ -64,15 +64,16 @@ static const sal_Int32 PREPARED_STATEMENT_RESULT_SET_TYPE = 8; #define PREPARED_STATEMENT_SIZE 9 -class PreparedStatement : public cppu::OComponentHelper, - public cppu::OPropertySetHelper, - public com::sun::star::sdbc::XPreparedStatement, - public com::sun::star::sdbc::XParameters, - 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::WeakComponentImplHelper< ::com::sun::star::sdbc::XPreparedStatement, + ::com::sun::star::sdbc::XParameters, + ::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 + > PreparedStatement_BASE; +class PreparedStatement : public PreparedStatement_BASE, + public cppu::OPropertySetHelper { private: com::sun::star::uno::Any m_props[PREPARED_STATEMENT_SIZE]; @@ -102,8 +103,8 @@ public: virtual ~PreparedStatement(); public: // XInterface - virtual void SAL_CALL acquire() throw() override { OComponentHelper::acquire(); } - virtual void SAL_CALL release() throw() override { OComponentHelper::release(); } + virtual void SAL_CALL acquire() throw() override { PreparedStatement_BASE::acquire(); } + virtual void SAL_CALL release() throw() override { PreparedStatement_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) override; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits