diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-13 11:02:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-13 14:06:49 +0200 |
commit | bc059c08d86ccdeca4f340078b0de39053bc0888 (patch) | |
tree | bf4cf4118c34be41dbe1d5c149fdaa8c14c56aae /connectivity | |
parent | 7abee444ed03a53f0a4d7f82e19887aa16262c5d (diff) |
use std::optional for this error field
otherwise when I add source/line to the uno::Exception in an
upcoming change, the message becomes non-empty, and hasErrors()
return true.
I note that we throw SQLException in lots of places without a
message, so it is possible that this change will cause us to notice
errors we previously missed.
Change-Id: Idf7c5b5143e20c992d8d7550043aa2ed875c78b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94108
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/parse/sqliterator.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 7af9dc9ab9ee..ba3f274e65ef 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -38,6 +38,7 @@ #include <connectivity/dbmetadata.hxx> #include <com/sun/star/sdb/SQLFilterOperator.hpp> #include <sal/log.hxx> +#include <tools/diagnose_ex.h> #include <iterator> #include <memory> @@ -209,7 +210,7 @@ void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree) if ( !m_pImpl->m_xTableContainer.is() ) return; - m_aErrors = SQLException(); + m_xErrors.reset(); // Determine statement type ... @@ -1468,7 +1469,7 @@ void OSQLParseTreeIterator::traverseAll() void OSQLParseTreeIterator::impl_traverse( TraversalParts _nIncludeMask ) { // resets our errors - m_aErrors = css::sdbc::SQLException(); + m_xErrors.reset(); m_pImpl->m_nIncludeMask = _nIncludeMask; @@ -2006,15 +2007,16 @@ void OSQLParseTreeIterator::impl_appendError( IParseContext::ErrorCode _eError, void OSQLParseTreeIterator::impl_appendError( const SQLException& _rError ) { - if ( !m_aErrors.Message.isEmpty() ) + SAL_WARN("connectivity.parse", "Adding error " << exceptionToString(Any(_rError))); + if ( m_xErrors ) { - SQLException* pErrorChain = &m_aErrors; + SQLException* pErrorChain = &*m_xErrors; while ( pErrorChain->NextException.hasValue() ) pErrorChain = static_cast< SQLException* >( pErrorChain->NextException.pData ); pErrorChain->NextException <<= _rError; } else - m_aErrors = _rError; + m_xErrors = _rError; } sal_Int32 OSQLParseTreeIterator::getFunctionReturnType(const OSQLParseNode* _pNode ) |