Tag: cws_src680_qiq User: fs Date: 2006/06/30 06:27:21 Modified: dba/dbaccess/source/core/api/query.cxx dba/dbaccess/source/core/api/query.hxx dba/dbaccess/source/core/api/querydescriptor.cxx dba/dbaccess/source/core/api/querydescriptor.hxx
Log: #i51143# protect against recusive sub queries File Changes: Directory: /dba/dbaccess/source/core/api/ ========================================= File [changed]: query.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/query.cxx?r1=1.29.124.4&r2=1.29.124.5 Delta lines: +8 -13 -------------------- --- query.cxx 27 Jun 2006 11:51:49 -0000 1.29.124.4 +++ query.cxx 30 Jun 2006 13:27:17 -0000 1.29.124.5 @@ -4,9 +4,9 @@ * * $RCSfile: query.cxx,v $ * - * $Revision: 1.29.124.4 $ + * $Revision: 1.29.124.5 $ * - * last change: $Author: fs $ $Date: 2006/06/27 11:51:49 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:27:17 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -177,12 +177,13 @@ IMPLEMENT_GETTYPES3(OQuery,OQueryDescriptor_Base,ODataSettings,OContentHelper); IMPLEMENT_FORWARD_XINTERFACE3( OQuery,OContentHelper,OQueryDescriptor_Base,ODataSettings) //-------------------------------------------------------------------------- -void OQuery::implCollectColumns( ) +void OQuery::rebuildColumns() { + OSL_PRECOND( getColumnCount() == 0, "OQuery::rebuildColumns: column container should be empty!" ); + // the base class' definition of rebuildColumns promised that clearColumns is called before rebuildColumns + try { - // empty the target container - clearColumns( ); m_pMediator = NULL; m_xColumnMediator = NULL; @@ -261,14 +262,8 @@ } catch( const Exception& ) { - DBG_ERROR( "OQuery::implCollectColumns: caught a strange exception!" ); + DBG_ERROR( "OQuery::rebuildColumns: caught a strange exception!" ); } -} - -//-------------------------------------------------------------------------- -void OQuery::rebuildColumns() -{ - implCollectColumns( ); } // XServiceInfo File [changed]: query.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/query.hxx?r1=1.17&r2=1.17.2.1 Delta lines: +3 -9 ------------------- --- query.hxx 20 Jun 2006 02:39:55 -0000 1.17 +++ query.hxx 30 Jun 2006 13:27:18 -0000 1.17.2.1 @@ -4,9 +4,9 @@ * * $RCSfile: query.hxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.17.2.1 $ * - * last change: $Author: hr $ $Date: 2006/06/20 02:39:55 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:27:18 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -176,12 +176,6 @@ virtual void rebuildColumns( ); private: - /** creates column objects for all columns which are necessary when executing our command - @param _bOnlyTemporary - if <TRUE/>, the resulting columns are inserted into m_aColumnMap only, else they're really appended to m_pColumns - */ - void implCollectColumns( ); - void registerProperties(); }; File [changed]: querydescriptor.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/querydescriptor.cxx?r1=1.26.78.4&r2=1.26.78.5 Delta lines: +13 -9 -------------------- --- querydescriptor.cxx 28 Jun 2006 10:31:07 -0000 1.26.78.4 +++ querydescriptor.cxx 30 Jun 2006 13:27:18 -0000 1.26.78.5 @@ -4,9 +4,9 @@ * * $RCSfile: querydescriptor.cxx,v $ * - * $Revision: 1.26.78.4 $ + * $Revision: 1.26.78.5 $ * - * last change: $Author: fs $ $Date: 2006/06/28 10:31:07 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:27:18 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -251,11 +251,17 @@ if ( isColumnsOutOfDate() ) { - // load the columns - refreshColumns(); + // clear the current columns + clearColumns(); + // do this before rebuildColumns. This prevents recursion, e.g. in the case where we + // have queries with cyclic references: + // foo := SELECT * FROM bar + // bar := SELECT * FROM foo setColumnsOutOfDate( sal_False ); - m_pColumns->setInitialized(); + + // rebuild them + rebuildColumns(); } return m_pColumns; @@ -312,14 +318,12 @@ } // ----------------------------------------------------------------------------- +// IRefreshableColumns void OQueryDescriptor_Base::refreshColumns() { - MutexGuard aGuard(m_rMutex); + MutexGuard aGuard( m_rMutex ); - // clear the current columns clearColumns(); - - // do the real rebuild rebuildColumns(); } File [changed]: querydescriptor.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/querydescriptor.hxx?r1=1.14.124.1&r2=1.14.124.2 Delta lines: +8 -5 ------------------- --- querydescriptor.hxx 16 Jun 2006 11:47:37 -0000 1.14.124.1 +++ querydescriptor.hxx 30 Jun 2006 13:27:18 -0000 1.14.124.2 @@ -4,9 +4,9 @@ * * $RCSfile: querydescriptor.hxx,v $ * - * $Revision: 1.14.124.1 $ + * $Revision: 1.14.124.2 $ * - * last change: $Author: fs $ $Date: 2006/06/16 11:47:37 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:27:18 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -138,13 +138,16 @@ virtual void columnAppended( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSourceDescriptor ); virtual void columnDropped(const ::rtl::OUString& _sName); - // called (after some preparations) from inside refreshColumns. Never overload refreshColumns directly! + /** rebuild our columns set + + clearColumns has already been called before, do <em>NOT</em> call it, again + */ virtual void rebuildColumns( ); virtual void disposeColumns(); -private: - virtual void refreshColumns(); + // IRefreshableColumns overridables + virtual void refreshColumns(); }; class OQueryDescriptor : public comphelper::OMutexAndBroadcastHelper --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
