summaryrefslogtreecommitdiff
path: root/include/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-05-13 11:02:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-13 14:06:49 +0200
commitbc059c08d86ccdeca4f340078b0de39053bc0888 (patch)
treebf4cf4118c34be41dbe1d5c149fdaa8c14c56aae /include/connectivity
parent7abee444ed03a53f0a4d7f82e19887aa16262c5d (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 'include/connectivity')
-rw-r--r--include/connectivity/sqliterator.hxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/connectivity/sqliterator.hxx b/include/connectivity/sqliterator.hxx
index f77df204d52c..e4f0450ea4bb 100644
--- a/include/connectivity/sqliterator.hxx
+++ b/include/connectivity/sqliterator.hxx
@@ -27,6 +27,7 @@
#include <rtl/ref.hxx>
#include <memory>
+#include <optional>
#include <vector>
#include <o3tl/typed_flags_set.hxx>
@@ -78,7 +79,7 @@ namespace connectivity
class OOO_DLLPUBLIC_DBTOOLS OSQLParseTreeIterator final
{
private:
- css::sdbc::SQLException m_aErrors; // contains the error while iterating through the statement
+ std::optional<css::sdbc::SQLException> m_xErrors; // contains the error while iterating through the statement
const OSQLParseNode* m_pParseTree; // current ParseTree
const OSQLParser& m_rParser; // if set used for general error messages from the context
OSQLStatementType m_eStatementType;
@@ -178,8 +179,8 @@ namespace connectivity
The returned object contains a chain (via SQLException::NextException) of SQLExceptions.
*/
- const css::sdbc::SQLException& getErrors() const { return m_aErrors; }
- bool hasErrors() const { return !m_aErrors.Message.isEmpty(); }
+ const css::sdbc::SQLException& getErrors() const { return *m_xErrors; }
+ bool hasErrors() const { return bool(m_xErrors); }
// statement type (already set in setParseTree):
OSQLStatementType getStatementType() const { return m_eStatementType; }