Tag: cws_src680_qiq User: fs Date: 06/05/12 07:11:42 Modified: /dba/connectivity/source/parse/ sqlnode.cxx
Log: #i51143# parseNodeToExecutableStatement now also taking a SQLParser - this allows nested sub queries File Changes: Directory: /dba/connectivity/source/parse/ ========================================== File [changed]: sqlnode.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/parse/sqlnode.cxx?r1=1.38.62.1&r2=1.38.62.2 Delta lines: +25 -3 -------------------- --- sqlnode.cxx 10 May 2006 10:19:46 -0000 1.38.62.1 +++ sqlnode.cxx 12 May 2006 14:11:40 -0000 1.38.62.2 @@ -4,9 +4,9 @@ * * $RCSfile: sqlnode.cxx,v $ * - * $Revision: 1.38.62.1 $ + * $Revision: 1.38.62.2 $ * - * last change: $Author: fs $ $Date: 2006/05/10 10:19:46 $ + * last change: $Author: fs $ $Date: 2006/05/12 14:11:40 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -183,6 +183,7 @@ ,xFormatter(_xFormatter) ,bPredicate(_bPredicate) ,bParseToSDBCLevel( _bParseToSDBC ) + ,pParser( NULL ) { } @@ -298,7 +299,7 @@ } } //----------------------------------------------------------------------------- -void OSQLParseNode::parseNodeToExecutableStatement( ::rtl::OUString& _out_rString, const Reference< XConnection >& _rxConnection ) const +void OSQLParseNode::parseNodeToExecutableStatement( ::rtl::OUString& _out_rString, const Reference< XConnection >& _rxConnection, OSQLParser& _rParser ) const { OSL_PRECOND( _rxConnection.is(), "OSQLParseNode::parseNodeToExecutableStatement: invalid connection!" ); Reference< XDatabaseMetaData > xMeta( _rxConnection->getMetaData() ); @@ -311,6 +312,8 @@ if ( xSuppQueries.is() ) aParseParam.xQueries = xSuppQueries->getQueries(); + aParseParam.pParser = &_rParser; + _out_rString = ::rtl::OUString(); parseNodeToStr( _out_rString, aParseParam ); } @@ -389,6 +392,25 @@ // substitute the query name with the constituting command ::rtl::OUString sCommand; OSL_VERIFY( xQuery->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_COMMAND ) ) >>= sCommand ); + + sal_Bool bEscapeProcessing = sal_False; + OSL_VERIFY( xQuery->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_ESCAPEPROCESSING ) ) >>= bEscapeProcessing ); + + // the query we found here might itself be based on another query, so parse it recursively + OSL_ENSURE( rParam.pParser, "OSQLParseNode::parseNodeToStr: cannot analyze sub queries without a parser!" ); + if ( bEscapeProcessing && rParam.pParser ) + { + ::rtl::OUString sError; + ::std::auto_ptr< OSQLParseNode > pSubQueryNode( rParam.pParser->parseTree( sError, sCommand, sal_False ) ); + if ( pSubQueryNode.get() ) + { + // parse the sub-select to SDBC level, too + ::rtl::OUString sSubSelect; + pSubQueryNode->parseNodeToStr( sSubSelect, rParam ); + if ( sSubSelect.getLength() ) + sCommand = sSubSelect; + } + } rString += ::rtl::OUString::createFromAscii( " ( " ); rString += sCommand; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
