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 @@
#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 )
......
......@@ -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;
......
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