summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2023-08-30 10:23:31 -0400
committerAron Budea <aron.budea@collabora.com>2023-09-01 23:20:31 +0200
commitc22c356cc1b7c08313a46a8269f4f43eb76ecf75 (patch)
treeca67baa3d2d60009ba0723424300b879c8b224f2
parentb36b4910301470f861e3b7a80683cf3fa4c390c5 (diff)
connectivity: add neutral context parser
Signed-off-by: Henry Castro <hcastro@collabora.com> Change-Id: I12b0fe811d141873aaa64af5b6c457051c3356b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156297 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit 57379b62950d5730cdd0ec2b14eaf55370a3298e)
-rw-r--r--connectivity/source/parse/sqlnode.cxx5
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx2
-rw-r--r--dbaccess/source/core/inc/SingleSelectQueryComposer.hxx1
-rw-r--r--include/connectivity/sqlparse.hxx10
4 files changed, 13 insertions, 5 deletions
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 947c1ef49580..e2b1daddde9e 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1316,8 +1316,11 @@ std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage
}
-OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const IParseContext* _pContext)
+OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const IParseContext* _pContext,
+ const IParseContext* _pNeutral)
:m_pContext(_pContext)
+ ,m_pNeutral(_pNeutral)
,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 401d2dcf4fb9..6af7d64c0af9 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -216,7 +216,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
const Reference<XComponentContext>& _rContext )
:OSubComponent(m_aMutex,_xConnection)
,OPropertyContainer(m_aBHelper)
- ,m_aSqlParser( _rContext, &m_aParseContext )
+ ,m_aSqlParser( _rContext, &m_aParseContext, &m_aNeutralContext )
,m_aSqlIterator( _xConnection, _rxTables, m_aSqlParser )
,m_aAdditiveIterator( _xConnection, _rxTables, m_aSqlParser )
,m_aElementaryParts( size_t(SQLPartCount) )
diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
index a0edfd195a69..fdde2d451d17 100644
--- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
+++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
@@ -76,6 +76,7 @@ namespace dbaccess
typedef std::function<const ::connectivity::OSQLParseNode*(::connectivity::OSQLParseTreeIterator *)>
TGetParseNode;
::svxform::OSystemParseContext m_aParseContext;
+ ::svxform::ONeutralParseContext m_aNeutralContext;
::connectivity::OSQLParser m_aSqlParser;
::connectivity::OSQLParseTreeIterator m_aSqlIterator; // the iterator for the complete statement
::connectivity::OSQLParseTreeIterator m_aAdditiveIterator; // the iterator for the "additive statement" (means without the clauses of the elementary statement)
diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx
index b92ff3b1c7c0..cbfd3dfaf557 100644
--- a/include/connectivity/sqlparse.hxx
+++ b/include/connectivity/sqlparse.hxx
@@ -124,7 +124,8 @@ namespace connectivity
static sal_Int32 s_nRefCount;
// information on the current parse action
- const IParseContext* m_pContext;
+ const IParseContext* m_pContext;
+ const IParseContext* m_pNeutral;
std::unique_ptr<OSQLParseNode> m_pParseTree; // result from parsing
::std::unique_ptr< OSQLParser_Data >
m_pData;
@@ -156,7 +157,9 @@ namespace connectivity
public:
// if NULL, a default context will be used
// the context must live as long as the parser
- OSQLParser(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const IParseContext* _pContext = nullptr);
+ OSQLParser(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const IParseContext* _pContext = nullptr,
+ const IParseContext* _pNeutral = nullptr);
~OSQLParser();
// Parsing an SQLStatement
@@ -173,7 +176,8 @@ namespace connectivity
bool bUseRealName = true);
// Access to the context
- const IParseContext& getContext() const {return *m_pContext;}
+ const IParseContext& getContext() const { return *m_pContext; }
+ const IParseContext* getNeutral() const { return m_pNeutral; }
/// access to the SQLError instance owned by this parser
const SQLError& getErrorHelper() const;