summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorkerem <hallackerem@gmail.com>2016-03-22 11:56:20 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-03-22 15:26:21 +0000
commit59a89dc69fda12adeba14e7c47d247380716ce94 (patch)
tree5775943260d830e99f1ac487066367a7f4ecf1f5 /connectivity
parentf47f49449cc69561906410a10dd574ab170aece9 (diff)
tdf#88462 convert manual XInterface implementations
Change-Id: Ia77c4d95b6f9c6ac3488406c5fe7585ec6e876a1 Reviewed-on: https://gerrit.libreoffice.org/23424 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx44
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.hxx23
2 files changed, 24 insertions, 43 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index a5f3cad4f791..0bd05a53f048 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 67a4a9ec9847..11e449f940c8 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;