diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-10-01 22:29:22 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-10-01 22:29:22 -0400 |
commit | d530c10e58ecf9d1efb6ac5242f706653f6caa5f (patch) | |
tree | 762a67cbe3c7cd146783ab8d1d979190ed33135b /dbaccess/source | |
parent | Remove unnecessary comments containing //CHINA001 (diff) | |
download | core-d530c10e58ecf9d1efb6ac5242f706653f6caa5f.tar.gz core-d530c10e58ecf9d1efb6ac5242f706653f6caa5f.zip |
Ported calc-perf-import-dbf-dbaccess.diff from ooo-build.
Add mechanism to optionally turn off property change notification,
which is quite expensive.
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 17 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSet.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetBase.cxx | 9 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetBase.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/inc/stringconstants.hrc | 2 | ||||
-rw-r--r-- | dbaccess/source/inc/stringconstants.inc | 1 |
6 files changed, 34 insertions, 0 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 829155709119..151ef19039fc 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -40,6 +40,7 @@ #include "core_resource.hrc" #include "core_resource.hxx" #include "tablecontainer.hxx" +#include "dbastrings.hrc" /** === begin UNO includes === **/ #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -170,6 +171,7 @@ ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory ,m_bNew(sal_False) ,m_bCanUpdateInsertedRows(sal_True) ,m_bOwnConnection(sal_False) + ,m_bPropChangeNotifyEnabled(sal_True) { m_nResultSetType = ResultSetType::SCROLL_SENSITIVE; m_nResultSetConcurrency = ResultSetConcurrency::UPDATABLE; @@ -222,6 +224,9 @@ ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND, &m_aUpdateCatalogName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND, &m_aUpdateSchemaName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND, &m_aUpdateTableName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + + // ??? + registerProperty(PROPERTY_CHANGE_NOTIFICATION_ENABLED, PROPERTY_ID_PROPCHANGE_NOTIFY, PropertyAttribute::BOUND, &m_bPropChangeNotifyEnabled, ::getBooleanCppuType()); } ORowSet::~ORowSet() @@ -373,6 +378,9 @@ void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const case PROPERTY_ID_TYPEMAP: ::cppu::extractInterface(m_xTypeMap,m_aTypeMap); break; + case PROPERTY_ID_PROPCHANGE_NOTIFY: + m_bPropChangeNotifyEnabled = ::cppu::any2bool(rValue); + break; default: break; }; @@ -413,6 +421,9 @@ void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const case PROPERTY_ID_TYPEMAP: rValue <<= m_xTypeMap; break; + case PROPERTY_ID_PROPCHANGE_NOTIFY: + rValue <<= m_bPropChangeNotifyEnabled; + break; default: ORowSetBase::getFastPropertyValue(rValue,nHandle); } @@ -2733,6 +2744,12 @@ sal_Bool ORowSet::isNew( ) } // ----------------------------------------------------------------------------- +sal_Bool ORowSet::isPropertyChangeNotificationEnabled() const +{ + return m_bPropChangeNotifyEnabled; +} + +// ----------------------------------------------------------------------------- void ORowSet::checkUpdateIterator() { if(!m_bModified && !m_bNew) diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx index 8a85237cb928..13f42de75b2c 100644 --- a/dbaccess/source/core/api/RowSet.hxx +++ b/dbaccess/source/core/api/RowSet.hxx @@ -145,6 +145,7 @@ namespace dbaccess sal_Bool m_bNew ; sal_Bool m_bCanUpdateInsertedRows; sal_Bool m_bOwnConnection; + sal_Bool m_bPropChangeNotifyEnabled; private: /** builds m_aActiveCommand from our settings @@ -248,6 +249,7 @@ namespace dbaccess virtual sal_Bool isModification( ); virtual sal_Bool isModified( ); virtual sal_Bool isNew( ); + virtual sal_Bool isPropertyChangeNotificationEnabled() const; virtual ~ORowSet(); diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 57157cf4f998..cd43437e1332 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -1272,6 +1272,9 @@ void SAL_CALL ORowSetBase::clearWarnings( ) throw(SQLException, RuntimeExceptio // ------------------------------------------------------------------------- void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow) { + if (!isPropertyChangeNotificationEnabled()) + return; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::firePropertyChange" ); DBG_TRACE2("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); OSL_ENSURE(m_pColumns,"Columns can not be NULL here!"); @@ -1326,6 +1329,12 @@ void ORowSetBase::notifyAllListeners(::osl::ResettableMutexGuard& /*_rGuard*/) } // ----------------------------------------------------------------------------- +sal_Bool ORowSetBase::isPropertyChangeNotificationEnabled() const +{ + return sal_True; +} + +// ----------------------------------------------------------------------------- void ORowSetBase::fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::fireProperty" ); diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx index 9a7e9182e1d0..dd61f997dd7d 100644 --- a/dbaccess/source/core/api/RowSetBase.hxx +++ b/dbaccess/source/core/api/RowSetBase.hxx @@ -190,6 +190,9 @@ namespace dbaccess virtual sal_Bool isModified( ) = 0; // return <TRUE/> if and only if the current row is the insert row virtual sal_Bool isNew( ) = 0; + // return <TRUE/> if the property change notification should be fired + // upon property change. + virtual sal_Bool isPropertyChangeNotificationEnabled() const; // notify the change of a boolean property void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld ); diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc index f295bb50378c..48fb8312839c 100644 --- a/dbaccess/source/inc/stringconstants.hrc +++ b/dbaccess/source/inc/stringconstants.hrc @@ -183,6 +183,7 @@ #define PROPERTY_ID_PERSISTENT_PATH 143 #define PROPERTY_ID_CURRENT_QUERY_DESIGN 144 #define PROPERTY_ID_SINGLESELECTQUERYCOMPOSER 145 +#define PROPERTY_ID_PROPCHANGE_NOTIFY 146 //============================================================ //= property names @@ -340,6 +341,7 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_HAVING_CLAUSE); DECLARE_CONSTASCII_USTRING(PROPERTY_GROUP_BY); DECLARE_CONSTASCII_USTRING(PROPERTY_EDIT_WIDTH); DECLARE_CONSTASCII_USTRING(PROPERTY_SINGLESELECTQUERYCOMPOSER); +DECLARE_CONSTASCII_USTRING(PROPERTY_CHANGE_NOTIFICATION_ENABLED); //============================================================ //= service names diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc index f2a39b06f110..5eef8a68d7bd 100644 --- a/dbaccess/source/inc/stringconstants.inc +++ b/dbaccess/source/inc/stringconstants.inc @@ -183,6 +183,7 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HAVING_CLAUSE, "HavingClause"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_GROUP_BY, "GroupBy"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EDIT_WIDTH, "EditWidth"); IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SINGLESELECTQUERYCOMPOSER,"SingleSelectQueryComposer"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHANGE_NOTIFICATION_ENABLED, "PropertyChangeNotificationEnabled"); //============================================================ //= service names |