Tag: cws_src680_qiq User: fs Date: 06/05/12 06:45:52 Modified: /dba/dbaccess/source/ui/querydesign/ querycontroller.cxx
Log: #i51143# don't allow sub queries if we're creating a view File Changes: Directory: /dba/dbaccess/source/ui/querydesign/ =============================================== File [changed]: querycontroller.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/querycontroller.cxx?r1=1.103.4.2&r2=1.103.4.3 Delta lines: +27 -46 --------------------- --- querycontroller.cxx 12 May 2006 11:10:16 -0000 1.103.4.2 +++ querycontroller.cxx 12 May 2006 13:45:50 -0000 1.103.4.3 @@ -4,9 +4,9 @@ * * $RCSfile: querycontroller.cxx,v $ * - * $Revision: 1.103.4.2 $ + * $Revision: 1.103.4.3 $ * - * last change: $Author: fs $ $Date: 2006/05/12 11:10:16 $ + * last change: $Author: fs $ $Date: 2006/05/12 13:45:50 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -753,56 +753,35 @@ InvalidateFeature(_nId); } // ----------------------------------------------------------------------------- -void OQueryController::impl_initialize( const Sequence< Any >& aArguments ) +void OQueryController::impl_initialize() { - OJoinController::impl_initialize(aArguments); + OJoinController::impl_initialize(); - PropertyValue aValue; - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); + const NamedValueCollection& rArguments( getInitParams() ); - for(;pIter != pEnd;++pIter) - { - if (!(*pIter >>= aValue)) - throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid type in argument list. PropertyValue expected.")),*this); + Reference< XConnection > xConnection; + xConnection = rArguments.getOrDefault( (::rtl::OUString)PROPERTY_ACTIVECONNECTION, xConnection ); + if ( xConnection.is() ) + initializeConnection( xConnection ); - if (0 == aValue.Name.compareToAscii(PROPERTY_ACTIVECONNECTION)) - { - Reference< XConnection > xConn; - if ( !(aValue.Value >>= xConn) ) - throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid argument type for ActiveConnection.")),*this); - if ( xConn.is() ) - initializeConnection( xConn ); - } - else if(0 == aValue.Name.compareToAscii(PROPERTY_CURRENTQUERY)) - { - if ( !(aValue.Value >>= m_sName) ) + if ( !rArguments.getIfExists_ensureType( (::rtl::OUString)PROPERTY_CURRENTQUERY, m_sName ) ) throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid argument type for CurrentQuery.")),*this); - } - else if(0 == aValue.Name.compareToAscii(PROPERTY_QUERYDESIGNVIEW)) - { - if ( !(aValue.Value >>= m_bDesign) ) + + if ( !rArguments.getIfExists_ensureType( (::rtl::OUString)PROPERTY_QUERYDESIGNVIEW, m_bDesign ) ) throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid argument type for QueryDesignView.")),*this); - } - else if(0 == aValue.Name.compareToAscii(PROPERTY_CREATEVIEW)) - { - if ( !(aValue.Value >>= m_bCreateView) ) + + if ( !rArguments.getIfExists_ensureType( (::rtl::OUString)PROPERTY_CREATEVIEW, m_bCreateView ) ) throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid argument type for CreateView.")),*this); - } - else if ( 0 == aValue.Name.compareToAscii( PARAM_INDEPENDENT_SQL_COMMAND ) ) + + ::rtl::OUString sIndependentSQLCommand; + if ( !rArguments.getIfExists_ensureType( (::rtl::OUString)PARAM_INDEPENDENT_SQL_COMMAND, sIndependentSQLCommand ) ) + throw Exception( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid argument type for IndependentSQLCommand." ) ),*this); + if ( sIndependentSQLCommand.getLength() ) { m_bIndependent = sal_True; m_bEsacpeProcessing = sal_True; + setStatement_fireEvent( sIndependentSQLCommand ); - ::rtl::OUString sNewStatement; - if ( !(aValue.Value >>= sNewStatement) ) - throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid argument type for IndependentSQLCommand.")),*this); - setStatement_fireEvent( sNewStatement ); - } - } - - if ( m_bIndependent ) - { OSL_ENSURE( m_sName.getLength() == 0, "OQueryController::initialize: both a query name and an independent SQL command?" ); OSL_ENSURE( !m_bCreateView, "OQueryController::initialize: create a view, *and* an independent SQL command?" ); m_sName = ::rtl::OUString(); @@ -1707,7 +1686,9 @@ // ----------------------------------------------------------------------------- bool OQueryController::allowQueries() const { - return true; + const NamedValueCollection& rArguments( getInitParams() ); + bool bCreatingView = rArguments.getOrDefault( (::rtl::OUString)PROPERTY_CREATEVIEW, false ); + return !bCreatingView; } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
