summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-08-23 19:42:55 +0100
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2013-08-26 18:52:14 +0100
commitb3b560e29514616382d687cb95d6fe7632c223b3 (patch)
tree30809159071b5e3dbe3de8bb72470c0753bb7402 /connectivity
parent197688f3fd54b6acffe7a6c3c55ce869714ec6f6 (diff)
Clean up PropertyHelper stuff, set ResultSet properties. (firebird-sdbc)
Change-Id: If2f2041b0f072f36fe56e92b9e54bbb0be8a5860
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/ResultSet.cxx141
-rw-r--r--connectivity/source/drivers/firebird/ResultSet.hxx48
2 files changed, 58 insertions, 131 deletions
diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx
index 237d56922d76..2afd1a408a7a 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -57,7 +57,7 @@ OResultSet::OResultSet(OConnection* pConnection,
isc_stmt_handle& aStatementHandle,
XSQLDA* pSqlda)
: OResultSet_BASE(pConnection->getMutex())
- , OPropertySetHelper(OResultSet_BASE::rBHelper)
+ , OPropertyContainer(OResultSet_BASE::rBHelper)
, m_pConnection(pConnection)
, m_xStatement(xStatement)
, m_xMetaData(0)
@@ -69,6 +69,31 @@ OResultSet::OResultSet(OConnection* pConnection,
, m_fieldCount(pSqlda? pSqlda->sqld : 0)
{
SAL_INFO("connectivity.firebird", "OResultSet().");
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE),
+ PROPERTY_ID_ISBOOKMARKABLE,
+ PropertyAttribute::READONLY,
+ &m_bIsBookmarkable,
+ ::getCppuType(&m_bIsBookmarkable));
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
+ PROPERTY_ID_FETCHSIZE,
+ PropertyAttribute::READONLY,
+ &m_nFetchSize,
+ ::getCppuType(&m_nFetchSize));
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ PROPERTY_ID_RESULTSETTYPE,
+ PropertyAttribute::READONLY,
+ &m_nResultSetType,
+ ::getCppuType(&m_nResultSetType));
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
+ PROPERTY_ID_FETCHDIRECTION,
+ PropertyAttribute::READONLY,
+ &m_nFetchDirection,
+ ::getCppuType(&m_nFetchDirection));
+ registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ PropertyAttribute::READONLY,
+ &m_nResultSetConcurrency,
+ ::getCppuType(&m_nResultSetConcurrency));
if (!pSqlda)
return; // TODO: what?
@@ -258,33 +283,16 @@ void SAL_CALL OResultSet::checkRowIndex()
throw SQLException( "Row index is out of valid range.", *this, OUString(),1, Any() );
}
}
-// -------------------------------------------------------------------------
-void OResultSet::disposing(void)
-{
-
- OPropertySetHelper::disposing();
-
- MutexGuard aGuard(m_pConnection->getMutex());
- m_xMetaData = NULL;
-}
-// -------------------------------------------------------------------------
Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
{
Any aRet = OPropertySetHelper::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OResultSet_BASE::queryInterface(rType);
- return aRet;
+ return aRet.hasValue() ? aRet : OResultSet_BASE::queryInterface(rType);
}
-// -------------------------------------------------------------------------
- Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw( RuntimeException)
-{
- OTypeCollection aTypes(
- ::cppu::UnoType< uno::Reference< ::com::sun::star::beans::XMultiPropertySet > >::get(),
- ::cppu::UnoType< uno::Reference< ::com::sun::star::beans::XFastPropertySet > >::get(),
- ::cppu::UnoType< uno::Reference< ::com::sun::star::beans::XPropertySet > >::get());
- return concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
+ Sequence< Type > SAL_CALL OResultSet::getTypes() throw( RuntimeException)
+{
+ return concatSequences(OPropertySetHelper::getTypes(), OResultSet_BASE::getTypes());
}
// ---- XColumnLocate ---------------------------------------------------------
sal_Int32 SAL_CALL OResultSet::findColumn(const OUString& columnName)
@@ -637,94 +645,19 @@ void SAL_CALL OResultSet::refreshRow() throw(SQLException, RuntimeException)
*this,
Any());
}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
-{
- Sequence< Property > aProps(6);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP1IMPL(CURSORNAME, OUString) PropertyAttribute::READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
- return new OPropertyArrayHelper(aProps);
+//----- OIdPropertyArrayUsageHelper ------------------------------------------
+IPropertyArrayHelper* OResultSet::createArrayHelper() const
+{
+ Sequence< Property > aProperties;
+ describeProperties(aProperties);
+ return new ::cppu::OPropertyArrayHelper(aProperties);
}
-// -------------------------------------------------------------------------
+
IPropertyArrayHelper & OResultSet::getInfoHelper()
{
return *const_cast<OResultSet*>(this)->getArrayHelper();
}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- (void) rConvertedValue;
- (void) rOldValue;
- (void) rValue;
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void OResultSet::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
-{
- (void) rValue;
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw Exception();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_FETCHSIZE:
- break;
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OResultSet::getFastPropertyValue(
- Any& rValue,
- sal_Int32 nHandle
- ) const
-{
- (void) rValue;
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- ;
- }
-}
// -----------------------------------------------------------------------------
void SAL_CALL OResultSet::acquire() throw()
{
diff --git a/connectivity/source/drivers/firebird/ResultSet.hxx b/connectivity/source/drivers/firebird/ResultSet.hxx
index 68c59a17b42e..e206ceb2a9a7 100644
--- a/connectivity/source/drivers/firebird/ResultSet.hxx
+++ b/connectivity/source/drivers/firebird/ResultSet.hxx
@@ -26,8 +26,13 @@
#include <connectivity/OSubComponent.hxx>
#include <cppuhelper/compbase8.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertycontainer.hxx>
#include <com/sun/star/util/XCancellable.hpp>
+#include <com/sun/star/sdbc/FetchDirection.hpp>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/XCloseable.hpp>
#include <com/sun/star/sdbc/XColumnLocate.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
@@ -57,10 +62,17 @@ namespace connectivity
* and ensure that the ResultSet is destroyed before disposing of the
* SQLDA.
*/
- class OResultSet : public OResultSet_BASE,
- public ::cppu::OPropertySetHelper,
- public OPropertyArrayUsageHelper<OResultSet>
+ class OResultSet: public OResultSet_BASE,
+ public ::comphelper::OPropertyContainer,
+ public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
{
+ private:
+ sal_Bool m_bIsBookmarkable = sal_False;
+ sal_Int32 m_nFetchSize = 1;
+ sal_Int32 m_nResultSetType = ::com::sun::star::sdbc::ResultSetType::FORWARD_ONLY;
+ sal_Int32 m_nFetchDirection = ::com::sun::star::sdbc::FetchDirection::FORWARD;
+ sal_Int32 m_nResultSetConcurrency = ::com::sun::star::sdbc::ResultSetConcurrency::READ_ONLY;
+
protected:
OConnection* m_pConnection;
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& m_xStatement;
@@ -84,27 +96,9 @@ namespace connectivity
template <typename T> T safelyRetrieveValue(sal_Int32 columnIndex)
throw(::com::sun::star::sdbc::SQLException);
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
-
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue
- )
- throw (::com::sun::star::uno::Exception);
- using cppu::OPropertySetHelper::getFastPropertyValue;
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle
- ) const;
+ // OIdPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
virtual void SAL_CALL checkColumnIndex( sal_Int32 index )
throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException );
@@ -126,10 +120,10 @@ namespace connectivity
return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this);
}
- // ::cppu::OComponentHelper
- virtual void SAL_CALL disposing(void);
// XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType)
+ throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL acquire() throw();
virtual void SAL_CALL release() throw();
//XTypeProvider