[Libreoffice-commits] core.git: connectivity/source dbaccess/source include/connectivity svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 21 07:26:44 UTC 2018


 connectivity/source/commontools/ParameterSubstitution.cxx |    5 +--
 connectivity/source/commontools/predicateinput.cxx        |   22 ++++++--------
 connectivity/source/drivers/ado/APreparedStatement.cxx    |    5 +--
 connectivity/source/drivers/file/FStatement.cxx           |    2 -
 connectivity/source/drivers/macab/MacabStatement.cxx      |    2 -
 connectivity/source/drivers/mork/MStatement.cxx           |    2 -
 connectivity/source/parse/sqlbison.y                      |    8 ++---
 connectivity/source/parse/sqlnode.cxx                     |    5 +--
 dbaccess/source/core/api/SingleSelectQueryComposer.cxx    |    8 ++---
 dbaccess/source/ui/inc/QueryDesignView.hxx                |    2 -
 dbaccess/source/ui/querydesign/QueryDesignView.cxx        |    4 +-
 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx     |    9 +----
 dbaccess/source/ui/querydesign/querycontroller.cxx        |    9 ++---
 include/connectivity/predicateinput.hxx                   |    4 +-
 include/connectivity/sqlparse.hxx                         |    6 +--
 svx/source/fmcomp/gridcell.cxx                            |    2 -
 svx/source/form/filtnav.cxx                               |    2 -
 svx/source/form/sqlparserclient.cxx                       |    4 +-
 svx/source/inc/sqlparserclient.hxx                        |    2 -
 19 files changed, 47 insertions(+), 56 deletions(-)

New commits:
commit d425658bd9fd8e315e4931afb544bc845da0360e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Dec 19 16:10:51 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Dec 21 08:26:15 2018 +0100

    pass OSQLParseNode around by unique_ptr
    
    Change-Id: I8ffb9e04614472c3645d24bebdc88f91059d12ad
    Reviewed-on: https://gerrit.libreoffice.org/65436
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/connectivity/source/commontools/ParameterSubstitution.cxx b/connectivity/source/commontools/ParameterSubstitution.cxx
index dfec360b23e5..a8efa6c6a694 100644
--- a/connectivity/source/commontools/ParameterSubstitution.cxx
+++ b/connectivity/source/commontools/ParameterSubstitution.cxx
@@ -83,12 +83,11 @@ namespace connectivity
                 OSQLParser aParser( m_xContext );
                 OUString sErrorMessage;
                 OUString sNewSql;
-                OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sText);
+                std::unique_ptr<OSQLParseNode> pNode = aParser.parseTree(sErrorMessage,_sText);
                 if(pNode)
                 {   // special handling for parameters
-                    OSQLParseNode::substituteParameterNames(pNode);
+                    OSQLParseNode::substituteParameterNames(pNode.get());
                     pNode->parseNodeToStr( sNewSql, xConnection );
-                    delete pNode;
                     sRet = sNewSql;
                 }
             }
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index fbc9c0bbb40e..b7a08ef57309 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -123,9 +123,9 @@ namespace dbtools
     }
 
 
-    OSQLParseNode* OPredicateInputController::implPredicateTree(OUString& _rErrorMessage, const OUString& _rStatement, const Reference< XPropertySet > & _rxField) const
+    std::unique_ptr<OSQLParseNode> OPredicateInputController::implPredicateTree(OUString& _rErrorMessage, const OUString& _rStatement, const Reference< XPropertySet > & _rxField) const
     {
-        OSQLParseNode* pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, _rStatement, m_xFormatter, _rxField );
+        std::unique_ptr<OSQLParseNode> pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, _rStatement, m_xFormatter, _rxField );
         if ( !pReturn )
         {   // is it a text field ?
             sal_Int32 nType = DataType::OTHER;
@@ -242,7 +242,7 @@ namespace dbtools
             // parse the string
             OUString sError;
             OUString sTransformedText( _rPredicateValue );
-            OSQLParseNode* pParseNode = implPredicateTree( sError, sTransformedText, _rxField );
+            std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, sTransformedText, _rxField );
             if ( _pErrorMessage ) *_pErrorMessage = sError;
 
             if ( pParseNode )
@@ -258,7 +258,6 @@ namespace dbtools
                     rParseContext.getPreferredLocale(), static_cast<sal_Char>(nDecSeparator), &rParseContext
                 );
                 _rPredicateValue = sTransformedText;
-                delete pParseNode;
 
                 bSuccess = true;
             }
@@ -279,9 +278,9 @@ namespace dbtools
             // (dbaccess/source/ui/dlg/paramdialog.cxx). I do not fully understand this .....
 
             OUString sError;
-            OSQLParseNode* pParseNode = implPredicateTree( sError, _rPredicateValue, _rxField );
+            std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, _rPredicateValue, _rxField );
 
-            implParseNode(pParseNode, true) >>= sReturn;
+            implParseNode(std::move(pParseNode), true) >>= sReturn;
         }
 
         return sReturn;
@@ -325,10 +324,10 @@ namespace dbtools
         pColumn->setFunction(true);
         pColumn->setRealName(sField);
 
-        OSQLParseNode* pParseNode = implPredicateTree( sError, _rPredicateValue, xColumn );
+        std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, _rPredicateValue, xColumn );
         if(pParseNode)
         {
-            implParseNode(pParseNode, true) >>= sReturn;
+            implParseNode(std::move(pParseNode), true) >>= sReturn;
         }
         return sReturn;
     }
@@ -344,22 +343,21 @@ namespace dbtools
             // (dbaccess/source/ui/dlg/paramdialog.cxx). I do not fully understand this .....
 
             OUString sError;
-            OSQLParseNode* pParseNode = implPredicateTree( sError, _rPredicateValue, _rxField );
+            std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, _rPredicateValue, _rxField );
 
-            return implParseNode(pParseNode, false);
+            return implParseNode(std::move(pParseNode), false);
         }
 
         return Any();
     }
 
-    Any OPredicateInputController::implParseNode(OSQLParseNode* pParseNode, bool _bForStatementUse) const
+    Any OPredicateInputController::implParseNode(std::unique_ptr<OSQLParseNode> pParseNode, bool _bForStatementUse) const
     {
         if ( ! pParseNode )
             return Any();
         else
         {
             OUString sReturn;
-            std::shared_ptr<OSQLParseNode> xTakeOwnership(pParseNode);
             OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec );
             if ( pOdbcSpec )
             {
diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx
index 9544bde9bfab..95ce16c347fb 100644
--- a/connectivity/source/drivers/ado/APreparedStatement.cxx
+++ b/connectivity/source/drivers/ado/APreparedStatement.cxx
@@ -61,15 +61,14 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection, const OUStrin
     OSQLParser aParser(comphelper::getComponentContext(_pConnection->getDriver()->getORB()));
     OUString sErrorMessage;
     OUString sNewSql;
-    OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,sql);
+    std::unique_ptr<OSQLParseNode> pNode = aParser.parseTree(sErrorMessage,sql);
     if(pNode)
     {   // special handling for parameters
         //  we recursive replace all occurrences of ? in the statement and
         //  replace them with name like "parame" */
         sal_Int32 nParameterCount = 0;
-        replaceParameterNodeName(pNode,"parame",nParameterCount);
+        replaceParameterNodeName(pNode.get(), "parame", nParameterCount);
         pNode->parseNodeToStr( sNewSql, _pConnection );
-        delete pNode;
     }
     else
         sNewSql = sql;
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx
index d99e3808f37b..ec74025fb945 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -367,7 +367,7 @@ void OStatement_Base::setOrderbyColumn( OSQLParseNode const * pColumnRef,
 void OStatement_Base::construct(const OUString& sql)
 {
     OUString aErr;
-    m_pParseTree = m_aParser.parseTree(aErr,sql);
+    m_pParseTree = m_aParser.parseTree(aErr,sql).release();
     if(!m_pParseTree)
         throw SQLException(aErr,*this,OUString(),0,Any());
 
diff --git a/connectivity/source/drivers/macab/MacabStatement.cxx b/connectivity/source/drivers/macab/MacabStatement.cxx
index 55d91567330e..a418b85c2d94 100644
--- a/connectivity/source/drivers/macab/MacabStatement.cxx
+++ b/connectivity/source/drivers/macab/MacabStatement.cxx
@@ -403,7 +403,7 @@ Reference< XResultSet > SAL_CALL MacabCommonStatement::executeQuery(
     Reference< XResultSet > xRS = pResult;
     OUString aErr;
 
-    m_pParseTree = m_aParser.parseTree(aErr, sql);
+    m_pParseTree = m_aParser.parseTree(aErr, sql).release();
     if (m_pParseTree == nullptr)
         throw SQLException(aErr, *this, aErr, 0, Any());
 
diff --git a/connectivity/source/drivers/mork/MStatement.cxx b/connectivity/source/drivers/mork/MStatement.cxx
index 813508f25994..5ae4a49952df 100644
--- a/connectivity/source/drivers/mork/MStatement.cxx
+++ b/connectivity/source/drivers/mork/MStatement.cxx
@@ -115,7 +115,7 @@ OCommonStatement::StatementType OCommonStatement::parseSql( const OUString& sql
 {
     OUString aErr;
 
-    m_pParseTree.reset( m_aParser.parseTree(aErr,sql) );
+    m_pParseTree = m_aParser.parseTree(aErr,sql);
 
     if(m_pParseTree)
     {
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index a93f3401cabc..013073b882d5 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -4494,10 +4494,10 @@ void setParser(OSQLParser* _pParser)
 	xxx_pGLOBAL_SQLPARSER = _pParser;
 }
 
-void OSQLParser::setParseTree(OSQLParseNode * pNewParseTree)
+void OSQLParser::setParseTree(OSQLParseNode* pNewParseTree)
 {
 	::osl::MutexGuard aGuard(getMutex());
-	m_pParseTree = pNewParseTree;
+	m_pParseTree.reset(pNewParseTree);
 }
 
 
@@ -4561,7 +4561,7 @@ static OUString delComment( const OUString& rQuery )
     return aBuf.makeStringAndClear();
 }
 
-OSQLParseNode* OSQLParser::parseTree(OUString& rErrorMessage,
+std::unique_ptr<OSQLParseNode> OSQLParser::parseTree(OUString& rErrorMessage,
                                      const OUString& rStatement,
                                      bool bInternational)
 {
@@ -4609,7 +4609,7 @@ OSQLParseNode* OSQLParser::parseTree(OUString& rErrorMessage,
 
         SAL_WARN_IF(!m_pParseTree, "connectivity.parse",
             "OSQLParser: Parser did not create ParseTree");
-		return m_pParseTree;
+		return std::move(m_pParseTree);
 	}
 }
 
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index f9acc655347f..b4890a25b46d 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1159,7 +1159,7 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale)
 }
 
 
-OSQLParseNode* OSQLParser::predicateTree(OUString& rErrorMessage, const OUString& rStatement,
+std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage, const OUString& rStatement,
                                          const Reference< css::util::XNumberFormatter > & xFormatter,
                                          const Reference< XPropertySet > & xField,
                                          bool bUseRealName)
@@ -1309,14 +1309,13 @@ OSQLParseNode* OSQLParser::predicateTree(OUString& rErrorMessage, const OUString
 
         // Instead, the parse method sets the member pParseTree and simply returns that
         OSL_ENSURE(m_pParseTree != nullptr,"OSQLParser: Parser did not return a ParseTree!");
-        return m_pParseTree;
+        return std::move(m_pParseTree);
     }
 }
 
 
 OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const IParseContext* _pContext)
     :m_pContext(_pContext)
-    ,m_pParseTree(nullptr)
     ,m_pData( new OSQLParser_Data )
     ,m_nFormatKey(0)
     ,m_nDateFormatKey(0)
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 67ec15d880e1..a2b8c1a99658 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -100,10 +100,10 @@ namespace
 
         If the statement cannot be parsed, an error is thrown.
     */
-    const OSQLParseNode* parseStatement_throwError( OSQLParser& _rParser, const OUString& _rStatement, const Reference< XInterface >& _rxContext )
+    std::unique_ptr<OSQLParseNode> parseStatement_throwError( OSQLParser& _rParser, const OUString& _rStatement, const Reference< XInterface >& _rxContext )
     {
         OUString aErrorMsg;
-        const OSQLParseNode* pNewSqlParseNode = _rParser.parseTree( aErrorMsg, _rStatement );
+        std::unique_ptr<OSQLParseNode> pNewSqlParseNode = _rParser.parseTree( aErrorMsg, _rStatement );
         if ( !pNewSqlParseNode )
         {
             OUString sSQLStateGeneralError( getStandardSQLState( StandardSQLState::GENERAL_ERROR ) );
@@ -146,8 +146,8 @@ namespace
     void parseAndCheck_throwError( OSQLParser& _rParser, const OUString& _rStatement,
         OSQLParseTreeIterator& _rIterator, const Reference< XInterface >& _rxContext )
     {
-        const OSQLParseNode* pNode = parseStatement_throwError( _rParser, _rStatement, _rxContext );
-        checkForSingleSelect_throwError( pNode, _rIterator, _rxContext, _rStatement );
+        std::unique_ptr<OSQLParseNode> pNode = parseStatement_throwError( _rParser, _rStatement, _rxContext );
+        checkForSingleSelect_throwError( pNode.release(), _rIterator, _rxContext, _rStatement );
     }
 
     /** transforms a parse node describing a complete statement into a pure select
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx
index b231e47f50d3..661f2bb722a1 100644
--- a/dbaccess/source/ui/inc/QueryDesignView.hxx
+++ b/dbaccess/source/ui/inc/QueryDesignView.hxx
@@ -134,7 +134,7 @@ namespace dbaui
                     const css::uno::Sequence< css::beans::PropertyValue >& i_rFieldDescriptions
                 );
 
-        ::connectivity::OSQLParseNode* getPredicateTreeFromEntry(   const OTableFieldDescRef& pEntry,
+        std::unique_ptr<::connectivity::OSQLParseNode> getPredicateTreeFromEntry(   const OTableFieldDescRef& pEntry,
                                                                     const OUString& _sCriteria,
                                                                     OUString& _rsErrorMessage,
                                                                     css::uno::Reference< css::beans::XPropertySet>& _rxColumn) const;
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 558cf3ee1315..23dac75ffab3 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2897,7 +2897,7 @@ void OQueryDesignView::SaveUIConfig()
         rCtrl.setSplitPos( m_aSplitter->GetSplitPosPixel() );
 }
 
-OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(const OTableFieldDescRef& pEntry,
+std::unique_ptr<OSQLParseNode> OQueryDesignView::getPredicateTreeFromEntry(const OTableFieldDescRef& pEntry,
                                                            const OUString& _sCriteria,
                                                            OUString& _rsErrorMessage,
                                                            Reference<XPropertySet>& _rxColumn) const
@@ -2989,7 +2989,7 @@ OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(const OTableFieldDesc
     // q itself is query "SELECT aye AS A, bee as B, cee as C FROM t"
     // We are currently treating the entry "C='foo'"
     // Then _rxColumn has Name "C" and RealName "cee". We should *obviously* use "C", not "cee".
-    OSQLParseNode* pParseNode = rParser.predicateTree(  _rsErrorMessage,
+    std::unique_ptr<OSQLParseNode> pParseNode = rParser.predicateTree(  _rsErrorMessage,
                                                         _sCriteria,
                                                         static_cast<OQueryController&>(getController()).getNumberFormatter(),
                                                         _rxColumn,
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 1d2ad3a6a67d..501949f68ce3 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -664,14 +664,14 @@ bool OSelectionBrowseBox::saveField(OUString& _sFieldName ,OTableFieldDescRef co
     {
         // automatically add parentheses around subqueries
         OUString devnull;
-        OSQLParseNode *pParseNode = rParser.parseTree( devnull, _sFieldName, true );
+        std::unique_ptr<OSQLParseNode> pParseNode = rParser.parseTree( devnull, _sFieldName, true );
         if (pParseNode == nullptr)
             pParseNode = rParser.parseTree( devnull, _sFieldName );
         if (pParseNode != nullptr && SQL_ISRULE(pParseNode, select_statement))
             _sFieldName = "(" + _sFieldName + ")";
     }
 
-    OSQLParseNode* pParseNode = nullptr;
+    std::unique_ptr<OSQLParseNode> pParseNode;
     {
         // 4 passes in trying to interpret the field name
         // - don't quote the field name, parse internationally
@@ -879,7 +879,6 @@ bool OSelectionBrowseBox::saveField(OUString& _sFieldName ,OTableFieldDescRef co
             }
         }
     }
-    delete pParseNode;
 
     return bError;
 }
@@ -1085,7 +1084,7 @@ bool OSelectionBrowseBox::SaveModified()
                 {
                     OUString aErrorMsg;
                     Reference<XPropertySet> xColumn;
-                    OSQLParseNode* pParseNode = getDesignView()->getPredicateTreeFromEntry(pEntry,aText,aErrorMsg,xColumn);
+                    std::unique_ptr<OSQLParseNode> pParseNode = getDesignView()->getPredicateTreeFromEntry(pEntry,aText,aErrorMsg,xColumn);
 
                     if (pParseNode)
                     {
@@ -1097,7 +1096,6 @@ bool OSelectionBrowseBox::SaveModified()
                                                             getDesignView()->getLocale(),
                                                             static_cast<sal_Char>(getDesignView()->getDecimalSeparator().toChar()),
                                                             &(static_cast<OQueryController&>(getDesignView()->getController()).getParser().getContext()));
-                        delete pParseNode;
                     }
                     else
                     {
@@ -1135,7 +1133,6 @@ bool OSelectionBrowseBox::SaveModified()
                                                                     getDesignView()->getLocale(),
                                                                     static_cast<sal_Char>(getDesignView()->getDecimalSeparator().toChar()),
                                                                     &(static_cast<OQueryController&>(getDesignView()->getController()).getParser().getContext()));
-                                delete pParseNode;
                             }
                             else
                             {
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 640297409998..c06e14d6010a 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -510,11 +510,11 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
                 }
                 else
                 {
-                    ::connectivity::OSQLParseNode* pNode = m_aSqlParser.parseTree(aErrorMsg,m_sStatement,m_bGraphicalDesign);
+                    std::unique_ptr<::connectivity::OSQLParseNode> pNode = m_aSqlParser.parseTree(aErrorMsg,m_sStatement,m_bGraphicalDesign);
                     if ( pNode )
                     {
                         delete m_pSqlIterator->getParseTree();
-                        m_pSqlIterator->setParseTree(pNode);
+                        m_pSqlIterator->setParseTree(pNode.release());
                         m_pSqlIterator->traverseAll();
 
                         if ( m_pSqlIterator->hasErrors() )
@@ -539,7 +539,7 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
                                 // change the view of the data
                                 m_bGraphicalDesign = !m_bGraphicalDesign;
                                 OUString sNewStatement;
-                                pNode->parseNodeToStr( sNewStatement, getConnection() );
+                                m_pSqlIterator->getParseTree()->parseNodeToStr( sNewStatement, getConnection() );
                                 setStatement_fireEvent( sNewStatement );
                                 getContainer()->SaveUIConfig();
                                 m_vTableConnectionData.clear();
@@ -1568,11 +1568,10 @@ OUString OQueryController::translateStatement( bool _bFireStatementChange )
 
             std::vector< CommentStrip > aComments = getComment( m_sStatement);
 
-            ::connectivity::OSQLParseNode* pNode = m_aSqlParser.parseTree( aErrorMsg, m_sStatement, m_bGraphicalDesign );
+            std::unique_ptr<::connectivity::OSQLParseNode> pNode = m_aSqlParser.parseTree( aErrorMsg, m_sStatement, m_bGraphicalDesign );
             if(pNode)
             {
                 pNode->parseNodeToStr( sTranslatedStmt, getConnection() );
-                delete pNode;
             }
 
             m_xComposer->setQuery(sTranslatedStmt);
diff --git a/include/connectivity/predicateinput.hxx b/include/connectivity/predicateinput.hxx
index 16ace17d9108..1e83d4ac43a5 100644
--- a/include/connectivity/predicateinput.hxx
+++ b/include/connectivity/predicateinput.hxx
@@ -103,7 +103,7 @@ namespace dbtools
         ) const;
 
     private:
-        ::connectivity::OSQLParseNode* implPredicateTree(
+        std::unique_ptr<::connectivity::OSQLParseNode> implPredicateTree(
             OUString& _rErrorMessage,
             const OUString& _rStatement,
             const css::uno::Reference< css::beans::XPropertySet > & _rxField
@@ -115,7 +115,7 @@ namespace dbtools
             sal_Unicode& _rThdSep
         ) const;
 
-        css::uno::Any implParseNode(::connectivity::OSQLParseNode* pParseNode, bool _bForStatementUse) const;
+        css::uno::Any implParseNode(std::unique_ptr<::connectivity::OSQLParseNode> pParseNode, bool _bForStatementUse) const;
     };
 
 
diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx
index 7dda08c4bca7..cdb92064997e 100644
--- a/include/connectivity/sqlparse.hxx
+++ b/include/connectivity/sqlparse.hxx
@@ -136,7 +136,7 @@ namespace connectivity
 
     // information on the current parse action
         const IParseContext*        m_pContext;
-        OSQLParseNode*              m_pParseTree;   // result from parsing
+        std::unique_ptr<OSQLParseNode> m_pParseTree;   // result from parsing
         ::std::unique_ptr< OSQLParser_Data >
                                     m_pData;
         OUString                     m_sFieldName;   // current field name for a predicate
@@ -171,14 +171,14 @@ namespace connectivity
         ~OSQLParser();
 
         // Parsing an SQLStatement
-        OSQLParseNode* parseTree(OUString& rErrorMessage,
+        std::unique_ptr<OSQLParseNode> parseTree(OUString& rErrorMessage,
                        const OUString& rStatement,
                        bool bInternational = false);
 
         // Check a Predicate
         // set bUseRealName to false if you pass a xField that comes from where you got that field,
         // as opposed from to from yourself.
-        OSQLParseNode* predicateTree(OUString& rErrorMessage, const OUString& rStatement,
+        std::unique_ptr<OSQLParseNode> predicateTree(OUString& rErrorMessage, const OUString& rStatement,
                        const css::uno::Reference< css::util::XNumberFormatter > & xFormatter,
                        const css::uno::Reference< css::beans::XPropertySet > & xField,
                        bool bUseRealName = true);
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 18d105fc5b1d..ae61518d539d 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2890,7 +2890,7 @@ bool DbFilterField::commitControl()
             OUString aErrorMsg;
             Reference< XNumberFormatter >  xNumberFormatter(m_rColumn.GetParent().getNumberFormatter());
 
-            std::shared_ptr< OSQLParseNode > pParseNode = predicateTree(aErrorMsg, aNewText,xNumberFormatter, m_rColumn.GetField());
+            std::unique_ptr< OSQLParseNode > pParseNode = predicateTree(aErrorMsg, aNewText,xNumberFormatter, m_rColumn.GetField());
             if (pParseNode != nullptr)
             {
                 OUString aPreparedText;
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 97e414984b12..a99b6e215613 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -805,7 +805,7 @@ bool FmFilterModel::ValidateText(FmFilterItem const * pItem, OUString& rText, OU
 
         // parse the given text as filter predicate
         OUString aErr, aTxt( rText );
-        std::shared_ptr< OSQLParseNode > pParseNode = predicateTree( aErr, aTxt, xFormatter, xField );
+        std::unique_ptr< OSQLParseNode > pParseNode = predicateTree( aErr, aTxt, xFormatter, xField );
         rErrorMsg = aErr;
         rText = aTxt;
         if ( pParseNode != nullptr )
diff --git a/svx/source/form/sqlparserclient.cxx b/svx/source/form/sqlparserclient.cxx
index 2664229ef55c..6bc957270b92 100644
--- a/svx/source/form/sqlparserclient.cxx
+++ b/svx/source/form/sqlparserclient.cxx
@@ -37,14 +37,14 @@ namespace svxform
         m_xContext = rxContext;
     }
 
-    std::shared_ptr< ::connectivity::OSQLParseNode > OSQLParserClient::predicateTree(
+    std::unique_ptr< ::connectivity::OSQLParseNode > OSQLParserClient::predicateTree(
             OUString& _rErrorMessage,
             const OUString& _rStatement,
             const css::uno::Reference< css::util::XNumberFormatter >& _rxFormatter,
             const css::uno::Reference< css::beans::XPropertySet >& _rxField
         ) const
     {
-        return std::shared_ptr< OSQLParseNode >(m_pParser->predicateTree(_rErrorMessage, _rStatement, _rxFormatter, _rxField));
+        return m_pParser->predicateTree(_rErrorMessage, _rStatement, _rxFormatter, _rxField);
     }
 
 }
diff --git a/svx/source/inc/sqlparserclient.hxx b/svx/source/inc/sqlparserclient.hxx
index 06341d76120b..7873c41bbf99 100644
--- a/svx/source/inc/sqlparserclient.hxx
+++ b/svx/source/inc/sqlparserclient.hxx
@@ -50,7 +50,7 @@ namespace svxform
         OSQLParserClient(
             const css::uno::Reference< css::uno::XComponentContext >& rxContext);
 
-        std::shared_ptr< ::connectivity::OSQLParseNode > predicateTree(
+        std::unique_ptr< ::connectivity::OSQLParseNode > predicateTree(
                 OUString& _rErrorMessage,
                 const OUString& _rStatement,
                 const css::uno::Reference< css::util::XNumberFormatter >& _rxFormatter,


More information about the Libreoffice-commits mailing list