Tag: cws_src680_oj14
User: fs      
Date: 2007-06-05 20:50:34+0000
Modified:
   dba/dbaccess/source/core/api/RowSet.cxx
   dba/dbaccess/source/core/api/RowSet.hxx

Log:
 #i78077# track whether any of the facets contributing to the complete command 
(Filter, Order, ApplyFilter, etc.) is dirty - in this case, re-create the 
parameters collection when it is retrieved

File Changes:

Directory: /dba/dbaccess/source/core/api/
=========================================

File [changed]: RowSet.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSet.cxx?r1=1.137.4.10&r2=1.137.4.11
Delta lines:  +44 -47
---------------------
--- RowSet.cxx  2007-06-05 20:16:13+0000        1.137.4.10
+++ RowSet.cxx  2007-06-05 20:50:31+0000        1.137.4.11
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: RowSet.cxx,v $
  *
- *  $Revision: 1.137.4.10 $
+ *  $Revision: 1.137.4.11 $
  *
- *  last change: $Author: fs $ $Date: 2007/06/05 20:16:13 $
+ *  last change: $Author: fs $ $Date: 2007/06/05 20:50:31 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -287,7 +287,7 @@
        ,m_nPrivileges(0)
        ,m_bUseEscapeProcessing(sal_True)
        ,m_bApplyFilter(sal_False)
-       ,m_bCreateStatement(sal_True)
+       ,m_bCommandFacetsDirty( sal_True )
        ,m_bModified(sal_False)
     ,m_bRebuildConnOnExecute(sal_False)
        ,m_bIsBookmarable(sal_True)
@@ -413,6 +413,24 @@
                        
OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue);
        }
 
+    if  (   ( nHandle == PROPERTY_ID_ACTIVECONNECTION )
+        ||  ( nHandle == PROPERTY_ID_DATASOURCENAME )
+        ||  ( nHandle == PROPERTY_ID_COMMAND )
+        ||  ( nHandle == PROPERTY_ID_COMMANDTYPE )
+        ||  ( nHandle == PROPERTY_ID_IGNORERESULT )
+        ||  ( nHandle == PROPERTY_ID_FILTER )
+        ||  ( nHandle == PROPERTY_ID_HAVING_CLAUSE )
+        ||  ( nHandle == PROPERTY_ID_GROUP_BY )
+        ||  ( nHandle == PROPERTY_ID_APPLYFILTER )
+        ||  ( nHandle == PROPERTY_ID_ORDER )
+        ||  ( nHandle == PROPERTY_ID_URL )
+        ||  ( nHandle == PROPERTY_ID_USER )
+        )
+    {
+        m_bCommandFacetsDirty = sal_True;
+    }
+
+
        switch(nHandle)
        {
                case PROPERTY_ID_ACTIVECONNECTION:
@@ -423,19 +441,9 @@
                        }
 
                        m_bOwnConnection                = sal_False;
-                       m_bCreateStatement              = sal_True;
                        m_bRebuildConnOnExecute = sal_False;
                        break;
 
-               case PROPERTY_ID_APPLYFILTER:
-                       m_bCreateStatement = sal_True;
-                       break;
-               case PROPERTY_ID_COMMAND:
-                       m_bCreateStatement = sal_True;
-                       break;
-               case PROPERTY_ID_COMMANDTYPE:
-                       m_bCreateStatement = sal_True;
-                       break;
                case PROPERTY_ID_DATASOURCENAME:
                        if(!m_xStatement.is())
                        {
@@ -446,8 +454,6 @@
                        }
                        else
                                m_bRebuildConnOnExecute = sal_True;
-                       m_bCreateStatement = sal_True;
-                       //      m_bOwnConnection   = sal_True;
                        break;
                case PROPERTY_ID_FETCHSIZE:
                        if(m_pCache)
@@ -456,14 +462,6 @@
                                fireRowcount();
                        }
                        break;
-               case PROPERTY_ID_HAVING_CLAUSE:
-               case PROPERTY_ID_GROUP_BY:
-               case PROPERTY_ID_FILTER:
-                       m_bCreateStatement = sal_True;
-                       break;
-               case PROPERTY_ID_ORDER:
-                       m_bCreateStatement = sal_True;
-                       break;
                case PROPERTY_ID_URL:
                        // is the connection-to-be-built determined by the url 
(which is the case if m_aDataSourceName is empty) ?
                        if (!m_aDataSourceName.getLength())
@@ -480,17 +478,13 @@
                                        
setFastPropertyValue(PROPERTY_ID_ACTIVECONNECTION, aNewConn);
                                }
                        }
-                       m_bCreateStatement = sal_True;
                        m_bOwnConnection = sal_True;
                        break;
-               case PROPERTY_ID_USER:
-                       m_bCreateStatement = sal_True;
-                       break;
                case PROPERTY_ID_TYPEMAP:
                        ::cppu::extractInterface(m_xTypeMap,m_aTypeMap);
                        break;
                default:
-                       ;
+                       break;
        };
 }
 // -------------------------------------------------------------------------
@@ -644,9 +638,7 @@
        m_aRowsetListeners.disposeAndClear( aDisposeEvent );
        m_aApproveListeners.disposeAndClear( aDisposeEvent );
 
-       // just because we want to clear all see freeResources()
-       m_bCreateStatement = sal_True;
-       freeResources();
+       freeResources( true );
        m_xServiceManager       = NULL;
        // remove myself as dispose listener
        Reference< XComponent >  xComponent(m_xActiveConnection, UNO_QUERY);
@@ -666,7 +658,7 @@
        ORowSetBase::disposing();
 }
 // -------------------------------------------------------------------------
-void ORowSet::freeResources()
+void ORowSet::freeResources( bool _bComplete )
 {
        MutexGuard aGuard(m_aMutex);
 
@@ -678,7 +670,8 @@
                        xComp->dispose();
        }
        m_aClones.clear();
-       if (m_bCreateStatement)
+
+    if ( _bComplete )
        {
                // the columns must be disposed before the querycomposer is 
disposed because
                // their owner can be the composer
@@ -712,6 +705,8 @@
                        m_aOldRow->clearRow();
 
         impl_disposeParametersContainer_nothrow();
+
+        m_bCommandFacetsDirty = sal_True;
        }
 }
 
@@ -787,8 +782,7 @@
                
::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
        }
        // additionals things to set
-       m_bCreateStatement = sal_True;
-       freeResources();
+       freeResources( true );
 }
 // -------------------------------------------------------------------------
 // comphelper::OPropertyArrayUsageHelper
@@ -1522,7 +1516,7 @@
 
        try
        {
-        freeResources();
+        freeResources( m_bCommandFacetsDirty );
 
                // calc the connection to be used
                if (m_xActiveConnection.is() && m_bRebuildConnOnExecute)
@@ -1560,6 +1554,11 @@
 // -------------------------------------------------------------------------
 Reference< XIndexAccess > SAL_CALL ORowSet::getParameters(  ) throw 
(RuntimeException)
 {
+    if ( m_bCommandFacetsDirty )
+        // need to rebuild the parameters, since some property which 
contributes to the
+        // complete command, and thus the parameters, changed
+        impl_disposeParametersContainer_nothrow();
+
     if ( !m_pParameters.get() && m_aCommand.getLength() )
     {
         try
@@ -1572,6 +1571,7 @@
                DBG_UNHANDLED_EXCEPTION();
         }
     }
+
     return m_pParameters.get();
 }
 
@@ -1598,7 +1598,7 @@
        approveExecution();
 
        ResettableMutexGuard aGuard( m_aMutex );
-       freeResources();
+       freeResources( m_bCommandFacetsDirty );
 
        // calc the connection to be used
        if (m_xActiveConnection.is() && m_bRebuildConnOnExecute) {
@@ -1824,7 +1824,7 @@
        m_xOldConnection = NULL;
 
        // do we need a new statement
-       if (m_bCreateStatement)
+       if ( m_bCommandFacetsDirty )
        {
                m_xStatement    = NULL;
                m_xComposer             = NULL;
@@ -2923,16 +2923,13 @@
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 
nHandle,const Any& rValue) throw (Exception)
 {
-       switch(nHandle)
+    if ( nHandle == PROPERTY_ID_FETCHSIZE )
        {
-       case PROPERTY_ID_FETCHSIZE:
-               if(m_pParent)
-                       
m_pParent->setFastPropertyValue_NoBroadcast(nHandle,rValue);
-               // run through
-       default:
-               
OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue);
+               if ( m_pParent )
+                       m_pParent->setFastPropertyValue_NoBroadcast( nHandle, 
rValue );
        }
 
+    OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue);
 }
 
 // 
-----------------------------------------------------------------------------

File [changed]: RowSet.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSet.hxx?r1=1.47.22.2&r2=1.47.22.3
Delta lines:  +5 -5
-------------------
--- RowSet.hxx  2007-06-05 20:16:13+0000        1.47.22.2
+++ RowSet.hxx  2007-06-05 20:50:31+0000        1.47.22.3
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: RowSet.hxx,v $
  *
- *  $Revision: 1.47.22.2 $
+ *  $Revision: 1.47.22.3 $
  *
- *  last change: $Author: fs $ $Date: 2007/06/05 20:16:13 $
+ *  last change: $Author: fs $ $Date: 2007/06/05 20:50:31 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -170,7 +170,7 @@
         sal_Bool                    m_bLastKnownRowCountFinal;
                sal_Bool                                        
m_bUseEscapeProcessing ;
                sal_Bool                                        m_bApplyFilter ;
-               sal_Bool                                        
m_bCreateStatement ;    // determines we to create a new prepared statement
+               sal_Bool                                        
m_bCommandFacetsDirty;  // any of the facets which define the active command is 
dirty
                sal_Bool                                        m_bModified ;
                sal_Bool                                        
m_bRebuildConnOnExecute ;
                sal_Bool                                        
m_bIsBookmarable ;
@@ -241,8 +241,8 @@
                         impl_prepareAndExecute_throw();
 
         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection 
>  calcConnection(const ::com::sun::star::uno::Reference< 
::com::sun::star::task::XInteractionHandler >& _rxHandler) throw( 
::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
-               // free clones and ParseTree
-               void freeResources();
+               // free clones and ParseTree. Plus, if _bComplete is <TRUE/>, 
*all* other associated resources
+               void freeResources( bool _bComplete );
 
                // fire a change for one column
                // _nPos starts at zero




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to