Kaydet (Commit) 79b5bf5c authored tarafından Lionel Elie Mamane's avatar Lionel Elie Mamane Kaydeden (comit) Michael Stahl

PostgreSQL statement: use :cppu::WeakComponentImplHelper

Change-Id: I081d375b0249a3b0e47c1dd6db3f86fef272e7fd
Reviewed-on: https://gerrit.libreoffice.org/13925Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 658be21d
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx> #include <cppuhelper/queryinterface.hxx>
#include <comphelper/sequence.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
...@@ -157,8 +159,8 @@ static ::cppu::IPropertyArrayHelper & getStatementPropertyArrayHelper() ...@@ -157,8 +159,8 @@ static ::cppu::IPropertyArrayHelper & getStatementPropertyArrayHelper()
Statement::Statement( const ::rtl::Reference< RefCountedMutex > & refMutex, Statement::Statement( const ::rtl::Reference< RefCountedMutex > & refMutex,
const Reference< XConnection > & conn, const Reference< XConnection > & conn,
struct ConnectionSettings *pSettings ) struct ConnectionSettings *pSettings )
: OComponentHelper( refMutex->mutex ) : Statement_BASE( refMutex->mutex )
, OPropertySetHelper( OComponentHelper::rBHelper ) , OPropertySetHelper( Statement_BASE::rBHelper )
, m_connection( conn ) , m_connection( conn )
, m_pSettings( pSettings ) , m_pSettings( pSettings )
, m_refMutex( refMutex ) , m_refMutex( refMutex )
...@@ -187,48 +189,29 @@ void Statement::checkClosed() throw (SQLException, RuntimeException ) ...@@ -187,48 +189,29 @@ void Statement::checkClosed() throw (SQLException, RuntimeException )
*this, OUString(),1,Any()); *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; Any aRet = Statement_BASE::queryInterface(rType);
return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType);
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;
} }
Sequence< Type > Statement::getTypes() throw ( RuntimeException, std::exception ) Sequence< Type > Statement::getTypes() throw ( RuntimeException, std::exception )
{ {
static cppu::OTypeCollection *pCollection; static Sequence< Type > *pCollection;
if( ! pCollection ) if( ! pCollection )
{ {
MutexGuard guard( osl::Mutex::getGlobalMutex() ); MutexGuard guard( osl::Mutex::getGlobalMutex() );
if( !pCollection ) if( !pCollection )
{ {
static cppu::OTypeCollection collection( static Sequence< Type > collection(
cppu::UnoType<XWarningsSupplier>::get(), ::comphelper::concatSequences(
cppu::UnoType<XStatement>::get(), OPropertySetHelper::getTypes(),
cppu::UnoType<com::sun::star::sdbc::XResultSetMetaDataSupplier>::get(), Statement_BASE::getTypes()));
cppu::UnoType<XCloseable>::get(),
cppu::UnoType<XPropertySet>::get(),
cppu::UnoType<XFastPropertySet>::get(),
cppu::UnoType<XMultiPropertySet>::get(),
cppu::UnoType<XGeneratedResultSet>::get(),
OComponentHelper::getTypes());
pCollection = &collection; pCollection = &collection;
} }
} }
return pCollection->getTypes(); return *pCollection;
} }
Sequence< sal_Int8> Statement::getImplementationId() throw ( RuntimeException, std::exception ) Sequence< sal_Int8> Statement::getImplementationId() throw ( RuntimeException, std::exception )
......
...@@ -61,14 +61,16 @@ static const sal_Int32 STATEMENT_RESULT_SET_TYPE = 8; ...@@ -61,14 +61,16 @@ static const sal_Int32 STATEMENT_RESULT_SET_TYPE = 8;
#define STATEMENT_SIZE 9 #define STATEMENT_SIZE 9
class Statement : public cppu::OComponentHelper, typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::sdbc::XStatement,
public cppu::OPropertySetHelper, ::com::sun::star::sdbc::XCloseable,
public com::sun::star::sdbc::XStatement, ::com::sun::star::sdbc::XWarningsSupplier,
public com::sun::star::sdbc::XCloseable, ::com::sun::star::sdbc::XMultipleResults,
public com::sun::star::sdbc::XWarningsSupplier, ::com::sun::star::sdbc::XGeneratedResultSet,
public com::sun::star::sdbc::XMultipleResults, ::com::sun::star::sdbc::XResultSetMetaDataSupplier
public com::sun::star::sdbc::XGeneratedResultSet, > Statement_BASE;
public com::sun::star::sdbc::XResultSetMetaDataSupplier
class Statement : public Statement_BASE,
public cppu::OPropertySetHelper
{ {
private: private:
com::sun::star::uno::Any m_props[STATEMENT_SIZE]; com::sun::star::uno::Any m_props[STATEMENT_SIZE];
...@@ -93,8 +95,8 @@ public: ...@@ -93,8 +95,8 @@ public:
virtual ~Statement(); virtual ~Statement();
public: // XInterface public: // XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); } virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { Statement_BASE::acquire(); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); } 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 ) 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; throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment