summaryrefslogtreecommitdiff
path: root/dbaccess/source/core/api/CRowSetDataColumn.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/core/api/CRowSetDataColumn.cxx')
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.cxx38
1 files changed, 18 insertions, 20 deletions
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx
index f0de794fb17d..3f2901d6f973 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx
@@ -24,6 +24,7 @@
#include <comphelper/types.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <tools/debug.hxx>
using namespace dbaccess;
@@ -39,16 +40,16 @@ using namespace cppu;
using namespace osl;
-ORowSetDataColumn::ORowSetDataColumn( const Reference < XResultSetMetaData >& _xMetaData,
+ORowSetDataColumn::ORowSetDataColumn( const Reference < XResultSetMetaData >& _xMetaData,
const Reference < XRow >& _xRow,
const Reference < XRowUpdate >& _xRowUpdate,
sal_Int32 _nPos,
const Reference< XDatabaseMetaData >& _rxDBMeta,
const OUString& _rDescription,
const OUString& i_sLabel,
- const ORowSetCacheIterator& _rColumnValue)
+ const boost::function< const ORowSetValue& (sal_Int32)> &_getValue)
:ODataColumn(_xMetaData,_xRow,_xRowUpdate,_nPos,_rxDBMeta)
- ,m_aColumnValue(_rColumnValue)
+ ,m_pGetValue(_getValue)
,m_sLabel(i_sLabel)
,m_aDescription(_rDescription)
{
@@ -105,15 +106,12 @@ void SAL_CALL ORowSetDataColumn::getFastPropertyValue( Any& rValue, sal_Int32 nH
{
if ( PROPERTY_ID_VALUE == nHandle )
{
- if ( !m_aColumnValue.isNull() && m_aColumnValue->is() )
+ try
+ {
+ rValue = m_pGetValue(m_nPos).makeAny();
+ }
+ catch(const SQLException &e)
{
- ::osl::Mutex* pMutex = m_aColumnValue.getMutex();
- ::osl::MutexGuard aGuard( *pMutex );
-#if OSL_DEBUG_LEVEL > 0
- ORowSetRow aRow = *m_aColumnValue;
-#endif
- OSL_ENSURE((sal_Int32)aRow->get().size() > m_nPos,"Pos is greater than size of vector");
- rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
}
}
else if ( PROPERTY_ID_LABEL == nHandle && !m_sLabel.isEmpty() )
@@ -179,19 +177,19 @@ Sequence< sal_Int8 > ORowSetDataColumn::getImplementationId() throw (RuntimeExce
void ORowSetDataColumn::fireValueChange(const ORowSetValue& _rOldValue)
{
- if ( !m_aColumnValue.isNull() && m_aColumnValue->is() && (((*m_aColumnValue)->get())[m_nPos] != _rOldValue) )
+ ORowSetValue value;
+ try
+ {
+ value = m_pGetValue(m_nPos);
+ }
+ catch(const SQLException &e)
{
- sal_Int32 nHandle = PROPERTY_ID_VALUE;
- m_aOldValue = _rOldValue.makeAny();
- Any aNew = ((*m_aColumnValue)->get())[m_nPos].makeAny();
-
- fire(&nHandle, &aNew, &m_aOldValue, 1, sal_False );
}
- else if ( !m_aColumnValue.isNull() && !_rOldValue.isNull() )
+ if ( value != _rOldValue)
{
- sal_Int32 nHandle = PROPERTY_ID_VALUE;
+ sal_Int32 nHandle(PROPERTY_ID_VALUE);
m_aOldValue = _rOldValue.makeAny();
- Any aNew;
+ Any aNew = value.makeAny();
fire(&nHandle, &aNew, &m_aOldValue, 1, sal_False );
}