[ooo-build-commit] .: dbaccess/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Oct 1 19:32:54 PDT 2010


 dbaccess/source/core/api/RowSet.cxx     |   17 +++++++++++++++++
 dbaccess/source/core/api/RowSet.hxx     |    2 ++
 dbaccess/source/core/api/RowSetBase.cxx |    9 +++++++++
 dbaccess/source/core/api/RowSetBase.hxx |    3 +++
 dbaccess/source/inc/stringconstants.hrc |    2 ++
 dbaccess/source/inc/stringconstants.inc |    1 +
 6 files changed, 34 insertions(+)

New commits:
commit e856f7d2e34683aeeb024d3f1d9f12cb318c0c4a
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Oct 1 22:29:22 2010 -0400

    Ported calc-perf-import-dbf-dbaccess.diff from ooo-build.
    
    Add mechanism to optionally turn off property change notification,
    which is quite expensive.

diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 1f7c029..7eda908 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 fdd0ecb..cb2e2ba 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 e19dd83..57c844f 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 at 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 at sun.com", "ORowSetBase::fireProperty" );
diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx
index 4140c21..8632487 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 5d7b985..6516006 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 f2a39b0..5eef8a6 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


More information about the ooo-build-commit mailing list